Hide status bar when Status is null

This commit is contained in:
DrabWeb 2017-05-24 00:45:56 -03:00
parent 247d8e9b21
commit 2be1b00a76
3 changed files with 14 additions and 8 deletions

View File

@ -51,6 +51,7 @@ namespace osu.Desktop.VisualTests.Tests
AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); });
AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); });
AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); }); AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); });
AddStep(@"null status", () => { flyte.Status.Value = null; });
} }
} }
} }

View File

@ -72,10 +72,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
}; };
break; break;
case APIState.Online: case APIState.Online:
UserPanel p;
Children = new Drawable[] Children = new Drawable[]
{ {
p = new UserPanel(api.LocalUser.Value) new UserPanel(api.LocalUser.Value)
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
@ -86,7 +85,6 @@ namespace osu.Game.Overlays.Settings.Sections.General
Action = api.Logout Action = api.Logout
} }
}; };
p.Status.Value = new UserStatusOnline();
break; break;
} }

View File

@ -23,6 +23,7 @@ namespace osu.Game.Users
private OsuColour colours; private OsuColour colours;
private readonly Container statusBar;
private readonly Box statusBg; private readonly Box statusBg;
private readonly OsuSpriteText statusMessage; private readonly OsuSpriteText statusMessage;
@ -30,7 +31,7 @@ namespace osu.Game.Users
public UserPanel(User user) public UserPanel(User user)
{ {
Height = height; Height = height - status_height;
Masking = true; Masking = true;
CornerRadius = 5; CornerRadius = 5;
EdgeEffect = new EdgeEffect EdgeEffect = new EdgeEffect
@ -54,8 +55,9 @@ namespace osu.Game.Users
}, },
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Top = content_padding, Bottom = status_height + content_padding, Left = content_padding, Right = content_padding }, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = content_padding, Left = content_padding, Right = content_padding },
Children = new Drawable[] Children = new Drawable[]
{ {
new UpdateableAvatar new UpdateableAvatar
@ -114,12 +116,12 @@ namespace osu.Game.Users
}, },
}, },
}, },
new Container statusBar = new Container
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = status_height, Alpha = 0f,
Children = new Drawable[] Children = new Drawable[]
{ {
statusBg = new Box statusBg = new Box
@ -174,6 +176,11 @@ namespace osu.Game.Users
private void displayStatus(UserStatus status) private void displayStatus(UserStatus status)
{ {
statusBar.ResizeHeightTo(status == null ? 0f : status_height, 500, EasingTypes.OutQuint);
statusBar.FadeTo(status == null ? 0f : 1f, 500, EasingTypes.OutQuint);
ResizeHeightTo(status == null ? height - status_height : height, 500, EasingTypes.OutQuint);
if (status == null) return;
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint); statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint);
statusMessage.Text = status.Message; statusMessage.Text = status.Message;
} }