mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 13:07:25 +08:00
Merge pull request #10387 from peppy/settings-item-ihascurrentvalue
Make SettingsItem conform to IHasCurrentValue
This commit is contained in:
commit
786b2592e8
@ -29,12 +29,12 @@ namespace osu.Game.Rulesets.Mania
|
||||
new SettingsEnumDropdown<ManiaScrollingDirection>
|
||||
{
|
||||
LabelText = "Scrolling direction",
|
||||
Bindable = config.GetBindable<ManiaScrollingDirection>(ManiaRulesetSetting.ScrollDirection)
|
||||
Current = config.GetBindable<ManiaScrollingDirection>(ManiaRulesetSetting.ScrollDirection)
|
||||
},
|
||||
new SettingsSlider<double, TimeSlider>
|
||||
{
|
||||
LabelText = "Scroll speed",
|
||||
Bindable = config.GetBindable<double>(ManiaRulesetSetting.ScrollTime),
|
||||
Current = config.GetBindable<double>(ManiaRulesetSetting.ScrollTime),
|
||||
KeyboardStep = 5
|
||||
},
|
||||
};
|
||||
|
@ -27,17 +27,17 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Snaking in sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuRulesetSetting.SnakingInSliders)
|
||||
Current = config.GetBindable<bool>(OsuRulesetSetting.SnakingInSliders)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Snaking out sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuRulesetSetting.SnakingOutSliders)
|
||||
Current = config.GetBindable<bool>(OsuRulesetSetting.SnakingOutSliders)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Cursor trail",
|
||||
Bindable = config.GetBindable<bool>(OsuRulesetSetting.ShowCursorTrail)
|
||||
Current = config.GetBindable<bool>(OsuRulesetSetting.ShowCursorTrail)
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -10,34 +10,34 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public class DateTextBox : SettingsTextBox
|
||||
{
|
||||
public new Bindable<DateTimeOffset> Bindable
|
||||
public new Bindable<DateTimeOffset> Current
|
||||
{
|
||||
get => bindable;
|
||||
get => current;
|
||||
set
|
||||
{
|
||||
bindable = value.GetBoundCopy();
|
||||
bindable.BindValueChanged(dto =>
|
||||
base.Bindable.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true);
|
||||
current = value.GetBoundCopy();
|
||||
current.BindValueChanged(dto =>
|
||||
base.Current.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true);
|
||||
}
|
||||
}
|
||||
|
||||
// hold a reference to the provided bindable so we don't have to in every settings section.
|
||||
private Bindable<DateTimeOffset> bindable = new Bindable<DateTimeOffset>();
|
||||
private Bindable<DateTimeOffset> current = new Bindable<DateTimeOffset>();
|
||||
|
||||
public DateTextBox()
|
||||
{
|
||||
base.Bindable = new Bindable<string>();
|
||||
base.Current = new Bindable<string>();
|
||||
|
||||
((OsuTextBox)Control).OnCommit += (sender, newText) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
bindable.Value = DateTimeOffset.Parse(sender.Text);
|
||||
current.Value = DateTimeOffset.Parse(sender.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// reset textbox content to its last valid state on a parse failure.
|
||||
bindable.TriggerChange();
|
||||
current.TriggerChange();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -63,25 +63,25 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
LabelText = "Name",
|
||||
Width = 0.33f,
|
||||
Bindable = Model.Name
|
||||
Current = Model.Name
|
||||
},
|
||||
new SettingsTextBox
|
||||
{
|
||||
LabelText = "Description",
|
||||
Width = 0.33f,
|
||||
Bindable = Model.Description
|
||||
Current = Model.Description
|
||||
},
|
||||
new DateTextBox
|
||||
{
|
||||
LabelText = "Start Time",
|
||||
Width = 0.33f,
|
||||
Bindable = Model.StartDate
|
||||
Current = Model.StartDate
|
||||
},
|
||||
new SettingsSlider<int>
|
||||
{
|
||||
LabelText = "Best of",
|
||||
Width = 0.33f,
|
||||
Bindable = Model.BestOf
|
||||
Current = Model.BestOf
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
@ -186,14 +186,14 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
LabelText = "Beatmap ID",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 200,
|
||||
Bindable = beatmapId,
|
||||
Current = beatmapId,
|
||||
},
|
||||
new SettingsTextBox
|
||||
{
|
||||
LabelText = "Mods",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 200,
|
||||
Bindable = mods,
|
||||
Current = mods,
|
||||
},
|
||||
drawableContainer = new Container
|
||||
{
|
||||
|
@ -74,13 +74,13 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
LabelText = "Mod",
|
||||
Width = 0.33f,
|
||||
Bindable = Model.Mod
|
||||
Current = Model.Mod
|
||||
},
|
||||
new SettingsSlider<int>
|
||||
{
|
||||
LabelText = "Seed",
|
||||
Width = 0.33f,
|
||||
Bindable = Model.Seed
|
||||
Current = Model.Seed
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
@ -187,21 +187,21 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
LabelText = "Beatmap ID",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 200,
|
||||
Bindable = beatmapId,
|
||||
Current = beatmapId,
|
||||
},
|
||||
new SettingsSlider<int>
|
||||
{
|
||||
LabelText = "Seed",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 200,
|
||||
Bindable = beatmap.Seed
|
||||
Current = beatmap.Seed
|
||||
},
|
||||
new SettingsTextBox
|
||||
{
|
||||
LabelText = "Score",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 200,
|
||||
Bindable = score,
|
||||
Current = score,
|
||||
},
|
||||
drawableContainer = new Container
|
||||
{
|
||||
|
@ -102,31 +102,31 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
LabelText = "Name",
|
||||
Width = 0.2f,
|
||||
Bindable = Model.FullName
|
||||
Current = Model.FullName
|
||||
},
|
||||
new SettingsTextBox
|
||||
{
|
||||
LabelText = "Acronym",
|
||||
Width = 0.2f,
|
||||
Bindable = Model.Acronym
|
||||
Current = Model.Acronym
|
||||
},
|
||||
new SettingsTextBox
|
||||
{
|
||||
LabelText = "Flag",
|
||||
Width = 0.2f,
|
||||
Bindable = Model.FlagName
|
||||
Current = Model.FlagName
|
||||
},
|
||||
new SettingsTextBox
|
||||
{
|
||||
LabelText = "Seed",
|
||||
Width = 0.2f,
|
||||
Bindable = Model.Seed
|
||||
Current = Model.Seed
|
||||
},
|
||||
new SettingsSlider<int>
|
||||
{
|
||||
LabelText = "Last Year Placement",
|
||||
Width = 0.33f,
|
||||
Bindable = Model.LastYearPlacing
|
||||
Current = Model.LastYearPlacing
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
@ -247,7 +247,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
LabelText = "User ID",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 200,
|
||||
Bindable = userId,
|
||||
Current = userId,
|
||||
},
|
||||
drawableContainer = new Container
|
||||
{
|
||||
|
@ -113,13 +113,13 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
new SettingsSlider<int>
|
||||
{
|
||||
LabelText = "Chroma width",
|
||||
Bindable = LadderInfo.ChromaKeyWidth,
|
||||
Current = LadderInfo.ChromaKeyWidth,
|
||||
KeyboardStep = 1,
|
||||
},
|
||||
new SettingsSlider<int>
|
||||
{
|
||||
LabelText = "Players per team",
|
||||
Bindable = LadderInfo.PlayersPerTeam,
|
||||
Current = LadderInfo.PlayersPerTeam,
|
||||
KeyboardStep = 1,
|
||||
}
|
||||
}
|
||||
|
@ -51,15 +51,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
editorInfo.Selected.ValueChanged += selection =>
|
||||
{
|
||||
roundDropdown.Bindable = selection.NewValue?.Round;
|
||||
roundDropdown.Current = selection.NewValue?.Round;
|
||||
losersCheckbox.Current = selection.NewValue?.Losers;
|
||||
dateTimeBox.Bindable = selection.NewValue?.Date;
|
||||
dateTimeBox.Current = selection.NewValue?.Date;
|
||||
|
||||
team1Dropdown.Bindable = selection.NewValue?.Team1;
|
||||
team2Dropdown.Bindable = selection.NewValue?.Team2;
|
||||
team1Dropdown.Current = selection.NewValue?.Team1;
|
||||
team2Dropdown.Current = selection.NewValue?.Team2;
|
||||
};
|
||||
|
||||
roundDropdown.Bindable.ValueChanged += round =>
|
||||
roundDropdown.Current.ValueChanged += round =>
|
||||
{
|
||||
if (editorInfo.Selected.Value?.Date.Value < round.NewValue?.StartDate.Value)
|
||||
{
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
public SettingsRoundDropdown(BindableList<TournamentRound> rounds)
|
||||
{
|
||||
Bindable = new Bindable<TournamentRound>();
|
||||
Current = new Bindable<TournamentRound>();
|
||||
|
||||
foreach (var r in rounds.Prepend(new TournamentRound()))
|
||||
add(r);
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
new SettingsTeamDropdown(LadderInfo.Teams)
|
||||
{
|
||||
LabelText = "Show specific team",
|
||||
Bindable = currentTeam,
|
||||
Current = currentTeam,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Configuration
|
||||
yield return new SettingsSlider<float>
|
||||
{
|
||||
LabelText = attr.Label,
|
||||
Bindable = bNumber,
|
||||
Current = bNumber,
|
||||
KeyboardStep = 0.1f,
|
||||
};
|
||||
|
||||
@ -67,7 +67,7 @@ namespace osu.Game.Configuration
|
||||
yield return new SettingsSlider<double>
|
||||
{
|
||||
LabelText = attr.Label,
|
||||
Bindable = bNumber,
|
||||
Current = bNumber,
|
||||
KeyboardStep = 0.1f,
|
||||
};
|
||||
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Configuration
|
||||
yield return new SettingsSlider<int>
|
||||
{
|
||||
LabelText = attr.Label,
|
||||
Bindable = bNumber
|
||||
Current = bNumber
|
||||
};
|
||||
|
||||
break;
|
||||
@ -86,7 +86,7 @@ namespace osu.Game.Configuration
|
||||
yield return new SettingsCheckbox
|
||||
{
|
||||
LabelText = attr.Label,
|
||||
Bindable = bBool
|
||||
Current = bBool
|
||||
};
|
||||
|
||||
break;
|
||||
@ -95,7 +95,7 @@ namespace osu.Game.Configuration
|
||||
yield return new SettingsTextBox
|
||||
{
|
||||
LabelText = attr.Label,
|
||||
Bindable = bString
|
||||
Current = bString
|
||||
};
|
||||
|
||||
break;
|
||||
@ -105,7 +105,7 @@ namespace osu.Game.Configuration
|
||||
var dropdown = (Drawable)Activator.CreateInstance(dropdownType);
|
||||
|
||||
dropdownType.GetProperty(nameof(SettingsDropdown<object>.LabelText))?.SetValue(dropdown, attr.Label);
|
||||
dropdownType.GetProperty(nameof(SettingsDropdown<object>.Bindable))?.SetValue(dropdown, bindable);
|
||||
dropdownType.GetProperty(nameof(SettingsDropdown<object>.Current))?.SetValue(dropdown, bindable);
|
||||
|
||||
yield return dropdown;
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
|
||||
updateItems();
|
||||
|
||||
dropdown.Bindable = audio.AudioDevice;
|
||||
dropdown.Current = audio.AudioDevice;
|
||||
|
||||
audio.OnNewDevice += onDeviceChanged;
|
||||
audio.OnLostDevice += onDeviceChanged;
|
||||
|
@ -21,23 +21,23 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Interface voices",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.MenuVoice)
|
||||
Current = config.GetBindable<bool>(OsuSetting.MenuVoice)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "osu! music theme",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.MenuMusic)
|
||||
Current = config.GetBindable<bool>(OsuSetting.MenuMusic)
|
||||
},
|
||||
new SettingsDropdown<IntroSequence>
|
||||
{
|
||||
LabelText = "Intro sequence",
|
||||
Bindable = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
|
||||
Current = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
|
||||
Items = Enum.GetValues(typeof(IntroSequence)).Cast<IntroSequence>()
|
||||
},
|
||||
new SettingsDropdown<BackgroundSource>
|
||||
{
|
||||
LabelText = "Background source",
|
||||
Bindable = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
||||
Current = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
||||
Items = Enum.GetValues(typeof(BackgroundSource)).Cast<BackgroundSource>()
|
||||
}
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
new SettingsSlider<double, OffsetSlider>
|
||||
{
|
||||
LabelText = "Audio offset",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.AudioOffset),
|
||||
Current = config.GetBindable<double>(OsuSetting.AudioOffset),
|
||||
KeyboardStep = 1f
|
||||
},
|
||||
new SettingsButton
|
||||
|
@ -20,28 +20,28 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Master",
|
||||
Bindable = audio.Volume,
|
||||
Current = audio.Volume,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Master (window inactive)",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.VolumeInactive),
|
||||
Current = config.GetBindable<double>(OsuSetting.VolumeInactive),
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Effect",
|
||||
Bindable = audio.VolumeSample,
|
||||
Current = audio.VolumeSample,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Music",
|
||||
Bindable = audio.VolumeTrack,
|
||||
Current = audio.VolumeTrack,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
|
@ -19,12 +19,12 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show log overlay",
|
||||
Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
|
||||
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Bypass front-to-back render pass",
|
||||
Bindable = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
|
||||
Current = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -21,62 +21,62 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Background dim",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DimLevel),
|
||||
Current = config.GetBindable<double>(OsuSetting.DimLevel),
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsSlider<double>
|
||||
{
|
||||
LabelText = "Background blur",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.BlurLevel),
|
||||
Current = config.GetBindable<double>(OsuSetting.BlurLevel),
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Lighten playfield during breaks",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks)
|
||||
Current = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show score overlay",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowInterface)
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowInterface)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show difficulty graph on progress bar",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowProgressGraph)
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowProgressGraph)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show health display even when you can't fail",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||
Keywords = new[] { "hp", "bar" }
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Fade playfield to red when health is low",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.FadePlayfieldWhenHealthLow),
|
||||
Current = config.GetBindable<bool>(OsuSetting.FadePlayfieldWhenHealthLow),
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Always show key overlay",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.KeyOverlay)
|
||||
Current = config.GetBindable<bool>(OsuSetting.KeyOverlay)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Positional hitsounds",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.PositionalHitSounds)
|
||||
Current = config.GetBindable<bool>(OsuSetting.PositionalHitSounds)
|
||||
},
|
||||
new SettingsEnumDropdown<ScoreMeterType>
|
||||
{
|
||||
LabelText = "Score meter type",
|
||||
Bindable = config.GetBindable<ScoreMeterType>(OsuSetting.ScoreMeter)
|
||||
Current = config.GetBindable<ScoreMeterType>(OsuSetting.ScoreMeter)
|
||||
},
|
||||
new SettingsEnumDropdown<ScoringMode>
|
||||
{
|
||||
LabelText = "Score display mode",
|
||||
Bindable = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode)
|
||||
Current = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode)
|
||||
}
|
||||
};
|
||||
|
||||
@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
Add(new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Disable Windows key during gameplay",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey)
|
||||
Current = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Increase visibility of first object when visual impairment mods are enabled",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility),
|
||||
Current = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -31,31 +31,31 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Right mouse drag to absolute scroll",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SongSelectRightMouseScroll),
|
||||
Current = config.GetBindable<bool>(OsuSetting.SongSelectRightMouseScroll),
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show converted beatmaps",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps),
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps),
|
||||
},
|
||||
new SettingsSlider<double, StarsSlider>
|
||||
{
|
||||
LabelText = "Display beatmaps from",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum),
|
||||
Current = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum),
|
||||
KeyboardStep = 0.1f,
|
||||
Keywords = new[] { "minimum", "maximum", "star", "difficulty" }
|
||||
},
|
||||
new SettingsSlider<double, MaximumStarsSlider>
|
||||
{
|
||||
LabelText = "up to",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
|
||||
Current = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
|
||||
KeyboardStep = 0.1f,
|
||||
Keywords = new[] { "minimum", "maximum", "star", "difficulty" }
|
||||
},
|
||||
new SettingsEnumDropdown<RandomSelectAlgorithm>
|
||||
{
|
||||
LabelText = "Random selection algorithm",
|
||||
Bindable = config.GetBindable<RandomSelectAlgorithm>(OsuSetting.RandomSelectAlgorithm),
|
||||
Current = config.GetBindable<RandomSelectAlgorithm>(OsuSetting.RandomSelectAlgorithm),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Prefer metadata in original language",
|
||||
Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowUnicode)
|
||||
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowUnicode)
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -240,12 +240,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Remember username",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SaveUsername),
|
||||
Current = config.GetBindable<bool>(OsuSetting.SaveUsername),
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Stay signed in",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SavePassword),
|
||||
Current = config.GetBindable<bool>(OsuSetting.SavePassword),
|
||||
},
|
||||
new Container
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
Add(new SettingsEnumDropdown<ReleaseStream>
|
||||
{
|
||||
LabelText = "Release stream",
|
||||
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
|
||||
Current = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
|
||||
});
|
||||
|
||||
if (updateManager?.CanCheckForUpdate == true)
|
||||
|
@ -19,22 +19,22 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Storyboard / Video",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard)
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Hit Lighting",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.HitLighting)
|
||||
Current = config.GetBindable<bool>(OsuSetting.HitLighting)
|
||||
},
|
||||
new SettingsEnumDropdown<ScreenshotFormat>
|
||||
{
|
||||
LabelText = "Screenshot format",
|
||||
Bindable = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat)
|
||||
Current = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show menu cursor in screenshots",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor)
|
||||
Current = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
windowModeDropdown = new SettingsDropdown<WindowMode>
|
||||
{
|
||||
LabelText = "Screen mode",
|
||||
Bindable = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
||||
Current = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
||||
ItemSource = windowModes,
|
||||
},
|
||||
resolutionSettingsContainer = new Container
|
||||
@ -74,14 +74,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
{
|
||||
LabelText = "UI Scaling",
|
||||
TransferValueOnCommit = true,
|
||||
Bindable = osuConfig.GetBindable<float>(OsuSetting.UIScale),
|
||||
Current = osuConfig.GetBindable<float>(OsuSetting.UIScale),
|
||||
KeyboardStep = 0.01f,
|
||||
Keywords = new[] { "scale", "letterbox" },
|
||||
},
|
||||
new SettingsEnumDropdown<ScalingMode>
|
||||
{
|
||||
LabelText = "Screen Scaling",
|
||||
Bindable = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling),
|
||||
Current = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling),
|
||||
Keywords = new[] { "scale", "letterbox" },
|
||||
},
|
||||
scalingSettings = new FillFlowContainer<SettingsSlider<float>>
|
||||
@ -97,28 +97,28 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
new SettingsSlider<float>
|
||||
{
|
||||
LabelText = "Horizontal position",
|
||||
Bindable = scalingPositionX,
|
||||
Current = scalingPositionX,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsSlider<float>
|
||||
{
|
||||
LabelText = "Vertical position",
|
||||
Bindable = scalingPositionY,
|
||||
Current = scalingPositionY,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsSlider<float>
|
||||
{
|
||||
LabelText = "Horizontal scale",
|
||||
Bindable = scalingSizeX,
|
||||
Current = scalingSizeX,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
new SettingsSlider<float>
|
||||
{
|
||||
LabelText = "Vertical scale",
|
||||
Bindable = scalingSizeY,
|
||||
Current = scalingSizeY,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true
|
||||
},
|
||||
@ -126,7 +126,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
},
|
||||
};
|
||||
|
||||
scalingSettings.ForEach(s => bindPreviewEvent(s.Bindable));
|
||||
scalingSettings.ForEach(s => bindPreviewEvent(s.Current));
|
||||
|
||||
var resolutions = getResolutions();
|
||||
|
||||
@ -137,10 +137,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
LabelText = "Resolution",
|
||||
ShowsDefaultIndicator = false,
|
||||
Items = resolutions,
|
||||
Bindable = sizeFullscreen
|
||||
Current = sizeFullscreen
|
||||
};
|
||||
|
||||
windowModeDropdown.Bindable.BindValueChanged(mode =>
|
||||
windowModeDropdown.Current.BindValueChanged(mode =>
|
||||
{
|
||||
if (mode.NewValue == WindowMode.Fullscreen)
|
||||
{
|
||||
|
@ -23,17 +23,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
new SettingsEnumDropdown<FrameSync>
|
||||
{
|
||||
LabelText = "Frame limiter",
|
||||
Bindable = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync)
|
||||
Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync)
|
||||
},
|
||||
new SettingsEnumDropdown<ExecutionMode>
|
||||
{
|
||||
LabelText = "Threading mode",
|
||||
Bindable = config.GetBindable<ExecutionMode>(FrameworkSetting.ExecutionMode)
|
||||
Current = config.GetBindable<ExecutionMode>(FrameworkSetting.ExecutionMode)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show FPS",
|
||||
Bindable = osuConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay)
|
||||
Current = osuConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay)
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -20,17 +20,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Rotate cursor when dragging",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.CursorRotation)
|
||||
Current = config.GetBindable<bool>(OsuSetting.CursorRotation)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Parallax",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
||||
Current = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
||||
},
|
||||
new SettingsSlider<float, TimeSlider>
|
||||
{
|
||||
LabelText = "Hold-to-confirm activation time",
|
||||
Bindable = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay),
|
||||
Current = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay),
|
||||
KeyboardStep = 50
|
||||
},
|
||||
};
|
||||
|
@ -35,32 +35,32 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Raw input",
|
||||
Bindable = rawInputToggle
|
||||
Current = rawInputToggle
|
||||
},
|
||||
new SensitivitySetting
|
||||
{
|
||||
LabelText = "Cursor sensitivity",
|
||||
Bindable = sensitivityBindable
|
||||
Current = sensitivityBindable
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Map absolute input to window",
|
||||
Bindable = config.GetBindable<bool>(FrameworkSetting.MapAbsoluteInputToWindow)
|
||||
Current = config.GetBindable<bool>(FrameworkSetting.MapAbsoluteInputToWindow)
|
||||
},
|
||||
new SettingsEnumDropdown<ConfineMouseMode>
|
||||
{
|
||||
LabelText = "Confine mouse cursor to window",
|
||||
Bindable = config.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode),
|
||||
Current = config.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode),
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Disable mouse wheel during gameplay",
|
||||
Bindable = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableWheel)
|
||||
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableWheel)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Disable mouse buttons during gameplay",
|
||||
Bindable = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons)
|
||||
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons)
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -19,13 +19,13 @@ namespace osu.Game.Overlays.Settings.Sections.Online
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Warn about opening external links",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning)
|
||||
Current = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Prefer downloads without video",
|
||||
Keywords = new[] { "no-video" },
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.PreferNoVideo)
|
||||
Current = config.GetBindable<bool>(OsuSetting.PreferNoVideo)
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -47,29 +47,29 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
new SettingsSlider<float, SizeSlider>
|
||||
{
|
||||
LabelText = "Menu cursor size",
|
||||
Bindable = config.GetBindable<float>(OsuSetting.MenuCursorSize),
|
||||
Current = config.GetBindable<float>(OsuSetting.MenuCursorSize),
|
||||
KeyboardStep = 0.01f
|
||||
},
|
||||
new SettingsSlider<float, SizeSlider>
|
||||
{
|
||||
LabelText = "Gameplay cursor size",
|
||||
Bindable = config.GetBindable<float>(OsuSetting.GameplayCursorSize),
|
||||
Current = config.GetBindable<float>(OsuSetting.GameplayCursorSize),
|
||||
KeyboardStep = 0.01f
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Adjust gameplay cursor size based on current beatmap",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.AutoCursorSize)
|
||||
Current = config.GetBindable<bool>(OsuSetting.AutoCursorSize)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Beatmap skins",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.BeatmapSkins)
|
||||
Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Beatmap hitsounds",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds)
|
||||
Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds)
|
||||
},
|
||||
};
|
||||
|
||||
@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
|
||||
config.BindWith(OsuSetting.Skin, configBindable);
|
||||
|
||||
skinDropdown.Bindable = dropdownBindable;
|
||||
skinDropdown.Current = dropdownBindable;
|
||||
skinDropdown.Items = skins.GetAllUsableSkins().ToArray();
|
||||
|
||||
// Todo: This should not be necessary when OsuConfigManager is databased
|
||||
|
@ -21,7 +21,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
public abstract class SettingsItem<T> : Container, IFilterable, ISettingsItem
|
||||
public abstract class SettingsItem<T> : Container, IFilterable, ISettingsItem, IHasCurrentValue<T>
|
||||
{
|
||||
protected abstract Drawable CreateControl();
|
||||
|
||||
@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Settings
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Bindable<T> Bindable
|
||||
public virtual Bindable<T> Current
|
||||
{
|
||||
get => controlWithCurrent.Current;
|
||||
set => controlWithCurrent.Current = value;
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Overlays.Settings;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Timing
|
||||
{
|
||||
internal class SliderWithTextBoxInput<T> : CompositeDrawable, IHasCurrentValue<T>
|
||||
public class SliderWithTextBoxInput<T> : CompositeDrawable, IHasCurrentValue<T>
|
||||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible
|
||||
{
|
||||
private readonly SettingsSlider<T> slider;
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
try
|
||||
{
|
||||
slider.Bindable.Parse(t.Text);
|
||||
slider.Current.Parse(t.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -71,8 +71,8 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
public Bindable<T> Current
|
||||
{
|
||||
get => slider.Bindable;
|
||||
set => slider.Bindable = value;
|
||||
get => slider.Current;
|
||||
set => slider.Current = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,14 +36,14 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
{
|
||||
if (point.NewValue != null)
|
||||
{
|
||||
bpmSlider.Bindable = point.NewValue.BeatLengthBindable;
|
||||
bpmSlider.Bindable.BindValueChanged(_ => ChangeHandler?.SaveState());
|
||||
bpmSlider.Current = point.NewValue.BeatLengthBindable;
|
||||
bpmSlider.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
|
||||
|
||||
bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable;
|
||||
// no need to hook change handler here as it's the same bindable as above
|
||||
|
||||
timeSignature.Bindable = point.NewValue.TimeSignatureBindable;
|
||||
timeSignature.Bindable.BindValueChanged(_ => ChangeHandler?.SaveState());
|
||||
timeSignature.Current = point.NewValue.TimeSignatureBindable;
|
||||
timeSignature.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,14 +121,14 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
beatLengthBindable.BindValueChanged(beatLength => updateCurrent(beatLengthToBpm(beatLength.NewValue)), true);
|
||||
bpmBindable.BindValueChanged(bpm => beatLengthBindable.Value = beatLengthToBpm(bpm.NewValue));
|
||||
|
||||
base.Bindable = bpmBindable;
|
||||
base.Current = bpmBindable;
|
||||
|
||||
TransferValueOnCommit = true;
|
||||
}
|
||||
|
||||
public override Bindable<double> Bindable
|
||||
public override Bindable<double> Current
|
||||
{
|
||||
get => base.Bindable;
|
||||
get => base.Current;
|
||||
set
|
||||
{
|
||||
// incoming will be beat length, not bpm
|
||||
|
@ -51,14 +51,14 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
}
|
||||
},
|
||||
},
|
||||
rateSlider = new PlayerSliderBar<double> { Bindable = UserPlaybackRate }
|
||||
rateSlider = new PlayerSliderBar<double> { Current = UserPlaybackRate }
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
rateSlider.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true);
|
||||
rateSlider.Current.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
dimSliderBar.Current = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
blurSliderBar.Current = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
showStoryboardToggle.Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
beatmapSkinsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||
beatmapHitsoundsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||
|
Loading…
Reference in New Issue
Block a user