From ace04f5d6e8cf7e33bc849a3f1dd9d43aed6e4fa Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Mon, 3 Jul 2023 21:17:17 +0800 Subject: [PATCH] Adopt fix from @starfi5h's NebulaCompabtibilityAssist --- Dustbin/StoragePatch.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Dustbin/StoragePatch.cs b/Dustbin/StoragePatch.cs index 4886c11..251b2bc 100644 --- a/Dustbin/StoragePatch.cs +++ b/Dustbin/StoragePatch.cs @@ -106,7 +106,7 @@ public static class StoragePatch comp.IsDusbin = _storageDustbinCheckBox.Checked; }; } - + [HarmonyPostfix] [HarmonyPatch(typeof(UIStorageWindow), "_OnUpdate")] private static void UIStorageWindow__OnUpdate_Postfix(UIStorageWindow __instance) @@ -119,11 +119,21 @@ public static class StoragePatch if (storagePool[storageId].id != storageId) return; if (storagePool[storageId] is not StorageComponentWithDustbin comp) return; _storageDustbinCheckBox.Checked = comp.IsDusbin; - if (__instance.transform is RectTransform rectTrans) { + if (__instance.transform is RectTransform rectTrans) + { _storageDustbinCheckBox.rectTrans.anchoredPosition3D = new Vector3(50, 58 - rectTrans.sizeDelta.y, 0); } } + /* Adopt fix from starfi5h's NebulaCompatiblilityAssist */ + [HarmonyPostfix] + [HarmonyPatch(typeof(UIStorageGrid), "OnStorageSizeChanged")] + private static void UIStorageGrid_OnStorageSizeChanged_Postfix() + { + // Due to storage window is empty when open in client, the size will change after receiving data from host + _lastStorageId = 0; // Refresh UI to reposition button on client side + } + [HarmonyPrefix] [HarmonyPatch(typeof(StorageComponent), "AddItem", new[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(bool) },