mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 18:07:27 +09:00
Move nested playfields to the base Playfield
This commit is contained in:
parent
96242234c0
commit
c32ff9c43b
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -23,6 +24,13 @@ namespace osu.Game.Rulesets.UI
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container<Drawable> content;
|
private readonly Container<Drawable> content;
|
||||||
|
|
||||||
|
private List<Playfield> nestedPlayfields;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All the <see cref="Playfield"/>s nested inside this playfield.
|
||||||
|
/// </summary>
|
||||||
|
public IReadOnlyList<Playfield> NestedPlayfields => nestedPlayfields;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A container for keeping track of DrawableHitObjects.
|
/// A container for keeping track of DrawableHitObjects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -64,7 +72,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield.
|
/// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void PostProcess() { }
|
public virtual void PostProcess() => nestedPlayfields?.ForEach(p => p.PostProcess());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a DrawableHitObject to this Playfield.
|
/// Adds a DrawableHitObject to this Playfield.
|
||||||
@ -85,6 +93,19 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <param name="judgement">The <see cref="Judgement"/> that occurred.</param>
|
/// <param name="judgement">The <see cref="Judgement"/> that occurred.</param>
|
||||||
public virtual void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { }
|
public virtual void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
||||||
|
/// This does not add the <see cref="Playfield"/> to the draw hierarchy.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="otherPlayfield">The <see cref="Playfield"/> to add.</param>
|
||||||
|
protected void AddNested(Playfield otherPlayfield)
|
||||||
|
{
|
||||||
|
if (nestedPlayfields == null)
|
||||||
|
nestedPlayfields = new List<Playfield>();
|
||||||
|
|
||||||
|
nestedPlayfields.Add(otherPlayfield);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the container that will be used to contain the <see cref="DrawableHitObject"/>s.
|
/// Creates the container that will be used to contain the <see cref="DrawableHitObject"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -76,25 +75,6 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
HitObjects.TimeRange.BindTo(VisibleTimeRange);
|
HitObjects.TimeRange.BindTo(VisibleTimeRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ScrollingPlayfield> nestedPlayfields;
|
|
||||||
/// <summary>
|
|
||||||
/// All the <see cref="ScrollingPlayfield"/>s nested inside this playfield.
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<ScrollingPlayfield> NestedPlayfields => nestedPlayfields;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a <see cref="ScrollingPlayfield"/> to this playfield. The nested <see cref="ScrollingPlayfield"/>
|
|
||||||
/// will be given all of the same speed adjustments as this playfield.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="otherPlayfield">The <see cref="ScrollingPlayfield"/> to add.</param>
|
|
||||||
protected void AddNested(ScrollingPlayfield otherPlayfield)
|
|
||||||
{
|
|
||||||
if (nestedPlayfields == null)
|
|
||||||
nestedPlayfields = new List<ScrollingPlayfield>();
|
|
||||||
|
|
||||||
nestedPlayfields.Add(otherPlayfield);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (!UserScrollSpeedAdjustment)
|
if (!UserScrollSpeedAdjustment)
|
||||||
|
@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield playfield)
|
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield playfield)
|
||||||
{
|
{
|
||||||
playfield.HitObjects.AddControlPoint(controlPoint);
|
playfield.HitObjects.AddControlPoint(controlPoint);
|
||||||
playfield.NestedPlayfields.ForEach(p => applySpeedAdjustment(controlPoint, p));
|
playfield.NestedPlayfields?.OfType<ScrollingPlayfield>().ForEach(p => applySpeedAdjustment(controlPoint, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user