Implement an intermediary EditRulesetContainer

This commit is contained in:
smoogipoo
2018-10-03 15:36:14 +09:00
parent 10d0e2fef1
commit 540a010fbb
11 changed files with 136 additions and 35 deletions

View File

@ -291,17 +291,7 @@ namespace osu.Game.Rulesets.UI
private void loadObjects()
{
foreach (TObject h in Beatmap.HitObjects)
{
var drawableObject = GetVisualRepresentation(h);
if (drawableObject == null)
continue;
drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r);
drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r);
Playfield.Add(drawableObject);
}
AddRepresentation(h);
Playfield.PostProcess();
@ -309,6 +299,23 @@ namespace osu.Game.Rulesets.UI
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
}
/// <summary>
/// Creates and adds the visual representation of a <see cref="TObject"/> to this <see cref="RulesetContainer{TObject}"/>.
/// </summary>
/// <param name="hitObject">The <see cref="TObject"/> to add the visual representation for.</param>
internal void AddRepresentation(TObject hitObject)
{
var drawableObject = GetVisualRepresentation(hitObject);
if (drawableObject == null)
return;
drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r);
drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r);
Playfield.Add(drawableObject);
}
protected override void Update()
{
base.Update();
@ -334,7 +341,7 @@ namespace osu.Game.Rulesets.UI
/// </summary>
/// <param name="h">The HitObject to make drawable.</param>
/// <returns>The DrawableHitObject.</returns>
protected abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
public abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
}
/// <summary>