Finalize Mod #8

Merged
david merged 17 commits from dev into main 2026-08-24 17:20:17 +02:00
Showing only changes of commit 3ceaff0d4e - Show all commits
+35 -15
View File
@@ -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<DewProfile.DailyReverieData> reveries = mainProfile.reverieSlots;
foreach (var revery in reveries)
{
Debug.Log("revery: "+revery.currentProgress+" with "+revery.grantedStardust);
}
private void Start()
{
SceneManager.sceneLoaded += (scene, mode) =>
{
// 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()