1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Hide taiko scroller when beatmap has storyboard

This commit is contained in:
Salman Ahmed 2024-02-29 05:39:59 +03:00
parent 7f5f3804f1
commit 847a8ead4f

View File

@ -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(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);
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)