1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 10:03:05 +08:00

Merge branch 'update-config-usages' into input-handler-configuration

This commit is contained in:
Dean Herbert 2021-03-17 18:08:13 +09:00
commit e0c0107461
27 changed files with 153 additions and 153 deletions

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Catch.Tests
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
LocalConfig.Set(OsuSetting.IncreaseFirstObjectVisibility, false); LocalConfig.SetValue(OsuSetting.IncreaseFirstObjectVisibility, false);
} }
[Test] [Test]

View File

@ -202,7 +202,7 @@ namespace osu.Game.Rulesets.Catch.Tests
public void TestHitLightingColour() public void TestHitLightingColour()
{ {
var fruitColour = SkinConfiguration.DefaultComboColours[1]; var fruitColour = SkinConfiguration.DefaultComboColours[1];
AddStep("enable hit lighting", () => config.Set(OsuSetting.HitLighting, true)); AddStep("enable hit lighting", () => config.SetValue(OsuSetting.HitLighting, true));
AddStep("catch fruit", () => attemptCatch(new Fruit())); AddStep("catch fruit", () => attemptCatch(new Fruit()));
AddAssert("correct hit lighting colour", () => AddAssert("correct hit lighting colour", () =>
catcher.ChildrenOfType<HitExplosion>().First()?.ObjectColour == fruitColour); catcher.ChildrenOfType<HitExplosion>().First()?.ObjectColour == fruitColour);
@ -211,7 +211,7 @@ namespace osu.Game.Rulesets.Catch.Tests
[Test] [Test]
public void TestHitLightingDisabled() public void TestHitLightingDisabled()
{ {
AddStep("disable hit lighting", () => config.Set(OsuSetting.HitLighting, false)); AddStep("disable hit lighting", () => config.SetValue(OsuSetting.HitLighting, false));
AddStep("catch fruit", () => attemptCatch(new Fruit())); AddStep("catch fruit", () => attemptCatch(new Fruit()));
AddAssert("no hit lighting", () => !catcher.ChildrenOfType<HitExplosion>().Any()); AddAssert("no hit lighting", () => !catcher.ChildrenOfType<HitExplosion>().Any());
} }

View File

@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Mania.Configuration
{ {
base.InitialiseDefaults(); base.InitialiseDefaults();
Set(ManiaRulesetSetting.ScrollTime, 1500.0, DrawableManiaRuleset.MIN_TIME_RANGE, DrawableManiaRuleset.MAX_TIME_RANGE, 5); SetDefault(ManiaRulesetSetting.ScrollTime, 1500.0, DrawableManiaRuleset.MIN_TIME_RANGE, DrawableManiaRuleset.MAX_TIME_RANGE, 5);
Set(ManiaRulesetSetting.ScrollDirection, ManiaScrollingDirection.Down); SetDefault(ManiaRulesetSetting.ScrollDirection, ManiaScrollingDirection.Down);
} }
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings public override TrackedSettings CreateTrackedSettings() => new TrackedSettings

View File

@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test] [Test]
public void TestHitLightingDisabled() public void TestHitLightingDisabled()
{ {
AddStep("hit lighting disabled", () => config.Set(OsuSetting.HitLighting, false)); AddStep("hit lighting disabled", () => config.SetValue(OsuSetting.HitLighting, false));
showResult(HitResult.Great); showResult(HitResult.Great);
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test] [Test]
public void TestHitLightingEnabled() public void TestHitLightingEnabled()
{ {
AddStep("hit lighting enabled", () => config.Set(OsuSetting.HitLighting, true)); AddStep("hit lighting enabled", () => config.SetValue(OsuSetting.HitLighting, true));
showResult(HitResult.Great); showResult(HitResult.Great);

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Tests
AddSliderStep("circle size", 0f, 10f, 0f, val => AddSliderStep("circle size", 0f, 10f, 0f, val =>
{ {
config.Set(OsuSetting.AutoCursorSize, true); config.SetValue(OsuSetting.AutoCursorSize, true);
gameplayBeatmap.BeatmapInfo.BaseDifficulty.CircleSize = val; gameplayBeatmap.BeatmapInfo.BaseDifficulty.CircleSize = val;
Scheduler.AddOnce(recreate); Scheduler.AddOnce(recreate);
}); });
@ -64,21 +64,21 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestCase(10, 1.5f)] [TestCase(10, 1.5f)]
public void TestSizing(int circleSize, float userScale) public void TestSizing(int circleSize, float userScale)
{ {
AddStep($"set user scale to {userScale}", () => config.Set(OsuSetting.GameplayCursorSize, userScale)); AddStep($"set user scale to {userScale}", () => config.SetValue(OsuSetting.GameplayCursorSize, userScale));
AddStep($"adjust cs to {circleSize}", () => gameplayBeatmap.BeatmapInfo.BaseDifficulty.CircleSize = circleSize); AddStep($"adjust cs to {circleSize}", () => gameplayBeatmap.BeatmapInfo.BaseDifficulty.CircleSize = circleSize);
AddStep("turn on autosizing", () => config.Set(OsuSetting.AutoCursorSize, true)); AddStep("turn on autosizing", () => config.SetValue(OsuSetting.AutoCursorSize, true));
AddStep("load content", loadContent); AddStep("load content", loadContent);
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == OsuCursorContainer.GetScaleForCircleSize(circleSize) * userScale); AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == OsuCursorContainer.GetScaleForCircleSize(circleSize) * userScale);
AddStep("set user scale to 1", () => config.Set(OsuSetting.GameplayCursorSize, 1f)); AddStep("set user scale to 1", () => config.SetValue(OsuSetting.GameplayCursorSize, 1f));
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == OsuCursorContainer.GetScaleForCircleSize(circleSize)); AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == OsuCursorContainer.GetScaleForCircleSize(circleSize));
AddStep("turn off autosizing", () => config.Set(OsuSetting.AutoCursorSize, false)); AddStep("turn off autosizing", () => config.SetValue(OsuSetting.AutoCursorSize, false));
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == 1); AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == 1);
AddStep($"set user scale to {userScale}", () => config.Set(OsuSetting.GameplayCursorSize, userScale)); AddStep($"set user scale to {userScale}", () => config.SetValue(OsuSetting.GameplayCursorSize, userScale));
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == userScale); AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == userScale);
} }

View File

@ -42,10 +42,10 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
AddStep("enable user provider", () => testUserSkin.Enabled = true); AddStep("enable user provider", () => testUserSkin.Enabled = true);
AddStep("enable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, true)); AddStep("enable beatmap skin", () => LocalConfig.SetValue(OsuSetting.BeatmapSkins, true));
checkNextHitObject("beatmap"); checkNextHitObject("beatmap");
AddStep("disable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, false)); AddStep("disable beatmap skin", () => LocalConfig.SetValue(OsuSetting.BeatmapSkins, false));
checkNextHitObject("user"); checkNextHitObject("user");
AddStep("disable user provider", () => testUserSkin.Enabled = false); AddStep("disable user provider", () => testUserSkin.Enabled = false);
@ -57,20 +57,20 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
AddStep("enable user provider", () => testUserSkin.Enabled = true); AddStep("enable user provider", () => testUserSkin.Enabled = true);
AddStep("enable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, true)); AddStep("enable beatmap skin", () => LocalConfig.SetValue(OsuSetting.BeatmapSkins, true));
AddStep("enable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, true)); AddStep("enable beatmap colours", () => LocalConfig.SetValue(OsuSetting.BeatmapColours, true));
checkNextHitObject("beatmap"); checkNextHitObject("beatmap");
AddStep("enable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, true)); AddStep("enable beatmap skin", () => LocalConfig.SetValue(OsuSetting.BeatmapSkins, true));
AddStep("disable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, false)); AddStep("disable beatmap colours", () => LocalConfig.SetValue(OsuSetting.BeatmapColours, false));
checkNextHitObject("beatmap"); checkNextHitObject("beatmap");
AddStep("disable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, false)); AddStep("disable beatmap skin", () => LocalConfig.SetValue(OsuSetting.BeatmapSkins, false));
AddStep("enable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, true)); AddStep("enable beatmap colours", () => LocalConfig.SetValue(OsuSetting.BeatmapColours, true));
checkNextHitObject("user"); checkNextHitObject("user");
AddStep("disable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, false)); AddStep("disable beatmap skin", () => LocalConfig.SetValue(OsuSetting.BeatmapSkins, false));
AddStep("disable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, false)); AddStep("disable beatmap colours", () => LocalConfig.SetValue(OsuSetting.BeatmapColours, false));
checkNextHitObject("user"); checkNextHitObject("user");
AddStep("disable user provider", () => testUserSkin.Enabled = false); AddStep("disable user provider", () => testUserSkin.Enabled = false);

View File

@ -17,10 +17,10 @@ namespace osu.Game.Rulesets.Osu.Configuration
protected override void InitialiseDefaults() protected override void InitialiseDefaults()
{ {
base.InitialiseDefaults(); base.InitialiseDefaults();
Set(OsuRulesetSetting.SnakingInSliders, true); SetDefault(OsuRulesetSetting.SnakingInSliders, true);
Set(OsuRulesetSetting.SnakingOutSliders, true); SetDefault(OsuRulesetSetting.SnakingOutSliders, true);
Set(OsuRulesetSetting.ShowCursorTrail, true); SetDefault(OsuRulesetSetting.ShowCursorTrail, true);
Set(OsuRulesetSetting.PlayfieldBorderStyle, PlayfieldBorderStyle.None); SetDefault(OsuRulesetSetting.PlayfieldBorderStyle, PlayfieldBorderStyle.None);
} }
} }

View File

@ -88,7 +88,7 @@ namespace osu.Game.Tests.Input
=> AddStep($"make window {mode}", () => frameworkConfigManager.GetBindable<WindowMode>(FrameworkSetting.WindowMode).Value = mode); => AddStep($"make window {mode}", () => frameworkConfigManager.GetBindable<WindowMode>(FrameworkSetting.WindowMode).Value = mode);
private void setGameSideModeTo(OsuConfineMouseMode mode) private void setGameSideModeTo(OsuConfineMouseMode mode)
=> AddStep($"set {mode} game-side", () => Game.LocalConfig.Set(OsuSetting.ConfineMouseMode, mode)); => AddStep($"set {mode} game-side", () => Game.LocalConfig.SetValue(OsuSetting.ConfineMouseMode, mode));
private void setLocalUserPlayingTo(bool playing) private void setLocalUserPlayingTo(bool playing)
=> AddStep($"local user {(playing ? "playing" : "not playing")}", () => Game.LocalUserPlaying.Value = playing); => AddStep($"local user {(playing ? "playing" : "not playing")}", () => Game.LocalUserPlaying.Value = playing);

View File

@ -47,7 +47,7 @@ namespace osu.Game.Tests.NonVisual
using (var host = new CustomTestHeadlessGameHost()) using (var host = new CustomTestHeadlessGameHost())
{ {
using (var storageConfig = new StorageConfigManager(host.InitialStorage)) using (var storageConfig = new StorageConfigManager(host.InitialStorage))
storageConfig.Set(StorageConfig.FullPath, customPath); storageConfig.SetValue(StorageConfig.FullPath, customPath);
try try
{ {
@ -73,7 +73,7 @@ namespace osu.Game.Tests.NonVisual
using (var host = new CustomTestHeadlessGameHost()) using (var host = new CustomTestHeadlessGameHost())
{ {
using (var storageConfig = new StorageConfigManager(host.InitialStorage)) using (var storageConfig = new StorageConfigManager(host.InitialStorage))
storageConfig.Set(StorageConfig.FullPath, customPath); storageConfig.SetValue(StorageConfig.FullPath, customPath);
try try
{ {

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Background
public void SetUp() => Schedule(() => public void SetUp() => Schedule(() =>
{ {
// reset API response in statics to avoid test crosstalk. // reset API response in statics to avoid test crosstalk.
statics.Set<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null); statics.SetValue<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
textureStore.PerformedLookups.Clear(); textureStore.PerformedLookups.Clear();
dummyAPI.SetState(APIState.Online); dummyAPI.SetState(APIState.Online);
@ -146,7 +146,7 @@ namespace osu.Game.Tests.Visual.Background
}); });
private void setSeasonalBackgroundMode(SeasonalBackgroundMode mode) private void setSeasonalBackgroundMode(SeasonalBackgroundMode mode)
=> AddStep($"set seasonal mode to {mode}", () => config.Set(OsuSetting.SeasonalBackgroundMode, mode)); => AddStep($"set seasonal mode to {mode}", () => config.SetValue(OsuSetting.SeasonalBackgroundMode, mode));
private void createLoader() private void createLoader()
=> AddStep("create loader", () => => AddStep("create loader", () =>

View File

@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}); });
AddStep("show health", () => showHealth.Value = true); AddStep("show health", () => showHealth.Value = true);
AddStep("enable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, true)); AddStep("enable layer", () => config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, true));
AddUntilStep("layer is visible", () => layer.IsPresent); AddUntilStep("layer is visible", () => layer.IsPresent);
} }
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test] [Test]
public void TestLayerDisabledViaConfig() public void TestLayerDisabledViaConfig()
{ {
AddStep("disable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, false)); AddStep("disable layer", () => config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, false));
AddStep("set health to 0.10", () => layer.Current.Value = 0.1); AddStep("set health to 0.10", () => layer.Current.Value = 0.1);
AddUntilStep("layer is not visible", () => !layer.IsPresent); AddUntilStep("layer is not visible", () => !layer.IsPresent);
} }
@ -81,19 +81,19 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("set health to 0.10", () => layer.Current.Value = 0.1); AddStep("set health to 0.10", () => layer.Current.Value = 0.1);
AddStep("don't show health", () => showHealth.Value = false); AddStep("don't show health", () => showHealth.Value = false);
AddStep("disable FadePlayfieldWhenHealthLow", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, false)); AddStep("disable FadePlayfieldWhenHealthLow", () => config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, false));
AddUntilStep("layer fade is invisible", () => !layer.IsPresent); AddUntilStep("layer fade is invisible", () => !layer.IsPresent);
AddStep("don't show health", () => showHealth.Value = false); AddStep("don't show health", () => showHealth.Value = false);
AddStep("enable FadePlayfieldWhenHealthLow", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, true)); AddStep("enable FadePlayfieldWhenHealthLow", () => config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, true));
AddUntilStep("layer fade is invisible", () => !layer.IsPresent); AddUntilStep("layer fade is invisible", () => !layer.IsPresent);
AddStep("show health", () => showHealth.Value = true); AddStep("show health", () => showHealth.Value = true);
AddStep("disable FadePlayfieldWhenHealthLow", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, false)); AddStep("disable FadePlayfieldWhenHealthLow", () => config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, false));
AddUntilStep("layer fade is invisible", () => !layer.IsPresent); AddUntilStep("layer fade is invisible", () => !layer.IsPresent);
AddStep("show health", () => showHealth.Value = true); AddStep("show health", () => showHealth.Value = true);
AddStep("enable FadePlayfieldWhenHealthLow", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, true)); AddStep("enable FadePlayfieldWhenHealthLow", () => config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, true));
AddUntilStep("layer fade is visible", () => layer.IsPresent); AddUntilStep("layer fade is visible", () => layer.IsPresent);
} }
} }

View File

@ -81,7 +81,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("get original config value", () => originalConfigValue = config.Get<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode)); AddStep("get original config value", () => originalConfigValue = config.Get<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode));
AddStep("set hud to never show", () => config.Set(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Never)); AddStep("set hud to never show", () => config.SetValue(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Never));
AddUntilStep("wait for fade", () => !hideTarget.IsPresent); AddUntilStep("wait for fade", () => !hideTarget.IsPresent);
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("stop trigering", () => InputManager.ReleaseKey(Key.ControlLeft)); AddStep("stop trigering", () => InputManager.ReleaseKey(Key.ControlLeft));
AddUntilStep("wait for fade", () => !hideTarget.IsPresent); AddUntilStep("wait for fade", () => !hideTarget.IsPresent);
AddStep("set original config value", () => config.Set(OsuSetting.HUDVisibilityMode, originalConfigValue)); AddStep("set original config value", () => config.SetValue(OsuSetting.HUDVisibilityMode, originalConfigValue));
} }
[Test] [Test]
@ -120,7 +120,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("set keycounter visible false", () => AddStep("set keycounter visible false", () =>
{ {
config.Set<bool>(OsuSetting.KeyOverlay, false); config.SetValue(OsuSetting.KeyOverlay, false);
hudOverlay.KeyCounter.AlwaysVisible.Value = false; hudOverlay.KeyCounter.AlwaysVisible.Value = false;
}); });
@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("hidetarget is visible", () => hideTarget.IsPresent); AddUntilStep("hidetarget is visible", () => hideTarget.IsPresent);
AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent); AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent);
AddStep("return value", () => config.Set<bool>(OsuSetting.KeyOverlay, keyCounterVisibleValue)); AddStep("return value", () => config.SetValue(OsuSetting.KeyOverlay, keyCounterVisibleValue));
} }
private void createNew(Action<HUDOverlay> action = null) private void createNew(Action<HUDOverlay> action = null)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
config.Set(OsuSetting.ShowStoryboard, true); config.SetValue(OsuSetting.ShowStoryboard, true);
storyboard = new Storyboard(); storyboard = new Storyboard();
var backgroundLayer = storyboard.GetLayer("Background"); var backgroundLayer = storyboard.GetLayer("Background");

View File

@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Navigation
// todo: this can be removed once we can run audio tracks without a device present // todo: this can be removed once we can run audio tracks without a device present
// see https://github.com/ppy/osu/issues/1302 // see https://github.com/ppy/osu/issues/1302
Game.LocalConfig.Set(OsuSetting.IntroSequence, IntroSequence.Circles); Game.LocalConfig.SetValue(OsuSetting.IntroSequence, IntroSequence.Circles);
Add(Game); Add(Game);
} }
@ -136,7 +136,7 @@ namespace osu.Game.Tests.Visual.Navigation
base.LoadComplete(); base.LoadComplete();
API.Login("Rhythm Champion", "osu!"); API.Login("Rhythm Champion", "osu!");
Dependencies.Get<SessionStatics>().Set(Static.MutedAudioNotificationShownOnce, true); Dependencies.Get<SessionStatics>().SetValue(Static.MutedAudioNotificationShownOnce, true);
} }
} }

View File

@ -15,8 +15,8 @@ namespace osu.Game.Tests.Visual.Navigation
using (var config = new OsuConfigManager(LocalStorage)) using (var config = new OsuConfigManager(LocalStorage))
{ {
config.Set(OsuSetting.Version, "2020.101.0"); config.SetValue(OsuSetting.Version, "2020.101.0");
config.Set(OsuSetting.DisplayStarsMaximum, 10.0); config.SetValue(OsuSetting.DisplayStarsMaximum, 10.0);
} }
} }
@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Navigation
{ {
AddAssert("config has migrated value", () => Precision.AlmostEquals(Game.LocalConfig.Get<double>(OsuSetting.DisplayStarsMaximum), 10.1)); AddAssert("config has migrated value", () => Precision.AlmostEquals(Game.LocalConfig.Get<double>(OsuSetting.DisplayStarsMaximum), 10.1));
AddStep("set value again", () => Game.LocalConfig.Set<double>(OsuSetting.DisplayStarsMaximum, 10)); AddStep("set value again", () => Game.LocalConfig.SetValue(OsuSetting.DisplayStarsMaximum, 10));
AddStep("force save config", () => Game.LocalConfig.Save()); AddStep("force save config", () => Game.LocalConfig.Save());

View File

@ -207,14 +207,14 @@ namespace osu.Game.Tests.Visual.SongSelect
addRulesetImportStep(0); addRulesetImportStep(0);
addRulesetImportStep(0); addRulesetImportStep(0);
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, false)); AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, false));
createSongSelect(); createSongSelect();
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child"))); AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen()); AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, true)); AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
AddStep("return", () => songSelect.MakeCurrent()); AddStep("return", () => songSelect.MakeCurrent());
AddUntilStep("wait for current", () => songSelect.IsCurrentScreen()); AddUntilStep("wait for current", () => songSelect.IsCurrentScreen());
@ -297,13 +297,13 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
AddStep(@"Sort by Artist", () => config.Set(OsuSetting.SongSelectSortingMode, SortMode.Artist)); AddStep(@"Sort by Artist", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Artist));
AddStep(@"Sort by Title", () => config.Set(OsuSetting.SongSelectSortingMode, SortMode.Title)); AddStep(@"Sort by Title", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Title));
AddStep(@"Sort by Author", () => config.Set(OsuSetting.SongSelectSortingMode, SortMode.Author)); AddStep(@"Sort by Author", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Author));
AddStep(@"Sort by DateAdded", () => config.Set(OsuSetting.SongSelectSortingMode, SortMode.DateAdded)); AddStep(@"Sort by DateAdded", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.DateAdded));
AddStep(@"Sort by BPM", () => config.Set(OsuSetting.SongSelectSortingMode, SortMode.BPM)); AddStep(@"Sort by BPM", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.BPM));
AddStep(@"Sort by Length", () => config.Set(OsuSetting.SongSelectSortingMode, SortMode.Length)); AddStep(@"Sort by Length", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Length));
AddStep(@"Sort by Difficulty", () => config.Set(OsuSetting.SongSelectSortingMode, SortMode.Difficulty)); AddStep(@"Sort by Difficulty", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Difficulty));
} }
[Test] [Test]
@ -470,7 +470,7 @@ namespace osu.Game.Tests.Visual.SongSelect
changeRuleset(0); changeRuleset(0);
// used for filter check below // used for filter check below
AddStep("allow convert display", () => config.Set(OsuSetting.ShowConvertedBeatmaps, true)); AddStep("allow convert display", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap != null); AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap != null);
@ -648,7 +648,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
int changeCount = 0; int changeCount = 0;
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, false)); AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, false));
AddStep("bind beatmap changed", () => AddStep("bind beatmap changed", () =>
{ {
Beatmap.ValueChanged += onChange; Beatmap.ValueChanged += onChange;
@ -686,7 +686,7 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("selection changed only fired twice", () => changeCount == 2); AddAssert("selection changed only fired twice", () => changeCount == 2);
AddStep("unbind beatmap changed", () => Beatmap.ValueChanged -= onChange); AddStep("unbind beatmap changed", () => Beatmap.ValueChanged -= onChange);
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, true)); AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
// ReSharper disable once AccessToModifiedClosure // ReSharper disable once AccessToModifiedClosure
void onChange(ValueChangedEvent<WorkingBeatmap> valueChangedEvent) => changeCount++; void onChange(ValueChangedEvent<WorkingBeatmap> valueChangedEvent) => changeCount++;

View File

@ -92,10 +92,10 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test] [Test]
public void TestExplicitConfig() public void TestExplicitConfig()
{ {
AddStep("configure explicit content to allowed", () => localConfig.Set(OsuSetting.ShowOnlineExplicitContent, true)); AddStep("configure explicit content to allowed", () => localConfig.SetValue(OsuSetting.ShowOnlineExplicitContent, true));
AddAssert("explicit control set to show", () => control.ExplicitContent.Value == SearchExplicit.Show); AddAssert("explicit control set to show", () => control.ExplicitContent.Value == SearchExplicit.Show);
AddStep("configure explicit content to disallowed", () => localConfig.Set(OsuSetting.ShowOnlineExplicitContent, false)); AddStep("configure explicit content to disallowed", () => localConfig.SetValue(OsuSetting.ShowOnlineExplicitContent, false));
AddAssert("explicit control set to hide", () => control.ExplicitContent.Value == SearchExplicit.Hide); AddAssert("explicit control set to hide", () => control.ExplicitContent.Value == SearchExplicit.Hide);
} }

View File

@ -44,22 +44,22 @@ namespace osu.Game.Tests.Visual.UserInterface
protected override void InitialiseDefaults() protected override void InitialiseDefaults()
{ {
Set(TestConfigSetting.ToggleSettingNoKeybind, false); SetDefault(TestConfigSetting.ToggleSettingNoKeybind, false);
Set(TestConfigSetting.EnumSettingNoKeybind, EnumSetting.Setting1); SetDefault(TestConfigSetting.EnumSettingNoKeybind, EnumSetting.Setting1);
Set(TestConfigSetting.ToggleSettingWithKeybind, false); SetDefault(TestConfigSetting.ToggleSettingWithKeybind, false);
Set(TestConfigSetting.EnumSettingWithKeybind, EnumSetting.Setting1); SetDefault(TestConfigSetting.EnumSettingWithKeybind, EnumSetting.Setting1);
base.InitialiseDefaults(); base.InitialiseDefaults();
} }
public void ToggleSetting(TestConfigSetting setting) => Set(setting, !Get<bool>(setting)); public void ToggleSetting(TestConfigSetting setting) => SetValue(setting, !Get<bool>(setting));
public void IncrementEnumSetting(TestConfigSetting setting) public void IncrementEnumSetting(TestConfigSetting setting)
{ {
var nextValue = Get<EnumSetting>(setting) + 1; var nextValue = Get<EnumSetting>(setting) + 1;
if (nextValue > EnumSetting.Setting4) if (nextValue > EnumSetting.Setting4)
nextValue = EnumSetting.Setting1; nextValue = EnumSetting.Setting1;
Set(setting, nextValue); SetValue(setting, nextValue);
} }
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings public override TrackedSettings CreateTrackedSettings() => new TrackedSettings

View File

@ -50,7 +50,7 @@ namespace osu.Game.Tournament.Tests.NonVisual
storage.DeleteDirectory(string.Empty); storage.DeleteDirectory(string.Empty);
using (var storageConfig = new TournamentStorageManager(storage)) using (var storageConfig = new TournamentStorageManager(storage))
storageConfig.Set(StorageConfig.CurrentTournament, custom_tournament); storageConfig.SetValue(StorageConfig.CurrentTournament, custom_tournament);
try try
{ {

View File

@ -70,7 +70,7 @@ namespace osu.Game.Tournament.IO
moveFileIfExists("drawings.ini", destination); moveFileIfExists("drawings.ini", destination);
ChangeTargetStorage(newStorage); ChangeTargetStorage(newStorage);
storageConfig.Set(StorageConfig.CurrentTournament, default_tournament); storageConfig.SetValue(StorageConfig.CurrentTournament, default_tournament);
storageConfig.Save(); storageConfig.Save();
} }

View File

@ -12,8 +12,8 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
protected override void InitialiseDefaults() protected override void InitialiseDefaults()
{ {
Set(DrawingsConfig.Groups, 8, 1, 8); SetDefault(DrawingsConfig.Groups, 8, 1, 8);
Set(DrawingsConfig.TeamsPerGroup, 8, 1, 8); SetDefault(DrawingsConfig.TeamsPerGroup, 8, 1, 8);
} }
public DrawingsConfigManager(Storage storage) public DrawingsConfigManager(Storage storage)

View File

@ -24,126 +24,126 @@ namespace osu.Game.Configuration
protected override void InitialiseDefaults() protected override void InitialiseDefaults()
{ {
// UI/selection defaults // UI/selection defaults
Set(OsuSetting.Ruleset, 0, 0, int.MaxValue); SetDefault(OsuSetting.Ruleset, 0, 0, int.MaxValue);
Set(OsuSetting.Skin, 0, -1, int.MaxValue); SetDefault(OsuSetting.Skin, 0, -1, int.MaxValue);
Set(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Details); SetDefault(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Details);
Set(OsuSetting.BeatmapDetailModsFilter, false); SetDefault(OsuSetting.BeatmapDetailModsFilter, false);
Set(OsuSetting.ShowConvertedBeatmaps, true); SetDefault(OsuSetting.ShowConvertedBeatmaps, true);
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1); SetDefault(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
Set(OsuSetting.DisplayStarsMaximum, 10.1, 0, 10.1, 0.1); SetDefault(OsuSetting.DisplayStarsMaximum, 10.1, 0, 10.1, 0.1);
Set(OsuSetting.SongSelectGroupingMode, GroupMode.All); SetDefault(OsuSetting.SongSelectGroupingMode, GroupMode.All);
Set(OsuSetting.SongSelectSortingMode, SortMode.Title); SetDefault(OsuSetting.SongSelectSortingMode, SortMode.Title);
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); SetDefault(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f); SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f);
// Online settings // Online settings
Set(OsuSetting.Username, string.Empty); SetDefault(OsuSetting.Username, string.Empty);
Set(OsuSetting.Token, string.Empty); SetDefault(OsuSetting.Token, string.Empty);
Set(OsuSetting.AutomaticallyDownloadWhenSpectating, false); SetDefault(OsuSetting.AutomaticallyDownloadWhenSpectating, false);
Set(OsuSetting.SavePassword, false).ValueChanged += enabled => SetDefault(OsuSetting.SavePassword, false).ValueChanged += enabled =>
{ {
if (enabled.NewValue) Set(OsuSetting.SaveUsername, true); if (enabled.NewValue) SetValue(OsuSetting.SaveUsername, true);
}; };
Set(OsuSetting.SaveUsername, true).ValueChanged += enabled => SetDefault(OsuSetting.SaveUsername, true).ValueChanged += enabled =>
{ {
if (!enabled.NewValue) Set(OsuSetting.SavePassword, false); if (!enabled.NewValue) SetValue(OsuSetting.SavePassword, false);
}; };
Set(OsuSetting.ExternalLinkWarning, true); SetDefault(OsuSetting.ExternalLinkWarning, true);
Set(OsuSetting.PreferNoVideo, false); SetDefault(OsuSetting.PreferNoVideo, false);
Set(OsuSetting.ShowOnlineExplicitContent, false); SetDefault(OsuSetting.ShowOnlineExplicitContent, false);
// Audio // Audio
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01); SetDefault(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
Set(OsuSetting.MenuVoice, true); SetDefault(OsuSetting.MenuVoice, true);
Set(OsuSetting.MenuMusic, true); SetDefault(OsuSetting.MenuMusic, true);
Set(OsuSetting.AudioOffset, 0, -500.0, 500.0, 1); SetDefault(OsuSetting.AudioOffset, 0, -500.0, 500.0, 1);
// Input // Input
Set(OsuSetting.MenuCursorSize, 1.0f, 0.5f, 2f, 0.01f); SetDefault(OsuSetting.MenuCursorSize, 1.0f, 0.5f, 2f, 0.01f);
Set(OsuSetting.GameplayCursorSize, 1.0f, 0.1f, 2f, 0.01f); SetDefault(OsuSetting.GameplayCursorSize, 1.0f, 0.1f, 2f, 0.01f);
Set(OsuSetting.AutoCursorSize, false); SetDefault(OsuSetting.AutoCursorSize, false);
Set(OsuSetting.MouseDisableButtons, false); SetDefault(OsuSetting.MouseDisableButtons, false);
Set(OsuSetting.MouseDisableWheel, false); SetDefault(OsuSetting.MouseDisableWheel, false);
Set(OsuSetting.ConfineMouseMode, OsuConfineMouseMode.DuringGameplay); SetDefault(OsuSetting.ConfineMouseMode, OsuConfineMouseMode.DuringGameplay);
// Graphics // Graphics
Set(OsuSetting.ShowFpsDisplay, false); SetDefault(OsuSetting.ShowFpsDisplay, false);
Set(OsuSetting.ShowStoryboard, true); SetDefault(OsuSetting.ShowStoryboard, true);
Set(OsuSetting.BeatmapSkins, true); SetDefault(OsuSetting.BeatmapSkins, true);
Set(OsuSetting.BeatmapColours, true); SetDefault(OsuSetting.BeatmapColours, true);
Set(OsuSetting.BeatmapHitsounds, true); SetDefault(OsuSetting.BeatmapHitsounds, true);
Set(OsuSetting.CursorRotation, true); SetDefault(OsuSetting.CursorRotation, true);
Set(OsuSetting.MenuParallax, true); SetDefault(OsuSetting.MenuParallax, true);
// Gameplay // Gameplay
Set(OsuSetting.DimLevel, 0.8, 0, 1, 0.01); SetDefault(OsuSetting.DimLevel, 0.8, 0, 1, 0.01);
Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01); SetDefault(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
Set(OsuSetting.LightenDuringBreaks, true); SetDefault(OsuSetting.LightenDuringBreaks, true);
Set(OsuSetting.HitLighting, true); SetDefault(OsuSetting.HitLighting, true);
Set(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Always); SetDefault(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Always);
Set(OsuSetting.ShowProgressGraph, true); SetDefault(OsuSetting.ShowProgressGraph, true);
Set(OsuSetting.ShowHealthDisplayWhenCantFail, true); SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true);
Set(OsuSetting.FadePlayfieldWhenHealthLow, true); SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true);
Set(OsuSetting.KeyOverlay, false); SetDefault(OsuSetting.KeyOverlay, false);
Set(OsuSetting.PositionalHitSounds, true); SetDefault(OsuSetting.PositionalHitSounds, true);
Set(OsuSetting.AlwaysPlayFirstComboBreak, true); SetDefault(OsuSetting.AlwaysPlayFirstComboBreak, true);
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth); SetDefault(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
Set(OsuSetting.FloatingComments, false); SetDefault(OsuSetting.FloatingComments, false);
Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised); SetDefault(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised);
Set(OsuSetting.IncreaseFirstObjectVisibility, true); SetDefault(OsuSetting.IncreaseFirstObjectVisibility, true);
Set(OsuSetting.GameplayDisableWinKey, true); SetDefault(OsuSetting.GameplayDisableWinKey, true);
// Update // Update
Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); SetDefault(OsuSetting.ReleaseStream, ReleaseStream.Lazer);
Set(OsuSetting.Version, string.Empty); SetDefault(OsuSetting.Version, string.Empty);
Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg); SetDefault(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg);
Set(OsuSetting.ScreenshotCaptureMenuCursor, false); SetDefault(OsuSetting.ScreenshotCaptureMenuCursor, false);
Set(OsuSetting.SongSelectRightMouseScroll, false); SetDefault(OsuSetting.SongSelectRightMouseScroll, false);
Set(OsuSetting.Scaling, ScalingMode.Off); SetDefault(OsuSetting.Scaling, ScalingMode.Off);
Set(OsuSetting.ScalingSizeX, 0.8f, 0.2f, 1f); SetDefault(OsuSetting.ScalingSizeX, 0.8f, 0.2f, 1f);
Set(OsuSetting.ScalingSizeY, 0.8f, 0.2f, 1f); SetDefault(OsuSetting.ScalingSizeY, 0.8f, 0.2f, 1f);
Set(OsuSetting.ScalingPositionX, 0.5f, 0f, 1f); SetDefault(OsuSetting.ScalingPositionX, 0.5f, 0f, 1f);
Set(OsuSetting.ScalingPositionY, 0.5f, 0f, 1f); SetDefault(OsuSetting.ScalingPositionY, 0.5f, 0f, 1f);
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f); SetDefault(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f); SetDefault(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
Set(OsuSetting.IntroSequence, IntroSequence.Triangles); SetDefault(OsuSetting.IntroSequence, IntroSequence.Triangles);
Set(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin); SetDefault(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
Set(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Sometimes); SetDefault(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Sometimes);
Set(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full); SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full);
Set(OsuSetting.EditorWaveformOpacity, 1f); SetDefault(OsuSetting.EditorWaveformOpacity, 1f);
} }
public OsuConfigManager(Storage storage) public OsuConfigManager(Storage storage)

View File

@ -14,10 +14,10 @@ namespace osu.Game.Configuration
{ {
protected override void InitialiseDefaults() protected override void InitialiseDefaults()
{ {
Set(Static.LoginOverlayDisplayed, false); SetDefault(Static.LoginOverlayDisplayed, false);
Set(Static.MutedAudioNotificationShownOnce, false); SetDefault(Static.MutedAudioNotificationShownOnce, false);
Set(Static.LastHoverSoundPlaybackTime, (double?)null); SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null);
Set<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null); SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
} }
} }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Configuration
{ {
base.InitialiseDefaults(); base.InitialiseDefaults();
Set(StorageConfig.FullPath, string.Empty); SetDefault(StorageConfig.FullPath, string.Empty);
} }
} }

View File

@ -58,7 +58,7 @@ namespace osu.Game.IO
/// </summary> /// </summary>
public void ResetCustomStoragePath() public void ResetCustomStoragePath()
{ {
storageConfig.Set(StorageConfig.FullPath, string.Empty); storageConfig.SetValue(StorageConfig.FullPath, string.Empty);
storageConfig.Save(); storageConfig.Save();
ChangeTargetStorage(defaultStorage); ChangeTargetStorage(defaultStorage);
@ -103,7 +103,7 @@ namespace osu.Game.IO
public override void Migrate(Storage newStorage) public override void Migrate(Storage newStorage)
{ {
base.Migrate(newStorage); base.Migrate(newStorage);
storageConfig.Set(StorageConfig.FullPath, newStorage.GetFullPath(".")); storageConfig.SetValue(StorageConfig.FullPath, newStorage.GetFullPath("."));
storageConfig.Save(); storageConfig.Save();
} }
} }

View File

@ -89,7 +89,7 @@ namespace osu.Game.Online.API
thread.Start(); thread.Start();
} }
private void onTokenChanged(ValueChangedEvent<OAuthToken> e) => config.Set(OsuSetting.Token, config.Get<bool>(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty); private void onTokenChanged(ValueChangedEvent<OAuthToken> e) => config.SetValue(OsuSetting.Token, config.Get<bool>(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty);
internal new void Schedule(Action action) => base.Schedule(action); internal new void Schedule(Action action) => base.Schedule(action);
@ -134,7 +134,7 @@ namespace osu.Game.Online.API
state.Value = APIState.Connecting; state.Value = APIState.Connecting;
// save the username at this point, if the user requested for it to be. // save the username at this point, if the user requested for it to be.
config.Set(OsuSetting.Username, config.Get<bool>(OsuSetting.SaveUsername) ? ProvidedUsername : string.Empty); config.SetValue(OsuSetting.Username, config.Get<bool>(OsuSetting.SaveUsername) ? ProvidedUsername : string.Empty);
if (!authentication.HasValidAccessToken && !authentication.AuthenticateWithLogin(ProvidedUsername, password)) if (!authentication.HasValidAccessToken && !authentication.AuthenticateWithLogin(ProvidedUsername, password))
{ {

View File

@ -52,7 +52,7 @@ namespace osu.Game.Updater
// debug / local compilations will reset to a non-release string. // debug / local compilations will reset to a non-release string.
// can be useful to check when an install has transitioned between release and otherwise (see OsuConfigManager's migrations). // can be useful to check when an install has transitioned between release and otherwise (see OsuConfigManager's migrations).
config.Set(OsuSetting.Version, version); config.SetValue(OsuSetting.Version, version);
} }
private readonly object updateTaskLock = new object(); private readonly object updateTaskLock = new object();