mirror of
https://github.com/ppy/osu.git
synced 2025-03-10 18:17:19 +08:00
Add basic subclassing and implement beatmap-start flow
This commit is contained in:
parent
28be0e31c2
commit
f0d6641adf
@ -78,8 +78,8 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("load screen", () => Stack.Push(new Screens.SelectV2.SongSelectV2()));
|
||||
AddUntilStep("wait for load", () => Stack.CurrentScreen is Screens.SelectV2.SongSelectV2 songSelect && songSelect.IsLoaded);
|
||||
AddStep("load screen", () => Stack.Push(new Screens.SelectV2.SoloSongSelect()));
|
||||
AddUntilStep("wait for load", () => Stack.CurrentScreen is Screens.SelectV2.SongSelect songSelect && songSelect.IsLoaded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
base.SetUpSteps();
|
||||
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||
AddWaitStep("wait", 5);
|
||||
PushAndConfirm(() => new Screens.SelectV2.SongSelectV2());
|
||||
PushAndConfirm(() => new Screens.SelectV2.SoloSongSelect());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -20,6 +20,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
[Cached]
|
||||
public partial class BeatmapCarousel : Carousel<BeatmapInfo>
|
||||
{
|
||||
public Action<BeatmapInfo>? RequestPresentBeatmap { private get; init; }
|
||||
|
||||
public const float SPACING = 5f;
|
||||
|
||||
private IBindableList<BeatmapSetInfo> detachedBeatmaps = null!;
|
||||
@ -128,6 +130,12 @@ namespace osu.Game.Screens.SelectV2
|
||||
return;
|
||||
|
||||
case BeatmapInfo beatmapInfo:
|
||||
if (ReferenceEquals(CurrentSelection, beatmapInfo))
|
||||
{
|
||||
RequestPresentBeatmap?.Invoke(beatmapInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentSelection = beatmapInfo;
|
||||
return;
|
||||
}
|
||||
|
28
osu.Game/Screens/SelectV2/SoloSongSelect.cs
Normal file
28
osu.Game/Screens/SelectV2/SoloSongSelect.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
public partial class SoloSongSelect : SongSelect
|
||||
{
|
||||
protected override bool OnStart()
|
||||
{
|
||||
this.Push(new PlayerLoaderV2(() => new SoloPlayer()));
|
||||
return false;
|
||||
}
|
||||
|
||||
private partial class PlayerLoaderV2 : PlayerLoader
|
||||
{
|
||||
public override bool ShowFooter => true;
|
||||
|
||||
public PlayerLoaderV2(Func<Player> createPlayer)
|
||||
: base(createPlayer)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
@ -11,7 +10,7 @@ using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Screens.Footer;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Screens.SelectV2.Footer;
|
||||
|
||||
namespace osu.Game.Screens.SelectV2
|
||||
@ -20,7 +19,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
/// This screen is intended to house all components introduced in the new song select design to add transitions and examine the overall look.
|
||||
/// This will be gradually built upon and ultimately replace <see cref="Select.SongSelect"/> once everything is in place.
|
||||
/// </summary>
|
||||
public partial class SongSelectV2 : OsuScreen
|
||||
public abstract partial class SongSelect : OsuScreen
|
||||
{
|
||||
private const float logo_scale = 0.4f;
|
||||
|
||||
@ -29,6 +28,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
|
||||
|
||||
private BeatmapCarousel carousel = null!;
|
||||
|
||||
public override bool ShowFooter => true;
|
||||
|
||||
[Resolved]
|
||||
@ -58,8 +59,9 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Bottom = ScreenFooter.HEIGHT },
|
||||
Child = new BeatmapCarousel
|
||||
Child = carousel = new BeatmapCarousel
|
||||
{
|
||||
RequestPresentBeatmap = _ => OnStart(),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
},
|
||||
@ -141,11 +143,17 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
logo.Action = () =>
|
||||
{
|
||||
this.Push(new PlayerLoaderV2(() => new SoloPlayer()));
|
||||
OnStart();
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a selection is made.
|
||||
/// </summary>
|
||||
/// <returns>If a resultant action occurred that takes the user away from SongSelect.</returns>
|
||||
protected abstract bool OnStart();
|
||||
|
||||
protected override void LogoSuspending(OsuLogo logo)
|
||||
{
|
||||
base.LogoSuspending(logo);
|
||||
@ -160,19 +168,22 @@ namespace osu.Game.Screens.SelectV2
|
||||
logo.FadeOut(120, Easing.Out);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the query to the search text box.
|
||||
/// </summary>
|
||||
/// <param name="query">The string to search.</param>
|
||||
public void Search(string query)
|
||||
{
|
||||
carousel.Filter(new FilterCriteria
|
||||
{
|
||||
// TODO: this should only set the text of the current criteria, not use a completely new criteria.
|
||||
SearchText = query,
|
||||
});
|
||||
}
|
||||
|
||||
private partial class SoloModSelectOverlay : UserModSelectOverlay
|
||||
{
|
||||
protected override bool ShowPresets => true;
|
||||
}
|
||||
|
||||
private partial class PlayerLoaderV2 : PlayerLoader
|
||||
{
|
||||
public override bool ShowFooter => true;
|
||||
|
||||
public PlayerLoaderV2(Func<Player> createPlayer)
|
||||
: base(createPlayer)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user