Better handling of nested playfields' hitobjects

This commit is contained in:
smoogipoo 2018-06-07 16:27:49 +09:00
parent 279a2844f0
commit d1b469c1a3
5 changed files with 10 additions and 95 deletions

View File

@ -1,28 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Screens.Edit.Screens.Compose.Layers;
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
{
public class ManiaHitObjectColumnMaskLayer : HitObjectMaskLayer
{
public readonly Column Column;
public ManiaHitObjectColumnMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, Column column)
: base(playfield, composer)
{
Column = column;
}
public void CreateMasks() => AddMasks();
protected override void AddMasks()
{
foreach (var obj in Column.HitObjects.Objects)
AddMask(obj);
}
}
}

View File

@ -1,28 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Screens.Compose.Layers;
using System.Collections.Generic;
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
{
public class ManiaHitObjectMaskLayer : HitObjectMaskLayer
{
public readonly List<ManiaHitObjectStageMaskLayer> Stages;
public ManiaHitObjectMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer)
: base(playfield, composer)
{
Stages = new List<ManiaHitObjectStageMaskLayer>();
foreach (var s in ((ManiaEditPlayfield)Playfield).Stages)
Stages.Add(new ManiaHitObjectStageMaskLayer((ManiaEditPlayfield)Playfield, Composer, s));
}
protected override void AddMasks()
{
foreach (var s in Stages)
s.CreateMasks();
}
}
}

View File

@ -1,31 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Screens.Edit.Screens.Compose.Layers;
using System.Collections.Generic;
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
{
public class ManiaHitObjectStageMaskLayer : HitObjectMaskLayer
{
public readonly List<ManiaHitObjectColumnMaskLayer> Columns;
public ManiaHitObjectStageMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, ManiaStage s)
: base(playfield, composer)
{
Columns = new List<ManiaHitObjectColumnMaskLayer>();
foreach (var c in s.Columns)
Columns.Add(new ManiaHitObjectColumnMaskLayer((ManiaEditPlayfield)Playfield, Composer, c));
}
public void CreateMasks() => AddMasks();
protected override void AddMasks()
{
foreach (var c in Columns)
c.CreateMasks();
}
}
}

View File

@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Edit.Screens.Compose.Layers;
using System.Collections.Generic;
namespace osu.Game.Rulesets.Mania.Edit
@ -41,7 +40,5 @@ namespace osu.Game.Rulesets.Mania.Edit
return base.CreateMaskFor(hitObject);
}
protected override HitObjectMaskLayer CreateHitObjectMaskLayer() => new ManiaHitObjectMaskLayer((ManiaEditPlayfield)RulesetContainer.Playfield, this);
}
}

View File

@ -55,13 +55,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
maskContainer,
dragLayer.CreateProxy()
};
AddMasks();
addMasks(Playfield);
}
protected virtual void AddMasks()
private void addMasks(Playfield playfield)
{
foreach (var obj in Playfield.HitObjects.Objects)
AddMask(obj);
foreach (var obj in playfield.HitObjects.Objects)
addMask(obj);
if (playfield.NestedPlayfields != null)
foreach (var p in playfield.NestedPlayfields)
addMasks(p);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -74,7 +79,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
/// Adds a mask for a <see cref="DrawableHitObject"/> which adds movement support.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create a mask for.</param>
protected void AddMask(DrawableHitObject hitObject)
private void addMask(DrawableHitObject hitObject)
{
var mask = Composer.CreateMaskFor(hitObject);
if (mask == null)