1.1.0 release! many new features.

This commit is contained in:
msk
2022-01-30 03:16:24 -08:00
parent 1eb6628a37
commit d4c5e84404
22 changed files with 342 additions and 144 deletions
+77 -15
View File
@@ -6,6 +6,7 @@ using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using TNHQoLImprovements;
@@ -33,18 +34,32 @@ public class MeatKitPlugin : BaseUnityPlugin
#pragma warning disable 414
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
#pragma warning restore 414
public static AssetBundle bundle;
public static Font fontAgencyFB;
public static ConfigEntry<bool> cfgShowLPC;
public static Font fontBombardier;
public static GameObject playerCamera;
// BepInEx configuration
//--- Health Counter ---//
public static ConfigEntry<bool> cfgSolidifyHPText;
public static ConfigEntry<bool> cfgShowHPBackground;
public static ConfigEntry<float> cfgHPBackgroundOpacity;
//--- Take and Hold Info ---//
public static ConfigEntry<bool> cfgShowLPC;
public static ConfigEntry<bool> cfgShowTokens;
public static ConfigEntry<bool> cfgShowHolds;
public static ConfigEntry<bool> cfgShowNumbersAtShop;
public static ConfigEntry<bool> cfgShowInfoOnGameOver;
public static ConfigEntry<bool> cfgShowWaves;
//--- Misc. ---//
public static ConfigEntry<HealthExpireIndicationType> cfgHealthCrystalIndicator;
// Take and Hold modifications
private static InPlay instance;
// Searching for old leaderboards player count mod to disable
private bool lpcModGone = false;
private float lpcModSearchTimeEnd;
@@ -52,14 +67,7 @@ public class MeatKitPlugin : BaseUnityPlugin
private void SceneChanged(Scene from, Scene to)
{
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>();
if (healthCounter != null)
{
if (cfgShowHPBackground.Value || cfgSolidifyHPText.Value)
HPReadability.ImproveHPTextReadability(healthCounter.transform.GetChild(0).gameObject);
}
if(GameObject.Find("_GameManager") != null || FindObjectOfType<FistVR.TNH_Manager>() != null)
if (GameObject.Find("_GameManager") != null || FindObjectOfType<FistVR.TNH_Manager>() != null)
{
Logger.LogInfo("We are in a TNH game!");
instance = new GameObject().AddComponent<InPlay>();
@@ -69,6 +77,37 @@ 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);
}
// grab Agency FB from game if it's not set
if(fontAgencyFB == null)
{
if (healthCounter != null)
{
fontAgencyFB = healthCounter.transform.GetChild(0).GetChild(0).GetComponent<Text>().font;
}
else
{
var query = FindObjectsOfType<Text>();
foreach (Text itm in query)
{
if (itm.font.name == "AGENCYR")
{
fontAgencyFB = itm.font;
break;
}
}
}
}
}
public MeatKitPlugin(): base()
@@ -81,14 +120,17 @@ public class MeatKitPlugin : BaseUnityPlugin
// MeatKit requirement
LoadAssets();
// get Agency FB from system
fontAgencyFB = Font.CreateDynamicFontFromOSFont("Agency FB", 16);
// get Agency FB from system (BAD IDEA, NOT EVERYONE WILL HAVE IT)
//fontAgencyFB = Font.CreateDynamicFontFromOSFont("Agency FB", 16);
// load asset bundle
bundle = AssetBundle.LoadFromFile(Path.Combine(BasePath, "tnh_qol_improvements"));
SceneManager.activeSceneChanged += SceneChanged;
fontBombardier = MeatKitPlugin.bundle.LoadAsset<Font>("Bombardier");
// setup configuration
//--- Health Counter ---//
cfgShowHPBackground = Config.Bind("Health Counter",
"Background enabled",
true,
@@ -101,6 +143,7 @@ public class MeatKitPlugin : BaseUnityPlugin
"Solidify HP text",
true,
"Set opacity of HP text to full and give it a shadow.");
//--- Take and Hold Info ---//
cfgShowLPC = Config.Bind("Take and Hold Info",
"Show player count in online leaderboards",
true,
@@ -113,6 +156,19 @@ public class MeatKitPlugin : BaseUnityPlugin
"Show Holds",
true,
"Shows how many holds the player has completed by their radar hand.");
cfgShowWaves = Config.Bind("Take and Hold Info",
"Show Waves",
true,
"Shows how many waves the player has completed on the current hold by their radar hand.");
cfgShowInfoOnGameOver = Config.Bind("Take and Hold Info",
"Show Extra Info at Game Over",
true,
"Show enabled extra game information at the game over area.");
cfgShowNumbersAtShop = Config.Bind("Take and Hold Info",
"Show Numbers for Tokens at Item Station",
true,
"At the item station, add a numberical representation to costs and player's tokens.");
//--- Misc. ---//
cfgHealthCrystalIndicator = Config.Bind("Misc.",
"Show expiration of Health Crystals",
HealthExpireIndicationType.Flashing,
@@ -139,16 +195,22 @@ public class MeatKitPlugin : BaseUnityPlugin
if (cfgShowLPC.Value)
LeaderboardPlayerCountPatch.Patch(harmony);
// for counting wins/loses
// for counting wins/loses for TNHInfo.holdCounter
if (cfgShowHolds.Value)
HoldCounterPatch.Patch(harmony);
// stick stats to hand after game over
if (cfgShowHolds.Value || cfgShowTokens.Value)
InPlay.Patch(harmony);
WavePatch.Patch(harmony);
ShopCostPatch.Patch(harmony);
// show numerical representation of shop values
if (cfgShowNumbersAtShop.Value)
{
// costs
ShopCostPatch.Patch(harmony);
// player tokens
ShopTokenPatch.Patch(harmony);
}
}
/// <summary>