From 3ceaff0d4e6efc04a61e3c943aaf655f56786402 Mon Sep 17 00:00:00 2001 From: davud Date: Sun, 23 Aug 2026 13:12:20 +0200 Subject: [PATCH] feat: ingame interface #3 --- IngameReveries/IngameReveries.cs | 48 ++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/IngameReveries/IngameReveries.cs b/IngameReveries/IngameReveries.cs index bc316c3..1a1aee8 100644 --- a/IngameReveries/IngameReveries.cs +++ b/IngameReveries/IngameReveries.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; +using System.IO; using UnityEngine; -using HarmonyLib; +using UnityEngine.SceneManagement; namespace IngameReveries @@ -12,24 +9,47 @@ namespace IngameReveries // Multiple ModBehaviours in your mod will share the same container. public class IngameReveries : ModBehaviour { + private GameObject _ingameReveriesUI; + private void Awake() { // Metadata of your mod is stored in this.about - Debug.Log("Hello! I'm loaded! " + mod.metadata.id); + Debug.Log("Hola! 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. harmony.PatchAll(); - - // This is legit where all game data is saved (aka there are the reveries saved) - DewProfile mainProfile = DewSave.profileMain; - Debug.Log("profile main: " + mainProfile.name + " with " + mainProfile.stardust + " stadust"); + } - List reveries = mainProfile.reverieSlots; - foreach (var revery in reveries) + private void Start() + { + SceneManager.sceneLoaded += (scene, mode) => { - Debug.Log("revery: "+revery.currentProgress+" with "+revery.grantedStardust); - } + // Check if UI already instantiated + if (_ingameReveriesUI != null) + { + return; + } + + string gameSceneDir = "Assets/Dew/Zones/"; + string relativeToScene = Path.GetRelativePath(gameSceneDir, scene.path); + + if (!relativeToScene.StartsWith("..")) + { + Debug.Log($"[IngameReveries] Switched to scene inside {gameSceneDir}"); + + GameObject menuViewGO = GameObject.Find("GameLogicPackage/UI/InGame/UI_Common_MenuView"); + if (menuViewGO == null) + { + Debug.Log("Couldn't find menu view"); + return; + } + + _ingameReveriesUI = new GameObject("IngameReveriesUI"); + _ingameReveriesUI.transform.parent = menuViewGO.transform; + Instantiate(DewGUI.widgetWindow, _ingameReveriesUI.transform); + } + }; } private void OnDestroy()