hp text customization, shrink hp bg border, hide hp when aiming there

This commit is contained in:
msk
2022-02-14 00:07:51 -08:00
parent 416e49d6d7
commit a9be72693c
9 changed files with 219 additions and 43 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
PackageName: TNH_Quality_of_Life_Improvements
Author: muskit
Version: 1.1.3
Version: 1.2.0
Icon: {fileID: 2800000, guid: 785b7946398f5314b95bf593d2d77d67, type: 3}
ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3}
WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements
+26 -17
View File
@@ -43,9 +43,10 @@ public class MeatKitPlugin : BaseUnityPlugin
// BepInEx configuration
//--- Health Counter ---//
public static ConfigEntry<bool> cfgSolidifyHPText;
public static ConfigEntry<bool> cfgHPHiddenWhenAiming;
public static ConfigEntry<bool> cfgShowHPBackground;
public static ConfigEntry<float> cfgHPBackgroundOpacity;
public static ConfigEntry<HPTextType> cfgHPTextType;
//--- Take and Hold Info ---//
public static ConfigEntry<bool> cfgShowLPC;
public static ConfigEntry<bool> cfgInfoFollowCamera;
@@ -68,6 +69,20 @@ public class MeatKitPlugin : BaseUnityPlugin
private void SceneChanged(Scene from, Scene to)
{
GetFonts();
playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
// apply health counter tweaks globally
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>();
if (healthCounter != null)
{
HPReadability.ImproveHPTextReadability(healthCounter.transform.GetChild(0).gameObject);
if (cfgHPHiddenWhenAiming.Value)
healthCounter.gameObject.AddComponent<HPHideWhenAiming>();
}
// TNH patches
if (GameObject.Find("_GameManager") != null || FindObjectOfType<FistVR.TNH_Manager>() != null)
{
Logger.LogInfo("We are in a TNH game!");
@@ -78,18 +93,6 @@ public class MeatKitPlugin : BaseUnityPlugin
Logger.LogInfo("We are NOT in a TNH game!");
Destroy(instance);
}
playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
// apply health readability globally
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>();
if (healthCounter != null)
{
if (cfgShowHPBackground.Value || cfgSolidifyHPText.Value)
HPReadability.ImproveHPTextReadability(healthCounter.transform.GetChild(0).gameObject);
}
GetFonts();
}
// called on scene change, find fonts from game if they're not set
@@ -140,6 +143,10 @@ public class MeatKitPlugin : BaseUnityPlugin
// setup configuration
//--- Health Counter ---//
cfgHPHiddenWhenAiming = Config.Bind("Health Counter",
"Hide HP Counter When Aiming",
true,
"While aiming around the health counter in view, hide it.");
cfgShowHPBackground = Config.Bind("Health Counter",
"Background enabled",
true,
@@ -148,10 +155,12 @@ public class MeatKitPlugin : BaseUnityPlugin
"Background opacity",
0.74f,
"Set opacity of health text's background (if enabled).");
cfgSolidifyHPText = Config.Bind("Health Counter",
"Solidify HP text",
true,
"Set opacity of HP text to full and give it a shadow.");
cfgHPTextType = Config.Bind("Health Counter",
"HP Text Type",
HPTextType.Solidify,
"Solidify: Set text to full opacity and give it a drop shadow\n" +
"Untouched: Leave text untouched\n" +
"Hidden: Hide health counter completely (will hide background if enabled)");
//--- Take and Hold Info ---//
cfgShowLPC = Config.Bind("Take and Hold Info",
"Show Player Count in Online Leaderboards",