mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Create connections from HitObjects instead of DrawableHitObjects.
This commit is contained in:
@ -2,17 +2,18 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects.Drawables.Connections
|
namespace osu.Game.Modes.Osu.Objects.Drawables.Connections
|
||||||
{
|
{
|
||||||
public abstract class HitObjectConnection : Container
|
public abstract class ConnectionRenderer<T> : Container
|
||||||
|
where T : HitObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create drawables inside this container, connecting hit objects visually, for example with follow points.
|
/// Create drawables inside this container, connecting hit objects visually, for example with follow points.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="drawableHitObjects">The drawables hit objects to create connections for</param>
|
/// <param name="hitObjects">Hit objects to create connections for</param>
|
||||||
public abstract void AddConnections(IEnumerable<DrawableHitObject> drawableHitObjects);
|
public abstract void AddConnections(IEnumerable<T> hitObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,15 +2,13 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables.Connections;
|
using osu.Game.Modes.Osu.Objects.Drawables.Connections;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class FollowPointConnection : HitObjectConnection
|
public class FollowPointRenderer : ConnectionRenderer<OsuHitObject>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines how much space there is between points.
|
/// Determines how much space there is between points.
|
||||||
@ -22,18 +20,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int PreEmpt = 800;
|
public int PreEmpt = 800;
|
||||||
|
|
||||||
public override void AddConnections(IEnumerable<DrawableHitObject> drawableHitObjects)
|
public override void AddConnections(IEnumerable<OsuHitObject> hitObjects)
|
||||||
{
|
{
|
||||||
var hitObjects = new List<OsuHitObject>(drawableHitObjects
|
OsuHitObject prevHitObject = null;
|
||||||
.Select(d => (OsuHitObject)d.HitObject)
|
foreach (var currHitObject in hitObjects)
|
||||||
.OrderBy(h => h.StartTime));
|
|
||||||
|
|
||||||
for (int i = 1; i <= hitObjects.Count - 1; i++)
|
|
||||||
{
|
{
|
||||||
var prevHitObject = hitObjects[i - 1];
|
if (prevHitObject != null && !currHitObject.NewCombo && !(prevHitObject is Spinner) && !(currHitObject is Spinner))
|
||||||
var currHitObject = hitObjects[i];
|
|
||||||
|
|
||||||
if (!currHitObject.NewCombo && !(prevHitObject is Spinner) && !(currHitObject is Spinner))
|
|
||||||
{
|
{
|
||||||
Vector2 startPosition = prevHitObject.EndPosition;
|
Vector2 startPosition = prevHitObject.EndPosition;
|
||||||
Vector2 endPosition = currHitObject.Position;
|
Vector2 endPosition = currHitObject.Position;
|
||||||
@ -63,6 +55,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
prevHitObject = currHitObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,6 +9,7 @@ using osu.Game.Modes.Osu.Objects;
|
|||||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables.Connections;
|
using osu.Game.Modes.Osu.Objects.Drawables.Connections;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.UI
|
namespace osu.Game.Modes.Osu.UI
|
||||||
{
|
{
|
||||||
@ -16,7 +17,7 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
{
|
{
|
||||||
private Container approachCircles;
|
private Container approachCircles;
|
||||||
private Container judgementLayer;
|
private Container judgementLayer;
|
||||||
private HitObjectConnection hitObjectConnection;
|
private ConnectionRenderer<OsuHitObject> connectionLayer;
|
||||||
|
|
||||||
public override Vector2 Size
|
public override Vector2 Size
|
||||||
{
|
{
|
||||||
@ -38,15 +39,15 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
|
|
||||||
Add(new Drawable[]
|
Add(new Drawable[]
|
||||||
{
|
{
|
||||||
hitObjectConnection = new FollowPointConnection
|
connectionLayer = new FollowPointRenderer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Depth = 1,
|
Depth = 2,
|
||||||
},
|
},
|
||||||
judgementLayer = new Container
|
judgementLayer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Depth = 0,
|
Depth = 1,
|
||||||
},
|
},
|
||||||
approachCircles = new Container
|
approachCircles = new Container
|
||||||
{
|
{
|
||||||
@ -72,7 +73,9 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
|
|
||||||
public override void PostProcess()
|
public override void PostProcess()
|
||||||
{
|
{
|
||||||
hitObjectConnection.AddConnections(HitObjects.Children);
|
connectionLayer.AddConnections(HitObjects.Children
|
||||||
|
.Select(d => (OsuHitObject)d.HitObject)
|
||||||
|
.OrderBy(h => h.StartTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void judgement(DrawableHitObject h, JudgementInfo j)
|
private void judgement(DrawableHitObject h, JudgementInfo j)
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
<Compile Include="Objects\BezierApproximator.cs" />
|
<Compile Include="Objects\BezierApproximator.cs" />
|
||||||
<Compile Include="Objects\CircularArcApproximator.cs" />
|
<Compile Include="Objects\CircularArcApproximator.cs" />
|
||||||
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />
|
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />
|
||||||
<Compile Include="Objects\Drawables\Connections\HitObjectConnection.cs" />
|
<Compile Include="Objects\Drawables\Connections\ConnectionRenderer.cs" />
|
||||||
<Compile Include="Objects\Drawables\Connections\FollowPointConnection.cs" />
|
<Compile Include="Objects\Drawables\Connections\FollowPointRenderer.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" />
|
<Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
|
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
|
||||||
<Compile Include="Objects\Drawables\DrawableSlider.cs" />
|
<Compile Include="Objects\Drawables\DrawableSlider.cs" />
|
||||||
|
Reference in New Issue
Block a user