mirror of
https://github.com/ppy/osu
synced 2024-12-15 11:25:29 +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;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
RoomLocalUserInfo localUserInfo;
|
||||||
RoomStatusInfo statusInfo;
|
RoomStatusInfo statusInfo;
|
||||||
ModeTypeInfo typeInfo;
|
ModeTypeInfo typeInfo;
|
||||||
ParticipantInfo participantInfo;
|
ParticipantInfo participantInfo;
|
||||||
|
|
||||||
InternalChild = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Spacing = new Vector2(0, 10),
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(0, 4),
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
roomName = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 30))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
},
|
||||||
|
participantInfo = new ParticipantInfo(),
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
statusInfo = new RoomStatusInfo(),
|
||||||
{
|
|
||||||
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(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
typeInfo = new ModeTypeInfo
|
typeInfo = new ModeTypeInfo
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomRight,
|
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()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (RoomID.Value == null)
|
if (RoomID.Value == null)
|
||||||
statusElements.ForEach(e => e.FadeOut());
|
statusElements.ForEach(e => e.FadeOut());
|
||||||
|
|
||||||
RoomID.BindValueChanged(id =>
|
RoomID.BindValueChanged(id =>
|
||||||
{
|
{
|
||||||
if (id.NewValue == null)
|
if (id.NewValue == null)
|
||||||
@ -83,7 +77,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
else
|
else
|
||||||
statusElements.ForEach(e => e.FadeIn(100));
|
statusElements.ForEach(e => e.FadeIn(100));
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
RoomName.BindValueChanged(name =>
|
RoomName.BindValueChanged(name =>
|
||||||
{
|
{
|
||||||
roomName.Text = name.NewValue ?? "No room selected";
|
roomName.Text = name.NewValue ?? "No room selected";
|
||||||
|
Loading…
Reference in New Issue
Block a user