Beispiel #1
0
        protected static void ScrollingMenu_PushedButton(ScrollingMenu __instance, ButtonHelper myButton)
        {
            if (__instance.menuType == "Challenges")
            {
                if (!myButton.scrollingButtonUnlock.unlocked || !__instance.gc.serverPlayer || myButton.scrollingButtonType == "ClearAll" || myButton.scrollingButtonType == "CreateAMutator")
                {
                    return;
                }

                if (myButton.scrollingHighlighted)
                {
                    foreach (CustomMutator mutator in RogueLibs.Instance.Mutators)
                    {
                        if (Array.IndexOf(mutator.Conflicting, myButton.scrollingButtonType) != -1)
                        {
                            foreach (ButtonData buttonData in __instance.buttonsData)
                            {
                                if (buttonData.scrollingButtonType == mutator.Id)
                                {
                                    if (buttonData.scrollingHighlighted)
                                    {
                                        mutator.TriggerStateChange(false);
                                    }

                                    buttonData.scrollingHighlighted = false;
                                    buttonData.highlightedSprite    = __instance.solidObjectButton;
                                    __instance.gc.challenges.Remove(buttonData.scrollingButtonType);
                                    __instance.gc.originalChallenges.Remove(buttonData.scrollingButtonType);
                                }
                            }
                        }
                    }
                    int index = RogueLibs.Instance.Mutators.FindIndex(m => m.Id == myButton.scrollingButtonType);
                    if (index != -1)
                    {
                        RogueLibs.Instance.Mutators[index].TriggerStateChange(true);
                    }

                    __instance.gc.SetDailyRunText();
                    __instance.UpdateOtherVisibleMenus(__instance.menuType);
                }
                else
                {
                    int index = RogueLibs.Instance.Mutators.FindIndex(m => m.Id == myButton.scrollingButtonType);
                    if (index != -1)
                    {
                        RogueLibs.Instance.Mutators[index].TriggerStateChange(false);
                    }

                    __instance.gc.SetDailyRunText();
                    __instance.UpdateOtherVisibleMenus(__instance.menuType);
                }
            }
        }