mirror of
https://github.com/ppy/osu.git
synced 2026-06-03 06:09:54 +08:00
Move result animation & sample implementation into selection panels
This commit is contained in:
@@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.Matchmaking
|
||||
|
||||
AddToggleStep("allow selection", value => panel!.AllowSelection = value);
|
||||
|
||||
AddStep("reveal beatmap", () => panel!.RevealBeatmap(CreateAPIBeatmap(), []));
|
||||
// AddStep("reveal beatmap", () => panel!.RevealBeatmap(CreateAPIBeatmap(), []));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
|
||||
private readonly Sample?[] spinSamples = new Sample?[5];
|
||||
private static readonly int[] spin_sample_sequence = [0, 1, 2, 3, 4, 2, 3, 4];
|
||||
private Sample? randomRevealSample;
|
||||
private Sample? resultSample;
|
||||
private Sample? swooshSample;
|
||||
private double? lastSamplePlayback;
|
||||
|
||||
@@ -81,8 +79,6 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
for (int i = 0; i < spinSamples.Length; i++)
|
||||
spinSamples[i] = audio.Samples.Get($@"Multiplayer/Matchmaking/Selection/roulette-{i}");
|
||||
|
||||
randomRevealSample = audio.Samples.Get(@"Multiplayer/Matchmaking/Selection/random-reveal");
|
||||
resultSample = audio.Samples.Get(@"Multiplayer/Matchmaking/Selection/roulette-result");
|
||||
swooshSample = audio.Samples.Get(@"SongSelect/options-pop-out");
|
||||
}
|
||||
|
||||
@@ -150,8 +146,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
|
||||
Debug.Assert(playlistItem != null);
|
||||
|
||||
randomRevealSample?.Play();
|
||||
randomPanel.RevealBeatmap(playlistItem.Beatmap, playlistItem.Mods);
|
||||
// TODO: make this happen via panel.PresentAsChosenBeatmap
|
||||
// randomPanel.RevealBeatmap(playlistItem.Beatmap, playlistItem.Mods);
|
||||
});
|
||||
|
||||
public void RollAndDisplayFinalBeatmap(long[] candidateItemIds, long finalItemId) => whenPanelsLoaded(() =>
|
||||
@@ -344,11 +340,9 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
{
|
||||
rollContainer.ChangeChildDepth(panel, float.MinValue);
|
||||
|
||||
panel.ShowChosenBorder();
|
||||
panel.MoveTo(Vector2.Zero, 1000, Easing.OutExpo)
|
||||
.ScaleTo(1.5f, 1000, Easing.OutExpo);
|
||||
var item = playlistItems[finalItem];
|
||||
|
||||
resultSample?.Play();
|
||||
panel.PresentAsChosenBeatmap(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +182,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
border.FadeOut(500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public abstract void PresentAsChosenBeatmap(MatchmakingPlaylistItem playlistItem);
|
||||
|
||||
public void FadeInAndEnterFromBelow(double duration = 500, double delay = 0, float distance = 200)
|
||||
{
|
||||
scaleContainer
|
||||
|
||||
+17
-1
@@ -2,8 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
{
|
||||
@@ -20,13 +24,25 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
}
|
||||
|
||||
private CardContent content = null!;
|
||||
private Sample? resultSample;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
resultSample = audio.Samples.Get(@"Multiplayer/Matchmaking/Selection/roulette-result");
|
||||
|
||||
Add(content = new CardContentBeatmap(beatmap, mods));
|
||||
}
|
||||
|
||||
public override void PresentAsChosenBeatmap(MatchmakingPlaylistItem playlistItem)
|
||||
{
|
||||
ShowChosenBorder();
|
||||
this.MoveTo(Vector2.Zero, 1000, Easing.OutExpo)
|
||||
.ScaleTo(1.5f, 1000, Easing.OutExpo);
|
||||
|
||||
resultSample?.Play();
|
||||
}
|
||||
|
||||
public override void AddUser(APIUser user)
|
||||
{
|
||||
content.SelectionOverlay.AddUser(user);
|
||||
|
||||
+15
-4
@@ -4,13 +4,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
{
|
||||
@@ -25,15 +26,21 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
private Drawable diceProxy = null!;
|
||||
private readonly List<APIUser> users = new List<APIUser>();
|
||||
|
||||
private Sample? resultSample;
|
||||
private Sample? swooshSample;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
resultSample = audio.Samples.Get(@"Multiplayer/Matchmaking/Selection/roulette-result");
|
||||
swooshSample = audio.Samples.Get(@"SongSelect/options-pop-out");
|
||||
|
||||
Add(content = new CardContentRandom());
|
||||
|
||||
AddInternal(diceProxy = content.Dice.CreateProxy());
|
||||
}
|
||||
|
||||
public void RevealBeatmap(APIBeatmap beatmap, Mod[] mods)
|
||||
public override void PresentAsChosenBeatmap(MatchmakingPlaylistItem playlistItem)
|
||||
{
|
||||
const double duration = 800;
|
||||
|
||||
@@ -48,6 +55,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
content.Dice.RotateTo(content.Dice.Rotation - 360 * 5, duration * 1.3f, Easing.Out);
|
||||
content.Label.FadeOut(200).Expire();
|
||||
|
||||
swooshSample?.Play();
|
||||
|
||||
Scheduler.AddDelayed(() =>
|
||||
{
|
||||
content.Expire();
|
||||
@@ -56,7 +65,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
new CardContentBeatmap(beatmap, mods),
|
||||
new CardContentBeatmap(playlistItem.Beatmap, playlistItem.Mods),
|
||||
flashLayer,
|
||||
});
|
||||
|
||||
@@ -64,6 +73,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
content.SelectionOverlay.AddUser(user);
|
||||
|
||||
flashLayer.FadeOutFromOne(1000, Easing.In);
|
||||
|
||||
resultSample?.Play();
|
||||
}, duration);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user