static void Postfix(SGNavigationList __instance, SimGameState simState) { if (SGNavigationList_Start.storeButton != null) { if (!IsShopActive(simState)) { Mod.Log.Info?.Write("Faction reputation too low, disabling store button."); SGNavigationList_Start.storeButton.SetState(ButtonState.Disabled); } } }
static void Postfix(SGNavigationList __instance, SimGameState simState) { if (SGNavigationList_Start.storeButton != null) { FactionValue owner = simState.CurSystem.OwnerValue; int reputation = (int)simState.GetReputation(owner); if (reputation <= -3) { Mod.Log.Info?.Write("Faction reputation too low, disabling store button."); SGNavigationList_Start.storeButton.SetState(ButtonState.Disabled); } } }
public static void Prefix(SGNavigationButton __instance, PointerEventData eventData, SGNavigationList ___buttonParent) { try { Logger.Debug($"[SGNavigationButton_OnPointerEnter_PREFIX] Collapse all submenus before opening this one's"); // Note that this method isn't used in vanilla. I patched it above to be actually useful... ___buttonParent.CollapseSet(false); } catch (Exception e) { Logger.Error(e); } }
static void Postfix(SGNavigationList __instance, HBSRadioSet ___radioSet, SGNavigationButton ___argoButton) { if (__instance.navParent != null) { Mod.Log.Info?.Write($"SGNL:Start - adding new button."); SimGameState simulation = UnityGameInstance.BattleTechGame.Simulation; try { // Create the store button Mod.Log.Info?.Write(" - Creating store button"); GameObject storeButtonGO = GameObject.Instantiate(___argoButton.gameObject); storeButtonGO.SetActive(true); storeButtonGO.transform.position = ___argoButton.gameObject.transform.position; storeButtonGO.transform.SetParent(___argoButton.gameObject.transform.parent); storeButtonGO.transform.localScale = Vector3.one; storeButtonGO.transform.SetSiblingIndex(1); storeButton = storeButtonGO.GetComponent <SGNavigationButton>(); Traverse storeButtonT = Traverse.Create(storeButton).Field("id"); storeButtonT.SetValue(DropshipLocation.SHIP); storeButton.SetupElement(__instance, ___radioSet, "Store", LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.DropshipRoomCaptainsQuartersIcon, simulation); // Create the staff button Mod.Log.Info?.Write(" - Creating staff button"); GameObject staffButtonGO = GameObject.Instantiate(___argoButton.gameObject); staffButtonGO.SetActive(true); staffButtonGO.transform.position = ___argoButton.gameObject.transform.position; staffButtonGO.transform.SetParent(___argoButton.gameObject.transform.parent); staffButtonGO.transform.localScale = Vector3.one; staffButtonGO.transform.SetSiblingIndex(7); staffButton = staffButtonGO.GetComponent <SGNavigationButton>(); Traverse staffButtonT = Traverse.Create(staffButton).Field("id"); staffButtonT.SetValue(DropshipLocation.CMD_CENTER); staffButton.SetupElement(__instance, ___radioSet, "CMD Staff", LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.DropshipRoomCommandCenterIcon, simulation); staffButton.AddFlyoutButton("Darius", DropshipMenuType.Darius); staffButton.AddFlyoutButton("Yang", DropshipMenuType.Yang); staffButton.AddFlyoutButton("Sumire", DropshipMenuType.Sumire); staffButton.AddFlyoutButton("Farah", DropshipMenuType.Farah); if (simulation.GetCharacterStatus(SimGameState.SimGameCharacterType.ALEXANDER)) { staffButton.AddFlyoutButton("Alexander", DropshipMenuType.Alexander); } // Create the memorial button Mod.Log.Info?.Write(" - Creating memorial button"); GameObject memorialButtonGO = GameObject.Instantiate(___argoButton.gameObject); memorialButtonGO.SetActive(true); memorialButtonGO.transform.position = ___argoButton.gameObject.transform.position; memorialButtonGO.transform.SetParent(___argoButton.gameObject.transform.parent); memorialButtonGO.transform.localScale = Vector3.one; memorialButtonGO.transform.SetSiblingIndex(9); memorialButton = memorialButtonGO.GetComponent <SGNavigationButton>(); Traverse memorialButtonT = Traverse.Create(memorialButton).Field("id"); memorialButtonT.SetValue(DropshipLocation.BARRACKS); memorialButton.SetupElement(__instance, ___radioSet, "Memorial", LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.DropshipRoomBarracksIcon, simulation); //memorialButton.AddFlyoutButton("Memorial Wall", DropshipMenuType.MemorialWall); } catch (Exception e) { Mod.Log.Info?.Write("Error: " + e.Message); } } }
static void Prefix(SGNavigationButton __instance, DropshipMenuType buttonID, LocalizableText ___text, SGNavigationList ___buttonParent) { Mod.Log.Debug?.Write($"SGNB:FC - button clicked for ID: {__instance.ID} for menuType:{buttonID} with transition:{SimGameCameraController.TransitionInProgress}"); // Skip if there's already a transition in progress if (SimGameCameraController.TransitionInProgress) { return; } ClickedID = buttonID; }
static void Postfix(SGNavigationWidgetLeft __instance, SGShipMap ___shipMap, SGNavigationList ___locationList) { Mod.Log.Info?.Write($"SGNWL:I - entered with instanceType: {__instance.GetType()}."); ___shipMap.gameObject.SetActive(false); Vector3 startPos = ___locationList.transform.position; startPos.y += 200; ___locationList.transform.position = startPos; }
static void Postfix(SGNavigationButton __instance, SGNavigationList ___buttonParent, LocalizableText ___text) { Mod.Log.Debug?.Write($"SGNB:OC - button clicked for ID: {__instance.ID}"); SimGameState simulation = UnityGameInstance.BattleTechGame.Simulation; switch (__instance.ID) { case DropshipLocation.CMD_CENTER: QueueOrForceActivation(DropshipMenuType.Contract, __instance.ID, ___buttonParent.navParent, simulation); if (SGNavigationButton_FlyoutClicked.ClickedID != DropshipMenuType.INVALID_UNSET) { if (___text.text.Contains("CMD Staff")) { switch (SGNavigationButton_FlyoutClicked.ClickedID) { case DropshipMenuType.Darius: case DropshipMenuType.Alexander: QueueOrForceActivation(SGNavigationButton_FlyoutClicked.ClickedID, DropshipLocation.CMD_CENTER, ___buttonParent.navParent, simulation); break; case DropshipMenuType.Yang: QueueOrForceActivation(SGNavigationButton_FlyoutClicked.ClickedID, DropshipLocation.MECH_BAY, ___buttonParent.navParent, simulation); break; case DropshipMenuType.Sumire: QueueOrForceActivation(SGNavigationButton_FlyoutClicked.ClickedID, DropshipLocation.NAVIGATION, ___buttonParent.navParent, simulation); break; case DropshipMenuType.Farah: QueueOrForceActivation(SGNavigationButton_FlyoutClicked.ClickedID, DropshipLocation.ENGINEERING, ___buttonParent.navParent, simulation); break; default: break; } } else if (___text.text.Contains("Memorial")) { QueueOrForceActivation(SGNavigationButton_FlyoutClicked.ClickedID, DropshipLocation.BARRACKS, ___buttonParent.navParent, simulation); } SGNavigationButton_FlyoutClicked.ClickedID = DropshipMenuType.INVALID_UNSET; } break; case DropshipLocation.BARRACKS: QueueOrForceActivation(DropshipMenuType.Mechwarrior, __instance.ID, ___buttonParent.navParent, simulation); break; case DropshipLocation.ENGINEERING: QueueOrForceActivation(DropshipMenuType.ShipUpgrade, __instance.ID, ___buttonParent.navParent, simulation); break; case DropshipLocation.MECH_BAY: QueueOrForceActivation(DropshipMenuType.MechBay, __instance.ID, ___buttonParent.navParent, simulation); break; case DropshipLocation.NAVIGATION: QueueOrForceActivation(DropshipMenuType.Navigation, __instance.ID, ___buttonParent.navParent, simulation); break; default: break; } if (___text.text.Contains("Store")) { if (simulation.CurRoomState != DropshipLocation.SHOP) { ___buttonParent.ArgoButtonFlyoutChangeRoom(DropshipLocation.SHOP); } QueueOrForceActivation(DropshipMenuType.Shop, DropshipLocation.SHOP, ___buttonParent.navParent, simulation); } else if (___text.text.Contains("Memorial")) { if (simulation.CurRoomState != DropshipLocation.BARRACKS) { ___buttonParent.ArgoButtonFlyoutChangeRoom(DropshipLocation.BARRACKS); } QueueOrForceActivation(DropshipMenuType.MemorialWall, DropshipLocation.BARRACKS, ___buttonParent.navParent, simulation); } }