diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 0c69f4aed2..2ff663e3a2 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -168,9 +168,23 @@ namespace osu.Game.Configuration Set(OsuConfig.CanForceOptimusCompatibility, true); Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? ConfineMouseMode.Fullscreen : ConfineMouseMode.Never); + + GetBindable(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); }; + GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); }; #pragma warning restore CS0612 // Type or member is obsolete } + private void eventPassword() + { + if ((GetBindable(OsuConfig.SavePassword) == true) && (GetBindable(OsuConfig.SaveUsername) == false)) + Set(OsuConfig.SaveUsername, true); + } + private void eventUsername() + { + if ((GetBindable(OsuConfig.SaveUsername) == false) && (GetBindable(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(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode; diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 5e81b741dd..333b794d58 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -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(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); }; - config.GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); }; } } }