feat: ingame interface #3

This commit is contained in:
2026-08-23 13:12:20 +02:00
parent 9117362f03
commit 3ceaff0d4e
+34 -14
View File
@@ -1,9 +1,6 @@
using System; using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
using HarmonyLib; using UnityEngine.SceneManagement;
namespace IngameReveries namespace IngameReveries
@@ -12,24 +9,47 @@ namespace IngameReveries
// Multiple ModBehaviours in your mod will share the same container. // Multiple ModBehaviours in your mod will share the same container.
public class IngameReveries : ModBehaviour public class IngameReveries : ModBehaviour
{ {
private GameObject _ingameReveriesUI;
private void Awake() private void Awake()
{ {
// Metadata of your mod is stored in this.about // 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. // 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. // It will be created with your mod's id automatically, the first time you access the property.
harmony.PatchAll(); 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<DewProfile.DailyReverieData> reveries = mainProfile.reverieSlots; private void Start()
foreach (var revery in reveries) {
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() private void OnDestroy()