mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Add drawable Hits/StrongHits.
This commit is contained in:
@ -0,0 +1,49 @@
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
/// <summary>
|
||||
/// A circle piece used for centre hits.
|
||||
/// </summary>
|
||||
public class CentreHitCirclePiece : Container
|
||||
{
|
||||
private CirclePiece circle;
|
||||
|
||||
public CentreHitCirclePiece(CirclePiece piece)
|
||||
{
|
||||
Add(circle = piece);
|
||||
|
||||
circle.Add(new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(CirclePiece.SYMBOL_INNER_SIZE),
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circle.AccentColour = colours.PinkDarker;
|
||||
}
|
||||
}
|
||||
}
|
17
osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs
Normal file
17
osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableCentreHit : DrawableHit
|
||||
{
|
||||
protected override List<Key> HitKeys { get; } = new List<Key>(new Key[] { Key.F, Key.J });
|
||||
|
||||
public DrawableCentreHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(new CentreHitCirclePiece(new CirclePiece()));
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,9 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using System;
|
||||
@ -16,6 +19,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
/// </summary>
|
||||
protected abstract List<Key> HitKeys { get; }
|
||||
|
||||
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer;
|
||||
|
||||
private readonly Hit hit;
|
||||
|
||||
/// <summary>
|
||||
@ -23,10 +28,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
/// </summary>
|
||||
private bool validKeyPressed;
|
||||
|
||||
private Container bodyContainer;
|
||||
|
||||
protected DrawableHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
this.hit = hit;
|
||||
|
||||
AddInternal(bodyContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
});
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
@ -63,5 +76,26 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
return UpdateJudgement(true);
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
switch (State)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
break;
|
||||
case ArmedState.Miss:
|
||||
bodyContainer.FadeOut(100);
|
||||
break;
|
||||
case ArmedState.Hit:
|
||||
bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad);
|
||||
bodyContainer.FadeOut(600, EasingTypes.OutQuint);
|
||||
bodyContainer.MoveToY(-200, 250, EasingTypes.Out);
|
||||
|
||||
bodyContainer.Delay(250);
|
||||
|
||||
bodyContainer.MoveToY(0, 500, EasingTypes.In);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableStrongCentreHit : DrawableStrongHit
|
||||
{
|
||||
protected override List<Key> HitKeys { get; } = new List<Key>(new Key[] { Key.F, Key.J });
|
||||
|
||||
public DrawableStrongCentreHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(new CentreHitCirclePiece(new StrongCirclePiece()));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user