mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Merge pull request #27424 from frenzibyte/taiko-slider-storyboard
Hide osu!taiko scroller when the beatmap has storyboard
This commit is contained in:
commit
4b3a5bde28
@ -0,0 +1,57 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Taiko.Skinning.Legacy;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests
|
||||||
|
{
|
||||||
|
public partial class TestSceneTaikoPlayerScroller : LegacySkinPlayerTestScene
|
||||||
|
{
|
||||||
|
private Storyboard? currentStoryboard;
|
||||||
|
|
||||||
|
protected override bool HasCustomSteps => true;
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestForegroundSpritesHidesScroller()
|
||||||
|
{
|
||||||
|
AddStep("load storyboard", () =>
|
||||||
|
{
|
||||||
|
currentStoryboard = new Storyboard();
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
currentStoryboard.GetLayer("Foreground").Add(new StoryboardSprite($"test{i}", Anchor.Centre, Vector2.Zero));
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateTest();
|
||||||
|
AddAssert("taiko scroller not present", () => !this.ChildrenOfType<LegacyTaikoScroller>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOverlaySpritesKeepsScroller()
|
||||||
|
{
|
||||||
|
AddStep("load storyboard", () =>
|
||||||
|
{
|
||||||
|
currentStoryboard = new Storyboard();
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
currentStoryboard.GetLayer("Overlay").Add(new StoryboardSprite($"test{i}", Anchor.Centre, Vector2.Zero));
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateTest();
|
||||||
|
AddAssert("taiko scroller present", () => this.ChildrenOfType<LegacyTaikoScroller>().Single().IsPresent);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Ruleset CreatePlayerRuleset() => new TaikoRuleset();
|
||||||
|
|
||||||
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard? storyboard = null)
|
||||||
|
=> base.CreateWorkingBeatmap(beatmap, currentStoryboard ?? storyboard);
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -22,7 +24,9 @@ using osu.Game.Rulesets.Timing;
|
|||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
@ -39,6 +43,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
|
[CanBeNull]
|
||||||
private SkinnableDrawable scroller;
|
private SkinnableDrawable scroller;
|
||||||
|
|
||||||
public DrawableTaikoRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
public DrawableTaikoRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||||
@ -48,16 +53,24 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
VisualisationMethod = ScrollVisualisationMethod.Overlapping;
|
VisualisationMethod = ScrollVisualisationMethod.Overlapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load()
|
private void load([CanBeNull] GameplayState gameplayState)
|
||||||
{
|
{
|
||||||
new BarLineGenerator<BarLine>(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar));
|
new BarLineGenerator<BarLine>(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar));
|
||||||
|
|
||||||
FrameStableComponents.Add(scroller = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Scroller), _ => Empty())
|
var spriteElements = gameplayState?.Storyboard.Layers.Where(l => l.Name != @"Overlay")
|
||||||
|
.SelectMany(l => l.Elements)
|
||||||
|
.OfType<StoryboardSprite>()
|
||||||
|
.DistinctBy(e => e.Path) ?? Enumerable.Empty<StoryboardSprite>();
|
||||||
|
|
||||||
|
if (spriteElements.Count() < 10)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
FrameStableComponents.Add(scroller = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Scroller), _ => Empty())
|
||||||
Depth = float.MaxValue
|
{
|
||||||
});
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Depth = float.MaxValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
KeyBindingInputManager.Add(new DrumTouchInputArea());
|
KeyBindingInputManager.Add(new DrumTouchInputArea());
|
||||||
}
|
}
|
||||||
@ -76,7 +89,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
var playfieldScreen = Playfield.ScreenSpaceDrawQuad;
|
var playfieldScreen = Playfield.ScreenSpaceDrawQuad;
|
||||||
scroller.Height = ToLocalSpace(playfieldScreen.TopLeft + new Vector2(0, playfieldScreen.Height / 20)).Y;
|
|
||||||
|
if (scroller != null)
|
||||||
|
scroller.Height = ToLocalSpace(playfieldScreen.TopLeft + new Vector2(0, playfieldScreen.Height / 20)).Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiplierControlPoint ControlPointAt(double time)
|
public MultiplierControlPoint ControlPointAt(double time)
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Rulesets.Judgements;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -40,6 +41,11 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public readonly ScoreProcessor ScoreProcessor;
|
public readonly ScoreProcessor ScoreProcessor;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The storyboard associated with the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Storyboard Storyboard;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether gameplay completed without the user failing.
|
/// Whether gameplay completed without the user failing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,7 +68,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>();
|
private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>();
|
||||||
|
|
||||||
public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList<Mod>? mods = null, Score? score = null, ScoreProcessor? scoreProcessor = null)
|
public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList<Mod>? mods = null, Score? score = null, ScoreProcessor? scoreProcessor = null, Storyboard? storyboard = null)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
@ -76,6 +82,7 @@ namespace osu.Game.Screens.Play
|
|||||||
};
|
};
|
||||||
Mods = mods ?? Array.Empty<Mod>();
|
Mods = mods ?? Array.Empty<Mod>();
|
||||||
ScoreProcessor = scoreProcessor ?? ruleset.CreateScoreProcessor();
|
ScoreProcessor = scoreProcessor ?? ruleset.CreateScoreProcessor();
|
||||||
|
Storyboard = storyboard ?? new Storyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -255,7 +255,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
|
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
|
||||||
Score.ScoreInfo.Mods = gameplayMods;
|
Score.ScoreInfo.Mods = gameplayMods;
|
||||||
|
|
||||||
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score, ScoreProcessor));
|
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score, ScoreProcessor, Beatmap.Value.Storyboard));
|
||||||
|
|
||||||
var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin);
|
var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin);
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ namespace osu.Game.Screens.Play
|
|||||||
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
||||||
|
|
||||||
private Drawable createUnderlayComponents() =>
|
private Drawable createUnderlayComponents() =>
|
||||||
DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard, GameplayState.Mods) { RelativeSizeAxes = Axes.Both };
|
DimmableStoryboard = new DimmableStoryboard(GameplayState.Storyboard, GameplayState.Mods) { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
private Drawable createGameplayComponents(IWorkingBeatmap working) => new ScalingContainer(ScalingMode.Gameplay)
|
private Drawable createGameplayComponents(IWorkingBeatmap working) => new ScalingContainer(ScalingMode.Gameplay)
|
||||||
{
|
{
|
||||||
@ -456,7 +456,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
RequestSkip = performUserRequestedSkip
|
RequestSkip = performUserRequestedSkip
|
||||||
},
|
},
|
||||||
skipOutroOverlay = new SkipOverlay(Beatmap.Value.Storyboard.LatestEventTime ?? 0)
|
skipOutroOverlay = new SkipOverlay(GameplayState.Storyboard.LatestEventTime ?? 0)
|
||||||
{
|
{
|
||||||
RequestSkip = () => progressToResults(false),
|
RequestSkip = () => progressToResults(false),
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
@ -1088,7 +1088,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
DimmableStoryboard.IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
DimmableStoryboard.IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
||||||
|
|
||||||
storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
|
storyboardReplacesBackground.Value = GameplayState.Storyboard.ReplacesBackground && GameplayState.Storyboard.HasDrawable;
|
||||||
|
|
||||||
foreach (var mod in GameplayState.Mods.OfType<IApplicableToPlayer>())
|
foreach (var mod in GameplayState.Mods.OfType<IApplicableToPlayer>())
|
||||||
mod.ApplyToPlayer(this);
|
mod.ApplyToPlayer(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user