Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f53b8fa854 | ||
|
|
3c623afb79 | ||
|
|
e4205b59bd |
@@ -11,14 +11,14 @@ namespace IngameReveries
|
|||||||
public class IngameReveries : ModBehaviour
|
public class IngameReveries : ModBehaviour
|
||||||
{
|
{
|
||||||
private GameObject _ingameReveriesUI;
|
private GameObject _ingameReveriesUI;
|
||||||
|
|
||||||
private AssetBundle _reveriesBundle;
|
private AssetBundle _reveriesBundle;
|
||||||
private GameObject _reveriesPrefab;
|
private GameObject _reveriesPrefab;
|
||||||
|
|
||||||
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("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.
|
// 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.
|
||||||
@@ -28,7 +28,7 @@ namespace IngameReveries
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
InitializeAssets();
|
InitializeAssets();
|
||||||
|
|
||||||
SceneManager.sceneLoaded += (scene, mode) =>
|
SceneManager.sceneLoaded += (scene, mode) =>
|
||||||
{
|
{
|
||||||
// Check if UI already instantiated
|
// Check if UI already instantiated
|
||||||
@@ -43,7 +43,7 @@ namespace IngameReveries
|
|||||||
if (!relativeToScene.StartsWith(".."))
|
if (!relativeToScene.StartsWith(".."))
|
||||||
{
|
{
|
||||||
Debug.Log($"[IngameReveries] Switched to scene inside {gameSceneDir}");
|
Debug.Log($"[IngameReveries] Switched to scene inside {gameSceneDir}");
|
||||||
|
|
||||||
GameObject menuViewGO = GameObject.Find("GameLogicPackage/UI/InGame/UI_Common_MenuView");
|
GameObject menuViewGO = GameObject.Find("GameLogicPackage/UI/InGame/UI_Common_MenuView");
|
||||||
if (menuViewGO == null)
|
if (menuViewGO == null)
|
||||||
{
|
{
|
||||||
@@ -51,9 +51,18 @@ namespace IngameReveries
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ingameReveriesUI = new GameObject("IngameReveriesUI");
|
_ingameReveriesUI = Instantiate(_reveriesPrefab, menuViewGO.transform);
|
||||||
_ingameReveriesUI.transform.parent = menuViewGO.transform;
|
_ingameReveriesUI.SetActive(true);
|
||||||
Instantiate(DewGUI.widgetWindow, _ingameReveriesUI.transform);
|
_ingameReveriesUI.name = "IngameReveriesUI";
|
||||||
|
_ingameReveriesUI.transform.SetAsFirstSibling();
|
||||||
|
|
||||||
|
var reveries = _ingameReveriesUI.GetComponent<UI_Reveries>();
|
||||||
|
|
||||||
|
var rect = _ingameReveriesUI.GetComponent<RectTransform>();
|
||||||
|
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 +77,7 @@ namespace IngameReveries
|
|||||||
private void InitializeAssets()
|
private void InitializeAssets()
|
||||||
{
|
{
|
||||||
string bundlePath = Path.Combine(mod.path, "assets", "bundle");
|
string bundlePath = Path.Combine(mod.path, "assets", "bundle");
|
||||||
|
|
||||||
if (!File.Exists(bundlePath))
|
if (!File.Exists(bundlePath))
|
||||||
{
|
{
|
||||||
Debug.LogError($"[IngameReveries] Bundle not found at: {bundlePath}");
|
Debug.LogError($"[IngameReveries] Bundle not found at: {bundlePath}");
|
||||||
@@ -102,7 +111,7 @@ namespace IngameReveries
|
|||||||
if (_reveriesPrefab == null)
|
if (_reveriesPrefab == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("[IngameReveries] Failed to load prefab!");
|
Debug.LogError("[IngameReveries] Failed to load prefab!");
|
||||||
|
|
||||||
// List what's in the bundle for debugging
|
// List what's in the bundle for debugging
|
||||||
string[] assetNames = _reveriesBundle.GetAllAssetNames();
|
string[] assetNames = _reveriesBundle.GetAllAssetNames();
|
||||||
Debug.Log("[IngameReveries] Assets in bundle:");
|
Debug.Log("[IngameReveries] Assets in bundle:");
|
||||||
@@ -110,6 +119,7 @@ namespace IngameReveries
|
|||||||
{
|
{
|
||||||
Debug.Log($" - {name}");
|
Debug.Log($" - {name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user