public static bool OnStorageIdChange_Prefix(UIStorageWindow __instance) { if (Multiplayer.IsActive && !Multiplayer.Session.LocalPlayer.IsHost && Multiplayer.Session.Storage.WindowOpened) { UIStorageGrid storageUI = __instance.storageUI; Multiplayer.Session.Storage.ActiveUIStorageGrid = storageUI; Text titleText = __instance.titleText; Multiplayer.Session.Storage.ActiveStorageComponent = __instance.factoryStorage.storagePool[__instance.storageId]; Multiplayer.Session.Storage.ActiveWindowTitle = titleText; Multiplayer.Session.Storage.ActiveBansSlider = __instance.bansSlider; Multiplayer.Session.Storage.ActiveBansValueText = __instance.bansValueText; titleText.text = "Loading..."; storageUI._Free(); storageUI._Open(); storageUI.OnStorageDataChanged(); Multiplayer.Session.Network.SendPacket(new StorageSyncRequestPacket(GameMain.data.localPlanet.id, __instance.storageId)); return(false); } return(true); }
public static bool OnStorageIdChange_Prefix(UIStorageWindow __instance) { if (SimulatedWorld.Initialized && !LocalPlayer.IsMasterClient && StorageManager.WindowOpened) { UIStorageGrid storageUI = (UIStorageGrid)AccessTools.Field(typeof(UIStorageWindow), "storageUI").GetValue(__instance); StorageManager.ActiveUIStorageGrid = storageUI; Text titleText = (Text)AccessTools.Field(typeof(UIStorageWindow), "titleText").GetValue(__instance); StorageManager.ActiveStorageComponent = __instance.factoryStorage.storagePool[__instance.storageId]; StorageManager.ActiveWindowTitle = titleText; StorageManager.ActiveBansSlider = (Slider)AccessTools.Field(typeof(UIStorageWindow), "bansSlider").GetValue(__instance); StorageManager.ActiveBansValueText = (Text)AccessTools.Field(typeof(UIStorageWindow), "bansValueText").GetValue(__instance); titleText.text = "Loading..."; storageUI._Free(); storageUI._Open(); storageUI.OnStorageDataChanged(); LocalPlayer.SendPacket(new StorageSyncRequestPacket(GameMain.data.localPlanet.id, __instance.storageId)); return(false); } return(true); }