mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:42:58 +08:00
Merge pull request #23906 from Joehuu/truncate-room-name
Truncate online play drawable room name text
This commit is contained in:
commit
6f0c8c286b
@ -117,6 +117,18 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
Colour = ColourInfo.GradientHorizontal(colours.Background5, colours.Background5.Opacity(0.3f)),
|
||||
Width = 0.8f,
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Name = @"Left details",
|
||||
@ -124,6 +136,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Left = 20,
|
||||
Right = DrawableRoomParticipantsList.SHEAR_WIDTH,
|
||||
Vertical = 5
|
||||
},
|
||||
Children = new Drawable[]
|
||||
@ -167,7 +180,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new RoomNameText(),
|
||||
new TruncatingSpriteText
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Font = OsuFont.GetFont(size: 28),
|
||||
Current = { BindTarget = Room.Name }
|
||||
},
|
||||
new RoomStatusText()
|
||||
}
|
||||
}
|
||||
@ -208,6 +226,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
passwordIcon = new PasswordProtectedIcon { Alpha = 0 }
|
||||
},
|
||||
},
|
||||
@ -301,23 +322,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
return pills;
|
||||
}
|
||||
|
||||
private partial class RoomNameText : OsuSpriteText
|
||||
{
|
||||
[Resolved(typeof(Room), nameof(Online.Rooms.Room.Name))]
|
||||
private Bindable<string> name { get; set; }
|
||||
|
||||
public RoomNameText()
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 28);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Current = name;
|
||||
}
|
||||
}
|
||||
|
||||
private partial class RoomStatusText : OnlinePlayComposite
|
||||
{
|
||||
[Resolved]
|
||||
@ -333,7 +337,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Width = 0.5f;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -24,8 +24,14 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
public partial class DrawableRoomParticipantsList : OnlinePlayComposite
|
||||
{
|
||||
public const float SHEAR_WIDTH = 12f;
|
||||
|
||||
private const float avatar_size = 36;
|
||||
|
||||
private const float height = 60f;
|
||||
|
||||
private static readonly Vector2 shear = new Vector2(SHEAR_WIDTH / height, 0);
|
||||
|
||||
private FillFlowContainer<CircularAvatar> avatarFlow;
|
||||
|
||||
private CircularAvatar hostAvatar;
|
||||
@ -36,7 +42,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
public DrawableRoomParticipantsList()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
Height = 60;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -49,7 +55,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = 10,
|
||||
Shear = new Vector2(0.2f, 0),
|
||||
Shear = shear,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -98,7 +104,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = 10,
|
||||
Shear = new Vector2(0.2f, 0),
|
||||
Shear = shear,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
Loading…
Reference in New Issue
Block a user