mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Move swells on top of the playfield when they reach the hit target.
This commit is contained in:
@ -19,6 +19,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
{
|
{
|
||||||
public class DrawableSwell : DrawableTaikoHitObject
|
public class DrawableSwell : DrawableTaikoHitObject
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when the swell has reached the hit target, i.e. when CurrentTime >= StartTime.
|
||||||
|
/// This is only ever invoked once.
|
||||||
|
/// </summary>
|
||||||
|
public event Action OnStart;
|
||||||
|
|
||||||
private const float target_ring_thick_border = 4f;
|
private const float target_ring_thick_border = 4f;
|
||||||
private const float target_ring_thin_border = 1f;
|
private const float target_ring_thin_border = 1f;
|
||||||
private const float target_ring_scale = 5f;
|
private const float target_ring_scale = 5f;
|
||||||
@ -35,6 +41,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
private readonly CircularContainer targetRing;
|
private readonly CircularContainer targetRing;
|
||||||
private readonly CircularContainer innerRing;
|
private readonly CircularContainer innerRing;
|
||||||
|
|
||||||
|
private bool hasStarted;
|
||||||
|
|
||||||
public DrawableSwell(Swell swell)
|
public DrawableSwell(Swell swell)
|
||||||
: base(swell)
|
: base(swell)
|
||||||
{
|
{
|
||||||
@ -176,7 +184,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
|
|
||||||
protected override void UpdateScrollPosition(double time)
|
protected override void UpdateScrollPosition(double time)
|
||||||
{
|
{
|
||||||
base.UpdateScrollPosition(Math.Min(time, HitObject.StartTime));
|
// Make the swell stop at the hit target
|
||||||
|
double t = Math.Min(HitObject.StartTime, time);
|
||||||
|
|
||||||
|
if (t == HitObject.StartTime && !hasStarted)
|
||||||
|
{
|
||||||
|
OnStart?.Invoke();
|
||||||
|
hasStarted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.UpdateScrollPosition(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool HandleKeyPress(Key key)
|
protected override bool HandleKeyPress(Key key)
|
||||||
|
@ -14,6 +14,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Modes.Taiko.Objects.Drawable;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.UI
|
namespace osu.Game.Modes.Taiko.UI
|
||||||
{
|
{
|
||||||
@ -52,7 +53,7 @@ namespace osu.Game.Modes.Taiko.UI
|
|||||||
private readonly Container<DrawableTaikoJudgement> judgementContainer;
|
private readonly Container<DrawableTaikoJudgement> judgementContainer;
|
||||||
|
|
||||||
private readonly Container hitObjectContainer;
|
private readonly Container hitObjectContainer;
|
||||||
//private Container topLevelHitContainer;
|
private Container topLevelHitContainer;
|
||||||
private readonly Container leftBackgroundContainer;
|
private readonly Container leftBackgroundContainer;
|
||||||
private readonly Container rightBackgroundContainer;
|
private readonly Container rightBackgroundContainer;
|
||||||
private readonly Box leftBackground;
|
private readonly Box leftBackground;
|
||||||
@ -154,10 +155,10 @@ namespace osu.Game.Modes.Taiko.UI
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//topLevelHitContainer = new Container
|
topLevelHitContainer = new Container
|
||||||
//{
|
{
|
||||||
// RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
//}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +178,11 @@ namespace osu.Game.Modes.Taiko.UI
|
|||||||
h.Scale = new Vector2(PLAYFIELD_SCALE);
|
h.Scale = new Vector2(PLAYFIELD_SCALE);
|
||||||
|
|
||||||
base.Add(h);
|
base.Add(h);
|
||||||
|
|
||||||
|
// Swells should be moved at the very top of the playfield when they reach the hit target
|
||||||
|
var swell = h as DrawableSwell;
|
||||||
|
if (swell != null)
|
||||||
|
swell.OnStart += () => topLevelHitContainer.Add(swell.CreateProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject)
|
public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject)
|
||||||
|
Reference in New Issue
Block a user