OsuConfig -> OsuSetting

This commit is contained in:
Dean Herbert 2017-05-15 10:56:27 +09:00
parent eaaba11586
commit 622b155fda
25 changed files with 70 additions and 70 deletions

View File

@ -97,8 +97,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders); snakingIn = config.GetBindable<bool>(OsuSetting.SnakingInSliders);
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders); snakingOut = config.GetBindable<bool>(OsuSetting.SnakingOutSliders);
reloadTexture(); reloadTexture();
} }

View File

@ -8,71 +8,71 @@ using osu.Game.Screens.Select;
namespace osu.Game.Configuration namespace osu.Game.Configuration
{ {
public class OsuConfigManager : ConfigManager<OsuConfig> public class OsuConfigManager : ConfigManager<OsuSetting>
{ {
protected override void InitialiseDefaults() protected override void InitialiseDefaults()
{ {
// UI/selection defaults // UI/selection defaults
Set(OsuConfig.Ruleset, 0, 0, int.MaxValue); Set(OsuSetting.Ruleset, 0, 0, int.MaxValue);
Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details);
Set(OsuConfig.DisplayStarsMinimum, 0.0, 0, 10); Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10);
Set(OsuConfig.DisplayStarsMaximum, 10.0, 0, 10); Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10);
Set(OsuConfig.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1); Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
// Online settings // Online settings
Set(OsuConfig.Username, string.Empty); Set(OsuSetting.Username, string.Empty);
Set(OsuConfig.Token, string.Empty); Set(OsuSetting.Token, string.Empty);
Set(OsuConfig.SavePassword, false).ValueChanged += val => Set(OsuSetting.SavePassword, false).ValueChanged += val =>
{ {
if (val) Set(OsuConfig.SaveUsername, true); if (val) Set(OsuSetting.SaveUsername, true);
}; };
Set(OsuConfig.SaveUsername, true).ValueChanged += val => Set(OsuSetting.SaveUsername, true).ValueChanged += val =>
{ {
if (!val) Set(OsuConfig.SavePassword, false); if (!val) Set(OsuSetting.SavePassword, false);
}; };
// Audio // Audio
Set(OsuConfig.AudioDevice, string.Empty); Set(OsuSetting.AudioDevice, string.Empty);
Set(OsuConfig.MenuVoice, true); Set(OsuSetting.MenuVoice, true);
Set(OsuConfig.MenuMusic, true); Set(OsuSetting.MenuMusic, true);
Set(OsuConfig.AudioOffset, 0, -500.0, 500.0); Set(OsuSetting.AudioOffset, 0, -500.0, 500.0);
// Input // Input
Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2); Set(OsuSetting.MenuCursorSize, 1.0, 0.5f, 2);
Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2); Set(OsuSetting.GameplayCursorSize, 1.0, 0.5f, 2);
Set(OsuConfig.MouseDisableButtons, false); Set(OsuSetting.MouseDisableButtons, false);
Set(OsuConfig.MouseDisableWheel, false); Set(OsuSetting.MouseDisableWheel, false);
// Graphics // Graphics
Set(OsuConfig.ShowFpsDisplay, false); Set(OsuSetting.ShowFpsDisplay, false);
Set(OsuConfig.MenuParallax, true); Set(OsuSetting.MenuParallax, true);
Set(OsuConfig.SnakingInSliders, true); Set(OsuSetting.SnakingInSliders, true);
Set(OsuConfig.SnakingOutSliders, true); Set(OsuSetting.SnakingOutSliders, true);
// Gameplay // Gameplay
Set(OsuConfig.DimLevel, 0.3, 0, 1); Set(OsuSetting.DimLevel, 0.3, 0, 1);
Set(OsuConfig.ShowInterface, true); Set(OsuSetting.ShowInterface, true);
Set(OsuConfig.KeyOverlay, false); Set(OsuSetting.KeyOverlay, false);
// Update // Update
Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer); Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer);
} }
public OsuConfigManager(Storage storage) : base(storage) public OsuConfigManager(Storage storage) : base(storage)
@ -80,7 +80,7 @@ namespace osu.Game.Configuration
} }
} }
public enum OsuConfig public enum OsuSetting
{ {
Ruleset, Ruleset,
Token, Token,

View File

@ -39,7 +39,7 @@ namespace osu.Game.Graphics.Containers
private void load(UserInputManager input, OsuConfigManager config) private void load(UserInputManager input, OsuConfigManager config)
{ {
this.input = input; this.input = input;
parallaxEnabled = config.GetBindable<bool>(OsuConfig.MenuParallax); parallaxEnabled = config.GetBindable<bool>(OsuSetting.MenuParallax);
parallaxEnabled.ValueChanged += delegate parallaxEnabled.ValueChanged += delegate
{ {
if (!parallaxEnabled) if (!parallaxEnabled)

View File

@ -114,7 +114,7 @@ namespace osu.Game.Graphics.Cursor
}, },
}; };
cursorScale = config.GetBindable<double>(OsuConfig.GameplayCursorSize); cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale);
cursorScale.TriggerChange(); cursorScale.TriggerChange();
} }

View File

@ -128,7 +128,7 @@ namespace osu.Game.Graphics.Cursor
} }
}; };
cursorScale = config.GetBindable<double>(OsuConfig.MenuCursorSize); cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale);
cursorScale.TriggerChange(); cursorScale.TriggerChange();
} }

View File

@ -88,7 +88,7 @@ namespace osu.Game
Dependencies.Cache(this); Dependencies.Cache(this);
configRuleset = LocalConfig.GetBindable<int>(OsuConfig.Ruleset); configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value); Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value);
Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0;
} }

View File

@ -125,8 +125,8 @@ namespace osu.Game
Dependencies.Cache(API = new APIAccess Dependencies.Cache(API = new APIAccess
{ {
Username = LocalConfig.Get<string>(OsuConfig.Username), Username = LocalConfig.Get<string>(OsuSetting.Username),
Token = LocalConfig.Get<string>(OsuConfig.Token) Token = LocalConfig.Get<string>(OsuSetting.Token)
}); });
API.Register(this); API.Register(this);
@ -137,7 +137,7 @@ namespace osu.Game
switch (state) switch (state)
{ {
case APIState.Online: case APIState.Online:
LocalConfig.Set(OsuConfig.Username, LocalConfig.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty); LocalConfig.Set(OsuSetting.Username, LocalConfig.Get<bool>(OsuSetting.SaveUsername) ? API.Username : string.Empty);
break; break;
} }
} }
@ -166,7 +166,7 @@ namespace osu.Game
// TODO: This is temporary until we reimplement the local FPS display. // TODO: This is temporary until we reimplement the local FPS display.
// It's just to allow end-users to access the framework FPS display without knowing the shortcut key. // It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuConfig.ShowFpsDisplay); fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay);
fpsDisplayVisible.ValueChanged += val => fpsDisplayVisible.ValueChanged += val =>
{ {
FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None;
@ -192,7 +192,7 @@ namespace osu.Game
//refresh token may have changed. //refresh token may have changed.
if (LocalConfig != null && API != null) if (LocalConfig != null && API != null)
{ {
LocalConfig.Set(OsuConfig.Token, LocalConfig.Get<bool>(OsuConfig.SavePassword) ? API.Token : string.Empty); LocalConfig.Set(OsuSetting.Token, LocalConfig.Get<bool>(OsuSetting.SavePassword) ? API.Token : string.Empty);
LocalConfig.Save(); LocalConfig.Save();
} }

View File

@ -195,7 +195,7 @@ namespace osu.Game.Overlays
this.api = api; this.api = api;
api.Register(this); api.Register(this);
chatHeight = config.GetBindable<double>(OsuConfig.ChatDisplayHeight); chatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
chatHeight.ValueChanged += h => chatHeight.ValueChanged += h =>
{ {
Height = (float)h; Height = (float)h;

View File

@ -18,12 +18,12 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Interface voices", LabelText = "Interface voices",
Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice) Bindable = config.GetBindable<bool>(OsuSetting.MenuVoice)
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "osu! music theme", LabelText = "osu! music theme",
Bindable = config.GetBindable<bool>(OsuConfig.MenuMusic) Bindable = config.GetBindable<bool>(OsuSetting.MenuMusic)
}, },
}; };
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
new SettingsSlider<double, OffsetSlider> new SettingsSlider<double, OffsetSlider>
{ {
LabelText = "Audio Offset", LabelText = "Audio Offset",
Bindable = config.GetBindable<double>(OsuConfig.AudioOffset) Bindable = config.GetBindable<double>(OsuSetting.AudioOffset)
}, },
new OsuButton new OsuButton
{ {

View File

@ -19,17 +19,17 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
new SettingsSlider<double> new SettingsSlider<double>
{ {
LabelText = "Background dim", LabelText = "Background dim",
Bindable = config.GetBindable<double>(OsuConfig.DimLevel) Bindable = config.GetBindable<double>(OsuSetting.DimLevel)
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Show score overlay", LabelText = "Show score overlay",
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface) Bindable = config.GetBindable<bool>(OsuSetting.ShowInterface)
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Always show key overlay", LabelText = "Always show key overlay",
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay) Bindable = config.GetBindable<bool>(OsuSetting.KeyOverlay)
}, },
}; };
} }

View File

@ -20,12 +20,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
new SettingsSlider<double, StarSlider> new SettingsSlider<double, StarSlider>
{ {
LabelText = "Display beatmaps from", LabelText = "Display beatmaps from",
Bindable = config.GetBindable<double>(OsuConfig.DisplayStarsMinimum) Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum)
}, },
new SettingsSlider<double, StarSlider> new SettingsSlider<double, StarSlider>
{ {
LabelText = "up to", LabelText = "up to",
Bindable = config.GetBindable<double>(OsuConfig.DisplayStarsMaximum) Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum)
}, },
}; };
} }

View File

@ -135,12 +135,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Remember username", LabelText = "Remember username",
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername), Bindable = config.GetBindable<bool>(OsuSetting.SaveUsername),
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Stay logged in", LabelText = "Stay logged in",
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword), Bindable = config.GetBindable<bool>(OsuSetting.SavePassword),
}, },
new OsuButton new OsuButton
{ {

View File

@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
new SettingsEnumDropdown<ReleaseStream> new SettingsEnumDropdown<ReleaseStream>
{ {
LabelText = "Release stream", LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuConfig.ReleaseStream), Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
}, },
new OsuButton new OsuButton
{ {

View File

@ -19,12 +19,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Snaking in sliders", LabelText = "Snaking in sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders) Bindable = config.GetBindable<bool>(OsuSetting.SnakingInSliders)
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Snaking out sliders", LabelText = "Snaking out sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingOutSliders) Bindable = config.GetBindable<bool>(OsuSetting.SnakingOutSliders)
}, },
}; };
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Parallax", LabelText = "Parallax",
Bindable = config.GetBindable<bool>(OsuConfig.MenuParallax) Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
}, },
}; };
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Show FPS", LabelText = "Show FPS",
Bindable = osuConfig.GetBindable<bool>(OsuConfig.ShowFpsDisplay) Bindable = osuConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay)
}, },
}; };
} }

View File

@ -27,12 +27,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Disable mouse wheel during gameplay", LabelText = "Disable mouse wheel during gameplay",
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableWheel) Bindable = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableWheel)
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Disable mouse buttons during gameplay", LabelText = "Disable mouse buttons during gameplay",
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableButtons) Bindable = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons)
}, },
}; };
} }

View File

@ -24,12 +24,12 @@ namespace osu.Game.Overlays.Settings.Sections
new SettingsSlider<double, SizeSlider> new SettingsSlider<double, SizeSlider>
{ {
LabelText = "Menu cursor size", LabelText = "Menu cursor size",
Bindable = config.GetBindable<double>(OsuConfig.MenuCursorSize) Bindable = config.GetBindable<double>(OsuSetting.MenuCursorSize)
}, },
new SettingsSlider<double, SizeSlider> new SettingsSlider<double, SizeSlider>
{ {
LabelText = "Gameplay cursor size", LabelText = "Gameplay cursor size",
Bindable = config.GetBindable<double>(OsuConfig.GameplayCursorSize) Bindable = config.GetBindable<double>(OsuSetting.GameplayCursorSize)
}, },
}; };
} }

View File

@ -64,8 +64,8 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config) private void load(AudioManager audio, OsuConfigManager config)
{ {
menuVoice = config.GetBindable<bool>(OsuConfig.MenuVoice); menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
menuMusic = config.GetBindable<bool>(OsuConfig.MenuMusic); menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
bgm = audio.Track.Get(@"circles"); bgm = audio.Track.Get(@"circles");
bgm.Looping = true; bgm.Looping = true;

View File

@ -66,7 +66,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps) private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps)
{ {
menuMusic = config.GetBindable<bool>(OsuConfig.MenuMusic); menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
LoadComponentAsync(background); LoadComponentAsync(background);
if (!menuMusic) if (!menuMusic)

View File

@ -67,7 +67,7 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuConfigManager config, NotificationManager notificationManager) private void load(OsuConfigManager config, NotificationManager notificationManager)
{ {
showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay); showKeyCounter = config.GetBindable<bool>(OsuSetting.KeyOverlay);
showKeyCounter.ValueChanged += keyCounterVisibility => showKeyCounter.ValueChanged += keyCounterVisibility =>
{ {
if (keyCounterVisibility) if (keyCounterVisibility)
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
}; };
showKeyCounter.TriggerChange(); showKeyCounter.TriggerChange();
showHud = config.GetBindable<bool>(OsuConfig.ShowInterface); showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
showHud.ValueChanged += hudVisibility => showHud.ValueChanged += hudVisibility =>
{ {
if (hudVisibility) if (hudVisibility)

View File

@ -79,8 +79,8 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu) private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu)
{ {
dimLevel = config.GetBindable<double>(OsuConfig.DimLevel); dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel); mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
Ruleset rulesetInstance; Ruleset rulesetInstance;
@ -138,7 +138,7 @@ namespace osu.Game.Screens.Play
offsetClock = new FramedOffsetClock(decoupledClock); offsetClock = new FramedOffsetClock(decoupledClock);
userAudioOffset = config.GetBindable<double>(OsuConfig.AudioOffset); userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
userAudioOffset.ValueChanged += v => offsetClock.Offset = v; userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
userAudioOffset.TriggerChange(); userAudioOffset.TriggerChange();

View File

@ -40,7 +40,7 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
mouseDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableButtons); mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -35,7 +35,7 @@ namespace osu.Game.Screens.Select
{ {
modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight;
selectedTab = config.GetBindable<BeatmapDetailTab>(OsuConfig.BeatmapDetailTab); selectedTab = config.GetBindable<BeatmapDetailTab>(OsuSetting.BeatmapDetailTab);
tabs.Current.BindTo(selectedTab); tabs.Current.BindTo(selectedTab);
tabs.Current.TriggerChange(); tabs.Current.TriggerChange();