Esempio n. 1
0
        public void CreateMenu(TextMenu menu, bool inGame)
        {
            currentPreset      = 0;
            enabledText        = new TextMenu.OnOff(Dialog.Clean("MODOPTIONS_HYPERLINE_ENABLED"), Settings.Enabled).Change(EnabledToggled);
            allowMapHairText   = new TextMenu.OnOff(Dialog.Clean("MODOPTIONS_HYPERLINE_ALLOWMAPHAIR"), Settings.AllowMapHairColors).Change(v => Settings.AllowMapHairColors = v);
            maddyCrownText     = new TextMenu.OnOff("Maddy Crown Support:", Settings.DoMaddyCrown).Change(v => { Settings.DoMaddyCrown = v; });
            doFeatherColorText = new TextMenu.OnOff("Do Feather Color", Settings.DoFeatherColor).Change(v => { Settings.DoFeatherColor = v; });
            doDashFlashText    = new TextMenu.OnOff("Do Dash Flash", Settings.DoDashFlash).Change(v => { Settings.DoDashFlash = v; });
            menu.Add(enabledText);
            menu.Add(allowMapHairText);
            menu.Add(maddyCrownText);
            menu.Add(doFeatherColorText);
            menu.Add(doDashFlashText);
            CreatePresetMenu(menu);

            colorMenus    = new List <List <List <TextMenu.Item> > >(); //dashes
            dashCountMenu = new TextMenuExt.OptionSubMenu("Dashes");
            dashCountMenu.SetInitialSelection(lastDash);

            dashCountMenu.Change(v => { UpdateHairType(v, Settings.hairTypeList[v]); });
            for (int counterd = 0; counterd < Hyperline.MAX_DASH_COUNT; counterd++)
            {
                int r = counterd;
                List <TextMenu.Item> Menu = new List <TextMenu.Item>();
                TextMenuExt.EnumerableSlider <uint> HairTypeMenu;
                colorMenus.Add(CreateDashCountMenu(menu, inGame, counterd, out HairTypeMenu));
                if (!inGame)
                {
                    Menu.Add(new TextMenu.Button("Custom Texture: " + Settings.hairTextureSource[counterd]).Pressed(() =>
                    {
                        Audio.Play(SFX.ui_main_savefile_rename_start);
                        menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(Settings.hairTextureSource[r], v => { Settings.hairTextureSource[r] = v; Settings.LoadCustomTexture(r); }, 12);
                    }));
                    Menu.Add(new TextMenu.Button("Custom Bangs: " + Settings.hairBangsSource[counterd]).Pressed(() =>
                    {
                        Audio.Play(SFX.ui_main_savefile_rename_start);
                        menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(Settings.hairBangsSource[r], v => { Settings.hairBangsSource[r] = v; Settings.LoadCustomBangs(r); }, 12);
                    }));
                }

                Menu.Add(new TextMenu.Slider("Speed:", StringFromInt, HyperlineSettings.MIN_HAIR_SPEED, HyperlineSettings.MAX_HAIR_SPEED, Settings.hairSpeedList[counterd]).Change(v => { SetHairSpeed(r, v); }));
                Menu.Add(new TextMenu.Slider("Length:", StringFromInt, HyperlineSettings.MIN_HAIR_LENGTH, Settings.HairLengthSoftCap, Settings.hairLengthList[counterd]).Change(v => { SetHairLength(r, v); }));
                Menu.Add(HairTypeMenu);
                if (!inGame)
                {
                    for (int i = 0; i < colorMenus[counterd].Count; i++)
                    {
                        for (int j = 0; j < colorMenus[counterd][i].Count; j++)
                        {
                            Menu.Add(colorMenus[counterd][i][j]);
                        }
                    }
                }
                dashCountMenu.Add(counterd.ToString(), Menu);
            }
            menu.Add(dashCountMenu);
            UpdateHairType(lastDash, Settings.hairTypeList[lastDash]);
            EnabledToggled(Settings.Enabled);
        }
Esempio n. 2
0
 public static TextMenu.Item CreateTriggerHitboxColorButton(TextMenu textMenu, bool inGame)
 {
     return(new TextMenu.Button($"Trigger Hitbox Color ARGB: {ColorToHex(Settings.TriggerHitboxColor)}").Pressed(() => {
         Audio.Play("event:/ui/main/savefile_rename_start");
         textMenu.SceneAs <Overworld>().Goto <OuiModOptionString>()
         .Init <OuiModOptions>(ColorToHex(Settings.TriggerHitboxColor), value => Settings.TriggerHitboxColor = HexToColor(value), 9);
     }));
 }
Esempio n. 3
0
        public override List <TextMenu.Item> CreateMenu(TextMenu menu, bool inGame)
        {
            List <TextMenu.Item> colorMenus = new List <TextMenu.Item>();

            colorMenus.Add(new TextMenu.Button("Color 1: " + color1.ToString()).Pressed(() =>
            {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(color1.ToString(), v => { color1 = new HSVColor(v); }, 9);
            }));

            colorMenus.Add(new TextMenu.Button("Color 2: " + color2.ToString()).Pressed(() =>
            {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(color2.ToString(), v => { color2 = new HSVColor(v); }, 9);
            }));

            colorMenus.Add(new TextMenu.OnOff("Rgb Gradient", doRgbGradient).Change(v => doRgbGradient = v));

            return(colorMenus);
        }
Esempio n. 4
0
        public List <TextMenu.Item> CreateMenu(TextMenu menu, bool inGame)
        {
            List <TextMenu.Item> colorMenus = new List <TextMenu.Item>();

            colorMenus.Add(new TextMenu.Button("Color 1: " + C.ToString()).Pressed(() =>
            {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(C.ToString(), v => { C = new HSVColor(v); }, 9);
            }));
            return(colorMenus);
        }
Esempio n. 5
0
 public static TextMenu.Item CreateTriggerHitboxColorButton(TextMenu textMenu, bool inGame)
 {
     TextMenu.Item item = new TextMenu.Button("Trigger Hitbox Color".ToDialogText() + $": {ColorToHex(Settings.TriggerHitboxColor)}").Pressed(
         () => {
         Audio.Play("event:/ui/main/savefile_rename_start");
         textMenu.SceneAs <Overworld>().Goto <OuiModOptionString>()
         .Init <OuiModOptions>(ColorToHex(Settings.TriggerHitboxColor),
                               value => Settings.TriggerHitboxColor = HexToColor(value, Settings.TriggerHitboxColor), 9);
     });
     item.Disabled = inGame;
     return(item);
 }
 public void CreateChannelNameEntry(TextMenu textMenu, bool inGame)
 {
     if (!inGame)
     {
         textMenu.Add(new TextMenu.Button(Dialog.Clean(DialogIds.ChannelName) + ": " + ChannelName).Pressed(() =>
         {
             textMenu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                 ChannelName,
                 v => ChannelName = v,
                 maxValueLength: 30
                 );
         }));
     }
 }
Esempio n. 7
0
 public void CreateServerEntry(TextMenu menu, bool inGame)
 {
     menu.Add(
         (ServerEntry = new TextMenu.Button(("modoptions_ghostnetmodule_server".DialogCleanOrNull() ?? "Server") + ": " + Server))
         .Pressed(() => {
         Audio.Play("event:/ui/main/savefile_rename_start");
         menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
             Server,
             v => Server = v,
             maxValueLength: 30
             );
     })
         );
     ServerEntry.Disabled = inGame || Connection;
 }
Esempio n. 8
0
        public override List <TextMenu.Item> CreateMenu(TextMenu menu, bool inGame)
        {
            List <TextMenu.Item> colorMenus = new List <TextMenu.Item>();

            colorMenus.Add(new TextMenu.Slider("Pattern Count: ", NumToString, 1, MAX_PATTERN_COUNT, patternCount).Change(UpdatePatternCount));
            for (int i = 0; i < MAX_PATTERN_COUNT; i++)
            {
                int counter = i;
                colorMenus.Add(new TextMenu.Button("Color " + (counter + 1) + ": " + colorList[counter].ToString()).Pressed(() =>
                {
                    Audio.Play(SFX.ui_main_savefile_rename_start);
                    menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(colorList[counter].ToString(), v => { colorList[counter] = new HSVColor(v); }, 9);
                }));
            }
            return(colorMenus);
        }
Esempio n. 9
0
        public void CreatePlayerNameEntry(TextMenu menu, bool inGame)
        {
            if (inGame)
            {
                return;
            }
            var item = new TextMenu.Button(Dialog.Clean("MODOPTIONS_BINGOCLIENT_PLAYERNAME") + ": " + this.PlayerName)
                       .Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    (string)this.PlayerName,
                    v => {
                    this.PlayerName = v;
                    BingoClient.Instance.Username    = v;
                    BingoClient.Instance.NameChanged = true;
                },
                    20,
                    0
                    );
            });

            menu.Add(item);
        }
Esempio n. 10
0
        /// <summary>
        /// Create the mod menu subsection including the section header in the given menu.
        /// The default implementation uses reflection to attempt creating a menu.
        /// </summary>
        /// <param name="menu">Menu to add the section to.</param>
        /// <param name="inGame">Whether we're in-game (paused) or in the main menu.</param>
        /// <param name="snapshot">The Level.PauseSnapshot</param>
        public virtual void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot)
        {
            Type type = SettingsType;
            EverestModuleSettings settings = _Settings;

            if (type == null || settings == null)
            {
                return;
            }

            // The default name prefix.
            string typeName = type.Name.ToLowerInvariant();

            if (typeName.EndsWith("settings"))
            {
                typeName = typeName.Substring(0, typeName.Length - 8);
            }
            string nameDefaultPrefix = $"modoptions_{typeName}_";

            // Any attributes we may want to get and read from later.
            SettingInGameAttribute      attribInGame;
            SettingRangeAttribute       attribRange;
            SettingNumberInputAttribute attribNumber;

            // If the settings type has got the InGame attrib, only show it in the matching situation.
            if ((attribInGame = type.GetCustomAttribute <SettingInGameAttribute>()) != null &&
                attribInGame.InGame != inGame)
            {
                return;
            }

            bool headerCreated = false;

            if (GetType().GetMethod("CreateModMenuSection").DeclaringType != typeof(EverestModule))
            {
                CreateModMenuSectionHeader(menu, inGame, snapshot);
                headerCreated = true;
            }

            PropertyInfo[] props;
            if (type == _PrevSettingsType)
            {
                props = _PrevSettingsProps;
            }
            else
            {
                _PrevSettingsProps = props = type.GetProperties();
                _PrevSettingsType  = type;
            }

            foreach (PropertyInfo prop in props)
            {
                MethodInfo creator = type.GetMethod(
                    $"Create{prop.Name}Entry",
                    BindingFlags.Public | BindingFlags.Instance,
                    null,
                    new Type[] { typeof(TextMenu), typeof(bool) },
                    new ParameterModifier[0]
                    );

                if (creator != null)
                {
                    if (!headerCreated)
                    {
                        CreateModMenuSectionHeader(menu, inGame, snapshot);
                        headerCreated = true;
                    }

                    creator.GetFastDelegate()(settings, menu, inGame);
                    continue;
                }

                if ((attribInGame = prop.GetCustomAttribute <SettingInGameAttribute>()) != null &&
                    attribInGame.InGame != inGame)
                {
                    continue;
                }

                if (prop.GetCustomAttribute <SettingIgnoreAttribute>() != null)
                {
                    continue;
                }

                if (!prop.CanRead || !prop.CanWrite)
                {
                    continue;
                }

                string name = prop.GetCustomAttribute <SettingNameAttribute>()?.Name ?? $"{nameDefaultPrefix}{prop.Name.ToLowerInvariant()}";
                name = name.DialogCleanOrNull() ?? prop.Name.SpacedPascalCase();

                bool needsRelaunch = prop.GetCustomAttribute <SettingNeedsRelaunchAttribute>() != null;

                string description = prop.GetCustomAttribute <SettingSubTextAttribute>()?.Description;

                TextMenu.Item item     = null;
                Type          propType = prop.PropertyType;
                object        value    = prop.GetValue(settings);

                // Create the matching item based off of the type and attributes.

                if (propType == typeof(bool))
                {
                    item =
                        new TextMenu.OnOff(name, (bool)value)
                        .Change(v => prop.SetValue(settings, v))
                    ;
                }
                else if (
                    propType == typeof(int) &&
                    (attribRange = prop.GetCustomAttribute <SettingRangeAttribute>()) != null
                    )
                {
                    if (attribRange.LargeRange)
                    {
                        item =
                            new TextMenuExt.IntSlider(name, attribRange.Min, attribRange.Max, (int)value)
                            .Change(v => prop.SetValue(settings, v))
                        ;
                    }
                    else
                    {
                        item =
                            new TextMenu.Slider(name, i => i.ToString(), attribRange.Min, attribRange.Max, (int)value)
                            .Change(v => prop.SetValue(settings, v))
                        ;
                    }
                }
                else if ((propType == typeof(int) || propType == typeof(float)) &&
                         (attribNumber = prop.GetCustomAttribute <SettingNumberInputAttribute>()) != null)
                {
                    float          currentValue;
                    Action <float> valueSetter;
                    if (propType == typeof(int))
                    {
                        currentValue = (int)value;
                        valueSetter  = v => prop.SetValue(settings, (int)v);
                    }
                    else
                    {
                        currentValue = (float)value;
                        valueSetter  = v => prop.SetValue(settings, v);
                    }
                    int  maxLength      = attribNumber.MaxLength;
                    bool allowNegatives = attribNumber.AllowNegatives;

                    item =
                        new TextMenu.Button(name + ": " + currentValue.ToString($"F{maxLength}").TrimEnd('0').TrimEnd('.'))
                        .Pressed(() => {
                        Audio.Play(SFX.ui_main_savefile_rename_start);
                        menu.SceneAs <Overworld>().Goto <OuiNumberEntry>().Init <OuiModOptions>(
                            currentValue,
                            valueSetter,
                            maxLength,
                            propType == typeof(float),
                            allowNegatives
                            );
                    })
                    ;
                }
                else if (propType.IsEnum)
                {
                    Array enumValues = Enum.GetValues(propType);
                    Array.Sort((int[])enumValues);
                    string enumNamePrefix = $"{nameDefaultPrefix}{prop.Name.ToLowerInvariant()}_";
                    item =
                        new TextMenu.Slider(name, (i) => {
                        string enumName = enumValues.GetValue(i).ToString();
                        return
                        ($"{enumNamePrefix}{enumName.ToLowerInvariant()}".DialogCleanOrNull() ??
                         $"modoptions_{propType.Name.ToLowerInvariant()}_{enumName.ToLowerInvariant()}".DialogCleanOrNull() ??
                         enumName);
                    }, 0, enumValues.Length - 1, (int)value)
                        .Change(v => prop.SetValue(settings, v))
                    ;
                }
                else if (!inGame && propType == typeof(string))
                {
                    int maxValueLength = prop.GetCustomAttribute <SettingMaxLengthAttribute>()?.Max ?? 12;
                    int minValueLength = prop.GetCustomAttribute <SettingMinLengthAttribute>()?.Min ?? 1;

                    item =
                        new TextMenu.Button(name + ": " + value)
                        .Pressed(() => {
                        Audio.Play(SFX.ui_main_savefile_rename_start);
                        menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                            (string)value,
                            v => prop.SetValue(settings, v),
                            maxValueLength,
                            minValueLength
                            );
                    })
                    ;
                }

                if (item == null)
                {
                    continue;
                }

                if (!headerCreated)
                {
                    CreateModMenuSectionHeader(menu, inGame, snapshot);
                    headerCreated = true;
                }

                menu.Add(item);

                if (needsRelaunch)
                {
                    item = item.NeedsRelaunch(menu);
                }

                if (description != null)
                {
                    item = item.AddDescription(menu, description.DialogCleanOrNull() ?? description);
                }
            }

            foreach (PropertyInfo prop in type.GetProperties())
            {
                if ((attribInGame = prop.GetCustomAttribute <SettingInGameAttribute>()) != null &&
                    attribInGame.InGame != inGame)
                {
                    continue;
                }

                if (prop.GetCustomAttribute <SettingIgnoreAttribute>() != null)
                {
                    continue;
                }

                if (!prop.CanRead || !prop.CanWrite)
                {
                    continue;
                }

                if (!typeof(ButtonBinding).IsAssignableFrom(prop.PropertyType))
                {
                    continue;
                }

                if (!headerCreated)
                {
                    CreateModMenuSectionHeader(menu, inGame, snapshot);
                    headerCreated = true;
                }

                CreateModMenuSectionKeyBindings(menu, inGame, snapshot);
                break;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Create the mod menu subsection including the section header in the given menu.
        /// The default implementation uses reflection to attempt creating a menu.
        /// </summary>
        /// <param name="menu">Menu to add the section to.</param>
        /// <param name="inGame">Whether we're in-game (paused) or in the main menu.</param>
        /// <param name="snapshot">The Level.PauseSnapshot</param>
        public virtual void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot)
        {
            Type type = SettingsType;
            EverestModuleSettings settings = _Settings;

            if (type == null || settings == null)
            {
                return;
            }

            // The default name prefix.
            string typeName = type.Name.ToLowerInvariant();

            if (typeName.EndsWith("settings"))
            {
                typeName = typeName.Substring(0, typeName.Length - 8);
            }
            string nameDefaultPrefix = $"modoptions_{typeName}_";

            // Any attributes we may want to get and read from later.
            SettingInGameAttribute attribInGame;
            SettingRangeAttribute  attribRange;

            // If the settings type has got the InGame attrib, only show it in the matching situation.
            if ((attribInGame = type.GetCustomAttribute <SettingInGameAttribute>()) != null &&
                attribInGame.InGame != inGame)
            {
                return;
            }

            // The settings subheader.
            string name; // We lazily reuse this field for the props later on.

            name = type.GetCustomAttribute <SettingNameAttribute>()?.Name ?? $"{nameDefaultPrefix}title";
            name = name.DialogCleanOrNull() ?? Metadata.Name.SpacedPascalCase();

            menu.Add(new TextMenu.SubHeader(name + " | v." + Metadata.VersionString));

            PropertyInfo[] props;
            if (type == _PrevSettingsType)
            {
                props = _PrevSettingsProps;
            }
            else
            {
                _PrevSettingsProps = props = type.GetProperties();
                _PrevSettingsType  = type;
            }

            foreach (PropertyInfo prop in props)
            {
                MethodInfo creator = type.GetMethod(
                    $"Create{prop.Name}Entry",
                    BindingFlags.Public | BindingFlags.Instance,
                    null,
                    new Type[] { typeof(TextMenu), typeof(bool) },
                    new ParameterModifier[0]
                    );

                if (creator != null)
                {
                    creator.GetFastDelegate()(settings, menu, inGame);
                    continue;
                }

                if ((attribInGame = prop.GetCustomAttribute <SettingInGameAttribute>()) != null &&
                    attribInGame.InGame != inGame)
                {
                    continue;
                }

                if (prop.GetCustomAttribute <SettingIgnoreAttribute>() != null)
                {
                    continue;
                }

                if (!prop.CanRead || !prop.CanWrite)
                {
                    continue;
                }

                name = prop.GetCustomAttribute <SettingNameAttribute>()?.Name ?? $"{nameDefaultPrefix}{prop.Name.ToLowerInvariant()}";
                name = name.DialogCleanOrNull() ?? prop.Name.SpacedPascalCase();

                bool needsRelaunch = prop.GetCustomAttribute <SettingNeedsRelaunchAttribute>() != null;

                TextMenu.Item item     = null;
                Type          propType = prop.PropertyType;
                object        value    = prop.GetValue(settings);

                // Create the matching item based off of the type and attributes.

                if (propType == typeof(bool))
                {
                    item =
                        new TextMenu.OnOff(name, (bool)value)
                        .Change(v => prop.SetValue(settings, v))
                    ;
                }
                else if (
                    propType == typeof(int) &&
                    (attribRange = prop.GetCustomAttribute <SettingRangeAttribute>()) != null
                    )
                {
                    item =
                        new TextMenu.Slider(name, i => i.ToString(), attribRange.Min, attribRange.Max, (int)value)
                        .Change(v => prop.SetValue(settings, v))
                    ;
                }
                else if (propType.IsEnum)
                {
                    Array enumValues = Enum.GetValues(propType);
                    Array.Sort((int[])enumValues);
                    string enumNamePrefix = $"{nameDefaultPrefix}{prop.Name.ToLowerInvariant()}_";
                    item =
                        new TextMenu.Slider(name, (i) => {
                        string enumName = enumValues.GetValue(i).ToString();
                        string fullName = $"{enumNamePrefix}{enumName.ToLowerInvariant()}";
                        return(fullName.DialogCleanOrNull() ?? enumName);
                    }, 0, enumValues.Length - 1, (int)value)
                        .Change(v => prop.SetValue(settings, v))
                    ;
                }
                else if (!inGame && propType == typeof(string))
                {
                    item =
                        new TextMenu.Button(name + ": " + value)
                        .Pressed(() => {
                        Audio.Play(Sfxs.ui_main_savefile_rename_start);
                        menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                            (string)value,
                            v => prop.SetValue(settings, v)
                            );
                    })
                    ;
                }

                if (item == null)
                {
                    continue;
                }

                if (needsRelaunch)
                {
                    item = item.NeedsRelaunch();
                }

                menu.Add(item);
            }
        }
Esempio n. 12
0
        public override string MenuName => "Emotes";             // text above things

        protected override void addOptionsToMenu(TextMenu menu)  // submenu
        {
            menu.Add(new TextMenu.Button($"1. {EmoteModMain.Settings.emote0}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote0,
                    v => EmoteModMain.Settings.emote0 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"2. {EmoteModMain.Settings.emote1}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote1,
                    v => EmoteModMain.Settings.emote1 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"3. {EmoteModMain.Settings.emote2}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote2,
                    v => EmoteModMain.Settings.emote2 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"4. {EmoteModMain.Settings.emote3}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote3,
                    v => EmoteModMain.Settings.emote3 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"5. {EmoteModMain.Settings.emote4}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote4,
                    v => EmoteModMain.Settings.emote4 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"6. {EmoteModMain.Settings.emote5}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote5,
                    v => EmoteModMain.Settings.emote5 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"7. {EmoteModMain.Settings.emote6}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote6,
                    v => EmoteModMain.Settings.emote6 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"8. {EmoteModMain.Settings.emote7}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote7,
                    v => EmoteModMain.Settings.emote7 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"9. {EmoteModMain.Settings.emote8}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote8,
                    v => EmoteModMain.Settings.emote8 = v,
                    12,
                    1
                    );
            }));

            menu.Add(new TextMenu.Button($"10. {EmoteModMain.Settings.emote9}").Pressed(() => {
                Audio.Play(SFX.ui_main_savefile_rename_start);
                menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                    EmoteModMain.Settings.emote9,
                    v => EmoteModMain.Settings.emote9 = v,
                    12,
                    1
                    );
            }));
        }
Esempio n. 13
0
        protected override void addOptionsToMenu(TextMenu menu, bool inGame, object[] parameters)
        {
            OptionItems items = new OptionItems();

            // Add the general settings
            menu.Add(new TextMenu.SubHeader(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_GENERALSETTINGS")));
            menu.Add(new TextMenu.Slider(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_CHANGEVARIANTSINTERVAL"),
                                         i => {
                if (i == 0)
                {
                    return(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_ONSCREENTRANSITION"));
                }
                return($"{Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_EVERY")} {changeVariantsIntervalScale[i]}s");
            }, 0, changeVariantsIntervalScale.Length - 1, indexFromChangeVariantsInterval(ExtendedVariantsModule.Settings.ChangeVariantsInterval))
                     .Change(i => {
                ExtendedVariantsModule.Settings.ChangeVariantsInterval = changeVariantsIntervalScale[i];
                refreshOptionMenuEnabledStatus(items);
                ExtendedVariantsModule.Instance.Randomizer.UpdateCountersFromSettings();
            }));

            menu.Add(new TextMenu.Slider(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_VARIANTSET"),
                                         i => Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_" + new string[] { "OFF", "VANILLA", "EXTENDED", "BOTH" }[i]), 1, 3, ExtendedVariantsModule.Settings.VariantSet)
                     .Change(i => {
                ExtendedVariantsModule.Settings.VariantSet = i;
                refreshOptionMenuEnabledStatus(items);
            }));

            TextMenu.Option <int> maxEnabledVariants = new TextMenu.Slider(
                Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_MAXENABLEDVARIANTS" + (ExtendedVariantsModule.Settings.RerollMode ? "_REROLL" : "")),
                i => i.ToString(), 0, ExtendedVariantsModule.Instance.VariantHandlers.Count + 13, ExtendedVariantsModule.Settings.MaxEnabledVariants)
                                                       .Change(newValue => ExtendedVariantsModule.Settings.MaxEnabledVariants = newValue);

            menu.Add(new TextMenu.OnOff(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_REROLLMODE"), ExtendedVariantsModule.Settings.RerollMode)
                     .Change(newValue => {
                ExtendedVariantsModule.Settings.RerollMode = newValue;
                maxEnabledVariants.Label = Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_MAXENABLEDVARIANTS" + (newValue ? "_REROLL" : ""));
            }));

            menu.Add(maxEnabledVariants);

            menu.Add(items.VanillafyOption = new TextMenu.Slider(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_VANILLAFY"), i => {
                if (i == 0)
                {
                    return(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_DISABLED"));
                }
                i = vanillafyScale[i];
                if (i < 60)
                {
                    return($"{i.ToString()}s");
                }
                return($"{(i / 60).ToString()} min");
            }, 0, vanillafyScale.Length - 1, indexFromVanillafyScale(ExtendedVariantsModule.Settings.Vanillafy))
                                             .Change(newValue => {
                ExtendedVariantsModule.Settings.Vanillafy = vanillafyScale[newValue];
                ExtendedVariantsModule.Instance.Randomizer.UpdateCountersFromSettings();
            }));

            menu.Add(new TextMenu.OnOff(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_DISPLAYONSCREEN"), ExtendedVariantsModule.Settings.DisplayEnabledVariantsToScreen)
                     .Change(newValue => ExtendedVariantsModule.Settings.DisplayEnabledVariantsToScreen = newValue));

            if (!inGame)
            {
                TextMenu.Button seedButton = new TextMenu.Button(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_SEEDINPUT") + " " + ExtendedVariantsModule.Settings.RandoSetSeed);
                seedButton.Pressed(() => {
                    returnIndex = menu.Selection;
                    Audio.Play(SFX.ui_main_savefile_rename_start);
                    menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiRandomizerOptions>(
                        ExtendedVariantsModule.Settings.RandoSetSeed,
                        v => ExtendedVariantsModule.Settings.RandoSetSeed = v,
                        25
                        );
                });

                TextMenu.Option <bool> toggle = new TextMenu.OnOff(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_SETSEED"), ExtendedVariantsModule.Settings.RandoSetSeed != null)
                                                .Change(newValue => {
                    ExtendedVariantsModule.Settings.RandoSetSeed = (newValue ? "seed" : null);

                    seedButton.Visible = newValue;
                    seedButton.Label   = Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_SEEDINPUT") + " seed";
                });

                seedButton.Visible = ExtendedVariantsModule.Settings.RandoSetSeed != null;

                menu.Add(toggle);
                toggle.AddDescription(menu, Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_SEEDDESCRIPTION2"));
                toggle.AddDescription(menu, Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_SEEDDESCRIPTION1"));
                menu.Add(seedButton);
            }


            // build the toggles to individually enable or disable all vanilla variants
            menu.Add(new TextMenu.SubHeader(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_ENABLED_VANILLA")));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.GameSpeed));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.MirrorMode));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.ThreeSixtyDashing));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.InvisibleMotion));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.NoGrabbing));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.LowFriction));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.SuperDashing));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.Hiccups));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.PlayAsBadeline));

            menu.Add(new TextMenu.SubHeader(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_ENABLED_VANILLA_ASSISTS")));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.InfiniteStamina));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.DashMode));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.Invincible));
            items.VanillaVariantOptions.Add(addToggleOptionToMenu(menu, VanillaVariant.DashAssist));

            // and do the same with extended ones
            menu.Add(new TextMenu.SubHeader(Dialog.Clean("MODOPTIONS_EXTENDEDVARIANTS_RANDOMIZER_ENABLED_EXTENDED")));
            foreach (ExtendedVariantsModule.Variant variant in ExtendedVariantsModule.Instance.VariantHandlers.Keys)
            {
                items.ExtendedVariantOptions.Add(addToggleOptionToMenu(menu, variant));
            }

            refreshOptionMenuEnabledStatus(items);

            if (returnIndex >= 0)
            {
                menu.Selection = returnIndex;
                returnIndex    = -1;
            }
        }