mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Make DrawableStoryboardSample a SkinnableSound
Allows sharing pause logic with gameplay samples.
This commit is contained in:
@ -191,9 +191,25 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
dependencies.CacheAs(gameplayBeatmap);
|
||||
|
||||
addUnderlayComponents(GameplayClockContainer);
|
||||
addGameplayComponents(GameplayClockContainer, Beatmap.Value, playableBeatmap);
|
||||
addOverlayComponents(GameplayClockContainer, Beatmap.Value);
|
||||
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
|
||||
|
||||
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
|
||||
// full access to all skin sources.
|
||||
var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider, playableBeatmap));
|
||||
|
||||
// load the skinning hierarchy first.
|
||||
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
|
||||
GameplayClockContainer.Add(beatmapSkinProvider.WithChild(rulesetSkinProvider));
|
||||
|
||||
rulesetSkinProvider.AddRange(new[]
|
||||
{
|
||||
// underlay and gameplay should have access the to skinning sources.
|
||||
createUnderlayComponents(),
|
||||
createGameplayComponents(Beatmap.Value, playableBeatmap)
|
||||
});
|
||||
|
||||
// add the overlay components as a separate step as they proxy some elements from the above underlay/gameplay components.
|
||||
GameplayClockContainer.Add(createOverlayComponents(Beatmap.Value));
|
||||
|
||||
if (!DrawableRuleset.AllowGameplayOverlays)
|
||||
{
|
||||
@ -238,45 +254,31 @@ namespace osu.Game.Screens.Play
|
||||
breakTracker.IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
|
||||
}
|
||||
|
||||
private void addUnderlayComponents(Container target)
|
||||
private Drawable createUnderlayComponents() =>
|
||||
DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
private Drawable createGameplayComponents(WorkingBeatmap working, IBeatmap playableBeatmap) => new ScalingContainer(ScalingMode.Gameplay)
|
||||
{
|
||||
target.Add(DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
|
||||
private void addGameplayComponents(Container target, WorkingBeatmap working, IBeatmap playableBeatmap)
|
||||
{
|
||||
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(working.Skin);
|
||||
|
||||
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
|
||||
// full access to all skin sources.
|
||||
var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider, playableBeatmap));
|
||||
|
||||
// load the skinning hierarchy first.
|
||||
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
|
||||
target.Add(new ScalingContainer(ScalingMode.Gameplay)
|
||||
.WithChild(beatmapSkinProvider
|
||||
.WithChild(target = rulesetSkinProvider)));
|
||||
|
||||
target.AddRange(new Drawable[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
DrawableRuleset,
|
||||
DrawableRuleset.With(r =>
|
||||
r.FrameStableComponents.Children = new Drawable[]
|
||||
{
|
||||
ScoreProcessor,
|
||||
HealthProcessor,
|
||||
breakTracker = new BreakTracker(DrawableRuleset.GameplayStartTime, ScoreProcessor)
|
||||
{
|
||||
Breaks = working.Beatmap.Breaks
|
||||
}
|
||||
}),
|
||||
new ComboEffects(ScoreProcessor)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
DrawableRuleset.FrameStableComponents.AddRange(new Drawable[]
|
||||
{
|
||||
ScoreProcessor,
|
||||
HealthProcessor,
|
||||
breakTracker = new BreakTracker(DrawableRuleset.GameplayStartTime, ScoreProcessor)
|
||||
{
|
||||
Breaks = working.Beatmap.Breaks
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addOverlayComponents(Container target, WorkingBeatmap working)
|
||||
private Drawable createOverlayComponents(WorkingBeatmap working) => new Container
|
||||
{
|
||||
target.AddRange(new[]
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
DimmableStoryboard.OverlayLayerContainer.CreateProxy(),
|
||||
BreakOverlay = new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
|
||||
@ -342,8 +344,8 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
},
|
||||
failAnimation = new FailAnimation(DrawableRuleset) { OnComplete = onFailComplete, },
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)
|
||||
{
|
||||
|
Reference in New Issue
Block a user