1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-31 23:50:29 +08:00

Merge pull request #17069 from hlysine/fix-IUpdatableByPlayfield

Change `IUpdatableByPlayfield.Update` to be called by the main playfield only
This commit is contained in:
Dean Herbert
2022-03-04 11:58:00 +09:00
committed by GitHub
Unverified
2 changed files with 19 additions and 1 deletions
@@ -5,8 +5,19 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// An interface for <see cref="Mod"/>s that are updated every frame by a <see cref="Playfield"/>.
/// </summary>
public interface IUpdatableByPlayfield : IApplicableMod
{
/// <summary>
/// Update this <see cref="Mod"/>.
/// </summary>
/// <param name="playfield">The main <see cref="Playfield"/></param>
/// <remarks>
/// This method is called once per frame during gameplay by the main <see cref="Playfield"/> only.
/// To access nested <see cref="Playfield"/>s, use <see cref="Playfield.NestedPlayfields"/>.
/// </remarks>
void Update(Playfield playfield);
}
}
+8 -1
View File
@@ -79,6 +79,11 @@ namespace osu.Game.Rulesets.UI
private readonly List<Playfield> nestedPlayfields = new List<Playfield>();
/// <summary>
/// Whether this <see cref="Playfield"/> is nested in another <see cref="Playfield"/>.
/// </summary>
public bool IsNested { get; private set; }
/// <summary>
/// Whether judgements should be displayed by this and and all nested <see cref="Playfield"/>s.
/// </summary>
@@ -206,6 +211,8 @@ namespace osu.Game.Rulesets.UI
/// <param name="otherPlayfield">The <see cref="Playfield"/> to add.</param>
protected void AddNested(Playfield otherPlayfield)
{
otherPlayfield.IsNested = true;
otherPlayfield.DisplayJudgements.BindTo(DisplayJudgements);
otherPlayfield.NewResult += (d, r) => NewResult?.Invoke(d, r);
@@ -229,7 +236,7 @@ namespace osu.Game.Rulesets.UI
{
base.Update();
if (mods != null)
if (!IsNested && mods != null)
{
foreach (var mod in mods)
{