11 Commits

Author SHA1 Message Date
Alex ad286b687d improve docs 2026-07-14 23:54:50 -07:00
Alex d3b8dd9dfb misc 2026-07-14 23:33:40 -07:00
Alex a39667f6c0 remove joke func. that kills the long-deprecated "Leaderboard Player Count" mod; clean up logging 2026-07-14 23:33:05 -07:00
Alex 4d855203f6 chore: update settings.json 2026-07-14 00:23:12 -07:00
Alex e02e25f98a fix unity crashing on start 2026-07-13 22:51:02 -07:00
msk 2f7fe60cd6 add discord contact in the Thunderstore readme 2023-11-13 16:15:45 -08:00
msk 611f074b73 minor cleanups, add the preview images back 2023-07-31 14:46:53 -07:00
msk 6cc32af15d Update README.md 2023-07-31 14:08:11 -07:00
msk b87db514a5 change initialization approach, refactoring
should resolve errors occurring on both Atlas and WurstMod maps
2023-07-31 02:32:02 -07:00
msk 73d8a5b89d Reorganize, revert changes for "fixing" Atlas maps 2023-07-31 00:12:10 -07:00
msk cf4b2847be Revert "add small setup delays to address errors in Atlas maps"
This reverts commit 64d8df148b.
2023-07-30 22:46:37 -07:00
18 changed files with 187 additions and 228 deletions
+5
View File
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-dotnettools.csdevkit"
]
}
+4
View File
@@ -0,0 +1,4 @@
{
"omnisharp.useModernNet": false,
"dotnet.preferCSharpExtension": true
}
+3 -3
View File
@@ -13,7 +13,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
PackageName: TNH_Quality_of_Life_Improvements PackageName: TNH_Quality_of_Life_Improvements
Author: muskit Author: muskit
Version: 1.2.4 Version: 1.2.6
Icon: {fileID: 2800000, guid: af542f3f6d6914f4e96d0326e8b296cc, type: 3} Icon: {fileID: 2800000, guid: af542f3f6d6914f4e96d0326e8b296cc, type: 3}
ReadMe: {fileID: 102900000, guid: efa2d6091ed77bd4b879a74bd81d6cbc, type: 3} ReadMe: {fileID: 102900000, guid: efa2d6091ed77bd4b879a74bd81d6cbc, type: 3}
WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements
@@ -26,5 +26,5 @@ MonoBehaviour:
ApplyHarmonyPatches: 1 ApplyHarmonyPatches: 1
BuildItems: BuildItems:
- {fileID: 11400000, guid: ccaff18373cd99848b344316974e6d46, type: 2} - {fileID: 11400000, guid: ccaff18373cd99848b344316974e6d46, type: 2}
BuildAction: 2 BuildAction: 1
OutputProfile: C:/Users/Alex/AppData/Roaming/r2modmanPlus-local/H3VR/profiles/dev OutputProfile: C:/ModsThunderstore/H3VR/profiles/TNH QoL Dev
+55
View File
@@ -0,0 +1,55 @@
## Changelog
1.2.6
* Remove the "Leaderboard Player Count" mod killer
1.2.5
* [TNH] Change initialization approach to cover errors in both Atlas/WurstMod-based maps
1.2.4
* [TNH] Fix errors occurring in Atlas-based maps
* Update MeatKit (now on Unity 5.6.7f1!)
1.2.3
* Added button in wrist menu to toggle HP counter (thanks PutterMyBancakes for the suggestion!)
* [TNH] Made the search time for deprecated Leaderboard mod based on day of year as an input of the sin()
1.2.2
* When aiming around the HP counter, its opacity can now change to a player setting
* Increased size of hide-HP aiming region
* [TNH] Decreased search time for deprecated Leaderboard mod
1.2.1
* [TNH] Changed leaderboard player count message for unavailability with TNHTweaker
**1.2.0**
* HP counter text can now be hidden completely
* Added HP counter fading when pointing a firearm towards it, allowing better visiblity
* Shrunk borders of health counter's background
1.1.3
* [TNH] Fixed wrist stats still trying to look at the camera in the game over area, resulting in weird rotations
1.1.2
* [TNH] Wrist stats can now tilt towards the camera, making it less awkward to read
1.1.1
* Fixed wave counter text not showing up during a hold
**1.1.0**
* [TNH] Added win/lose count on hold counter
* [TNH] Added enemy waves counter (substitutes token counter during hold if enabled)
* [TNH] Added token numerical representation to shop
* [TNH] Extra info from this mod now shows in game over
* Added expiration indicators to Health Crystals
* Health readability now applies outside of Take and Hold
1.0.1
* Fixed the in-play improvements only applying to Classic Hallways map (whoops!!)
* Added option to enable/disable showing player count of online leaderboards
* Added option to enable/disable HP text opacity/shadow change
* (Surprisingly, the HP text normally doesn't have full opacity)
* Searching for the deprecated TNH Leaderboards Player Count mod to kill now stops after 120s
**1.0.0**
* Initial release!
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 59291b514bf8a814690c9d4b60f494ce
timeCreated: 1784097793
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
+30 -62
View File
@@ -68,12 +68,7 @@ public static AssetBundle bundle;
public static ConfigEntry<HealthExpireIndicationType> cfgHealthCrystalIndicator; public static ConfigEntry<HealthExpireIndicationType> cfgHealthCrystalIndicator;
// Take and Hold modifications // Take and Hold modifications
private static InPlay instance; private static InPlay playInstance;
// Searching for old leaderboards player count mod to disable
private float lpcSearchTime;
private bool lpcStopSearching = false;
private float lpcModSearchTimeEnd;
public static FVRHealthBar hpDisplay; public static FVRHealthBar hpDisplay;
@@ -85,26 +80,35 @@ public static AssetBundle bundle;
private void SceneChanged(Scene from, Scene to) private void SceneChanged(Scene from, Scene to)
{ {
StartCoroutine("SceneChangedCoRoutine"); StartCoroutine("SceneChangedCoroutine");
} }
private IEnumerator SceneChangedCoRoutine() private IEnumerator SceneChangedCoroutine()
{ {
// grab H3VR objects Destroy(playInstance);
playerCamera = null; for (int i = 1; i <= 10; ++i)
hpDisplay = null;
while (playerCamera == null)
{ {
playerCamera = GameObject.FindGameObjectWithTag("MainCamera"); // TNH patches
hpDisplay = FindObjectOfType<FVRHealthBar>(); if (GameObject.Find("_GameManager") != null || FindObjectOfType<TNH_Manager>() != null)
yield return null; {
} Logger.LogInfo("We are in a TNH game!");
playInstance = new GameObject().AddComponent<InPlay>();
playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
break;
}
// Logger.LogInfo(String.Format("Couldn't find a TNH game. Checking again...({0}/10)", i));
yield return new WaitForEndOfFrame();
}
// ---- MAINCAMERA FOUND SIGNIFIES THAT ESSENTIAL GAME OBJECTS HAVE LOADED IN ---- // if (playInstance == null)
{
// find Agency font Logger.LogInfo("We are NOT in a TNH game!");
GetFonts(); }
// setup non-TNH specific static objects
// running AFTER searching for TNH_Manager ensures we have everything initialized
playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
hpDisplay = FindObjectOfType<FVRHealthBar>();
// apply health counter tweaks globally // apply health counter tweaks globally
if (hpDisplay != null) if (hpDisplay != null)
{ {
@@ -119,18 +123,8 @@ public static AssetBundle bundle;
{ {
WristMenuAPI.Buttons.Remove(wmbHPToggle); WristMenuAPI.Buttons.Remove(wmbHPToggle);
} }
GetFonts();
if (GameObject.Find("_GameManager") != null || FindObjectOfType<TNH_Manager>() != null) }
{
Logger.LogInfo("We are in a TNH game!");
instance = new GameObject().AddComponent<InPlay>();
}
else
{
Logger.LogInfo("We are NOT in a TNH game!");
Destroy(instance);
}
}
// called on scene change, find fonts from game if they're not set // called on scene change, find fonts from game if they're not set
private void GetFonts() private void GetFonts()
@@ -160,7 +154,6 @@ public static AssetBundle bundle;
public MeatKitPlugin(): base() public MeatKitPlugin(): base()
{ {
harmony = new Harmony("muskit.TNHQualityOfLifeImprovements"); harmony = new Harmony("muskit.TNHQualityOfLifeImprovements");
lpcSearchTime = 30f + 30f * Mathf.Sin(System.DateTime.Today.DayOfYear / 365f); // lolz
} }
// You are free to edit this method, however please ensure LoadAssets is still called somewhere inside it. // You are free to edit this method, however please ensure LoadAssets is still called somewhere inside it.
@@ -243,9 +236,6 @@ public static AssetBundle bundle;
HealthExpireIndicationType.Flashing, HealthExpireIndicationType.Flashing,
"Add a visual indication on the Health Crystal's despawn timer."); "Add a visual indication on the Health Crystal's despawn timer.");
// calculate end time to search for my deprecated Leaderboard
lpcModSearchTimeEnd = Time.time + lpcSearchTime;
wmbHPToggle = new WristMenuButton("Toggle HP Display", ToggleHPVisibility); wmbHPToggle = new WristMenuButton("Toggle HP Display", ToggleHPVisibility);
RunPatches(); RunPatches();
@@ -273,7 +263,7 @@ public static AssetBundle bundle;
// stick stats to hand after game over // stick stats to hand after game over
if (cfgShowHolds.Value || cfgShowTokens.Value) if (cfgShowHolds.Value || cfgShowTokens.Value)
InPlay.Patch(harmony); TNHInfo.Patch(harmony);
// show numerical representation of shop values // show numerical representation of shop values
if (cfgShowNumbersAtShop.Value) if (cfgShowNumbersAtShop.Value)
@@ -283,7 +273,9 @@ public static AssetBundle bundle;
// player tokens // player tokens
ShopTokenPatch.Patch(harmony); ShopTokenPatch.Patch(harmony);
} }
}
Logger.LogInfo("Successfully ran patches!");
}
private void ToggleHPVisibility(object sender, ButtonClickEventArgs args) private void ToggleHPVisibility(object sender, ButtonClickEventArgs args)
{ {
@@ -292,30 +284,6 @@ public static AssetBundle bundle;
hpDisplay.gameObject.SetActive(hpDisplayEnabled); hpDisplay.gameObject.SetActive(hpDisplayEnabled);
} }
/// <summary>
/// Its only purpose: to kill the deprecated TNH Leaderboard Player Count mod.
/// </summary>
private void Update()
{
if (lpcStopSearching)
return;
foreach (var plugin in Chainloader.PluginInfos)
{
if (plugin.Key == "me.muskit.tnhLeaderboardPlayerCount")
{
Logger.LogWarning("TNH Leaderboard Player Count mod detected. Destroying it to avoid interference.");
Destroy(plugin.Value.Instance);
lpcStopSearching = true;
}
}
if (Time.realtimeSinceStartup >= lpcModSearchTimeEnd)
{
Logger.LogInfo(string.Format("Stopping search for TNH Leaderboard Player Count mod after {0} seconds.", lpcSearchTime));
lpcStopSearching = true;
}
}
// DO NOT CHANGE OR REMOVE THIS METHOD. It's contents will be overwritten when building your package. // DO NOT CHANGE OR REMOVE THIS METHOD. It's contents will be overwritten when building your package.
private void LoadAssets() private void LoadAssets()
+9 -57
View File
@@ -2,72 +2,24 @@
Ever got frustrated checking your HP against a bright ceiling in TNH? Ever got frustrated checking your HP against a bright ceiling in TNH?
Have you forgotten how many Holds you're playing for, so you don't know if you should spend all your tokens? Have you forgotten how many Holds you're playing for, so you don't know if you should spend all your tokens?
And... wait, which hold are you on again? And... wait, which hold are you on again?
**This mod adds quality of life improvements to the *Take and Hold* experience that help with these questions, and then some.** **This mod adds quality of life improvements to the *Take and Hold* experience by addressing various little issues such as these.**
## Features ## Features
* Health counter toggle
* Better health counter visibility * Better health counter visibility
* Health counter fade when aiming around it * Health counter fade/hide when aiming around it
* Token, hold, and wave counter on radar hand * Token, hold, and wave counter on radar hand
* Player count for online leaderboards; see how you stack up! * Player count for online leaderboards; see how you stack up!
* Disabled if [*TakeAndHoldTweaker*](https://h3vr.thunderstore.io/package/devyndamonster/TakeAndHoldTweaker/) is installed * Doesn't work with [*TakeAndHoldTweaker*](https://h3vr.thunderstore.io/package/devyndamonster/TakeAndHoldTweaker/)
* Numerical representation of tokens at item stations * Numerical representation of tokens at item stations
* Expiration indication for health crystals (configurable to multiple types) * Expiration indication for health crystals (configurable to multiple types)
* ...and possibly more! * ...and possibly more!
Toggle and customize these features in your mod manager's *Config editor*. Toggle and customize these features in your mod manager's *Config editor* or *Wrist Menu > Mod Panel* in-game.
**This mod will not disqualify you from Steam or TNHTweaker leaderboards.** **Unless *Take and Hold* has an anti-modding mechanism, this mod SHOULD NOT disqualify you from Steam or TNHTweaker leaderboards.**
For any issues/ideas, please create an issue at the GitHub repository (linked on Thunderstore page). If you have any issues, please contact me on Discord (@muskit) by DM'ing or pinging me in one of the modding servers.
You can also create an issue ticket at the [GitHub repository](https://github.com/muskit/H3VR-TNH-Quality-of-Life-Improvements).
## Changelog **NOTE: [*TNH Leaderboard Player Count*](https://h3vr.thunderstore.io/package/muskit/TNH_Leaderboard_Player_Count/) has been merged with this mod. If for some ungodly reason you have it installed (delisted in 2022), please uninstall that as it WILL conflict with this mod.**
1.2.4
* [TNH] Fix errors occurring in Atlas-based maps
* Update MeatKit (now on Unity 5.6.7f1!)
1.2.3
* Added button in wrist menu to toggle HP counter (thanks PutterMyBancakes for the suggestion!)
* [TNH] Made the search time for deprecated Leaderboard mod based on day of year as an input of the sin()
1.2.2
* When aiming around the HP counter, its opacity can now change to a player setting
* Increased size of hide-HP aiming region
* [TNH] Decreased search time for deprecated Leaderboard mod
1.2.1
* [TNH] Changed leaderboard player count message for unavailability with TNHTweaker
**1.2.0**
* HP counter text can now be hidden completely
* Added HP counter fading when pointing a firearm towards it, allowing better visiblity
* Shrunk borders of health counter's background
1.1.3
* [TNH] Fixed wrist stats still trying to look at the camera in the game over area, resulting in weird rotations
1.1.2
* [TNH] Wrist stats can now tilt towards the camera, making it less awkward to read
1.1.1
* Fixed wave counter text not showing up during a hold
**1.1.0**
* [TNH] Added win/lose count on hold counter
* [TNH] Added enemy waves counter (substitutes token counter during hold if enabled)
* [TNH] Added token numerical representation to shop
* [TNH] Extra info from this mod now shows in game over
* Added expiration indicators to Health Crystals
* Health readability now applies outside of Take and Hold
1.0.1
* Fixed the in-play improvements only applying to Classic Hallways map (whoops!!)
* Added option to enable/disable showing player count of online leaderboards
* Added option to enable/disable HP text opacity/shadow change
* (Surprisingly, the HP text normally doesn't have full opacity)
* Searching for the deprecated TNH Leaderboards Player Count mod to kill now stops after 120s
**1.0.0**
* Initial release!
**NOTE: [*TNH Leaderboard Player Count*](https://h3vr.thunderstore.io/package/muskit/TNH_Leaderboard_Player_Count/) has been merged with this mod. If installed, please remove that mod as it lacks features and is no longer supported.**
+9
View File
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a7e0925cb0a2d20488bcb5d230cf74f7
folderAsset: yes
timeCreated: 1690792321
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
+5 -5
View File
@@ -1,11 +1,10 @@
using System.Collections; using UnityEngine;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using FistVR; using FistVR;
// To be attached to FVRHealthBar object // To be attached to FVRHealthBar object
public class HPHideWhenAiming : MonoBehaviour { public class HPHideWhenAiming : MonoBehaviour
{
CanvasGroup canvasGroup; CanvasGroup canvasGroup;
GameObject gObjHUD; GameObject gObjHUD;
@@ -25,7 +24,8 @@ public class HPHideWhenAiming : MonoBehaviour {
//LineRenderer colliderRenderer; //LineRenderer colliderRenderer;
// Use this for initialization // Use this for initialization
void Start() { void Start()
{
gObjHUD = transform.GetChild(0).gameObject; gObjHUD = transform.GetChild(0).gameObject;
leftHand = MeatKitPlugin.playerCamera.transform.parent.GetChild(1).GetComponent<FVRViveHand>(); leftHand = MeatKitPlugin.playerCamera.transform.parent.GetChild(1).GetComponent<FVRViveHand>();
rightHand = MeatKitPlugin.playerCamera.transform.parent.GetChild(0).GetComponent<FVRViveHand>(); rightHand = MeatKitPlugin.playerCamera.transform.parent.GetChild(0).GetComponent<FVRViveHand>();
+5 -44
View File
@@ -1,7 +1,4 @@
using HarmonyLib; using UnityEngine;
using System.Reflection;
using UnityEngine;
using UnityEngine.UI;
using FistVR; using FistVR;
namespace TNHQoLImprovements namespace TNHQoLImprovements
@@ -13,50 +10,14 @@ namespace TNHQoLImprovements
{ {
public static TNH_Manager tnhManager; public static TNH_Manager tnhManager;
private static Transform[] hands;
private static GameObject tnhInfo;
public static bool InHold()
{
if (tnhManager == null)
return false;
return tnhManager.Phase == TNH_Phase.Hold;
}
// Bring extra info into game over
public static void Patch(Harmony harmony)
{
var original = typeof(TNH_Manager).GetMethod("SetPhase", BindingFlags.NonPublic | BindingFlags.Instance);
var patch = typeof(InPlay).GetMethod("MoveStatsToController", BindingFlags.NonPublic | BindingFlags.Static);
harmony.Patch(original, postfix: new HarmonyMethod(patch));
}
private static void MoveStatsToController(TNH_Phase p)
{
if (tnhManager == null)
return;
if (p == TNH_Phase.Dead || p == TNH_Phase.Completed)
{
int handSide = tnhManager.RadarHand == TNH_RadarHand.Left ? 0 : 1;
tnhInfo.transform.SetParent(hands[handSide], false);
tnhInfo.GetComponent<TNHInfo>().GameOverPos();
}
}
void Start() void Start()
{ {
tnhManager = FindObjectOfType<TNH_Manager>(); tnhManager = FindObjectOfType<TNH_Manager>();
var rig = Object.FindObjectOfType<FVRMovementManager>().transform; TNHInfo.instance = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("TNHInfo"),
hands = new Transform[] { FindObjectOfType<TAH_Reticle>().transform.GetChild(3))
rig.transform.GetChild(1), rig.transform.GetChild(0) .GetComponent<TNHInfo>();
}; TNHInfo.instance.transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
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() void OnDestroy()
+3 -16
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.Reflection; using System.Reflection;
using BepInEx.Bootstrap;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using FistVR; using FistVR;
@@ -15,26 +14,21 @@ namespace TNHQoLImprovements
private bool tnhTweakerInstalled = false; private bool tnhTweakerInstalled = false;
private string curID; private string curID;
private string loadingStr;
private TNH_ScoreDisplay scoreDisplay; private TNH_ScoreDisplay scoreDisplay;
private Text lblGlobalScores; private Text lblGlobalScores;
private GameObject gObjLoading;
#region INITIALIZATION #region INITIALIZATION
public void Init(TNH_ScoreDisplay tnhScore, Text scoreLabel, GameObject gObjLoading) public void Init(TNH_ScoreDisplay tnhScore, Text scoreLabel)
{ {
if (initialized) if (initialized)
return; return;
// don't run with TNHTweaker installed // don't run with TNHTweaker installed
this.gObjLoading = gObjLoading;
var loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies(); var loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
if (Array.Exists<Assembly>(loadedAssemblies, x => x.GetName().Name == "TakeAndHoldTweaker")) if (Array.Exists<Assembly>(loadedAssemblies, x => x.GetName().Name == "TakeAndHoldTweaker"))
{ {
tnhTweakerInstalled = true; tnhTweakerInstalled = true;
this.gObjLoading.transform.GetChild(0).GetComponent<Text>().text = "<color=lightblue><size=30>Online leaderboards player count unavailable for TNHTweaker.</size></color>";
this.gObjLoading.SetActive(true);
return; return;
} }
@@ -42,9 +36,6 @@ namespace TNHQoLImprovements
this.lblGlobalScores = scoreLabel; this.lblGlobalScores = scoreLabel;
this.lblGlobalScores.resizeTextForBestFit = true; this.lblGlobalScores.resizeTextForBestFit = true;
this.lblGlobalScores.horizontalOverflow = HorizontalWrapMode.Overflow; this.lblGlobalScores.horizontalOverflow = HorizontalWrapMode.Overflow;
loadingStr = gObjLoading.GetComponentInChildren<Text>().text;
initialized = true; initialized = true;
} }
@@ -71,20 +62,16 @@ namespace TNHQoLImprovements
lblGlobalScores.text = "Global Scores: <color=lightblue>(" + playerCountText + " players)</color>"; lblGlobalScores.text = "Global Scores: <color=lightblue>(" + playerCountText + " players)</color>";
curID = id; curID = id;
gObjLoading.SetActive(false);
} }
catch (KeyNotFoundException e) catch (KeyNotFoundException e)
{ {
lblGlobalScores.text = "Global Scores:"; lblGlobalScores.text = "Global Scores:";
gObjLoading.GetComponentInChildren<Text>().text = loadingStr;
gObjLoading.SetActive(true);
curID = null; curID = null;
} }
catch (Exception e) catch (Exception e)
{ {
gObjLoading.GetComponentInChildren<Text>().text = string.Format("<color=lightblue><size=30>Unknown error occured trying to retrieve online player count.</size></color>\n" + MeatKitPlugin.Logger.LogWarning("Unknown error occurred trying to retrieve online player count.");
"<color=red>{0}</color>", e); MeatKitPlugin.Logger.LogWarning(e);
gObjLoading.SetActive(true);
} }
} }
} }
+1 -13
View File
@@ -8,7 +8,6 @@ namespace TNHQoLImprovements
{ {
public static class LeaderboardPlayerCountPatch public static class LeaderboardPlayerCountPatch
{ {
private static GameObject gObjLoading;
private static Text uiGlobalText; private static Text uiGlobalText;
public static void Patch(Harmony harmony) public static void Patch(Harmony harmony)
@@ -22,29 +21,18 @@ namespace TNHQoLImprovements
public static void Setup(TNH_ScoreDisplay __instance) public static void Setup(TNH_ScoreDisplay __instance)
{ {
GameObject gObjLeaderboard = null; GameObject gObjLeaderboard = null;
gObjLoading = GameObject.Instantiate(MeatKitPlugin.bundle.LoadAsset<GameObject>("PlayerCount_LoadingText"));
if (__instance.gameObject.name == "_MainMenu") // lobby if (__instance.gameObject.name == "_MainMenu") // lobby
{ {
gObjLeaderboard = __instance.transform.GetChild(3).gameObject; // MainMenuCanvas_RightFar gObjLeaderboard = __instance.transform.GetChild(3).gameObject; // MainMenuCanvas_RightFar
gObjLoading.transform.SetParent(gObjLeaderboard.transform, false);
gObjLoading.GetComponent<RectTransform>().pivot = new Vector2(0, 1);
gObjLoading.transform.localPosition = new Vector3(520, 380, 0);
gObjLoading.transform.GetChild(0).GetComponent<Text>().alignment = TextAnchor.UpperLeft;
} }
if (__instance.gameObject.name == "_FinalScoreDisplay(Clone)") // game over room if (__instance.gameObject.name == "_FinalScoreDisplay(Clone)") // game over room
{ {
gObjLeaderboard = __instance.transform.GetChild(0).gameObject; // ScoreCanvas_PastScores gObjLeaderboard = __instance.transform.GetChild(0).gameObject; // ScoreCanvas_PastScores
gObjLoading.transform.SetParent(gObjLeaderboard.transform, false);
gObjLoading.GetComponent<RectTransform>().pivot = new Vector2(1, 1);
gObjLoading.transform.localPosition = new Vector3(-520, 380, 0);
gObjLoading.transform.GetChild(0).GetComponent<Text>().alignment = TextAnchor.UpperRight;
} }
uiGlobalText = gObjLeaderboard.transform.GetChild(0).GetChild(2).GetComponent<Text>(); uiGlobalText = gObjLeaderboard.transform.GetChild(0).GetChild(2).GetComponent<Text>();
gObjLoading.transform.rotation = gObjLeaderboard.transform.rotation;
gObjLoading.transform.GetChild(0).GetComponent<Text>().font = uiGlobalText.font;
var playerCountComponent = gObjLeaderboard.AddComponent<LeaderboardPlayerCount>(); var playerCountComponent = gObjLeaderboard.AddComponent<LeaderboardPlayerCount>();
playerCountComponent.Init(__instance, uiGlobalText, gObjLoading); playerCountComponent.Init(__instance, uiGlobalText);
} }
} }
} }
+4 -20
View File
@@ -1,5 +1,4 @@
using System.Collections; using HarmonyLib;
using HarmonyLib;
using System.Reflection; using System.Reflection;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@@ -27,7 +26,7 @@ namespace TNHQoLImprovements
{ {
private Text text; private Text text;
private IEnumerator Start() private void Start()
{ {
var gObjText = new GameObject("TokenCounter"); var gObjText = new GameObject("TokenCounter");
gObjText.transform.SetParent(transform, false); gObjText.transform.SetParent(transform, false);
@@ -38,26 +37,11 @@ namespace TNHQoLImprovements
text.font = MeatKitPlugin.fontBombardier; text.font = MeatKitPlugin.fontBombardier;
text.fontSize = 55; text.fontSize = 55;
text.color = new Color(0.1307786f, 0.2461715f, 0.359f); text.color = new Color(0.1307786f, 0.2461715f, 0.359f);
}
while (InPlay.tnhManager == null) private void Update()
{
Debug.Log("[ShopTokenNumber] tnhManager is null!");
yield return null;
}
InPlay.tnhManager.TokenCountChangeEvent += UpdateText;
UpdateText();
}
private void UpdateText(int _ = 0)
{ {
int tokens = InPlay.tnhManager.GetNumTokens(); int tokens = InPlay.tnhManager.GetNumTokens();
text.text = tokens.ToString(); text.text = tokens.ToString();
} }
private void OnDestroy()
{
InPlay.tnhManager.TokenCountChangeEvent -= UpdateText;
}
} }
} }
+44 -6
View File
@@ -1,4 +1,5 @@
using HarmonyLib; using HarmonyLib;
using System.Reflection;
using UnityEngine; using UnityEngine;
using FistVR; using FistVR;
@@ -6,23 +7,55 @@ namespace TNHQoLImprovements
{ {
class TNHInfo : MonoBehaviour class TNHInfo : MonoBehaviour
{ {
private GameObject holdCounter; public static TNHInfo instance;
public Transform[] hands;
private GameObject holdCounter;
private GameObject tokenCounter; private GameObject tokenCounter;
private GameObject waveCounter; private GameObject waveCounter;
public void Start() // Bring extra info into game over
public static void Patch(Harmony harmony)
{ {
if (MeatKitPlugin.cfgShowHolds.Value) var original = typeof(TNH_Manager).GetMethod("SetPhase", BindingFlags.NonPublic | BindingFlags.Instance);
var patch = typeof(TNHInfo).GetMethod("MoveStatsToController", BindingFlags.NonPublic | BindingFlags.Static);
harmony.Patch(original, postfix: new HarmonyMethod(patch));
}
private static void MoveStatsToController(TNH_Phase p)
{
if (InPlay.tnhManager == null)
return;
if (p == TNH_Phase.Dead || p == TNH_Phase.Completed)
{
int handSide = InPlay.tnhManager.RadarHand == TNH_RadarHand.Left ? 0 : 1;
instance.transform.SetParent(instance.hands[handSide], false);
instance.GetComponent<TNHInfo>().GameOverPos();
}
}
void Start()
{
instance = this;
if (MeatKitPlugin.cfgShowHolds.Value)
holdCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("HoldCounter"), transform); holdCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("HoldCounter"), transform);
if (MeatKitPlugin.cfgShowTokens.Value) if (MeatKitPlugin.cfgShowTokens.Value)
tokenCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("TokenCounter"), transform); tokenCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("TokenCounter"), transform);
if (MeatKitPlugin.cfgShowWaves.Value) if (MeatKitPlugin.cfgShowWaves.Value)
waveCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("WaveCounter"), transform); waveCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("WaveCounter"), transform);
var rig = Object.FindObjectOfType<FVRMovementManager>().transform;
hands = new Transform[] {
rig.transform.GetChild(1), rig.transform.GetChild(0)
};
PlayPos(); PlayPos();
} }
public void PlayPos() private void PlayPos()
{ {
transform.localPosition = new Vector3(0, 0, -1.2f); transform.localPosition = new Vector3(0, 0, -1.2f);
if (holdCounter != null) if (holdCounter != null)
@@ -35,7 +68,7 @@ namespace TNHQoLImprovements
waveCounter.transform.localPosition = new Vector3(333, 0, 0); waveCounter.transform.localPosition = new Vector3(333, 0, 0);
} }
public void GameOverPos() private void GameOverPos()
{ {
transform.localScale = new Vector3(.0002f, .0002f, .0002f); transform.localScale = new Vector3(.0002f, .0002f, .0002f);
transform.localPosition = Vector3.zero; transform.localPosition = Vector3.zero;
@@ -60,7 +93,7 @@ namespace TNHQoLImprovements
} }
} }
public void Update() private void Update()
{ {
// game over area; do not update anything else // game over area; do not update anything else
if (InPlay.tnhManager.Phase == TNH_Phase.Dead || InPlay.tnhManager.Phase == TNH_Phase.Completed) if (InPlay.tnhManager.Phase == TNH_Phase.Dead || InPlay.tnhManager.Phase == TNH_Phase.Completed)
@@ -100,5 +133,10 @@ namespace TNHQoLImprovements
waveCounter.SetActive(false); waveCounter.SetActive(false);
} }
} }
void OnDestroy()
{
instance = null;
}
} }
} }
+1 -1
View File
@@ -238,7 +238,7 @@ PlayerSettings:
m_BuildTargetGraphicsAPIs: [] m_BuildTargetGraphicsAPIs: []
m_BuildTargetVRSettings: m_BuildTargetVRSettings:
- m_BuildTarget: Standalone - m_BuildTarget: Standalone
m_Enabled: 1 m_Enabled: 0
m_Devices: m_Devices:
- Oculus - Oculus
- OpenVR - OpenVR
+1 -1
View File
@@ -19,6 +19,6 @@ Numbered tokens at item stations<br/>
Player count for online leaderboards (won't work w/ *TNHTweaker* installed)<br/> Player count for online leaderboards (won't work w/ *TNHTweaker* installed)<br/>
<img src=preview/leaderboard.png><br/> <img src=preview/leaderboard.png><br/>
Features are modifiable via the mod manager's *Config editor*. Features are modifiable via your mod manager's *Config editor*.
**This mod is built on [MeatKit](https://github.com/H3VR-Modding/MeatKit).** **This mod is built on [MeatKit](https://github.com/H3VR-Modding/MeatKit).**