private void load(FrameworkConfigManager frameworkConfig) { frameworkLocale = frameworkConfig.GetBindable <string>(FrameworkSetting.Locale); Children = new Drawable[] { languageSelection = new SettingsEnumDropdown <Language> { LabelText = GeneralSettingsStrings.LanguageDropdown, }, new SettingsCheckbox { LabelText = GeneralSettingsStrings.PreferOriginalMetadataLanguage, Current = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowUnicode) }, }; if (!LanguageExtensions.TryParseCultureCode(frameworkLocale.Value, out var locale)) { locale = Language.en; } languageSelection.Current.Value = locale; languageSelection.Current.BindValueChanged(val => frameworkLocale.Value = val.NewValue.ToCultureCode()); }
private void load(OsuConfigManager config, SkinManager skins) { FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { skinDropdown = new SettingsDropdown <int>(), new SettingsSlider <double, SizeSlider> { LabelText = "Menu cursor size", Bindable = config.GetBindable <double>(OsuSetting.MenuCursorSize), KeyboardStep = 0.1f }, new SettingsSlider <double, SizeSlider> { LabelText = "Gameplay cursor size", Bindable = config.GetBindable <double>(OsuSetting.GameplayCursorSize), KeyboardStep = 0.1f }, new SettingsCheckbox { LabelText = "Adjust gameplay cursor size based on current beatmap", Bindable = config.GetBindable <bool>(OsuSetting.AutoCursorSize) }, }; void reloadSkins() => skinDropdown.Items = skins.GetAllUsableSkins().Select(s => new KeyValuePair <string, int>(s.ToString(), s.ID)); skins.ItemAdded += _ => reloadSkins(); skins.ItemRemoved += _ => reloadSkins(); reloadSkins(); skinDropdown.Bindable = config.GetBindable <int>(OsuSetting.Skin); }
private void load(OsuConfigManager config, SkinManager skins) { this.skins = skins; FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { skinDropdown = new SettingsDropdown <int>(), new SettingsSlider <double, SizeSlider> { LabelText = "Menu cursor size", Bindable = config.GetBindable <double>(OsuSetting.MenuCursorSize), KeyboardStep = 0.1f }, new SettingsSlider <double, SizeSlider> { LabelText = "Gameplay cursor size", Bindable = config.GetBindable <double>(OsuSetting.GameplayCursorSize), KeyboardStep = 0.1f }, new SettingsCheckbox { LabelText = "Adjust gameplay cursor size based on current beatmap", Bindable = config.GetBindable <bool>(OsuSetting.AutoCursorSize) }, }; skins.ItemAdded += reloadSkins; skins.ItemRemoved += reloadSkins; reloadSkins(null); skinDropdown.Bindable = config.GetBindable <int>(OsuSetting.Skin); }
private void load(FrameworkConfigManager frameworkConfig) { frameworkLocale = frameworkConfig.GetBindable <string>(FrameworkSetting.Locale); Children = new Drawable[] { languageSelection = new SettingsEnumDropdown <Language> { LabelText = "Language", }, new SettingsCheckbox { LabelText = "Prefer metadata in original language", Current = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowUnicode) }, }; if (!Enum.TryParse <Language>(frameworkLocale.Value, out var locale)) { locale = Language.en; } languageSelection.Current.Value = locale; languageSelection.Current.BindValueChanged(val => frameworkLocale.Value = val.NewValue.ToString()); }
private void load(OsuConfigManager config, SkinManager skins) { this.skins = skins; FlowContent.Spacing = new Vector2(0, 5); Children = new Drawable[] { skinDropdown = new SettingsDropdown <int>(), new SettingsSlider <double, SizeSlider> { LabelText = "Menu cursor size", Bindable = config.GetBindable <double>(OsuSetting.MenuCursorSize), KeyboardStep = 0.01f }, new SettingsSlider <double, SizeSlider> { LabelText = "Gameplay cursor size", Bindable = config.GetBindable <double>(OsuSetting.GameplayCursorSize), KeyboardStep = 0.01f }, new SettingsCheckbox { LabelText = "Adjust gameplay cursor size based on current beatmap", Bindable = config.GetBindable <bool>(OsuSetting.AutoCursorSize) }, }; skins.ItemAdded += itemAdded; skins.ItemRemoved += itemRemoved; skinDropdown.Entries = skins.GetAllUsableSkins().Select(s => new KeyValuePair <string, int>(s.ToString(), s.ID)); var skinBindable = config.GetBindable <int>(OsuSetting.Skin); // Todo: This should not be necessary when OsuConfigManager is databased if (skinDropdown.Entries.All(s => s.Value != skinBindable.Value)) { skinBindable.Value = 0; } skinDropdown.Bindable = skinBindable; }
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game) { this.game = game; scalingMode = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling); sizeFullscreen = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen); scalingSizeX = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeX); scalingSizeY = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeY); scalingPositionX = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionX); scalingPositionY = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionY); Container resolutionSettingsContainer; Children = new Drawable[] { windowModeDropdown = new SettingsEnumDropdown <WindowMode> { LabelText = "Screen mode", Bindable = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), }, resolutionSettingsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, new SettingsSlider <float, UIScaleSlider> { LabelText = "UI Scaling", TransferValueOnCommit = true, Bindable = osuConfig.GetBindable <float>(OsuSetting.UIScale), KeyboardStep = 0.01f }, new SettingsEnumDropdown <ScalingMode> { LabelText = "Screen Scaling", Bindable = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling), }, scalingSettings = new FillFlowContainer <SettingsSlider <float> > { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new [] { new SettingsSlider <float> { LabelText = "Horizontal position", Bindable = scalingPositionX, KeyboardStep = 0.01f }, new SettingsSlider <float> { LabelText = "Vertical position", Bindable = scalingPositionY, KeyboardStep = 0.01f }, new SettingsSlider <float> { LabelText = "Horizontal scale", Bindable = scalingSizeX, KeyboardStep = 0.01f }, new SettingsSlider <float> { LabelText = "Vertical scale", Bindable = scalingSizeY, KeyboardStep = 0.01f }, } }, }; scalingSettings.ForEach(s => bindPreviewEvent(s.Bindable)); var resolutions = getResolutions(); if (resolutions.Count > 1) { resolutionSettingsContainer.Child = resolutionDropdown = new ResolutionSettingsDropdown { LabelText = "Resolution", ShowsDefaultIndicator = false, Items = resolutions, Bindable = sizeFullscreen }; windowModeDropdown.Bindable.BindValueChanged(windowMode => { if (windowMode == WindowMode.Fullscreen) { resolutionDropdown.Show(); sizeFullscreen.TriggerChange(); } else { resolutionDropdown.Hide(); } }, true); } scalingMode.BindValueChanged(mode => { scalingSettings.ClearTransforms(); scalingSettings.AutoSizeAxes = mode != ScalingMode.Off ? Axes.Y : Axes.None; if (mode == ScalingMode.Off) { scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } scalingSettings.ForEach(s => s.TransferValueOnCommit = mode == ScalingMode.Everything); }, true); }
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, GameHost host) { scalingMode = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling); sizeFullscreen = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen); scalingSizeX = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeX); scalingSizeY = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeY); scalingPositionX = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionX); scalingPositionY = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionY); if (host.Window != null) { currentDisplay.BindTo(host.Window.CurrentDisplayBindable); windowModes.BindTo(host.Window.SupportedWindowModes); } Children = new Drawable[] { windowModeDropdown = new SettingsDropdown <WindowMode> { LabelText = GraphicsSettingsStrings.ScreenMode, ItemSource = windowModes, Current = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), }, resolutionDropdown = new ResolutionSettingsDropdown { LabelText = GraphicsSettingsStrings.Resolution, ShowsDefaultIndicator = false, ItemSource = resolutions, Current = sizeFullscreen }, new SettingsSlider <float, UIScaleSlider> { LabelText = GraphicsSettingsStrings.UIScaling, TransferValueOnCommit = true, Current = osuConfig.GetBindable <float>(OsuSetting.UIScale), KeyboardStep = 0.01f, Keywords = new[] { "scale", "letterbox" }, }, new SettingsEnumDropdown <ScalingMode> { LabelText = GraphicsSettingsStrings.ScreenScaling, Current = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling), Keywords = new[] { "scale", "letterbox" }, }, scalingSettings = new FillFlowContainer <SettingsSlider <float> > { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new[] { new SettingsSlider <float> { LabelText = GraphicsSettingsStrings.HorizontalPosition, Current = scalingPositionX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = GraphicsSettingsStrings.VerticalPosition, Current = scalingPositionY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = GraphicsSettingsStrings.HorizontalScale, Current = scalingSizeX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = GraphicsSettingsStrings.VerticalScale, Current = scalingSizeY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, } }, }; }
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, GameHost host) { scalingMode = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling); sizeFullscreen = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen); scalingSizeX = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeX); scalingSizeY = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeY); scalingPositionX = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionX); scalingPositionY = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionY); if (host.Window != null) { currentDisplay.BindTo(host.Window.CurrentDisplayBindable); windowModes.BindTo(host.Window.SupportedWindowModes); } Children = new Drawable[] { windowModeDropdown = new SettingsDropdown <WindowMode> { LabelText = "Screen mode", ItemSource = windowModes, Current = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), }, resolutionDropdown = new ResolutionSettingsDropdown { LabelText = "Resolution", ShowsDefaultIndicator = false, ItemSource = resolutions, Current = sizeFullscreen }, new SettingsSlider <float, UIScaleSlider> { LabelText = "UI Scaling", TransferValueOnCommit = true, Current = osuConfig.GetBindable <float>(OsuSetting.UIScale), KeyboardStep = 0.01f, Keywords = new[] { "scale", "letterbox" }, }, new SettingsEnumDropdown <ScalingMode> { LabelText = "Screen Scaling", Current = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling), Keywords = new[] { "scale", "letterbox" }, }, scalingSettings = new FillFlowContainer <SettingsSlider <float> > { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new[] { new SettingsSlider <float> { LabelText = "Horizontal position", Current = scalingPositionX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical position", Current = scalingPositionY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Horizontal scale", Current = scalingSizeX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical scale", Current = scalingSizeY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, } }, }; windowModes.BindCollectionChanged((sender, args) => { if (windowModes.Count > 1) { windowModeDropdown.Show(); } else { windowModeDropdown.Hide(); } }, true); windowModeDropdown.Current.ValueChanged += _ => updateResolutionDropdown(); currentDisplay.BindValueChanged(display => Schedule(() => { resolutions.RemoveRange(1, resolutions.Count - 1); if (display.NewValue != null) { resolutions.AddRange(display.NewValue.DisplayModes .Where(m => m.Size.Width >= 800 && m.Size.Height >= 600) .OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width)) .Select(m => m.Size) .Distinct()); } updateResolutionDropdown(); }), true); scalingSettings.ForEach(s => bindPreviewEvent(s.Current)); scalingMode.BindValueChanged(mode => { scalingSettings.ClearTransforms(); scalingSettings.AutoSizeAxes = mode.NewValue != ScalingMode.Off ? Axes.Y : Axes.None; if (mode.NewValue == ScalingMode.Off) { scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything); }, true); void updateResolutionDropdown() { if (resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen) { resolutionDropdown.Show(); } else { resolutionDropdown.Hide(); } } }
private void load(FrameworkConfigManager config, OsuGameBase game) { this.game = game; letterboxing = config.GetBindable <bool>(FrameworkSetting.Letterboxing); sizeFullscreen = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen); Container resolutionSettingsContainer; Children = new Drawable[] { windowModeDropdown = new SettingsEnumDropdown <WindowMode> { LabelText = "Screen mode", Bindable = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), }, resolutionSettingsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, new SettingsCheckbox { LabelText = "Letterboxing", Bindable = letterboxing, }, letterboxSettings = new FillFlowContainer { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new Drawable[] { new SettingsSlider <double> { LabelText = "Horizontal position", Bindable = config.GetBindable <double>(FrameworkSetting.LetterboxPositionX), KeyboardStep = 0.01f }, new SettingsSlider <double> { LabelText = "Vertical position", Bindable = config.GetBindable <double>(FrameworkSetting.LetterboxPositionY), KeyboardStep = 0.01f }, } }, }; var resolutions = getResolutions(); if (resolutions.Count > 1) { resolutionSettingsContainer.Child = resolutionDropdown = new SettingsDropdown <Size> { LabelText = "Resolution", ShowsDefaultIndicator = false, Entries = resolutions, Bindable = sizeFullscreen }; windowModeDropdown.Bindable.BindValueChanged(windowMode => { if (windowMode == WindowMode.Fullscreen) { resolutionDropdown.Show(); sizeFullscreen.TriggerChange(); } else { resolutionDropdown.Hide(); } }, true); } letterboxing.BindValueChanged(isVisible => { letterboxSettings.ClearTransforms(); letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None; if (!isVisible) { letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } }, true); }
private void load(VignetteConfigManager config) { Add(backgrounds = new SettingsDropdown <string> { Label = "Background", Bindable = config.GetBindable <string>(VignetteSetting.BackgroundImage), }); Add(new SettingsColorPicker { Label = @"Background Color", Bindable = config.GetBindable <Colour4>(VignetteSetting.BackgroundColor), }); Add(new SettingsSliderBar <float> { Label = @"Scale", Bindable = config.GetBindable <float>(VignetteSetting.BackgroundScale), }); Add(new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0, 5), Direction = FillDirection.Vertical, Children = new Drawable[] { new VignetteSpriteText { Text = @"Position" }, new GridContainer { Height = 25, RelativeSizeAxes = Axes.X, ColumnDimensions = new[] { new Dimension(GridSizeMode.Distributed), new Dimension(GridSizeMode.Distributed), }, Content = new[] { new Drawable[] { new SettingsBadgedNumberBox <float> { Width = 0.75f, BadgeText = @"X", Bindable = config.GetBindable <float>(VignetteSetting.BackgroundPositionX), }, new SettingsBadgedNumberBox <float> { Width = 0.75f, BadgeText = @"Y", Bindable = config.GetBindable <float>(VignetteSetting.BackgroundPositionY), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, }, }, } } }); Add(new VignetteButton { Text = @"Reset", BackgroundColor = Colour4.Red, RelativeSizeAxes = Axes.X, }); imported.CollectionChanged += (_, __) => updateList(); updateList(); }
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, GameHost host) { scalingMode = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling); sizeFullscreen = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen); scalingSizeX = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeX); scalingSizeY = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeY); scalingPositionX = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionX); scalingPositionY = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionY); if (host.Window != null) { windowModes.BindTo(host.Window.SupportedWindowModes); } Container resolutionSettingsContainer; Children = new Drawable[] { windowModeDropdown = new SettingsDropdown <WindowMode> { LabelText = "Screen mode", Current = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), ItemSource = windowModes, }, resolutionSettingsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, new SettingsSlider <float, UIScaleSlider> { LabelText = "UI Scaling", TransferValueOnCommit = true, Current = osuConfig.GetBindable <float>(OsuSetting.UIScale), KeyboardStep = 0.01f, Keywords = new[] { "scale", "letterbox" }, }, new SettingsEnumDropdown <ScalingMode> { LabelText = "Screen Scaling", Current = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling), Keywords = new[] { "scale", "letterbox" }, }, scalingSettings = new FillFlowContainer <SettingsSlider <float> > { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new[] { new SettingsSlider <float> { LabelText = "Horizontal position", Current = scalingPositionX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical position", Current = scalingPositionY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Horizontal scale", Current = scalingSizeX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical scale", Current = scalingSizeY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, } }, }; scalingSettings.ForEach(s => bindPreviewEvent(s.Current)); var resolutions = getResolutions(); if (resolutions.Count > 1) { resolutionSettingsContainer.Child = resolutionDropdown = new ResolutionSettingsDropdown { LabelText = "Resolution", ShowsDefaultIndicator = false, Items = resolutions, Current = sizeFullscreen }; windowModeDropdown.Current.BindValueChanged(mode => { if (mode.NewValue == WindowMode.Fullscreen) { resolutionDropdown.Show(); sizeFullscreen.TriggerChange(); } else { resolutionDropdown.Hide(); } }, true); } scalingMode.BindValueChanged(mode => { scalingSettings.ClearTransforms(); scalingSettings.AutoSizeAxes = mode.NewValue != ScalingMode.Off ? Axes.Y : Axes.None; if (mode.NewValue == ScalingMode.Off) { scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything); }, true); windowModes.CollectionChanged += (sender, args) => windowModesChanged(); windowModesChanged(); }