コード例 #1
0
        private void SetSeedBasedOnDifficulty()
        {
            var tag      = difficultyPopUp.SelectedTag;
            var selected = AlltpHelpers.ToDifficulty(tag);

            switch (selected)
            {
            case RandomizerDifficulty.Casual:
                seedField.StringValue = string.Format("C{0:0000000}", (new SeedRandom()).Next(10000000));
                break;

            case RandomizerDifficulty.Glitched:
                seedField.StringValue = string.Format("G{0:0000000}", (new SeedRandom()).Next(10000000));
                break;

            case RandomizerDifficulty.None:
                seedField.StringValue = string.Format("NORAND");
                break;

            default:
                var alert = new NSAlert
                {
                    MessageText     = "Select Difficulty",
                    InformativeText = "Please select a difficulty.",
                    AlertStyle      = NSAlertStyle.Warning
                };

                alert.BeginSheet(this.View.Window);
                break;
            }
        }
コード例 #2
0
        private RandomizerDifficulty GetRandomizerDifficulty()
        {
            RandomizerDifficulty difficulty;

            if (seedField.StringValue.ToUpper().Contains("C"))
            {
                difficultyPopUp.SelectItemWithTag((int)RandomizerDifficulty.Casual);
                seedField.StringValue = seedField.StringValue.ToUpper().Replace("C", "");
                difficulty            = RandomizerDifficulty.Casual;
            }
            else if (seedField.StringValue.ToUpper().Contains("G"))
            {
                difficultyPopUp.SelectItemWithTag((int)RandomizerDifficulty.Glitched);
                seedField.StringValue = seedField.StringValue.ToUpper().Replace("G", "");
                difficulty            = RandomizerDifficulty.Glitched;
            }
            else if (seedField.StringValue.ToUpper().Contains("NORAND"))
            {
                difficultyPopUp.SelectItemWithTag((int)RandomizerDifficulty.None);
                difficulty = RandomizerDifficulty.None;
            }
            else
            {
                var tag      = difficultyPopUp.SelectedTag;
                var selected = AlltpHelpers.ToDifficulty(tag) ?? RandomizerDifficulty.None;
                difficulty = selected;
            }

            return(difficulty);
        }
コード例 #3
0
        private HeartBeepSpeed GetHeartBeepSpeed()
        {
            var beep = AlltpHelpers.ToHeartBeep(heartBeepPopUp.SelectedTag);

            if (beep != null)
            {
                return((HeartBeepSpeed)beep);
            }

            if (Enum.TryParse(heartBeepPopUp.SelectedItem.Title, true, out HeartBeepSpeed retVal))
            {
                return(retVal);
            }

            return(HeartBeepSpeed.Normal);
        }
コード例 #4
0
        void DifficultyChanged(Foundation.NSObject sender)
        {
            var tag        = difficultyPopUp.SelectedTag;
            var difficulty = AlltpHelpers.ToDifficulty(tag) ?? RandomizerDifficulty.Casual;

            switch (difficulty)
            {
            case RandomizerDifficulty.Casual:
                bulkGenerateButton.Enabled = true;
                if (seedField.StringValue.ToUpper().StartsWith("G", StringComparison.Ordinal))
                {
                    seedField.StringValue = seedField.StringValue.ToUpper().Replace('G', 'C');
                }
                else if (seedField.StringValue.ToUpper() == "NORAND")
                {
                    seedField.StringValue = "";
                }
                break;

            case RandomizerDifficulty.Glitched:
                bulkGenerateButton.Enabled = true;
                if (seedField.StringValue.ToUpper().StartsWith("C", StringComparison.Ordinal))
                {
                    seedField.StringValue = seedField.StringValue.ToUpper().Replace('C', 'G');
                }
                else if (seedField.StringValue.ToUpper() == "NORAND")
                {
                    seedField.StringValue = "";
                }
                break;

            case RandomizerDifficulty.None:
                seedField.StringValue      = "NORAND";
                bulkGenerateButton.Enabled = false;
                break;
            }
        }