From 3c623afb79aa1cd74f897f968ab964f12787df11 Mon Sep 17 00:00:00 2001 From: davud Date: Sun, 23 Aug 2026 14:11:46 +0200 Subject: [PATCH] feat: reveries window #4 --- IngameReveries/IngameReveries.cs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/IngameReveries/IngameReveries.cs b/IngameReveries/IngameReveries.cs index 1b3a807..9d5cc7f 100644 --- a/IngameReveries/IngameReveries.cs +++ b/IngameReveries/IngameReveries.cs @@ -11,14 +11,14 @@ namespace IngameReveries public class IngameReveries : ModBehaviour { private GameObject _ingameReveriesUI; - + private AssetBundle _reveriesBundle; private GameObject _reveriesPrefab; private void Awake() { // Metadata of your mod is stored in this.about - Debug.Log("Hola! I'm loaded! " + mod.metadata.id); + Debug.Log("Xin Chao! I'm loaded! " + mod.metadata.id); // If you need to patch with Harmony, you can use this.harmony to access the Harmony instance for your mod. // It will be created with your mod's id automatically, the first time you access the property. @@ -28,7 +28,7 @@ namespace IngameReveries private void Start() { InitializeAssets(); - + SceneManager.sceneLoaded += (scene, mode) => { // Check if UI already instantiated @@ -43,7 +43,7 @@ namespace IngameReveries if (!relativeToScene.StartsWith("..")) { Debug.Log($"[IngameReveries] Switched to scene inside {gameSceneDir}"); - + GameObject menuViewGO = GameObject.Find("GameLogicPackage/UI/InGame/UI_Common_MenuView"); if (menuViewGO == null) { @@ -53,7 +53,19 @@ namespace IngameReveries _ingameReveriesUI = new GameObject("IngameReveriesUI"); _ingameReveriesUI.transform.parent = menuViewGO.transform; - Instantiate(DewGUI.widgetWindow, _ingameReveriesUI.transform); + + GameObject reveriesGO = Instantiate(_reveriesPrefab, menuViewGO.transform); + reveriesGO.SetActive(true); + reveriesGO.name = "IngameReveriessss"; + reveriesGO.transform.SetAsFirstSibling(); + + var reveries = reveriesGO.GetComponent(); + + var rect = reveriesGO.GetComponent(); + rect.anchorMin = new Vector2(0f, 1f); + rect.anchorMax = new Vector2(0f, 1f); + rect.pivot = new Vector2(0f, 1f); + rect.anchoredPosition = new Vector2(+70f, -70f); } }; } @@ -68,7 +80,7 @@ namespace IngameReveries private void InitializeAssets() { string bundlePath = Path.Combine(mod.path, "assets", "bundle"); - + if (!File.Exists(bundlePath)) { Debug.LogError($"[IngameReveries] Bundle not found at: {bundlePath}"); @@ -102,7 +114,7 @@ namespace IngameReveries if (_reveriesPrefab == null) { Debug.LogError("[IngameReveries] Failed to load prefab!"); - + // List what's in the bundle for debugging string[] assetNames = _reveriesBundle.GetAllAssetNames(); Debug.Log("[IngameReveries] Assets in bundle:"); @@ -110,6 +122,7 @@ namespace IngameReveries { Debug.Log($" - {name}"); } + return; }