Ejemplo n.º 1
0
        public virtual OptionsTextEntry AddTextEntry(string label, string tooltip, Func <string> get, Action <string> set)
        {
            OptionsTextEntry option_element = new OptionsTextEntry(label, -999);

            tooltips[option_element]    = tooltip;
            option_element.textBox.Text = get();
            applySettingCallbacks.Add(delegate
            {
                set(option_element.textBox.Text);
            });
            options.Add(option_element);
            return(option_element);
        }
Ejemplo n.º 2
0
        public virtual void PopulateOptions()
        {
            options.Clear();
            tooltips.Clear();
            applySettingCallbacks.Clear();
            options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:AGO_Label")));
            options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:AGO_CCB"))
            {
                style = OptionsElement.Style.OptionLabel
            });
            AddDropdown("", Game1.content.LoadString("Strings\\UI:AGO_CCB_Tooltip"), () => Game1.bundleType, delegate(Game1.BundleType val)
            {
                Game1.bundleType = val;
            }, new KeyValuePair <string, Game1.BundleType>(Game1.content.LoadString("Strings\\UI:AGO_CCB_Normal"), Game1.BundleType.Default), new KeyValuePair <string, Game1.BundleType>(Game1.content.LoadString("Strings\\UI:AGO_CCB_Remixed"), Game1.BundleType.Remixed));
            AddCheckbox(Game1.content.LoadString("Strings\\UI:AGO_Year1Completable"), Game1.content.LoadString("Strings\\UI:AGO_Year1Completable_Tooltip"), () => Game1.game1.GetNewGameOption <bool>("YearOneCompletable"), delegate(bool val)
            {
                Game1.game1.SetNewGameOption("YearOneCompletable", val);
            });
            options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:AGO_MineTreasureShuffle"))
            {
                style = OptionsElement.Style.OptionLabel
            });
            AddDropdown("", Game1.content.LoadString("Strings\\UI:AGO_MineTreasureShuffle_Tooltip"), () => Game1.game1.GetNewGameOption <Game1.MineChestType>("MineChests"), delegate(Game1.MineChestType val)
            {
                Game1.game1.SetNewGameOption("MineChests", val);
            }, new KeyValuePair <string, Game1.MineChestType>(Game1.content.LoadString("Strings\\UI:AGO_CCB_Normal"), Game1.MineChestType.Default), new KeyValuePair <string, Game1.MineChestType>(Game1.content.LoadString("Strings\\UI:AGO_CCB_Remixed"), Game1.MineChestType.Remixed));
            AddCheckbox(Game1.content.LoadString("Strings\\UI:AGO_FarmMonsters"), Game1.content.LoadString("Strings\\UI:AGO_FarmMonsters_Tooltip"), delegate
            {
                bool result2 = Game1.spawnMonstersAtNight;
                if (Game1.game1.newGameSetupOptions.ContainsKey("SpawnMonstersAtNight"))
                {
                    result2 = Game1.game1.GetNewGameOption <bool>("SpawnMonstersAtNight");
                }
                initialMonsterSpawnAtValue = result2;
                return(result2);
            }, delegate(bool val)
            {
                if (initialMonsterSpawnAtValue != val)
                {
                    Game1.game1.SetNewGameOption("SpawnMonstersAtNight", val);
                }
            });
            AddDropdown(Game1.content.LoadString("Strings\\UI:Character_Difficulty"), Game1.content.LoadString("Strings\\UI:AGO_ProfitMargin_Tooltip"), () => Game1.player.difficultyModifier, delegate(float val)
            {
                Game1.player.difficultyModifier = val;
            }, new KeyValuePair <string, float>(Game1.content.LoadString("Strings\\UI:Character_Normal"), 1f), new KeyValuePair <string, float>("75%", 0.75f), new KeyValuePair <string, float>("50%", 0.5f), new KeyValuePair <string, float>("25%", 0.25f));
            options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:AGO_MPOptions_Label")));
            AddDropdown(Game1.content.LoadString("Strings\\UI:Character_StartingCabins"), Game1.content.LoadString("Strings\\UI:AGO_StartingCabins_Tooltip"), () => Game1.startingCabins, delegate(int val)
            {
                Game1.startingCabins = val;
            }, new KeyValuePair <string, int>(Game1.content.LoadString("Strings\\UI:Character_none"), 0), new KeyValuePair <string, int>("1", 1), new KeyValuePair <string, int>("2", 2), new KeyValuePair <string, int>("3", 3));
            AddDropdown(Game1.content.LoadString("Strings\\UI:Character_CabinLayout"), Game1.content.LoadString("Strings\\UI:AGO_CabinLayout_Tooltip"), () => Game1.cabinsSeparate, delegate(bool val)
            {
                Game1.cabinsSeparate = val;
            }, new KeyValuePair <string, bool>(Game1.content.LoadString("Strings\\UI:Character_Close"), value: false), new KeyValuePair <string, bool>(Game1.content.LoadString("Strings\\UI:Character_Separate"), value: true));
            options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:AGO_OtherOptions_Label")));
            options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:AGO_RandomSeed"))
            {
                style = OptionsElement.Style.OptionLabel
            });
            OptionsTextEntry optionsTextEntry = AddTextEntry("", Game1.content.LoadString("Strings\\UI:AGO_RandomSeed_Tooltip"), () => (!Game1.startingGameSeed.HasValue) ? "" : Game1.startingGameSeed.Value.ToString(), delegate(string val)
            {
                val.Trim();
                if (string.IsNullOrEmpty(val))
                {
                    Game1.startingGameSeed = null;
                }
                else
                {
                    ulong result = 0uL;
                    while (true)
                    {
                        if (val.Length <= 0)
                        {
                            return;
                        }
                        if (ulong.TryParse(val, out result))
                        {
                            break;
                        }
                        val = val.Substring(0, val.Length - 1);
                    }
                    Game1.startingGameSeed = result;
                }
            });

            optionsTextEntry.textBox.numbersOnly = true;
            optionsTextEntry.textBox.textLimit   = 9;
            for (int i = options.Count; i < 7; i++)
            {
                options.Add(new OptionsElement(""));
            }
        }