mirror of
https://github.com/ppy/osu
synced 2025-01-11 08:39:31 +00: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,94 +117,115 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
Colour = ColourInfo.GradientHorizontal(colours.Background5, colours.Background5.Opacity(0.3f)),
|
||||
Width = 0.8f,
|
||||
},
|
||||
new Container
|
||||
new GridContainer
|
||||
{
|
||||
Name = @"Left details",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
Left = 20,
|
||||
Vertical = 5
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Children = new Drawable[]
|
||||
Content = new[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
new Container
|
||||
{
|
||||
new FillFlowContainer
|
||||
Name = @"Left details",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new RoomStatusPill
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
specialCategoryPill = new RoomSpecialCategoryPill
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
endDateInfo = new EndDateInfo
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
}
|
||||
Left = 20,
|
||||
Right = DrawableRoomParticipantsList.SHEAR_WIDTH,
|
||||
Vertical = 5
|
||||
},
|
||||
new FillFlowContainer
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Top = 3 },
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
new FillFlowContainer
|
||||
{
|
||||
new RoomNameText(),
|
||||
new RoomStatusText()
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new RoomStatusPill
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
specialCategoryPill = new RoomSpecialCategoryPill
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
endDateInfo = new EndDateInfo
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Top = 3 },
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new TruncatingSpriteText
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Font = OsuFont.GetFont(size: 28),
|
||||
Current = { BindTarget = Room.Name }
|
||||
},
|
||||
new RoomStatusText()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
ChildrenEnumerable = CreateBottomDetails()
|
||||
}
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Name = "Right content",
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(5),
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Right = 10,
|
||||
Vertical = 20,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
ButtonsContainer,
|
||||
drawableRoomParticipantsList = new DrawableRoomParticipantsList
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
NumberOfCircles = NumberOfAvatars
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
ChildrenEnumerable = CreateBottomDetails()
|
||||
}
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Name = "Right content",
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(5),
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Right = 10,
|
||||
Vertical = 20,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
ButtonsContainer,
|
||||
drawableRoomParticipantsList = new DrawableRoomParticipantsList
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
NumberOfCircles = NumberOfAvatars
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -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