1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 03:33:22 +08:00

Move column changing logic to ManiaSelectionHandler

This commit is contained in:
smoogipoo 2021-05-13 20:13:50 +09:00
parent 1ae57a6105
commit 98e77a30d3
2 changed files with 7 additions and 42 deletions

View File

@ -59,8 +59,9 @@ namespace osu.Game.Rulesets.Mania.Edit
EditorBeatmap.PerformOnSelection(h => EditorBeatmap.PerformOnSelection(h =>
{ {
if (h is ManiaHitObject maniaObj) maniaPlayfield.Remove(h);
maniaObj.Column += columnDelta; ((ManiaHitObject)h).Column += columnDelta;
maniaPlayfield.Add(h);
}); });
} }
} }

View File

@ -139,49 +139,13 @@ namespace osu.Game.Rulesets.Mania.UI
NewResult += OnNewResult; NewResult += OnNewResult;
} }
public override void Add(HitObject hitObject) public override void Add(HitObject hitObject) => Columns.ElementAt(((ManiaHitObject)hitObject).Column - firstColumnIndex).Add(hitObject);
{
var maniaObject = (ManiaHitObject)hitObject;
int columnIndex = -1;
maniaObject.ColumnBindable.BindValueChanged(_ => public override bool Remove(HitObject hitObject) => Columns.ElementAt(((ManiaHitObject)hitObject).Column - firstColumnIndex).Remove(hitObject);
{
if (columnIndex != -1)
Columns.ElementAt(columnIndex).Remove(hitObject);
columnIndex = maniaObject.Column - firstColumnIndex; public override void Add(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column - firstColumnIndex).Add(h);
Columns.ElementAt(columnIndex).Add(hitObject);
}, true);
}
public override bool Remove(HitObject hitObject) public override bool Remove(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column - firstColumnIndex).Remove(h);
{
var maniaObject = (ManiaHitObject)hitObject;
int columnIndex = maniaObject.Column - firstColumnIndex;
return Columns.ElementAt(columnIndex).Remove(hitObject);
}
public override void Add(DrawableHitObject h)
{
var maniaObject = (ManiaHitObject)h.HitObject;
int columnIndex = -1;
maniaObject.ColumnBindable.BindValueChanged(_ =>
{
if (columnIndex != -1)
Columns.ElementAt(columnIndex).Remove(h);
columnIndex = maniaObject.Column - firstColumnIndex;
Columns.ElementAt(columnIndex).Add(h);
}, true);
}
public override bool Remove(DrawableHitObject h)
{
var maniaObject = (ManiaHitObject)h.HitObject;
int columnIndex = maniaObject.Column - firstColumnIndex;
return Columns.ElementAt(columnIndex).Remove(h);
}
public void Add(BarLine barline) => base.Add(new DrawableBarLine(barline)); public void Add(BarLine barline) => base.Add(new DrawableBarLine(barline));