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

Show maximum attempt count in room display (when not unlimited)

This commit is contained in:
Dean Herbert 2021-02-02 18:44:35 +09:00
parent 9b209d67dc
commit fc3adaf612
2 changed files with 66 additions and 23 deletions

View File

@ -0,0 +1,50 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.OnlinePlay.Components
{
public class RoomLocalUserInfo : OnlinePlayComposite
{
private OsuSpriteText attemptDisplay;
public RoomLocalUserInfo()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
attemptDisplay = new OsuSpriteText
{
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14)
},
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
MaxAttempts.BindValueChanged(attempts =>
{
attemptDisplay.Text = attempts.NewValue == null
? string.Empty
: $"Maximum attempts: {attempts.NewValue:N0}";
}, true);
}
}
}

View File

@ -20,41 +20,34 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
AutoSizeAxes = Axes.Y;
RoomLocalUserInfo localUserInfo;
RoomStatusInfo statusInfo;
ModeTypeInfo typeInfo;
ParticipantInfo participantInfo;
InternalChild = new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(0, 10),
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 4),
Children = new Drawable[]
{
roomName = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 30))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
participantInfo = new ParticipantInfo(),
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
roomName = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 30))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
statusInfo = new RoomStatusInfo(),
}
},
statusInfo = new RoomStatusInfo(),
typeInfo = new ModeTypeInfo
{
Anchor = Anchor.BottomRight,
@ -62,20 +55,21 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
}
}
},
participantInfo = new ParticipantInfo(),
localUserInfo = new RoomLocalUserInfo(),
}
};
statusElements.AddRange(new Drawable[] { statusInfo, typeInfo, participantInfo });
statusElements.AddRange(new Drawable[]
{
statusInfo, typeInfo, participantInfo, localUserInfo
});
}
protected override void LoadComplete()
{
base.LoadComplete();
if (RoomID.Value == null)
statusElements.ForEach(e => e.FadeOut());
RoomID.BindValueChanged(id =>
{
if (id.NewValue == null)
@ -83,7 +77,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
else
statusElements.ForEach(e => e.FadeIn(100));
}, true);
RoomName.BindValueChanged(name =>
{
roomName.Text = name.NewValue ?? "No room selected";