1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

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]
private void load(OsuConfigManager config)
{
snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders);
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);
snakingIn = config.GetBindable<bool>(OsuSetting.SnakingInSliders);
snakingOut = config.GetBindable<bool>(OsuSetting.SnakingOutSliders);
reloadTexture();
}

View File

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

View File

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

View File

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

View File

@ -125,8 +125,8 @@ namespace osu.Game
Dependencies.Cache(API = new APIAccess
{
Username = LocalConfig.Get<string>(OsuConfig.Username),
Token = LocalConfig.Get<string>(OsuConfig.Token)
Username = LocalConfig.Get<string>(OsuSetting.Username),
Token = LocalConfig.Get<string>(OsuSetting.Token)
});
API.Register(this);
@ -137,7 +137,7 @@ namespace osu.Game
switch (state)
{
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;
}
}
@ -166,7 +166,7 @@ namespace osu.Game
// 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.
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuConfig.ShowFpsDisplay);
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay);
fpsDisplayVisible.ValueChanged += val =>
{
FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None;
@ -192,7 +192,7 @@ namespace osu.Game
//refresh token may have changed.
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();
}

View File

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

View File

@ -18,12 +18,12 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
new SettingsCheckbox
{
LabelText = "Interface voices",
Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice)
Bindable = config.GetBindable<bool>(OsuSetting.MenuVoice)
},
new SettingsCheckbox
{
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>
{
LabelText = "Audio Offset",
Bindable = config.GetBindable<double>(OsuConfig.AudioOffset)
Bindable = config.GetBindable<double>(OsuSetting.AudioOffset)
},
new OsuButton
{

View File

@ -19,17 +19,17 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
new SettingsSlider<double>
{
LabelText = "Background dim",
Bindable = config.GetBindable<double>(OsuConfig.DimLevel)
Bindable = config.GetBindable<double>(OsuSetting.DimLevel)
},
new SettingsCheckbox
{
LabelText = "Show score overlay",
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface)
Bindable = config.GetBindable<bool>(OsuSetting.ShowInterface)
},
new SettingsCheckbox
{
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>
{
LabelText = "Display beatmaps from",
Bindable = config.GetBindable<double>(OsuConfig.DisplayStarsMinimum)
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum)
},
new SettingsSlider<double, StarSlider>
{
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
{
LabelText = "Remember username",
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername),
Bindable = config.GetBindable<bool>(OsuSetting.SaveUsername),
},
new SettingsCheckbox
{
LabelText = "Stay logged in",
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),
Bindable = config.GetBindable<bool>(OsuSetting.SavePassword),
},
new OsuButton
{

View File

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

View File

@ -19,12 +19,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
new SettingsCheckbox
{
LabelText = "Snaking in sliders",
Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders)
Bindable = config.GetBindable<bool>(OsuSetting.SnakingInSliders)
},
new SettingsCheckbox
{
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
{
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
{
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
{
LabelText = "Disable mouse wheel during gameplay",
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableWheel)
Bindable = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableWheel)
},
new SettingsCheckbox
{
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>
{
LabelText = "Menu cursor size",
Bindable = config.GetBindable<double>(OsuConfig.MenuCursorSize)
Bindable = config.GetBindable<double>(OsuSetting.MenuCursorSize)
},
new SettingsSlider<double, SizeSlider>
{
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]
private void load(AudioManager audio, OsuConfigManager config)
{
menuVoice = config.GetBindable<bool>(OsuConfig.MenuVoice);
menuMusic = config.GetBindable<bool>(OsuConfig.MenuMusic);
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
bgm = audio.Track.Get(@"circles");
bgm.Looping = true;

View File

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

View File

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

View File

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

View File

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

View File

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