Esempio n. 1
0
            static void Postfix(CheatMenu __instance)
            {
                AchievementManager am = G.Sys.Achievements_;

                EAchievements achievement = EAchievements.Rampage;

                string cheatname = "THE MIGHTY LAMP";

                string cheatlocked   = string.Format("{0} Complete: {1}", "To Unlock:".Colorize(Colors.tomato), am.GetAchievement(achievement).name_);
                string cheatunlocked = string.Format("{0}: Enlighten your way through the Array", "Visual".Colorize(Colors.yellowGreen));

                if (!am.HasAchieved(achievement))
                {
                    __instance.TweakAction(GUtils.GetLockedText(cheatname).Colorize(Colors.gray), null, cheatlocked);
                }
                else
                {
                    __instance.TweakBool(cheatname, Entry.GetKey("lamp.cheat", false), (value) => {
                        Entry.SetKey("lamp.cheat", value);
                        foreach (Scripts.LampController controller in UnityEngine.Object.FindObjectsOfType <Scripts.LampController>())
                        {
                            controller.lamp.SetActive(Entry.GetKey("lamp.cheat", false));
                        }
                    }, cheatunlocked);
                }
            }
        public override void Run()
        {
            Transform OptionsTable = GameObject.Find(Root()).transform;

            Transform[] Widgets = (from child_object in OptionsTable.GetChildren() where !child_object.HasComponent <UIExBlueprint>() select child_object).ToArray();

            void Translate(ECheat cheat, int index, string id)
            {
                if (G.Sys.CheatsManager_.IsUnlocked(cheat))
                {
                    if ((cheat == ECheat.CampaignPlus && !G.Sys.CheatsManager_.CampaignPlusRecognized_) || G.Sys.CheatsManager_.GetCheat(cheat).affectsGameplay&& !G.Sys.CheatsManager_.GameplayCheatsRecognized_)
                    {
                        Widgets[index].Find("NameLabel").GetComponent <UILabel>().text = Language.GetLine($"settings.cheats.{id}").UP().Colorize(Colors.tomato);
                        Widgets[index].gameObject.GetComponent <SetMenuDescriptionOnHover>().SetText(Language.GetLine($"settings.cheats.{id}.description.unavailable"));
                    }
                    else
                    {
                        bool flag_needrestart = cheat == ECheat.CampaignPlus && G.Sys.GameManager_.IsCampaignMode_;
                        Widgets[index].Find("NameLabel").GetComponent <UILabel>().text = (Language.GetLine($"settings.cheats.{id}") + ':').UP();
                        Widgets[index].gameObject.GetComponent <SetMenuDescriptionOnHover>().SetText(Language.GetLine($"settings.cheats.{id}.description.unlocked") + (flag_needrestart ? '\n' + Language.GetLine($"settings.cheats.{id}.description.needrestart") : ""));
                    }
                }
                else
                {
                    Widgets[index].Find("NameLabel").GetComponent <UILabel>().text = GUtils.GetLockedText(Language.GetLine($"settings.cheats.{id}")).Colorize(Color.gray);
                    Widgets[index].gameObject.GetComponent <SetMenuDescriptionOnHover>().SetText(Language.GetLine($"settings.cheats.{id}.description.locked"));
                }
            }

            GameObject.Find($"{MenuTitleTemplate()}/UILabel - Title").GetComponent <UILabel>().text = Language.GetLine("settings.cheats.title");

            Translate(ECheat.CampaignPlus, 0, "campaignplus");
            Translate(ECheat.MotorcycleMode, 1, "motorcyclemode");
            Translate(ECheat.MonsterTruck, 2, "monstertruck");
            Translate(ECheat.SkyWalker, 3, "skywalker");
            Translate(ECheat.FilmNoir, 4, "filmnoir");
            Translate(ECheat.StylizedOutlines, 5, "stylizedoutlines");
            Translate(ECheat.SuperBoost, 6, "superboost");
            Translate(ECheat.MaxDamage, 7, "maxdamage");
            Translate(ECheat.BubbleCar, 8, "bubblecar");
            Translate(ECheat.DeathProof, 9, "deathproof");
            Translate(ECheat.CrabFriend, 10, "crabfriend");
            Translate(ECheat.CrownOfTheElders, 11, "crownoftheelders");
            Translate(ECheat.PreservationalBoosterSloth, 12, "preservationalboostersloth");

            Disable();
        }