1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 01:02:54 +08:00

Moved Config logic to OsuConfigManager

This commit is contained in:
Andrey Zavadskiy 2017-01-28 13:10:05 +03:00
parent ac7feafe9a
commit f12a8ace3f
2 changed files with 14 additions and 13 deletions

View File

@ -168,9 +168,23 @@ namespace osu.Game.Configuration
Set(OsuConfig.CanForceOptimusCompatibility, true);
Set(OsuConfig.ConfineMouse, Get<bool>(OsuConfig.ConfineMouseToFullscreen) ?
ConfineMouseMode.Fullscreen : ConfineMouseMode.Never);
GetBindable<bool>(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); };
GetBindable<bool>(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); };
#pragma warning restore CS0612 // Type or member is obsolete
}
private void eventPassword()
{
if ((GetBindable<bool>(OsuConfig.SavePassword) == true) && (GetBindable<bool>(OsuConfig.SaveUsername) == false))
Set(OsuConfig.SaveUsername, true);
}
private void eventUsername()
{
if ((GetBindable<bool>(OsuConfig.SaveUsername) == false) && (GetBindable<bool>(OsuConfig.SavePassword) == true))
Set(OsuConfig.SavePassword, false);
}
//todo: make a UnicodeString class/struct rather than requiring this helper method.
public string GetUnicodeString(string nonunicode, string unicode)
=> Get<bool>(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode;

View File

@ -80,17 +80,6 @@ namespace osu.Game.Overlays.Options.General
private CheckBoxOption saveUsername;
private CheckBoxOption savePassword;
private void eventPassword()
{
if ((savePassword.State == CheckBoxState.Checked) && (saveUsername.State == CheckBoxState.Unchecked))
saveUsername.State = CheckBoxState.Checked;
}
private void eventUsername()
{
if ((saveUsername.State == CheckBoxState.Unchecked) && (savePassword.State == CheckBoxState.Checked))
savePassword.State = CheckBoxState.Unchecked;
}
private void performLogin()
{
if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text))
@ -143,8 +132,6 @@ namespace osu.Game.Overlays.Options.General
//Action = registerLink
}
};
config.GetBindable<bool>(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); };
config.GetBindable<bool>(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); };
}
}
}