public static void Postfix(uGUI_InventoryTab __instance) { // This event happens whenever the player opens their PDA. if (__instance == null) { return; } PdaOverlayManager.FinishingConnectingToPda(__instance.equipment); }
public 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 Base BioReactor item container. if (__instance == null) { return; } PdaOverlayManager.FinishingConnectingToPda(__instance.equipment); }
internal static void Postfix(uGUI_InventoryTab __instance) { if (__instance == null || !CyBioReactorMono.PdaIsOpen) { return; } ItemsContainer containerObj = __instance.storage.container; CyBioReactorMono reactor = CyBioReactorMono.OpenInPda; reactor.ConnectToContainer(__instance.storage.items); }
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 || !CyBioReactorMono.PdaIsOpen) { return; } ItemsContainer containerObj = __instance.storage.container; CyBioReactorMono reactor = CyBioReactorMono.OpenInPda; reactor.ConnectToInventory(__instance.storage.items); }
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(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 is null) { return; // Safety check } if (!Player.main.IsInSub() || !Player.main.currentSub.isCyclops) { return; // If not in Cyclops then all is irrelevant } if (__instance.storage is null) { return; // Safety check } ItemsContainer containerObj = __instance.storage.container; if (containerObj is null) { return; // If this isn't a non-null ItemsContainer, then it's not what we want. } string label = containerObj._label; if (label != CyBioReactor.StorageLabel) { return; // Not a Cyclops Bioreactor storage } List <CyBioReactorMono> reactors = CyclopsManager.GetBioReactors(Player.main.currentSub); if (reactors is null || reactors.Count == 0) { return; // Cyclops has no bioreactors } // Look for the reactor that matches the container we just opened. CyBioReactorMono reactor = reactors.Find(r => r.Container == containerObj); if (reactor is null) { return; // Didn't find the reactor we were looking for. Could it be on another cyclops? } Dictionary <InventoryItem, uGUI_ItemIcon> lookup = __instance.storage.items; reactor.ConnectToInventory(lookup); // Found! }
public 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 Base BioReactor item container. if (__instance is null) { return; // Safety check } if (!Player.main.IsInSub() || !Player.main.currentSub.isBase) { return; // If not in Base then all is irrelevant } if (__instance.storage is null) { return; // Safety check } ItemsContainer currentContainer = __instance.storage.container; if (currentContainer is null) { return; // If this isn't a non-null ItemsContainer, then it's not what we want. } if (currentContainer._label != "BaseBioReactorStorageLabel") { return; // Not a BaseBioReactor storage } BaseBioReactor[] reactors = Player.main.currentSub.GetAllComponentsInChildren <BaseBioReactor>(); if (reactors is null || reactors.Length == 0) { return; // Base has no bioreactors } // Look for the reactor that matches the container we just opened. foreach (BaseBioReactor reactor in reactors) { if (reactor.container != currentContainer) { continue; } CyBioReactorMini.GetMiniReactor(reactor).ConnectToInventory(__instance.storage.items); } }