diff --git a/Projects/TerraTech/TerraTech/Class1.cs b/Projects/TerraTech/TerraTech/Class1.cs index 727e754..c4df6ad 100644 --- a/Projects/TerraTech/TerraTech/Class1.cs +++ b/Projects/TerraTech/TerraTech/Class1.cs @@ -15,6 +15,7 @@ namespace TerraTech { private const string PluginVersion = "1.0.0"; public static ConfigEntry debug; + public static ConfigEntry debugBuyAll; public static ConfigEntry xpMultiplier; public static ConfigEntry moneyMultiplier; public static ConfigEntry heartbeatIntervalMultiplier; @@ -25,6 +26,7 @@ namespace TerraTech { public void Awake() { debug = Config.Bind("General", "Debug", false); + debugBuyAll = Config.Bind("General", "Debug Buy All", false); float min = 0.01f; float max = 32f; diff --git a/Projects/TerraTech/TerraTech/TerraTech.csproj b/Projects/TerraTech/TerraTech/TerraTech.csproj index b97f258..dc67dbc 100644 --- a/Projects/TerraTech/TerraTech/TerraTech.csproj +++ b/Projects/TerraTech/TerraTech/TerraTech.csproj @@ -60,6 +60,7 @@ + @@ -74,6 +75,9 @@ $(GAME_MANAGED)/UnityEngine.CoreModule.dll + + $(GAME_MANAGED)/UnityEngine.UI.dll + $(GAME_MANAGED)/UnityEngine.Networking.dll diff --git a/Projects/TerraTech/TerraTech/UISnapshotPanelBuyAll.cs b/Projects/TerraTech/TerraTech/UISnapshotPanelBuyAll.cs new file mode 100644 index 0000000..4289791 --- /dev/null +++ b/Projects/TerraTech/TerraTech/UISnapshotPanelBuyAll.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using HarmonyLib; +using Snapshots; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace TerraTech { + [HarmonyPatch] + public class UISnapshotPanelBuyAll { + public static UISnapshotPanel panel; + public static Traverse panelTraverse; + public static SnapshotLiveData selectedData; + + [HarmonyPostfix] + [HarmonyPatch(typeof(UISnapshotPanel), "OnPool")] + public static void PostfixCreate(UISnapshotPanel __instance) { + if (Main.debugBuyAll.Value) + Console.WriteLine("UISnapshotPanel.OnPool: {0}", __instance); + panel = __instance; + panelTraverse = Traverse.Create(__instance); + var placeButton = panelTraverse.Field("m_PlaceButton").GetValue