1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 18:27:19 +08:00

Small refactorings

This commit is contained in:
smoogipoo 2020-11-12 12:55:42 +09:00
parent a8929b0764
commit d7d77460fb
2 changed files with 22 additions and 3 deletions

View File

@ -233,6 +233,13 @@ namespace osu.Game.Rulesets.UI
ResumeOverlay?.Hide();
}
/// <summary>
/// Adds a <see cref="HitObject"/> to this <see cref="DrawableRuleset"/>.
/// </summary>
/// <remarks>
/// This does not add the <see cref="HitObject"/> to the beatmap.
/// </remarks>
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
public void AddHitObject(TObject hitObject)
{
if (PoolHitObjects)
@ -241,6 +248,13 @@ namespace osu.Game.Rulesets.UI
Playfield.Add(CreateDrawableRepresentation(hitObject));
}
/// <summary>
/// Removes a <see cref="HitObject"/> from this <see cref="HitObject"/>.
/// </summary>
/// <remarks>
/// This does not remove the <see cref="HitObject"/> from the beatmap.
/// </remarks>
/// <param name="hitObject">The <see cref="HitObject"/> to remove.</param>
public void RemoveHitObject(TObject hitObject)
{
if (PoolHitObjects)
@ -380,7 +394,6 @@ namespace osu.Game.Rulesets.UI
/// Displays an interactive ruleset gameplay instance.
/// <remarks>
/// This type is required only for adding non-generic type to the draw hierarchy.
/// Once IDrawable is a thing, this can also become an interface.
/// </remarks>
/// </summary>
[Cached(typeof(DrawableRuleset))]

View File

@ -100,10 +100,11 @@ namespace osu.Game.Rulesets.UI
public virtual void Add(DrawableHitObject hitObject)
{
bindStartTime(hitObject);
AddInternal(hitObject);
hitObject.OnNewResult += onNewResult;
hitObject.OnRevertResult += onRevertResult;
AddInternal(hitObject);
}
public virtual bool Remove(DrawableHitObject hitObject)
@ -143,7 +144,12 @@ namespace osu.Game.Rulesets.UI
unbindAllStartTimes();
}
protected override bool CheckChildrenLife() => base.CheckChildrenLife() | lifetimeManager.Update(Time.Current, Time.Current);
protected override bool CheckChildrenLife()
{
bool aliveChanged = base.CheckChildrenLife();
aliveChanged |= lifetimeManager.Update(Time.Current, Time.Current);
return aliveChanged;
}
private void onNewResult(DrawableHitObject d, JudgementResult r) => NewResult?.Invoke(d, r);
private void onRevertResult(DrawableHitObject d, JudgementResult r) => RevertResult?.Invoke(d, r);