public static bool CharacterCreation_PushedButton(CharacterCreation __instance, ButtonHelper myButton) { bool debug = RogueFramework.IsDebugEnabled(DebugFlags.UnlockMenus); if (__instance.selectedSpace == "Load") { if (debug) { RogueFramework.LogDebug("Redirecting the button push to the original method."); } return(true); } if (debug) { RogueFramework.LogDebug($"Pressing \"{myButton.myText.text}\" ({myButton.scrollingButtonNum}, {myButton.scrollingButtonType}) button."); } string type = myButton.scrollingButtonUnlock.unlockType; List <ButtonData> buttonsData = type == UnlockTypes.Item ? __instance.buttonsDataItems : type == UnlockTypes.Trait ? __instance.buttonsDataTraits : type == UnlockTypes.Ability ? __instance.buttonsDataAbilities : type == UnlockTypes.BigQuest ? __instance.buttonsDataBigQuests : null; ButtonData buttonData = buttonsData[myButton.scrollingButtonNum]; DisplayedUnlock du = (DisplayedUnlock)buttonData.__RogueLibsCustom; try { du.OnPushedButton(); } catch (Exception e) { RogueFramework.LogError(e, "DisplayedUnlock.OnPushedButton", du, du.Menu); } __instance.curSelectedButton = myButton; __instance.curSelectedButtonNum = myButton.scrollingButtonNum; return(false); }
public static bool ScrollingMenu_PushedButton(ScrollingMenu __instance, ButtonHelper myButton) { bool debug = RogueFramework.IsDebugEnabled(DebugFlags.UnlockMenus); if (__instance.menuType.EndsWith("Configs")) { if (debug) { RogueFramework.LogDebug("Redirecting the button push to the original method."); } return(true); } if (debug) { RogueFramework.LogDebug($"Pressing \"{myButton.myText.text}\" ({myButton.scrollingButtonNum}, {myButton.scrollingButtonType}) button."); } ButtonData buttonData = __instance.buttonsData[myButton.scrollingButtonNum]; DisplayedUnlock du = (DisplayedUnlock)buttonData.__RogueLibsCustom; try { du.OnPushedButton(); } catch (Exception e) { RogueFramework.LogError(e, "DisplayedUnlock.OnPushedButton", du, du.Menu); } return(false); }
public static bool ScrollingMenu_ShowDetails(ScrollingMenu __instance, ButtonHelper myButton) { if (__instance.agent != null && myButton.scrollingButtonUnlock?.unlockType == "Trait" && __instance.agent.addedEndLevelTrait || !string.IsNullOrEmpty(myButton.scrollingButtonLevelFeeling) || !string.IsNullOrEmpty(myButton.scrollingButtonConfigName) || !string.IsNullOrEmpty(myButton.scrollingButtonAgentName)) { return(true); } DisplayedUnlock du = (DisplayedUnlock)myButton.scrollingButtonUnlock.__RogueLibsCustom; __instance.detailsTitle.text = du.GetName(); __instance.detailsText.text = du.GetFancyDescription(); __instance.detailsImage.sprite = du.GetImage(); __instance.detailsImage.gameObject.SetActive(__instance.detailsImage.sprite != null); return(false); }
public static bool SetupUnlocks(ButtonData myButtonData, Unlock myUnlock) { DisplayedUnlock du = (DisplayedUnlock)(myButtonData.__RogueLibsCustom = myUnlock.__RogueLibsCustom); du.ButtonData = myButtonData; myButtonData.scrollingButtonUnlock = myUnlock; myButtonData.scrollingButtonType = myUnlock.unlockName; myButtonData.interactable = true; myButtonData.buttonText = du.GetFancyName(); du.UpdateUnlock(); du.UpdateButton(); return(false); }
public static bool CharacterCreation_ShowDetails(CharacterCreation __instance, ButtonHelper myButton) { if (__instance.loadMenu.gameObject.activeSelf) { return(true); } Image image = null; Text title = null; Text text = null; if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.Item) { image = __instance.detailsImageItems; title = __instance.detailsTitleItems; text = __instance.detailsTextItems; } else if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.Trait) { image = __instance.detailsImageTraits; title = __instance.detailsTitleTraits; text = __instance.detailsTextTraits; } else if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.Ability) { image = __instance.detailsImageAbilities; title = __instance.detailsTitleAbilities; text = __instance.detailsTextAbilities; } else if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.BigQuest) { image = __instance.detailsImageBigQuests; title = __instance.detailsTitleBigQuests; text = __instance.detailsTextBigQuests; } if (image != null) { DisplayedUnlock du = (DisplayedUnlock)myButton.scrollingButtonUnlock.__RogueLibsCustom; title.text = du.GetName(); text.text = du.GetFancyDescription(); image.sprite = du.GetImage(); image.gameObject.SetActive(image.sprite != null); } __instance.curSelectedButton = myButton; __instance.curSelectedButtonNum = myButton.scrollingButtonNum; return(false); }