mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 15:02:55 +08:00
Merge branch 'hitrenderer-improvements' into mania-timing-sections
This commit is contained in:
commit
5365dff698
@ -12,6 +12,7 @@ using Container = osu.Framework.Graphics.Containers.Container;
|
|||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Drawables
|
namespace osu.Game.Rulesets.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -24,6 +25,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
|
|
||||||
public TJudgement Judgement;
|
public TJudgement Judgement;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this hit object has been judged.
|
||||||
|
/// </summary>
|
||||||
|
public virtual bool Judged => (Judgement?.Result ?? HitResult.None) != HitResult.None;
|
||||||
|
|
||||||
protected abstract TJudgement CreateJudgement();
|
protected abstract TJudgement CreateJudgement();
|
||||||
|
|
||||||
protected abstract void UpdateState(ArmedState state);
|
protected abstract void UpdateState(ArmedState state);
|
||||||
@ -86,6 +92,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Color4 AccentColour { get; protected set; }
|
public Color4 AccentColour { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this hit object and all of its nested hit objects have been judged.
|
||||||
|
/// </summary>
|
||||||
|
public sealed override bool Judged => base.Judged && (NestedHitObjects?.All(h => h.Judged) ?? true);
|
||||||
|
|
||||||
protected DrawableHitObject(TObject hitObject)
|
protected DrawableHitObject(TObject hitObject)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
@ -97,7 +108,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// <returns>Whether a hit was processed.</returns>
|
/// <returns>Whether a hit was processed.</returns>
|
||||||
protected bool UpdateJudgement(bool userTriggered)
|
protected bool UpdateJudgement(bool userTriggered)
|
||||||
{
|
{
|
||||||
IPartialJudgement partial = Judgement as IPartialJudgement;
|
var partial = Judgement as IPartialJudgement;
|
||||||
|
|
||||||
// Never re-process non-partial hits
|
// Never re-process non-partial hits
|
||||||
if (Judgement.Result != HitResult.None && partial == null)
|
if (Judgement.Result != HitResult.None && partial == null)
|
||||||
@ -169,7 +180,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
|
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
|
||||||
|
|
||||||
protected IEnumerable<DrawableHitObject<TObject, TJudgement>> NestedHitObjects => nestedHitObjects;
|
protected IEnumerable<DrawableHitObject<TObject, TJudgement>> NestedHitObjects => nestedHitObjects;
|
||||||
|
|
||||||
protected void AddNested(DrawableHitObject<TObject, TJudgement> h)
|
protected void AddNested(DrawableHitObject<TObject, TJudgement> h)
|
||||||
|
@ -187,17 +187,19 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
|
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
public override IEnumerable<HitObject> Objects => Beatmap.HitObjects;
|
||||||
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None);
|
|
||||||
|
protected override bool AllObjectsJudged => drawableObjects.All(h => h.Judged);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The playfield.
|
/// The playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Playfield<TObject, TJudgement> Playfield;
|
protected Playfield<TObject, TJudgement> Playfield;
|
||||||
|
|
||||||
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
public override IEnumerable<HitObject> Objects => Beatmap.HitObjects;
|
private readonly List<DrawableHitObject<TObject, TJudgement>> drawableObjects = new List<DrawableHitObject<TObject, TJudgement>>();
|
||||||
|
|
||||||
protected HitRenderer(WorkingBeatmap beatmap)
|
protected HitRenderer(WorkingBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
@ -224,6 +226,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
private void loadObjects()
|
private void loadObjects()
|
||||||
{
|
{
|
||||||
|
drawableObjects.Capacity = Beatmap.HitObjects.Count;
|
||||||
|
|
||||||
foreach (TObject h in Beatmap.HitObjects)
|
foreach (TObject h in Beatmap.HitObjects)
|
||||||
{
|
{
|
||||||
var drawableObject = GetVisualRepresentation(h);
|
var drawableObject = GetVisualRepresentation(h);
|
||||||
@ -233,6 +237,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
drawableObject.OnJudgement += onJudgement;
|
drawableObject.OnJudgement += onJudgement;
|
||||||
|
|
||||||
|
drawableObjects.Add(drawableObject);
|
||||||
Playfield.Add(drawableObject);
|
Playfield.Add(drawableObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The HitObjects contained in this Playfield.
|
/// The HitObjects contained in this Playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
|
protected HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
|
||||||
|
|
||||||
internal Container<Drawable> ScaledContent;
|
internal Container<Drawable> ScaledContent;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user