Compare commits

..
14 Commits
Author SHA1 Message Date
david c4226c2be0 Merge pull request 'Finalize Mod' (#8) from dev into main
Reviewed-on: #8
2026-08-24 17:20:16 +02:00
david ef7def0790 Merge remote-tracking branch 'origin/dev' into dev 2026-08-24 17:14:28 +02:00
david e5c35b9941 chore: typo 2026-08-24 17:14:17 +02:00
david 50fb0c1410 feat: icon image #7 2026-08-24 16:39:24 +02:00
david 4bd6862b46 feat: preview image #7 2026-08-24 16:29:30 +02:00
david 3e6d700200 feat: add description #7 2026-08-24 16:29:02 +02:00
david 900b97583b chore: update README.me 2026-08-24 15:30:20 +02:00
david 9389a13d2e fix: asset loader breaks when reloading mod 2026-08-23 23:06:01 +02:00
david 2820d0860b fix: first reverie not clickable
moved reveries window down because i don't want to search for a gameobject that blocks the reveries window at that specific point.
2026-08-23 23:03:25 +02:00
david d95935d140 fix: fixed invisible text and add #5 2026-08-23 23:01:53 +02:00
david 7a1227d588 refactor: pull out method
pull out event to be able to unsubscribe from it when mod is unloaded
2026-08-23 22:59:26 +02:00
david f53b8fa854 refactor: cleaned object instantiation 2026-08-23 14:25:45 +02:00
david 3c623afb79 feat: reveries window #4 2026-08-23 14:11:46 +02:00
david e4205b59bd feat: prefab asset 2026-08-23 14:10:24 +02:00
7 changed files with 99 additions and 35 deletions
+84 -29
View File
@@ -1,7 +1,9 @@
using System.IO;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace IngameReveries
@@ -18,7 +20,7 @@ namespace IngameReveries
private void Awake()
{
// Metadata of your mod is stored in this.about
Debug.Log("Hola! I'm loaded! " + mod.metadata.id);
Debug.Log("Hello! 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.
@@ -29,33 +31,7 @@ namespace IngameReveries
{
InitializeAssets();
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);
}
};
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnDestroy()
@@ -63,6 +39,54 @@ namespace IngameReveries
// Make sure you clean up properly to support Live Reload.
Debug.Log("Good bye! " + mod.metadata.id);
harmony.UnpatchAll();
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode 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 = Instantiate(_reveriesPrefab, menuViewGO.transform);
_ingameReveriesUI.SetActive(true);
_ingameReveriesUI.name = "IngameReveriesUI";
_ingameReveriesUI.transform.SetSiblingIndex(1);
var reveries = _ingameReveriesUI.GetComponent<UI_Reveries>();
// Show reveries window
var canvasGroup = _ingameReveriesUI.GetComponent<CanvasGroup>();
canvasGroup.alpha = 1f;
canvasGroup.interactable = true;
canvasGroup.blocksRaycasts = true;
// Position reveries window top left
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, -400f);
FixFonts();
}
}
private void InitializeAssets()
@@ -76,7 +100,7 @@ namespace IngameReveries
}
_reveriesBundle = AssetBundle.GetAllLoadedAssetBundles()
.FirstOrDefault(b => b.name == "logosteal" || b.mainAsset != null);
.FirstOrDefault(b => b.name == "bundle" || b.mainAsset != null);
if (_reveriesBundle == null)
{
@@ -110,10 +134,41 @@ namespace IngameReveries
{
Debug.Log($" - {name}");
}
return;
}
Debug.Log("[IngameReveries] Successfully loaded prefab!");
}
private void FixFonts()
{
// Get all fonts
TMP_FontAsset[] loadedFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
// Get all text from the reveries window
TMP_Text[] textComponents = _ingameReveriesUI.GetComponentsInChildren<TMP_Text>(true);
foreach (TMP_Text textComp in textComponents)
{
if (textComp.font == null) continue;
string originalFontName = textComp.font.name;
// Match the font by name, ensuring we don't pick the dead assetbundle version
foreach (TMP_FontAsset loadedFont in loadedFonts)
{
// Pick a matching font that has an active atlas/material
if (loadedFont.name == originalFontName && loadedFont.atlasTexture != null)
{
textComp.font = loadedFont;
// Force TMP to update its internal mesh and material reference
textComp.ForceMeshUpdate();
textComp.SetAllDirty();
break;
}
}
}
}
}
}
+4
View File
@@ -235,6 +235,10 @@
<HintPath>$(GameManagedDir)\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>$(GameManagedDir)\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.XR.LegacyInputHelpers">
<HintPath>$(GameManagedDir)\UnityEngine.XR.LegacyInputHelpers.dll</HintPath>
<Private>False</Private>
+4 -3
View File
@@ -1,3 +1,4 @@
[h1]Hello World![/h1]
This description will be shown on the mod manager, and be uploaded to Steam Workshop.
Note some tags like tables, links and images are not supported in the in-game mod manager and will be either omitted / shown as plain-text.
[h1]Ingame Reveries[/h1]
Displays the daily reveries from the title screen in the ingame pause menu.
[h2]Note[/h2]
Current progress won't be displayed until you go back to the title screen and save the game.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.
+4
View File
@@ -2,6 +2,10 @@
joa coole mod die in einem run ermöglicht, daily quests (Reveries) anzuschauen.
## Current Behaiviour
Progress lässt sich erst nach dem Rausgehen eines Spiels aktuallisieren. Reroll und claim gehen denoch.
## Links
- [Shape of Dreams Docs](https://github.com/LizardSmoothie/ShapeOfDreamsModDocs)