feat: ingame interface #3
This commit is contained in:
@@ -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)
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user