Cover online-play room screens with context menu containers

This commit is contained in:
Salman Ahmed 2022-07-08 01:42:11 +03:00
parent 1d0f2e359a
commit 7b08501eaf
2 changed files with 242 additions and 232 deletions

View File

@ -15,6 +15,7 @@ using osu.Framework.Screens;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.Cursor;
using osu.Game.Online; using osu.Game.Online;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
@ -81,134 +82,138 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = 5, Vertical = 10 }, Padding = new MarginPadding { Horizontal = 5, Vertical = 10 },
Child = new GridContainer Child = new OsuContextMenuContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[] Child = new GridContainer
{ {
new Dimension(), RelativeSizeAxes = Axes.Both,
new Dimension(GridSizeMode.Absolute, 10), ColumnDimensions = new[]
new Dimension(),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{ {
// Participants column new Dimension(),
new GridContainer new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{ {
RelativeSizeAxes = Axes.Both, // Participants column
RowDimensions = new[] new GridContainer
{ {
new Dimension(GridSizeMode.AutoSize) RelativeSizeAxes = Axes.Both,
}, RowDimensions = new[]
Content = new[]
{
new Drawable[] { new ParticipantsListHeader() },
new Drawable[]
{ {
new ParticipantsList new Dimension(GridSizeMode.AutoSize)
{
RelativeSizeAxes = Axes.Both
},
}
}
},
// Spacer
null,
// Beatmap column
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[] { new OverlinedHeader("Beatmap") },
new Drawable[]
{
addItemButton = new AddItemButton
{
RelativeSizeAxes = Axes.X,
Height = 40,
Text = "Add item",
Action = () => OpenSongSelection()
},
}, },
null, Content = new[]
new Drawable[]
{ {
new MultiplayerPlaylist new Drawable[] { new ParticipantsListHeader() },
new Drawable[]
{ {
RelativeSizeAxes = Axes.Both, new ParticipantsList
RequestEdit = item => OpenSongSelection(item.ID)
}
},
new[]
{
UserModsSection = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 10 },
Alpha = 0,
Children = new Drawable[]
{ {
new OverlinedHeader("Extra mods"), RelativeSizeAxes = Axes.Both
new FillFlowContainer },
{ }
AutoSizeAxes = Axes.Both, }
Direction = FillDirection.Horizontal, },
Spacing = new Vector2(10, 0), // Spacer
Children = new Drawable[] null,
{ // Beatmap column
new UserModSelectButton new GridContainer
{ {
Anchor = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both,
Origin = Anchor.CentreLeft, Content = new[]
Width = 90, {
Text = "Select", new Drawable[] { new OverlinedHeader("Beatmap") },
Action = ShowUserModSelect, new Drawable[]
}, {
new ModDisplay addItemButton = new AddItemButton
{ {
Anchor = Anchor.CentreLeft, RelativeSizeAxes = Axes.X,
Origin = Anchor.CentreLeft, Height = 40,
Current = UserMods, Text = "Add item",
Scale = new Vector2(0.8f), Action = () => OpenSongSelection()
}, },
} },
}, null,
new Drawable[]
{
new MultiplayerPlaylist
{
RelativeSizeAxes = Axes.Both,
RequestEdit = item => OpenSongSelection(item.ID)
} }
}, },
new[]
{
UserModsSection = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 10 },
Alpha = 0,
Children = new Drawable[]
{
new OverlinedHeader("Extra mods"),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
new UserModSelectButton
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 90,
Text = "Select",
Action = ShowUserModSelect,
},
new ModDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = UserMods,
Scale = new Vector2(0.8f),
},
}
},
}
},
},
}, },
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, 5),
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
}
}, },
RowDimensions = new[] // Spacer
null,
// Main right column
new GridContainer
{ {
new Dimension(GridSizeMode.AutoSize), RelativeSizeAxes = Axes.Both,
new Dimension(GridSizeMode.AutoSize), Content = new[]
new Dimension(GridSizeMode.Absolute, 5), {
new Dimension(), new Drawable[] { new OverlinedHeader("Chat") },
new Dimension(GridSizeMode.AutoSize), new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } }
} },
}, RowDimensions = new[]
// Spacer {
null, new Dimension(GridSizeMode.AutoSize),
// Main right column new Dimension(),
new GridContainer }
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[] { new OverlinedHeader("Chat") },
new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } }
}, },
RowDimensions = new[] }
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
}
},
} }
} }
} }

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Graphics.Cursor;
using osu.Game.Input; using osu.Game.Input;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Components; using osu.Game.Screens.OnlinePlay.Components;
@ -75,151 +76,155 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = 5, Vertical = 10 }, Padding = new MarginPadding { Horizontal = 5, Vertical = 10 },
Child = new GridContainer Child = new OsuContextMenuContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[] Child = new GridContainer
{ {
new Dimension(), RelativeSizeAxes = Axes.Both,
new Dimension(GridSizeMode.Absolute, 10), ColumnDimensions = new[]
new Dimension(),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{ {
// Playlist items column new Dimension(),
new Container new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{ {
RelativeSizeAxes = Axes.Both, // Playlist items column
Padding = new MarginPadding { Right = 5 }, new Container
Child = new GridContainer {
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Right = 5 },
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[] { new OverlinedPlaylistHeader(), },
new Drawable[]
{
new DrawableRoomPlaylist
{
RelativeSizeAxes = Axes.Both,
Items = { BindTarget = Room.Playlist },
SelectedItem = { BindTarget = SelectedItem },
AllowSelection = true,
AllowShowingResults = true,
RequestResults = item =>
{
Debug.Assert(RoomId.Value != null);
ParentScreen?.Push(new PlaylistsResultsScreen(null, RoomId.Value.Value, item, false));
}
}
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
}
}
},
// Spacer
null,
// Middle column (mods and leaderboard)
new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Content = new[] Content = new[]
{ {
new Drawable[] { new OverlinedPlaylistHeader(), }, new[]
{
UserModsSection = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Alpha = 0,
Margin = new MarginPadding { Bottom = 10 },
Children = new Drawable[]
{
new OverlinedHeader("Extra mods"),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
new UserModSelectButton
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 90,
Text = "Select",
Action = ShowUserModSelect,
},
new ModDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = UserMods,
Scale = new Vector2(0.8f),
},
}
}
}
},
},
new Drawable[] new Drawable[]
{ {
new DrawableRoomPlaylist progressSection = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.X,
Items = { BindTarget = Room.Playlist }, AutoSizeAxes = Axes.Y,
SelectedItem = { BindTarget = SelectedItem }, Alpha = 0,
AllowSelection = true, Margin = new MarginPadding { Bottom = 10 },
AllowShowingResults = true, Direction = FillDirection.Vertical,
RequestResults = item => Children = new Drawable[]
{ {
Debug.Assert(RoomId.Value != null); new OverlinedHeader("Progress"),
ParentScreen?.Push(new PlaylistsResultsScreen(null, RoomId.Value.Value, item, false)); new RoomLocalUserInfo(),
} }
} },
}, },
new Drawable[]
{
new OverlinedHeader("Leaderboard")
},
new Drawable[] { leaderboard = new MatchLeaderboard { RelativeSizeAxes = Axes.Both }, },
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
}
},
// Spacer
null,
// Main right column
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[] { new OverlinedHeader("Chat") },
new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } }
}, },
RowDimensions = new[] RowDimensions = new[]
{ {
new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize),
new Dimension(), new Dimension(),
} }
}
},
// Spacer
null,
// Middle column (mods and leaderboard)
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new[]
{
UserModsSection = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Alpha = 0,
Margin = new MarginPadding { Bottom = 10 },
Children = new Drawable[]
{
new OverlinedHeader("Extra mods"),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
new UserModSelectButton
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 90,
Text = "Select",
Action = ShowUserModSelect,
},
new ModDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = UserMods,
Scale = new Vector2(0.8f),
},
}
}
}
},
},
new Drawable[]
{
progressSection = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Alpha = 0,
Margin = new MarginPadding { Bottom = 10 },
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OverlinedHeader("Progress"),
new RoomLocalUserInfo(),
}
},
},
new Drawable[]
{
new OverlinedHeader("Leaderboard")
},
new Drawable[] { leaderboard = new MatchLeaderboard { RelativeSizeAxes = Axes.Both }, },
}, },
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
}
},
// Spacer
null,
// Main right column
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[] { new OverlinedHeader("Chat") },
new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } }
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
}
}, },
}, },
}, }
} }
}; };