コード例 #1
0
        private void load(OsuGame game)
        {
            var config            = (KaraokeRulesetConfigManager)Config;
            var microphoneManager = new MicrophoneManager();

            Children = new Drawable[]
            {
                // Visual
                new SettingsEnumDropdown <KaraokeScrollingDirection>
                {
                    LabelText = "Scrolling direction",
                    Bindable  = config.GetBindable <KaraokeScrollingDirection>(KaraokeRulesetSetting.ScrollDirection)
                },
                new SettingsSlider <double, TimeSlider>
                {
                    LabelText = "Scroll speed",
                    Bindable  = config.GetBindable <double>(KaraokeRulesetSetting.ScrollTime)
                },
                new SettingsCheckbox
                {
                    LabelText = "Display alternative text",
                    Bindable  = config.GetBindable <bool>(KaraokeRulesetSetting.DisplayAlternativeText)
                },
                new SettingsCheckbox
                {
                    LabelText = "Show cursor while playing",
                    Bindable  = config.GetBindable <bool>(KaraokeRulesetSetting.ShowCursor)
                },
                // Translate
                new SettingsCheckbox
                {
                    LabelText = "Translate",
                    Bindable  = config.GetBindable <bool>(KaraokeRulesetSetting.UseTranslate)
                },
                new SettingsTextBox
                {
                    LabelText = "Prefer language",
                    Bindable  = config.GetBindable <string>(KaraokeRulesetSetting.PreferLanguage)
                },
                // Pitch
                new SettingsCheckbox
                {
                    LabelText = "Override pitch at gameplay",
                    Bindable  = config.GetBindable <bool>(KaraokeRulesetSetting.OverridePitchAtGameplay)
                },
                new MicrophoneDeviceSettingsDropdown
                {
                    LabelText = "Microphone devices",
                    Items     = microphoneManager.MicrophoneDeviceNames,
                    Bindable  = config.GetBindable <string>(KaraokeRulesetSetting.MicrophoneDevice)
                },
                new SettingsSlider <int, PitchSlider>
                {
                    LabelText = "Pitch",
                    Bindable  = config.GetBindable <int>(KaraokeRulesetSetting.Pitch)
                },
                new SettingsCheckbox
                {
                    LabelText = "Override vocal pitch at gameplay",
                    Bindable  = config.GetBindable <bool>(KaraokeRulesetSetting.OverrideVocalPitchAtGameplay)
                },
                new SettingsSlider <int, PitchSlider>
                {
                    LabelText = "Vocal pitch",
                    Bindable  = config.GetBindable <int>(KaraokeRulesetSetting.VocalPitch)
                },
                new SettingsCheckbox
                {
                    LabelText = "Override saiten pitch at gameplay",
                    Bindable  = config.GetBindable <bool>(KaraokeRulesetSetting.OverrideSaitenPitchAtGameplay)
                },
                new SettingsSlider <int, PitchSlider>
                {
                    LabelText = "Saiten pitch",
                    Bindable  = config.GetBindable <int>(KaraokeRulesetSetting.SaitenPitch)
                },
                // Practice
                new SettingsSlider <double, TimeSlider>
                {
                    LabelText = "Practice preempt time",
                    Bindable  = config.GetBindable <double>(KaraokeRulesetSetting.PracticePreemptTime)
                },
                new SettingsButton
                {
                    Text        = "Change log",
                    TooltipText = "Let's see what karaoke! changed.",
                    Action      = () =>
                    {
                        var overlayContent = game.Children[3] as Container;

                        if (overlayContent == null)
                        {
                            return;
                        }

                        if (changelogOverlay == null && !overlayContent.Children.OfType <KaraokeChangelogOverlay>().Any())
                        {
                            overlayContent.Add(changelogOverlay = new KaraokeChangelogOverlay("karaoke-dev"));
                        }

                        changelogOverlay?.Show();
                    }
                }
            };
        }
コード例 #2
0
        private void load()
        {
            var config = (KaraokeRulesetConfigManager)Config;

            Children = new Drawable[]
            {
                // Scrolling
                new SettingsSlider <double, TimeSlider>
                {
                    LabelText = "Scroll speed",
                    Current   = config.GetBindable <double>(KaraokeRulesetSetting.ScrollTime)
                },
                new SettingsCheckbox
                {
                    LabelText = "Show cursor while playing",
                    Current   = config.GetBindable <bool>(KaraokeRulesetSetting.ShowCursor)
                },
                // Translate
                new SettingsCheckbox
                {
                    LabelText = "Translate",
                    Current   = config.GetBindable <bool>(KaraokeRulesetSetting.UseTranslate)
                },
                new SettingsLanguage
                {
                    LabelText   = "Prefer language",
                    TooltipText = "Select prefer translate language.",
                    Current     = config.GetBindable <CultureInfo>(KaraokeRulesetSetting.PreferLanguage)
                },
                new SettingsMicrophoneDeviceDropdown
                {
                    LabelText = "Microphone devices",
                    Current   = config.GetBindable <string>(KaraokeRulesetSetting.MicrophoneDevice)
                },
                // Practice
                new SettingsSlider <double, TimeSlider>
                {
                    LabelText = "Practice preempt time",
                    Current   = config.GetBindable <double>(KaraokeRulesetSetting.PracticePreemptTime)
                },
                new DangerousSettingsButton
                {
                    Text        = "Open config",
                    TooltipText = "Hello config",
                    Action      = () =>
                    {
                        try
                        {
                            var screenStake    = Game.GetScreenStack();
                            var settingOverlay = Game.GetSettingsOverlay();
                            screenStake?.Push(new KaraokeConfigScreen());
                            settingOverlay?.Hide();
                        }
                        catch
                        {
                        }
                    }
                },
                new SettingsButton
                {
                    Text        = "Change log",
                    TooltipText = "Let's see what karaoke! changed.",
                    Action      = () =>
                    {
                        try
                        {
                            var displayContainer = Game.GetDisplayContainer();
                            var settingOverlay   = Game.GetSettingsOverlay();
                            if (displayContainer == null)
                            {
                                return;
                            }

                            if (changelogOverlay == null && !displayContainer.Children.OfType <KaraokeChangelogOverlay>().Any())
                            {
                                displayContainer.Add(changelogOverlay = new KaraokeChangelogOverlay("karaoke-dev"));
                            }

                            changelogOverlay?.Show();
                            settingOverlay?.Hide();
                        }
                        catch
                        {
                            // maybe this overlay has been moved into internal.
                        }
                    }
                }
            };
        }