From be81346573dc4e3f6b94258c4442a42d16129458 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 May 2017 14:47:25 +0900 Subject: [PATCH] Attempt to fix inner scope warning --- .../Sections/General/LoginSettings.cs | 62 +++++++++---------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 501618be7f..2c92e8653e 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -95,8 +95,33 @@ namespace osu.Game.Overlays.Settings.Sections.General }; break; case APIState.Online: - UserDropdown dropdown; - UserPanel panel; + UserDropdown dropdown = new UserDropdown { RelativeSizeAxes = Axes.X }; + dropdown.Current.ValueChanged += newValue => + { + switch (newValue) + { + case UserAction.Online: + api.LocalUser.Value.Status.Value = new UserStatusOnline(); + dropdown.StatusColour = colours.Green; + break; + case UserAction.DoNotDisturb: + api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); + dropdown.StatusColour = colours.Red; + break; + case UserAction.AppearOffline: + api.LocalUser.Value.Status.Value = new UserStatusOffline(); + dropdown.StatusColour = colours.Gray7; + break; + case UserAction.SignOut: + api.Logout(); + break; + } + }; + dropdown.Current.TriggerChange(); + + UserPanel panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X }; + panel.Status.BindTo(api.LocalUser.Value.Status); + Children = new Drawable[] { new FillFlowContainer @@ -125,40 +150,11 @@ namespace osu.Game.Overlays.Settings.Sections.General }, }, }, - panel = new UserPanel(api.LocalUser.Value) - { - RelativeSizeAxes = Axes.X, - }, - dropdown = new UserDropdown - { - RelativeSizeAxes = Axes.X, - }, + panel, + dropdown, }, }, }; - panel.Status.BindTo(api.LocalUser.Value.Status); - dropdown.Current.ValueChanged += newValue => - { - switch (newValue) - { - case UserAction.Online: - api.LocalUser.Value.Status.Value = new UserStatusOnline(); - dropdown.StatusColour = colours.Green; - break; - case UserAction.DoNotDisturb: - api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); - dropdown.StatusColour = colours.Red; - break; - case UserAction.AppearOffline: - api.LocalUser.Value.Status.Value = new UserStatusOffline(); - dropdown.StatusColour = colours.Gray7; - break; - case UserAction.SignOut: - api.Logout(); - break; - } - }; - dropdown.Current.TriggerChange(); break; }