mirror of
https://github.com/muskit/H3VR-TNH-Quality-of-Life-Improvements.git
synced 2026-06-02 20:24:26 -07:00
@@ -58,5 +58,10 @@ namespace TNHQoLImprovements
|
||||
tnhInfo = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("TNHInfo"), FindObjectOfType<TAH_Reticle>().transform.GetChild(3));
|
||||
tnhInfo.transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
tnhManager = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using System.Collections;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -26,7 +27,7 @@ namespace TNHQoLImprovements
|
||||
{
|
||||
private Text text;
|
||||
|
||||
private void Start()
|
||||
private IEnumerator Start()
|
||||
{
|
||||
var gObjText = new GameObject("TokenCounter");
|
||||
gObjText.transform.SetParent(transform, false);
|
||||
@@ -37,11 +38,26 @@ namespace TNHQoLImprovements
|
||||
text.font = MeatKitPlugin.fontBombardier;
|
||||
text.fontSize = 55;
|
||||
text.color = new Color(0.1307786f, 0.2461715f, 0.359f);
|
||||
}
|
||||
private void Update()
|
||||
|
||||
while (InPlay.tnhManager == null)
|
||||
{
|
||||
Debug.Log("[ShopTokenNumber] tnhManager is null!");
|
||||
yield return null;
|
||||
}
|
||||
|
||||
InPlay.tnhManager.TokenCountChangeEvent += UpdateText;
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
private void UpdateText(int _ = 0)
|
||||
{
|
||||
int tokens = InPlay.tnhManager.GetNumTokens();
|
||||
text.text = tokens.ToString();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
InPlay.tnhManager.TokenCountChangeEvent -= UpdateText;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,8 +62,8 @@ namespace TNHQoLImprovements
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// game over area; do not update anything else
|
||||
if (InPlay.tnhManager.Phase == TNH_Phase.Dead || InPlay.tnhManager.Phase == TNH_Phase.Completed)
|
||||
// game over area; do not update anything else
|
||||
if (InPlay.tnhManager.Phase == TNH_Phase.Dead || InPlay.tnhManager.Phase == TNH_Phase.Completed)
|
||||
{
|
||||
if (tokenCounter != null)
|
||||
tokenCounter.SetActive(true);
|
||||
|
||||
Reference in New Issue
Block a user