mirror of
https://github.com/ppy/osu
synced 2024-12-16 03:45:46 +00:00
Show maximum attempt count in room display (when not unlimited)
This commit is contained in:
parent
9b209d67dc
commit
fc3adaf612
50
osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs
Normal file
50
osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user