mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 12:42:54 +08:00
Replace AddConnections by a HitObjects property.
This commit is contained in:
parent
de2791e179
commit
daa14bfec8
@ -7,13 +7,15 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects.Drawables.Connections
|
namespace osu.Game.Modes.Osu.Objects.Drawables.Connections
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Connects hit objects visually, for example with follow points.
|
||||||
|
/// </summary>
|
||||||
public abstract class ConnectionRenderer<T> : Container
|
public abstract class ConnectionRenderer<T> : Container
|
||||||
where T : HitObject
|
where T : HitObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create drawables inside this container, connecting hit objects visually, for example with follow points.
|
/// Hit objects to create connections for
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObjects">Hit objects to create connections for</param>
|
public abstract IEnumerable<T> HitObjects { get; set; }
|
||||||
public abstract void AddConnections(IEnumerable<T> hitObjects);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,18 +10,53 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public class FollowPointRenderer : ConnectionRenderer<OsuHitObject>
|
public class FollowPointRenderer : ConnectionRenderer<OsuHitObject>
|
||||||
{
|
{
|
||||||
|
private int pointDistance = 32;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines how much space there is between points.
|
/// Determines how much space there is between points.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PointDistance = 32;
|
public int PointDistance
|
||||||
|
{
|
||||||
|
get { return pointDistance; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (pointDistance == value) return;
|
||||||
|
pointDistance = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int preEmpt = 800;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Follow points to the next hitobject start appearing for this many milliseconds before an hitobject's end time.
|
/// Follow points to the next hitobject start appearing for this many milliseconds before an hitobject's end time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PreEmpt = 800;
|
public int PreEmpt
|
||||||
|
|
||||||
public override void AddConnections(IEnumerable<OsuHitObject> hitObjects)
|
|
||||||
{
|
{
|
||||||
|
get { return preEmpt; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (preEmpt == value) return;
|
||||||
|
preEmpt = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<OsuHitObject> hitObjects;
|
||||||
|
public override IEnumerable<OsuHitObject> HitObjects
|
||||||
|
{
|
||||||
|
get { return hitObjects; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hitObjects = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void update()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
if (hitObjects == null)
|
||||||
|
return;
|
||||||
|
|
||||||
OsuHitObject prevHitObject = null;
|
OsuHitObject prevHitObject = null;
|
||||||
foreach (var currHitObject in hitObjects)
|
foreach (var currHitObject in hitObjects)
|
||||||
{
|
{
|
||||||
|
@ -73,9 +73,9 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
|
|
||||||
public override void PostProcess()
|
public override void PostProcess()
|
||||||
{
|
{
|
||||||
connectionLayer.AddConnections(HitObjects.Children
|
connectionLayer.HitObjects = HitObjects.Children
|
||||||
.Select(d => (OsuHitObject)d.HitObject)
|
.Select(d => (OsuHitObject)d.HitObject)
|
||||||
.OrderBy(h => h.StartTime));
|
.OrderBy(h => h.StartTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void judgement(DrawableHitObject h, JudgementInfo j)
|
private void judgement(DrawableHitObject h, JudgementInfo j)
|
||||||
|
Loading…
Reference in New Issue
Block a user