1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +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 =>
{
if (h is ManiaHitObject maniaObj)
maniaObj.Column += columnDelta;
maniaPlayfield.Remove(h);
((ManiaHitObject)h).Column += columnDelta;
maniaPlayfield.Add(h);
});
}
}

View File

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