1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:02:55 +08:00

Merge remote-tracking branch 'ppy/master' into triangles-particles

This commit is contained in:
Dean Herbert 2017-05-25 22:47:03 +09:00
commit 4ecb3220dd
2 changed files with 37 additions and 31 deletions

View File

@ -28,6 +28,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
private LoginForm form;
private OsuColour colours;
private UserPanel panel;
private UserDropdown dropdown;
public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty;
public bool Bounding
@ -95,33 +98,6 @@ namespace osu.Game.Overlays.Settings.Sections.General
};
break;
case APIState.Online:
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
@ -150,11 +126,36 @@ namespace osu.Game.Overlays.Settings.Sections.General
},
},
},
panel,
dropdown,
panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X },
dropdown = new UserDropdown { RelativeSizeAxes = Axes.X },
},
},
};
panel.Status.BindTo(api.LocalUser.Value.Status);
dropdown.Current.TriggerChange();
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;
}
};
break;
}

View File

@ -158,14 +158,19 @@ namespace osu.Game.Users
},
},
};
Status.ValueChanged += displayStatus;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
this.colours = colours;
Status.ValueChanged += displayStatus;
}
protected override void LoadComplete()
{
base.LoadComplete();
Status.TriggerChange();
}
private void displayStatus(UserStatus status)