1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:47:25 +08:00

Merge pull request #854 from peppy/fix-warning

Attempt to fix inner scope warning
This commit is contained in:
Dan Balasescu 2017-05-25 15:06:32 +09:00 committed by GitHub
commit 4d7d4b7389

View File

@ -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;
}