Exemplo n.º 1
0
        private void SetOptionsString(string defaultOpts)
        {
            HashSet <string> validOptions = new HashSet <string>();

            GetAllControlNames(this, validOptions);
            bool isValidOption(string s)
            {
                if (validOptions.Contains(s))
                {
                    return(true);
                }
                if (uint.TryParse(s, out var ignored))
                {
                    return(true);
                }
                return(false);
            }

            previousOpts = new HashSet <string>(defaultOpts.Split(' '));
            options      = RandomizerOptions.Parse(previousOpts, false, isValidOption);

            simultaneousUpdate = true;
            InsertControlFlags(this);
            difficulty.Value   = options.Difficulty;
            simultaneousUpdate = false;

            fixedseed.Text = options.Seed == 0 ? "" : $"{options.Seed}";
        }
Exemplo n.º 2
0
        private void SetOptionsString(string defaultOpts)
        {
            HashSet <string> validOptions = new HashSet <string>();

            GetAllControlNames(this, validOptions);
            bool isValidOption(string s)
            {
                if (validOptions.Contains(s))
                {
                    return(true);
                }
                if (uint.TryParse(s, out var ignored))
                {
                    return(true);
                }
                return(false);
            }

            previousOpts = new HashSet <string>(defaultOpts.Split(' '));
            options      = RandomizerOptions.Parse(previousOpts, true, isValidOption);

            // New defaults
            if (previousOpts.Contains("v1"))
            {
                options["veryearlyhirata"] = true;
                options["openstart"]       = true;
            }
            if (previousOpts.Contains("v1") || previousOpts.Contains("v2"))
            {
                options["scale"]    = true;
                options["edittext"] = true;
            }

            simultaneousUpdate = true;
            InsertControlFlags(this);
            difficulty.Value = options.Difficulty;
            if (!enemytoitem.Checked)
            {
                defaultAllowReroll.Checked = true;
            }
            simultaneousUpdate = false;

            fixedseed.Text = options.Seed == 0 ? "" : $"{options.Seed}";
            enemyseed.Text = options.Seed2 == 0 || options.Seed == options.Seed2 ? "" : $"{options.Seed2}";
            // Also need to set enemy seed. This may be done by enemyseed text change handler?

            if (options.Preset == null)
            {
                SetPreset(null);
            }
            else
            {
                try
                {
                    Preset preset = LoadPreset(options.Preset, extractOopsAll: true);
                    SetPreset(preset);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    SetPreset(null);
                }
            }
        }