mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
commit
3136bbeabc
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Modes.Objects;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
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
|
||||||
|
where T : HitObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Hit objects to create connections for
|
||||||
|
/// </summary>
|
||||||
|
public abstract IEnumerable<T> HitObjects { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Osu.Objects.Drawables.Connections
|
||||||
|
{
|
||||||
|
public class FollowPoint : Container
|
||||||
|
{
|
||||||
|
public double StartTime;
|
||||||
|
public double EndTime;
|
||||||
|
public Vector2 EndPosition;
|
||||||
|
|
||||||
|
const float width = 8;
|
||||||
|
|
||||||
|
public FollowPoint()
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
Alpha = 0;
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
CornerRadius = width / 2;
|
||||||
|
EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Colour = Color4.White.Opacity(0.2f),
|
||||||
|
Radius = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Size = new Vector2(width),
|
||||||
|
BlendingMode = BlendingMode.Additive,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Delay(StartTime);
|
||||||
|
FadeIn(DrawableOsuHitObject.TIME_FADEIN);
|
||||||
|
ScaleTo(1.5f);
|
||||||
|
ScaleTo(1, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out);
|
||||||
|
MoveTo(EndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out);
|
||||||
|
|
||||||
|
Delay(EndTime - StartTime);
|
||||||
|
FadeOut(DrawableOsuHitObject.TIME_FADEIN);
|
||||||
|
|
||||||
|
Delay(DrawableOsuHitObject.TIME_FADEIN);
|
||||||
|
Expire(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Game.Modes.Osu.Objects.Drawables.Connections;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||||
|
{
|
||||||
|
public class FollowPointRenderer : ConnectionRenderer<OsuHitObject>
|
||||||
|
{
|
||||||
|
private int pointDistance = 32;
|
||||||
|
/// <summary>
|
||||||
|
/// Determines how much space there is between points.
|
||||||
|
/// </summary>
|
||||||
|
public int PointDistance
|
||||||
|
{
|
||||||
|
get { return pointDistance; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (pointDistance == value) return;
|
||||||
|
pointDistance = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int preEmpt = 800;
|
||||||
|
/// <summary>
|
||||||
|
/// Follow points to the next hitobject start appearing for this many milliseconds before an hitobject's end time.
|
||||||
|
/// </summary>
|
||||||
|
public int PreEmpt
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
foreach (var currHitObject in hitObjects)
|
||||||
|
{
|
||||||
|
if (prevHitObject != null && !currHitObject.NewCombo && !(prevHitObject is Spinner) && !(currHitObject is Spinner))
|
||||||
|
{
|
||||||
|
Vector2 startPosition = prevHitObject.EndPosition;
|
||||||
|
Vector2 endPosition = currHitObject.Position;
|
||||||
|
double startTime = prevHitObject.EndTime;
|
||||||
|
double endTime = currHitObject.StartTime;
|
||||||
|
|
||||||
|
Vector2 distanceVector = endPosition - startPosition;
|
||||||
|
int distance = (int)distanceVector.Length;
|
||||||
|
float rotation = (float)Math.Atan2(distanceVector.Y, distanceVector.X);
|
||||||
|
double duration = endTime - startTime;
|
||||||
|
|
||||||
|
for (int d = (int)(PointDistance * 1.5); d < distance - PointDistance; d += PointDistance)
|
||||||
|
{
|
||||||
|
float fraction = ((float)d / distance);
|
||||||
|
Vector2 pointStartPosition = startPosition + (fraction - 0.1f) * distanceVector;
|
||||||
|
Vector2 pointEndPosition = startPosition + fraction * distanceVector;
|
||||||
|
double fadeOutTime = startTime + fraction * duration;
|
||||||
|
double fadeInTime = fadeOutTime - PreEmpt;
|
||||||
|
|
||||||
|
Add(new FollowPoint()
|
||||||
|
{
|
||||||
|
StartTime = fadeInTime,
|
||||||
|
EndTime = fadeOutTime,
|
||||||
|
Position = pointStartPosition,
|
||||||
|
EndPosition = pointEndPosition,
|
||||||
|
Rotation = rotation,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prevHitObject = currHitObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,15 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// 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 osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Objects;
|
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.UI;
|
using osu.Game.Modes.UI;
|
||||||
using OpenTK;
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.UI
|
namespace osu.Game.Modes.Osu.UI
|
||||||
{
|
{
|
||||||
@ -15,6 +17,7 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
{
|
{
|
||||||
private Container approachCircles;
|
private Container approachCircles;
|
||||||
private Container judgementLayer;
|
private Container judgementLayer;
|
||||||
|
private ConnectionRenderer<OsuHitObject> connectionLayer;
|
||||||
|
|
||||||
public override Vector2 Size
|
public override Vector2 Size
|
||||||
{
|
{
|
||||||
@ -36,6 +39,11 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
|
|
||||||
Add(new Drawable[]
|
Add(new Drawable[]
|
||||||
{
|
{
|
||||||
|
connectionLayer = new FollowPointRenderer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Depth = 2,
|
||||||
|
},
|
||||||
judgementLayer = new Container
|
judgementLayer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -63,6 +71,13 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
base.Add(h);
|
base.Add(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PostProcess()
|
||||||
|
{
|
||||||
|
connectionLayer.HitObjects = 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)
|
||||||
{
|
{
|
||||||
HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, (OsuHitObject)h.HitObject);
|
HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, (OsuHitObject)h.HitObject);
|
||||||
|
@ -46,9 +46,12 @@
|
|||||||
<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\ConnectionRenderer.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" />
|
||||||
|
<Compile Include="Objects\Drawables\Connections\FollowPoint.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\ExplodePiece.cs" />
|
<Compile Include="Objects\Drawables\Pieces\ExplodePiece.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\FlashPiece.cs" />
|
<Compile Include="Objects\Drawables\Pieces\FlashPiece.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\GlowPiece.cs" />
|
<Compile Include="Objects\Drawables\Pieces\GlowPiece.cs" />
|
||||||
|
@ -83,6 +83,7 @@ namespace osu.Game.Modes.UI
|
|||||||
|
|
||||||
Playfield.Add(drawableObject);
|
Playfield.Add(drawableObject);
|
||||||
}
|
}
|
||||||
|
Playfield.PostProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onJudgement(DrawableHitObject o, JudgementInfo j) => TriggerOnJudgement(j);
|
private void onJudgement(DrawableHitObject o, JudgementInfo j) => TriggerOnJudgement(j);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// 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 osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
@ -32,6 +32,10 @@ namespace osu.Game.Modes.UI
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void PostProcess()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public class ScaledContainer : Container
|
public class ScaledContainer : Container
|
||||||
{
|
{
|
||||||
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
|
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
|
||||||
|
@ -237,11 +237,10 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
Delay(250, true);
|
Content.Delay(250);
|
||||||
Content.FadeIn(250);
|
Content.FadeIn(250);
|
||||||
|
|
||||||
Delay(500, true);
|
Delay(750);
|
||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
sourceClock.Start();
|
sourceClock.Start();
|
||||||
|
Loading…
Reference in New Issue
Block a user