private static void Postfix(uGUI_ItemsContainer __instance, int width, int height) { var x = __instance.rectTransform.anchoredPosition.x; if (height == 9) { __instance.rectTransform.anchoredPosition = new Vector2(x, -39); } else if (height == 10) { __instance.rectTransform.anchoredPosition = new Vector2(x, -75); } else { __instance.rectTransform.anchoredPosition = new Vector2(x, -4); } var y = __instance.rectTransform.anchoredPosition.y; var sign = Mathf.Sign(x); if (width == 8) { __instance.rectTransform.anchoredPosition = new Vector2(sign * (284 + 8), y); } else { __instance.rectTransform.anchoredPosition = new Vector2(sign * 284, y); } }
public static void Postfix(uGUI_ItemsContainer __instance, ItemsContainer container) { if (container == Inventory.main.container) { InventoryOpener.InventoryUGUI = __instance; } }
public static void fixOnResize(ref uGUI_ItemsContainer itemsContainer, int width, int height) { if (height == 10) { itemsContainer.rectTransform.anchoredPosition = new Vector2(itemsContainer.rectTransform.anchoredPosition.x, -55f); } }
public static void Postfix(uGUI_ItemsContainer __instance, ItemsContainer container) { try { if (container == Inventory.main.container) { InventoryOpener.InventoryUGUI = __instance; } } catch (Exception e) { Logger.Exception(e, LoggedWhen.InPatch, QMod.assembly); } }
internal static void Postfix(uGUI_InventoryTab __instance) { // This event happens whenever the player opens their PDA. // We will make a series of checks to see if what they have opened is the Cyclops Bioreactor item container. if (__instance == null) { return; // Safety check } if (!Player.main.IsInSub() || !Player.main.currentSub.isCyclops) { return; // If not in Cyclops then all is irrelevant } uGUI_ItemsContainer storageUI = __instance.storage; if (storageUI == null) { return; // Not an equipment container } var container = (ItemsContainer)containerField.GetValue(storageUI); if (container == null) { return; // Safety check } string label = (container as IItemsContainer).label; if (label != CyNukReactorBuildable.StorageLabel()) { return; // Not a CyNukReactor } List <CyNukeReactorMono> reactors = MCUServices.Find.AuxCyclopsManager <CyNukeManager>(Player.main.currentSub)?.CyNukeReactors; if (reactors == null || reactors.Count == 0) { return; // Cyclops has no reactors } // Look for the reactor that matches the container we just opened. CyNukeReactorMono reactor = reactors.Find(r => r.RodsContainer == container); if (reactor == null) { return; // Didn't find the reactor we were looking for. Could it be on another cyclops? } var lookup = (Dictionary <InventoryItem, uGUI_ItemIcon>)itemsField.GetValue(storageUI); reactor.ConnectToContainer(lookup); // Found! }
internal static void Postfix(ref uGUI_ItemsContainer __instance, int width, int height) { StorageModuleMgr.fixOnResize(ref __instance, width, height); }