public static bool OnItemIconMouseUp_Postfix(UIStationStorage __instance, BaseEventData evt) { if (SimulatedWorld.Initialized && !ILSShipManager.PatchLockILS) { StationUIManager.LastMouseEvent = evt; StationUIManager.LastMouseEventWasDown = false; StationUI packet; if (LocalPlayer.IsMasterClient) { if ((bool)AccessTools.Field(typeof(UIStationStorage), "insplit").GetValue(__instance)) { int splitVal = UIRoot.instance.uiGame.gridSplit.value; int diff = (splitVal >= __instance.station.storage[__instance.index].count) ? __instance.station.storage[__instance.index].count : splitVal; packet = new StationUI(__instance.stationWindow.factory.planet.id, __instance.station.id, __instance.station.gid, __instance.index, StationUI.EUISettings.AddOrRemoveItemFromStorageResponse, __instance.station.storage[__instance.index].itemId, __instance.station.storage[__instance.index].count - diff); LocalPlayer.SendPacket(packet); } } else { packet = new StationUI(__instance.stationWindow.factory.planet.id, __instance.station.id, __instance.station.gid, __instance.index, StationUI.EUISettings.AddOrRemoveItemFromStorageRequest, __instance.station.storage[__instance.index].itemId, __instance.station.storage[__instance.index].count); LocalPlayer.SendPacket(packet); } if (LocalPlayer.IsMasterClient) { return(true); } return(false); } return(true); }
public static bool OnItemIconMouseDown_Postfix(UIStationStorage __instance, BaseEventData evt) { if (SimulatedWorld.Initialized && !ILSShipManager.PatchLockILS) { StationUIManager.LastMouseEvent = evt; StationUIManager.LastMouseEventWasDown = true; StationUI packet; if (LocalPlayer.IsMasterClient) { PointerEventData pointEventData = evt as PointerEventData; if (GameMain.mainPlayer.inhandItemId == __instance.station.storage[__instance.index].itemId && pointEventData.button == PointerEventData.InputButton.Left) { int diff = __instance.station.storage[__instance.index].max - __instance.station.storage[__instance.index].count; int amount = (diff >= GameMain.mainPlayer.inhandItemCount) ? GameMain.mainPlayer.inhandItemCount : diff; if (amount < 0) { amount = 0; } packet = new StationUI(__instance.stationWindow.factory.planet.id, __instance.station.id, __instance.station.gid, __instance.index, StationUI.EUISettings.AddOrRemoveItemFromStorageResponse, __instance.station.storage[__instance.index].itemId, __instance.station.storage[__instance.index].count + amount); LocalPlayer.SendPacket(packet); } } else { packet = new StationUI(__instance.stationWindow.factory.planet.id, __instance.station.id, __instance.station.gid, __instance.index, StationUI.EUISettings.AddOrRemoveItemFromStorageRequest, __instance.station.storage[__instance.index].itemId, __instance.station.storage[__instance.index].count); LocalPlayer.SendPacket(packet); } if (LocalPlayer.IsMasterClient) { return(true); } return(false); } return(true); }
public static void _OnUpdate_Postfix(UIStationStorage __instance, float __state) { // Restore the silder value so it is not modified by RefreshValues() if (Multiplayer.IsActive && Multiplayer.Session.StationsUI.StorageMaxChangeId != -1) { __instance.maxSlider.value = __state; __instance.maxValueText.text = ((int)(__instance.maxSlider.value * 100)).ToString(); } eventLock = false; }
public static bool OnMaxSliderValueChangePrefix(UIStationStorage __instance, float val) { if (Multiplayer.IsActive && !eventLock) { if (val != (float)(__instance.station.storage[__instance.index].max / 100)) { // If the silder value doesn't match with storage.max, mark it Multiplayer.Session.StationsUI.StorageMaxChangeId = __instance.index; } } return(!Multiplayer.IsActive); }
public static bool UIStationWindow_OnCreate_Prefix(UIStationWindow __instance, ref UIStationStorage[] ___storageUIs, UIStationStorage ___storageUIPrefab) { bool showWarperSlot = Config.General.ShowWarperSlot.Value; if (showWarperSlot == true || ModDisabled == true) { return(true); } ___storageUIs = new UIStationStorage[5]; for (int i = 0; i < ___storageUIs.Length; i++) { ___storageUIs[i] = Object.Instantiate(___storageUIPrefab, ___storageUIPrefab.transform.parent); ((RectTransform)___storageUIs[i].transform).anchoredPosition = new Vector2(40f, -90 - 76 * i); ___storageUIs[i].stationWindow = __instance; ___storageUIs[i]._Create(); } return(false); }
public static bool UIStationStorage_OnItemPickerReturn_Prefix(UIStationStorage __instance, ItemProto itemProto) { if (ModDisabled == true) { return(true); } int warperId = ItemProto.kWarperId; int IlsId = 2104; PrefabDesc prefabDesc = LDB.items.Select(IlsId).prefabDesc; int warperSlotIndex = prefabDesc.stationMaxItemKinds; if (itemProto == null) { return(false); } if (__instance.station == null || __instance.index >= __instance.station.storage.Length) { return(false); } ItemProto itemProto2 = LDB.items.Select((int)__instance.stationWindow.factory.entityPool[__instance.station.entityId].protoId); if (itemProto2 == null) { return(false); } for (int i = 0; i < __instance.station.storage.Length; i++) { if (__instance.station.storage[i].itemId == itemProto.ID) { if (__instance.station.isStellar == true && __instance.station.isCollector == false && i == warperSlotIndex && itemProto.ID == warperId) { continue; } UIRealtimeTip.Popup("不选择重复物品".Translate(), true, 0); return(false); } } __instance.stationWindow.transport.SetStationStorage(__instance.station.id, __instance.index, itemProto.ID, itemProto2.prefabDesc.stationMaxItemCount, ELogisticStorage.Supply, (!__instance.station.isStellar) ? ELogisticStorage.None : ELogisticStorage.Supply, GameMain.mainPlayer); return(false); }
public static void OnItemIconMouseDown_Prefix(UIStationStorage __instance, ref (int, int) __state)
public static void _OnUpdate_Prefix(UIStationStorage __instance, ref float __state) { // Set up eventLock so value changes in maxSlider.value don't trigger changed check eventLock = true; __state = __instance.maxSlider.value; }