many shit (survived an SSD failure, plz push more)

This commit is contained in:
msk
2022-01-28 19:57:50 -08:00
parent fcea383739
commit 1eb6628a37
22 changed files with 732 additions and 113 deletions
+44 -12
View File
@@ -34,12 +34,14 @@ public class MeatKitPlugin : BaseUnityPlugin
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 ConfigEntry<bool> cfgSolidifyHPText;
public static ConfigEntry<bool> cfgShowHPBackground;
public static ConfigEntry<float> cfgHPBackgroundOpacity;
public static ConfigEntry<bool> cfgShowTokens;
public static ConfigEntry<bool> cfgShowHolds;
public static ConfigEntry<HealthExpireIndicationType> cfgHealthCrystalIndicator;
private static InPlay instance;
@@ -50,9 +52,13 @@ public class MeatKitPlugin : BaseUnityPlugin
private void SceneChanged(Scene from, Scene to)
{
//Logger.LogInfo(string.Format("scene chg: {0} --> {1}", from.name, to.name));
Logger.LogInfo("_GameManager present: " + (GameObject.Find("_GameManager") != null));
Logger.LogInfo("TNH_Manager object present: " + (FindObjectOfType<FistVR.TNH_Manager>() != null));
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)
{
Logger.LogInfo("We are in a TNH game!");
@@ -72,10 +78,15 @@ public class MeatKitPlugin : BaseUnityPlugin
private void Awake()
{
// MeatKit requirement
LoadAssets();
// get Agency FB from system
fontAgencyFB = Font.CreateDynamicFontFromOSFont("Agency FB", 16);
// load asset bundle
bundle = AssetBundle.LoadFromFile(Path.Combine(BasePath, "tnh_qol_improvements"));
SceneManager.activeSceneChanged += SceneChanged;
LoadAssets();
// setup configuration
cfgShowHPBackground = Config.Bind("Health Counter",
@@ -90,34 +101,55 @@ public class MeatKitPlugin : BaseUnityPlugin
"Solidify HP text",
true,
"Set opacity of HP text to full and give it a shadow.");
cfgShowLPC = Config.Bind("Game Info",
cfgShowLPC = Config.Bind("Take and Hold Info",
"Show player count in online leaderboards",
true,
"Shows the number of players in the currently selected TNH leaderboard.");
cfgShowTokens = Config.Bind("Game Info",
cfgShowTokens = Config.Bind("Take and Hold Info",
"Show Tokens",
true,
"Shows how many tokens the player has by their radar hand.");
cfgShowHolds = Config.Bind("Game Info",
cfgShowHolds = Config.Bind("Take and Hold Info",
"Show Holds",
true,
"Shows how many holds the player has completed by their radar hand.");
cfgHealthCrystalIndicator = Config.Bind("Misc.",
"Show expiration of Health Crystals",
HealthExpireIndicationType.Flashing,
"Add a visual indication on the Health Crystal's despawn timer.");
// give 120 seconds to search for old mod, which we want to kill
lpcModSearchTimeEnd = Time.time + 120;
RunPatches();
}
// DO NOT EDIT.
private void LoadAssets() {}
private void RunPatches()
{
if (harmony == null)
return;
// patch KillAll code (only acts w/ health crystals)
if (cfgHealthCrystalIndicator.Value != HealthExpireIndicationType.None)
TimedHealthCrystalPatch.Patch(harmony);
// patch leaderboard code
if (cfgShowLPC.Value)
LeaderboardPlayerCountPatch.Patch(harmony);
// for counting wins/loses
if (cfgShowHolds.Value)
HoldCounter.Patch(harmony);
HoldCounterPatch.Patch(harmony);
// give 120 seconds to search for old mod, which we want to kill
lpcModSearchTimeEnd = Time.realtimeSinceStartup + 120;
// stick stats to hand after game over
if (cfgShowHolds.Value || cfgShowTokens.Value)
InPlay.Patch(harmony);
WavePatch.Patch(harmony);
ShopCostPatch.Patch(harmony);
}
// DO NOT EDIT.
private void LoadAssets() {}
/// <summary>
/// Its only purpose: to kill the deprecated TNH Leaderboard Player Count mod.
+9 -9
View File
@@ -105,11 +105,11 @@ MonoBehaviour:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3}
m_FontSize: 30
m_FontSize: 70
m_FontStyle: 0
m_BestFit: 1
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 67
m_MaxSize: 70
m_Alignment: 7
m_AlignByGeometry: 0
m_RichText: 1
@@ -212,12 +212,12 @@ MonoBehaviour:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3}
m_FontSize: 200
m_FontSize: 164
m_FontStyle: 0
m_BestFit: 1
m_MinSize: 2
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 200
m_Alignment: 1
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
@@ -245,9 +245,9 @@ MonoBehaviour:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3}
m_FontSize: 26
m_FontSize: 49
m_FontStyle: 0
m_BestFit: 1
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 100
m_Alignment: 7
+1
View File
@@ -17,3 +17,4 @@ MonoBehaviour:
- {fileID: 1421894940388160, guid: 2e88fb286dba59a45b49fb0ae7d9449b, type: 2}
- {fileID: 1395656030192232, guid: 6085354c72844664589bb5f21f9872b1, type: 2}
- {fileID: 1634027973393822, guid: a97af7648bcd6394b867989bf8fb9ed0, type: 2}
- {fileID: 1106932692061560, guid: 9c96f08f84c4ede44ae45ae4afd1901b, type: 2}
+53
View File
@@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1106932692061560}
m_IsPrefabParent: 1
--- !u!1 &1106932692061560
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4863261474150994}
- component: {fileID: 114110489569638852}
m_Layer: 0
m_Name: TNHInfo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4863261474150994
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1106932692061560}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114110489569638852
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1106932692061560}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d549cfce77855f4e9d9778d4c602f21, type: 3}
m_Name:
m_EditorClassIdentifier:
+9
View File
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9c96f08f84c4ede44ae45ae4afd1901b
timeCreated: 1643333802
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
+11 -11
View File
@@ -160,12 +160,12 @@ MonoBehaviour:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3}
m_FontSize: 200
m_FontSize: 252
m_FontStyle: 0
m_BestFit: 1
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 200
m_Alignment: 3
m_MaxSize: 274
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
@@ -249,9 +249,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 73.2, y: 0}
m_SizeDelta: {x: -146.4, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 73.2, y: 49.6}
m_SizeDelta: {x: -146.4, y: 49.599907}
m_Pivot: {x: 0.5, y: 1}
--- !u!224 &224145026042435474
RectTransform:
m_ObjectHideFlags: 1
@@ -265,11 +265,11 @@ RectTransform:
m_Father: {fileID: 224329896993820026}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -122, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -46}
m_SizeDelta: {x: 120, y: 120}
m_Pivot: {x: 1, y: 0.5}
m_Pivot: {x: 0, y: 1}
--- !u!224 &224329896993820026
RectTransform:
m_ObjectHideFlags: 1
+298
View File
@@ -0,0 +1,298 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1484126367028484}
m_IsPrefabParent: 1
--- !u!1 &1284361357339212
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224892970170756718}
- component: {fileID: 222469931575018544}
- component: {fileID: 114369350517400038}
- component: {fileID: 114774221110400688}
m_Layer: 5
m_Name: Text (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1484126367028484
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224505954339385570}
- component: {fileID: 223350672124862004}
- component: {fileID: 114814645303408290}
- component: {fileID: 114323534746903312}
- component: {fileID: 114698421110497518}
m_Layer: 5
m_Name: WaveCounter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1767730806891424
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224426227895944482}
- component: {fileID: 222191868559757652}
- component: {fileID: 114991591682320102}
- component: {fileID: 114225475503413820}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114225475503413820
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1767730806891424}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1573420865, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.734}
m_EffectDistance: {x: 3.5, y: -3.5}
m_UseGraphicAlpha: 1
--- !u!114 &114323534746903312
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1484126367028484}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &114369350517400038
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1284361357339212}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3}
m_FontSize: 177
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 203
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: -1 / -1
--- !u!114 &114698421110497518
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1484126367028484}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0c3423ff90fccc45bc00c97177b33fb, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114774221110400688
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1284361357339212}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1573420865, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.734}
m_EffectDistance: {x: 3.5, y: -3.5}
m_UseGraphicAlpha: 1
--- !u!114 &114814645303408290
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1484126367028484}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &114991591682320102
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1767730806891424}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3}
m_FontSize: 70
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 70
m_Alignment: 7
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: WAVES COMPLETED
--- !u!222 &222191868559757652
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1767730806891424}
--- !u!222 &222469931575018544
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1284361357339212}
--- !u!223 &223350672124862004
Canvas:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1484126367028484}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &224426227895944482
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1767730806891424}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224505954339385570}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 105.9}
m_SizeDelta: {x: 0, y: -211.8}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224505954339385570
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1484126367028484}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 150.00005}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224426227895944482}
- {fileID: 224892970170756718}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -500, y: 0}
m_SizeDelta: {x: 500, y: 300}
m_Pivot: {x: 0, y: 1}
--- !u!224 &224892970170756718
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1284361357339212}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224505954339385570}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -39.525}
m_SizeDelta: {x: 0, y: -79.05}
m_Pivot: {x: 0.5, y: 0.5}
+9
View File
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5a8f723d4ab4740458cbb4df16bf2c5e
timeCreated: 1643271770
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
Binary file not shown.
+45
View File
@@ -0,0 +1,45 @@
using UnityEngine;
using UnityEngine.UI;
namespace TNHQoLImprovements
{
public static class HPReadability
{
public static void ImproveHPTextReadability(GameObject gObjHUD)
{
Debug.Log("gObjHUD: " + gObjHUD);
var canvas = gObjHUD.GetComponent<Canvas>();
var gObjBG = new GameObject();
Transform[] tranHPText = {
gObjHUD.transform.Find("Label_Title (1)"),
gObjHUD.transform.Find("Label_Title")
};
// apply background
if (MeatKitPlugin.cfgShowHPBackground.Value)
{
gObjBG.transform.parent = gObjHUD.transform;
gObjBG.transform.SetSiblingIndex(0);
gObjBG.transform.localPosition = new Vector3(0, 1, 0);
gObjBG.transform.localRotation = Quaternion.identity;
gObjBG.transform.localScale = tranHPText[0].localScale;
var rawImage = gObjBG.AddComponent<RawImage>();
rawImage.color = new Color(0, 0, 0, MeatKitPlugin.cfgHPBackgroundOpacity.Value);
rawImage.rectTransform.SetWidth(100);
rawImage.rectTransform.SetHeight(52);
}
if (MeatKitPlugin.cfgSolidifyHPText.Value)
{
foreach (var text in tranHPText)
{
// full alpha
text.GetComponent<Text>().color = Color.white;
// drop shadow
var shadow = text.gameObject.AddComponent<Shadow>();
shadow.effectColor = new Color(0, 0, 0, .95f);
shadow.effectDistance = new Vector2(0.5f, -0.5f);
}
}
}
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 13876b4618c99394bbb2838f5c26cd19
timeCreated: 1643268023
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+11 -20
View File
@@ -6,6 +6,16 @@ using FistVR;
namespace TNHQoLImprovements
{
public static class HoldCounterPatch
{
public static void Patch(Harmony harmony)
{
var original = typeof(TNH_Manager).GetMethod("HoldPointCompleted", BindingFlags.Public | BindingFlags.Instance);
var patch = typeof(HoldCounter).GetMethod("OnHoldEnd");
harmony.Patch(original, postfix: new HarmonyMethod(patch));
}
}
public class HoldCounter : MonoBehaviour
{
private Text lblHoldCount;
@@ -14,21 +24,6 @@ namespace TNHQoLImprovements
public static int[] winLose = { -1, 1 };
public const string WIN_LOSE_TEXT = "<color=#10ff10>{0}</color> <color=red>{1}</color>";
private void OnDeath(bool _)
{
Debug.Log("I died!");
// TODO: bind stats to controller hand
}
// TODO: win/lose counter. patch postfix FistVR.TNH_Manager.HoldPointCompleted
public static void Patch(Harmony harmony)
{
var original = typeof(TNH_Manager).GetMethod("HoldPointCompleted", BindingFlags.Public | BindingFlags.Instance);
var patch = typeof(HoldCounter).GetMethod("OnHoldEnd");
Debug.Log(string.Format("Original: {0} // Patch: {1}", original, patch));
harmony.Patch(original, postfix: new HarmonyMethod(patch));
}
public static void OnHoldEnd(TNH_HoldPoint p, bool success)
{
if (success)
@@ -39,17 +34,13 @@ namespace TNHQoLImprovements
void Start()
{
transform.localPosition = new Vector3(-1f, 0, -.5f);
transform.localRotation = Quaternion.Euler(90, 0, 0);
transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
transform.localPosition = new Vector3(-333, 0, -450);
lblHoldCount = transform.GetChild(1).GetComponent<Text>();
lblWinLose = transform.GetChild(2).GetComponent<Text>();
winLose[0] = 0;
winLose[1] = 0;
FindObjectOfType<FVRSceneSettings>().PlayerDeathEvent += OnDeath;
}
void Update()
+26 -37
View File
@@ -1,4 +1,5 @@
using System.Collections;
using HarmonyLib;
using System.Reflection;
using UnityEngine;
using UnityEngine.UI;
using FistVR;
@@ -10,42 +11,30 @@ namespace TNHQoLImprovements
/// </summary>
public class InPlay : MonoBehaviour
{
private GameObject gObjHUD;
public static TNH_Manager tnhManager;
void ImproveHPTextReadability()
{
var canvas = gObjHUD.GetComponent<Canvas>();
var gObjBG = new GameObject();
Transform[] tranHPText = {
gObjHUD.transform.Find("Label_Title (1)"),
gObjHUD.transform.Find("Label_Title")
};
private static Transform[] hands;
private static GameObject tnhInfo;
// apply background
if (MeatKitPlugin.cfgShowHPBackground.Value)
public static void Patch(Harmony harmony)
{
gObjBG.transform.parent = gObjHUD.transform;
gObjBG.transform.SetSiblingIndex(0);
gObjBG.transform.localPosition = new Vector3(0, 1, 0);
gObjBG.transform.localRotation = Quaternion.identity;
gObjBG.transform.localScale = tranHPText[0].localScale;
var rawImage = gObjBG.AddComponent<RawImage>();
rawImage.color = new Color(0, 0, 0, MeatKitPlugin.cfgHPBackgroundOpacity.Value);
rawImage.rectTransform.SetWidth(100);
rawImage.rectTransform.SetHeight(52);
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));
}
if (MeatKitPlugin.cfgSolidifyHPText.Value)
private static void MoveStatsToController(TNH_Phase p)
{
foreach (var text in tranHPText)
if (tnhManager == null)
return;
if (p == TNH_Phase.Dead || p == TNH_Phase.Completed)
{
// full alpha
text.GetComponent<Text>().color = Color.white;
// drop shadow
var shadow = text.gameObject.AddComponent<Shadow>();
shadow.effectColor = new Color(0, 0, 0, .95f);
shadow.effectDistance = new Vector2(0.5f, -0.5f);
}
int handSide = tnhManager.RadarHand == TNH_RadarHand.Left ? 0 : 1;
tnhInfo.transform.SetParent(hands[handSide], false);
tnhInfo.transform.localScale = new Vector3(.0002f, .0002f, .0002f);
tnhInfo.GetComponent<TNHInfo>().GameOverPos();
}
}
@@ -53,14 +42,14 @@ namespace TNHQoLImprovements
void Start()
{
tnhManager = GameObject.Find("_GameManager").GetComponent<TNH_Manager>();
gObjHUD = GameObject.Find("HealthBar(Clone)/f");
if(MeatKitPlugin.cfgShowHPBackground.Value || MeatKitPlugin.cfgSolidifyHPText.Value)
ImproveHPTextReadability();
if (MeatKitPlugin.cfgShowTokens.Value)
Instantiate(MeatKitPlugin.bundle.LoadAsset<GameObject>("TokenCounter"), FindObjectOfType<TAH_Reticle>().transform.GetChild(3));
if (MeatKitPlugin.cfgShowHolds.Value)
Instantiate(MeatKitPlugin.bundle.LoadAsset<GameObject>("HoldCounter"), FindObjectOfType<TAH_Reticle>().transform.GetChild(3));
var rig = Object.FindObjectOfType<FVRMovementManager>().transform;
hands = new Transform[] {
rig.transform.GetChild(1), rig.transform.GetChild(0)
};
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);
}
}
}
+56
View File
@@ -0,0 +1,56 @@
using System.Collections.Generic;
using System.Reflection;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
using FistVR;
namespace TNHQoLImprovements
{
public class ShopCostPatch : MonoBehaviour
{
public static void Patch(Harmony harmony)
{
var original = typeof(TNH_ObjectConstructorIcon).GetMethod("Init", BindingFlags.Public | BindingFlags.Instance);
var postfix = typeof(ShopCostPatch).GetMethod("Postfix", BindingFlags.NonPublic | BindingFlags.Static);
harmony.Patch(original, new HarmonyMethod(postfix));
}
private static void AddNumericalRepresentation(TNH_ObjectConstructorIcon __instance)
{
foreach (Transform curTran in __instance.gameObject.transform)
{
if (curTran.name.Contains("Cost"))
curTran.gameObject.AddComponent<ShopCostNumber>();
}
}
}
public class ShopCostNumber : MonoBehaviour
{
private TNH_ObjectConstructorIcon objConstructor;
private Text text;
public void Awake()
{
objConstructor = transform.parent.GetComponent<TNH_ObjectConstructorIcon>();
}
public void Start()
{
var textTran = new GameObject().transform;
textTran.SetParent(transform, false);
textTran.localPosition = new Vector2(0, -245);
text = textTran.gameObject.AddComponent<Text>();
text.font = MeatKitPlugin.fontAgencyFB;
text.alignment = TextAnchor.MiddleCenter;
text.fontSize = 50;
}
public void Update()
{
text.text = objConstructor.Cost.ToString();
}
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 51b19459f850a654488e4057bf5dbb1f
timeCreated: 1643424482
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+38
View File
@@ -0,0 +1,38 @@
using UnityEngine;
using FistVR;
namespace TNHQoLImprovements
{
class TNHInfo : MonoBehaviour
{
private GameObject holdCounter;
private GameObject tokenCounter;
public void Start()
{
if (MeatKitPlugin.cfgShowHolds.Value)
holdCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("HoldCounter"), transform);
if (MeatKitPlugin.cfgShowTokens.Value)
tokenCounter = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("TokenCounter"), transform);
}
public void PlayPos()
{
if (holdCounter != null)
holdCounter.transform.localPosition = new Vector3(-333, 0, -450);
if (tokenCounter != null)
tokenCounter.transform.localPosition = new Vector3(333, 0, -450);
}
public void GameOverPos()
{
if (holdCounter != null)
holdCounter.transform.localPosition = new Vector3(-250, 0, 0);
if (tokenCounter != null)
tokenCounter.transform.localPosition = new Vector3(250, 0, 0);
}
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0d549cfce77855f4e9d9778d4c602f21
timeCreated: 1643333500
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+10 -12
View File
@@ -5,6 +5,11 @@ using FistVR;
namespace TNHQoLImprovements
{
public enum HealthExpireIndicationType
{
None, Flashing, CircularGraphic
}
/// <summary>
/// If KillAfter is attached to a HealthCrystal, show visual representation of expiration.
/// </summary>
@@ -29,27 +34,20 @@ namespace TNHQoLImprovements
if (__instance.transform.GetComponentInChildren<HealthPickUp>() == null)
return;
Debug.Log("KillAfter will expire in " + __instance.DieTime + " seconds.");
GameObject timer;
Transform healthCrystal = __instance.transform.Find("HealthCrystal");
switch (VISUAL_APPROACH)
switch (MeatKitPlugin.cfgHealthCrystalIndicator.Value)
{
case 0: // ring above
case HealthExpireIndicationType.CircularGraphic: // ring above
timer = GameObject.Instantiate<GameObject>(timerAsset, healthCrystal);
timer.GetComponent<UIRingTimer>().Init(__instance.DieTime);
timer.transform.localScale = new Vector2(0.001f, 0.001f);
timer.transform.localPosition = new Vector3(0, .9f, 0);
// TODO: disable scoring?
break;
case 1: // ring around
timer = GameObject.Instantiate<GameObject>(timerAsset, healthCrystal);
timer.GetComponent<UIRingTimer>().Init(__instance.DieTime);
timer.transform.localScale = new Vector2(0.0035f, 0.0035f);
timer.transform.localPosition = Vector3.zero;
break;
case 2: // flashing crystal
case HealthExpireIndicationType.Flashing: // flashing crystal
var flicker = healthCrystal.gameObject.AddComponent<MeshRendererFlicker>();
flicker.Init(.4f, 0.6f, __instance.DieTime - 3f);
flicker.Init(.6f, .7f, __instance.DieTime - 3);
break;
}
}
+1 -3
View File
@@ -9,9 +9,7 @@ namespace TNHQoLImprovements
{
void Start()
{
transform.localPosition = new Vector3(1, 0, -.5f);
transform.localRotation = Quaternion.Euler(90, 0, 0);
transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
transform.localPosition = new Vector3(333, 0, -450);
StartCoroutine(SetTokenImage());
}
+54
View File
@@ -0,0 +1,54 @@
using System.Reflection;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using FistVR;
namespace TNHQoLImprovements
{
public static class WavePatch
{
public static void Patch(Harmony harmony)
{
var original = typeof(TNH_Manager).GetMethod("HoldPointStarted", BindingFlags.Public | BindingFlags.Instance);
var patch = typeof(WavePatch).GetMethod("OnHoldStart", BindingFlags.NonPublic | BindingFlags.Static);
harmony.Patch(original, postfix: new HarmonyMethod(patch));
}
private static void OnHoldStart(TNH_HoldPoint p)
{
WaveCounter.WaveStarted.Invoke(p);
}
}
public class WaveCounter : MonoBehaviour
{
[System.Serializable]
public class WaveStartedEvent : UnityEvent<TNH_HoldPoint> { }
public static WaveStartedEvent WaveStarted = new WaveStartedEvent();
private bool initialized = false;
private TNH_HoldPoint holdPoint;
// Use this for initialization
void Start()
{
}
void Init(TNH_Manager manager)
{
holdPoint = manager.m_curHoldPoint;
initialized = true;
}
// Update is called once per frame
void Update()
{
if (!initialized)
return;
}
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c0c3423ff90fccc45bc00c97177b33fb
timeCreated: 1643271842
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: