fixed wave counter's lack of font

This commit is contained in:
msk
2022-01-30 14:41:03 -08:00
parent d4c5e84404
commit 640245cdd5
5 changed files with 32 additions and 16 deletions
+1 -1
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.1.0 Version: 1.1.1
Icon: {fileID: 2800000, guid: 785b7946398f5314b95bf593d2d77d67, type: 3} Icon: {fileID: 2800000, guid: 785b7946398f5314b95bf593d2d77d67, type: 3}
ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3} ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3}
WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements
+10 -2
View File
@@ -88,9 +88,16 @@ public class MeatKitPlugin : BaseUnityPlugin
HPReadability.ImproveHPTextReadability(healthCounter.transform.GetChild(0).gameObject); HPReadability.ImproveHPTextReadability(healthCounter.transform.GetChild(0).gameObject);
} }
// grab Agency FB from game if it's not set GetFonts();
if(fontAgencyFB == null) }
// called on scene change, find fonts from game if they're not set
private void GetFonts()
{
// Agency FB
if (fontAgencyFB == null)
{ {
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>();
if (healthCounter != null) if (healthCounter != null)
{ {
fontAgencyFB = healthCounter.transform.GetChild(0).GetChild(0).GetComponent<Text>().font; fontAgencyFB = healthCounter.transform.GetChild(0).GetChild(0).GetComponent<Text>().font;
@@ -108,6 +115,7 @@ public class MeatKitPlugin : BaseUnityPlugin
} }
} }
} }
} }
public MeatKitPlugin(): base() public MeatKitPlugin(): base()
+5 -2
View File
@@ -18,7 +18,10 @@ Toggle and customize these features in your mod manager's *Config editor*.
For any issues/ideas, please create an issue on the GitHub repo (linked on Thunderstore page). For any issues/ideas, please create an issue on the GitHub repo (linked on Thunderstore page).
## Changelog ## Changelog
1.1.0 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 win/lose count on hold counter
* [TNH] Added enemy waves counter (substitutes token counter during hold if enabled) * [TNH] Added enemy waves counter (substitutes token counter during hold if enabled)
* [TNH] Added token numerical representation to shop * [TNH] Added token numerical representation to shop
@@ -34,7 +37,7 @@ For any issues/ideas, please create an issue on the GitHub repo (linked on Thund
* Searching for the deprecated TNH Leaderboards Player Count mod to kill now stops after 120s * Searching for the deprecated TNH Leaderboards Player Count mod to kill now stops after 120s
1.0.0 **1.0.0**
* Initial release! * 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.** **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.**
+14 -10
View File
@@ -27,20 +27,24 @@ namespace TNHQoLImprovements
if (initialized) if (initialized)
return; return;
this.scoreDisplay = tnhScore; // don't run with TNHTweaker installed
this.gObjLoading = gObjLoading;
var loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
if (Array.Exists<Assembly>(loadedAssemblies, x => x.GetName().Name == "TakeAndHoldTweaker"))
{
tnhTweakerInstalled = true;
this.gObjLoading.transform.GetChild(0).GetComponent<Text>().text = "<color=lightblue><size=30>Online player count is incompatible with TNHTweaker.</size></color>";
this.gObjLoading.SetActive(true);
return;
}
this.scoreDisplay = tnhScore;
this.lblGlobalScores = scoreLabel; this.lblGlobalScores = scoreLabel;
this.lblGlobalScores.resizeTextForBestFit = true; this.lblGlobalScores.resizeTextForBestFit = true;
this.lblGlobalScores.horizontalOverflow = HorizontalWrapMode.Overflow; this.lblGlobalScores.horizontalOverflow = HorizontalWrapMode.Overflow;
this.gObjLoading = gObjLoading;
loadingStr = gObjLoading.GetComponentInChildren<Text>().text; loadingStr = gObjLoading.GetComponentInChildren<Text>().text;
var loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
if (Array.Exists<Assembly>(loadedAssemblies, x => x.GetName().Name == "TakeAndHoldTweaker"))
{
tnhTweakerInstalled = true;
this.gObjLoading.transform.GetChild(0).GetComponent<Text>().text = "<color=lightblue><size=30>Online player count is incompatible with TNHTweaker.</size></color>";
this.gObjLoading.SetActive(true);
}
initialized = true; initialized = true;
} }
@@ -78,7 +82,7 @@ namespace TNHQoLImprovements
} }
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\n" + gObjLoading.GetComponentInChildren<Text>().text = string.Format("<color=lightblue><size=30>Unknown error occured trying to retrieve online player count.</size></color>\n" +
"<color=red>{0}</color>", e); "<color=red>{0}</color>", e);
gObjLoading.SetActive(true); gObjLoading.SetActive(true);
} }
+2 -1
View File
@@ -16,7 +16,9 @@ namespace TNHQoLImprovements
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
transform.GetChild(0).GetComponent<Text>().font = MeatKitPlugin.fontAgencyFB;
text = transform.GetChild(1).GetComponent<Text>(); text = transform.GetChild(1).GetComponent<Text>();
text.font = MeatKitPlugin.fontAgencyFB;
} }
// Update is called once per frame // Update is called once per frame
@@ -27,7 +29,6 @@ namespace TNHQoLImprovements
if(!ReferenceEquals(curHoldPoint, InPlay.tnhManager.m_curHoldPoint)) if(!ReferenceEquals(curHoldPoint, InPlay.tnhManager.m_curHoldPoint))
{ {
Debug.Log("Hold point updated!");
curHoldPoint = InPlay.tnhManager.m_curHoldPoint; curHoldPoint = InPlay.tnhManager.m_curHoldPoint;
trCurPhaseIdx = Traverse.Create(curHoldPoint).Field<int>("m_phaseIndex"); trCurPhaseIdx = Traverse.Create(curHoldPoint).Field<int>("m_phaseIndex");
trMaxPhases = Traverse.Create(curHoldPoint).Field<int>("m_maxPhases"); trMaxPhases = Traverse.Create(curHoldPoint).Field<int>("m_maxPhases");