1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 10:07:36 +08:00

Merge pull request #3744 from smoogipoo/fix-deletion-crash

Implement mania note deletion
This commit is contained in:
Dean Herbert 2018-11-26 14:28:39 +09:00 committed by GitHub
commit e94c5dfabe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 2 deletions

View File

@ -137,6 +137,13 @@ namespace osu.Game.Rulesets.Mania.UI
HitObjectContainer.Add(hitObject);
}
public override void Remove(DrawableHitObject h)
{
h.OnNewResult -= OnNewResult;
HitObjectContainer.Remove(h);
}
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
{
if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements)

View File

@ -52,6 +52,8 @@ namespace osu.Game.Rulesets.Mania.UI
public override void Add(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h);
public override void Remove(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Remove(h);
public void Add(BarLine barline) => stages.ForEach(s => s.Add(barline));
private ManiaStage getStageByColumn(int column)

View File

@ -157,6 +157,15 @@ namespace osu.Game.Rulesets.Mania.UI
h.OnNewResult += OnNewResult;
}
public override void Remove(DrawableHitObject h)
{
var maniaObject = (ManiaHitObject)h.HitObject;
int columnIndex = maniaObject.Column - firstColumnIndex;
Columns.ElementAt(columnIndex).Remove(h);
h.OnNewResult -= OnNewResult;
}
public void Add(BarLine barline) => base.Add(new DrawableBarLine(barline));
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)

View File

@ -91,8 +91,8 @@ namespace osu.Game.Rulesets.Edit
// Process the beatmap
var processor = ruleset.CreateBeatmapProcessor(beatmap);
processor.PreProcess();
processor.PostProcess();
processor?.PreProcess();
processor?.PostProcess();
// Remove visual representation
var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject);