mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Re-layout match subscreen columns
This commit is contained in:
@ -1,32 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Screens.Multi.Match.Components;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Multiplayer
|
|
||||||
{
|
|
||||||
public class TestSceneMatchLeaderboardChatDisplay : MultiplayerTestScene
|
|
||||||
{
|
|
||||||
protected override bool UseOnlineAPI => true;
|
|
||||||
|
|
||||||
public TestSceneMatchLeaderboardChatDisplay()
|
|
||||||
{
|
|
||||||
Room.RoomID.Value = 7;
|
|
||||||
|
|
||||||
Add(new Container
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(500),
|
|
||||||
Child = new LeaderboardChatDisplay
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -58,6 +58,22 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddUntilStep("wait for load", () => match.IsCurrentScreen());
|
AddUntilStep("wait for load", () => match.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestLoadSimpleMatch()
|
||||||
|
{
|
||||||
|
AddStep("set room properties", () =>
|
||||||
|
{
|
||||||
|
Room.RoomID.Value = 1;
|
||||||
|
Room.Name.Value = "my awesome room";
|
||||||
|
Room.Host.Value = new User { Id = 2, Username = "peppy" };
|
||||||
|
Room.Playlist.Add(new PlaylistItem
|
||||||
|
{
|
||||||
|
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
||||||
|
Ruleset = { Value = new OsuRuleset().RulesetInfo }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPlaylistItemSelectedOnCreate()
|
public void TestPlaylistItemSelectedOnCreate()
|
||||||
{
|
{
|
||||||
|
@ -1,100 +0,0 @@
|
|||||||
// 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.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Multi.Match.Components
|
|
||||||
{
|
|
||||||
public class LeaderboardChatDisplay : MultiplayerComposite
|
|
||||||
{
|
|
||||||
private const double fade_duration = 100;
|
|
||||||
|
|
||||||
private readonly OsuTabControl<DisplayMode> tabControl;
|
|
||||||
private readonly MatchLeaderboard leaderboard;
|
|
||||||
private readonly MatchChatDisplay chat;
|
|
||||||
|
|
||||||
public LeaderboardChatDisplay()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
InternalChild = new GridContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Content = new[]
|
|
||||||
{
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
tabControl = new DisplayModeTabControl
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 24,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Top = 10 },
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
leaderboard = new MatchLeaderboard { RelativeSizeAxes = Axes.Both },
|
|
||||||
chat = new MatchChatDisplay
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
RowDimensions = new[]
|
|
||||||
{
|
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
tabControl.AccentColour = colours.Yellow;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
tabControl.Current.BindValueChanged(changeTab);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RefreshScores() => leaderboard.RefreshScores();
|
|
||||||
|
|
||||||
private void changeTab(ValueChangedEvent<DisplayMode> mode)
|
|
||||||
{
|
|
||||||
chat.FadeTo(mode.NewValue == DisplayMode.Chat ? 1 : 0, fade_duration);
|
|
||||||
leaderboard.FadeTo(mode.NewValue == DisplayMode.Leaderboard ? 1 : 0, fade_duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DisplayModeTabControl : OsuTabControl<DisplayMode>
|
|
||||||
{
|
|
||||||
protected override TabItem<DisplayMode> CreateTabItem(DisplayMode value) => base.CreateTabItem(value).With(d =>
|
|
||||||
{
|
|
||||||
d.Anchor = Anchor.Centre;
|
|
||||||
d.Origin = Anchor.Centre;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum DisplayMode
|
|
||||||
{
|
|
||||||
Leaderboard,
|
|
||||||
Chat,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Game.Screens.Multi.Components;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Multi.Match.Components
|
||||||
|
{
|
||||||
|
public class OverlinedChatDisplay : OverlinedDisplay
|
||||||
|
{
|
||||||
|
public OverlinedChatDisplay()
|
||||||
|
: base("Chat")
|
||||||
|
{
|
||||||
|
Content.Add(new MatchChatDisplay
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Game.Screens.Multi.Components;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Multi.Match.Components
|
||||||
|
{
|
||||||
|
public class OverlinedLeaderboard : OverlinedDisplay
|
||||||
|
{
|
||||||
|
private readonly MatchLeaderboard leaderboard;
|
||||||
|
|
||||||
|
public OverlinedLeaderboard()
|
||||||
|
: base("Leaderboard")
|
||||||
|
{
|
||||||
|
Content.Add(leaderboard = new MatchLeaderboard
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RefreshScores() => leaderboard.RefreshScores();
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Online.Multiplayer.GameTypes;
|
using osu.Game.Online.Multiplayer.GameTypes;
|
||||||
@ -52,8 +51,8 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
|
|
||||||
protected readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
protected readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
||||||
|
|
||||||
private LeaderboardChatDisplay leaderboardChatDisplay;
|
|
||||||
private MatchSettingsOverlay settingsOverlay;
|
private MatchSettingsOverlay settingsOverlay;
|
||||||
|
private OverlinedLeaderboard leaderboard;
|
||||||
|
|
||||||
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
||||||
|
|
||||||
@ -87,7 +86,10 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[] { new Components.Header() },
|
new Drawable[]
|
||||||
|
{
|
||||||
|
new Components.Header()
|
||||||
|
},
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -96,12 +98,6 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
Padding = new MarginPadding { Top = 65 },
|
Padding = new MarginPadding { Top = 65 },
|
||||||
Child = new GridContainer
|
Child = new GridContainer
|
||||||
{
|
{
|
||||||
ColumnDimensions = new[]
|
|
||||||
{
|
|
||||||
new Dimension(minSize: 160),
|
|
||||||
new Dimension(minSize: 360),
|
|
||||||
new Dimension(minSize: 400),
|
|
||||||
},
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
@ -111,49 +107,23 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Right = 5 },
|
Padding = new MarginPadding { Right = 5 },
|
||||||
Child = new OverlinedParticipants(Direction.Vertical) { RelativeSizeAxes = Axes.Both }
|
Child = new OverlinedPlaylist(true) // Temporarily always allow selection
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Horizontal = 5 },
|
|
||||||
Child = new GridContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
SelectedItem = { BindTarget = SelectedItem }
|
||||||
{
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
new OverlinedPlaylist(true) // Temporarily always allow selection
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
SelectedItem = { BindTarget = SelectedItem }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
new TriangleButton
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Text = "Show beatmap results",
|
|
||||||
Action = showBeatmapResults
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RowDimensions = new[]
|
|
||||||
{
|
|
||||||
new Dimension(),
|
|
||||||
new Dimension(GridSizeMode.Absolute, 5),
|
|
||||||
new Dimension(GridSizeMode.AutoSize)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Horizontal = 5 },
|
||||||
|
Child = leaderboard = new OverlinedLeaderboard { RelativeSizeAxes = Axes.Both },
|
||||||
|
},
|
||||||
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Left = 5 },
|
Padding = new MarginPadding { Left = 5 },
|
||||||
Child = leaderboardChatDisplay = new LeaderboardChatDisplay()
|
Child = new OverlinedChatDisplay { RelativeSizeAxes = Axes.Both }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -261,7 +231,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
case GameTypeTimeshift _:
|
case GameTypeTimeshift _:
|
||||||
multiplayer?.Push(new PlayerLoader(() => new TimeshiftPlayer(SelectedItem.Value)
|
multiplayer?.Push(new PlayerLoader(() => new TimeshiftPlayer(SelectedItem.Value)
|
||||||
{
|
{
|
||||||
Exited = () => leaderboardChatDisplay.RefreshScores()
|
Exited = () => leaderboard.RefreshScores()
|
||||||
}));
|
}));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -21,19 +21,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep("set test data", () => currentTestData = testData);
|
AddStep("set test data", () => currentTestData = testData);
|
||||||
});
|
});
|
||||||
|
|
||||||
public override void TearDownSteps()
|
|
||||||
{
|
|
||||||
AddUntilStep("test passed", () =>
|
|
||||||
{
|
|
||||||
if (currentTestData == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return currentTestData.PassCondition?.Invoke() ?? false;
|
|
||||||
});
|
|
||||||
|
|
||||||
base.TearDownSteps();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed override IBeatmap CreateBeatmap(RulesetInfo ruleset) => currentTestData?.Beatmap ?? base.CreateBeatmap(ruleset);
|
protected sealed override IBeatmap CreateBeatmap(RulesetInfo ruleset) => currentTestData?.Beatmap ?? base.CreateBeatmap(ruleset);
|
||||||
|
|
||||||
protected sealed override TestPlayer CreatePlayer(Ruleset ruleset)
|
protected sealed override TestPlayer CreatePlayer(Ruleset ruleset)
|
||||||
|
@ -33,8 +33,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public virtual void SetUpSteps() => addExitAllScreensStep();
|
public virtual void SetUpSteps() => addExitAllScreensStep();
|
||||||
|
|
||||||
[TearDownSteps]
|
// [TearDownSteps]
|
||||||
public virtual void TearDownSteps() => addExitAllScreensStep();
|
// public virtual void TearDownSteps() => addExitAllScreensStep();
|
||||||
|
|
||||||
private void addExitAllScreensStep()
|
private void addExitAllScreensStep()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user