mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add drawable Hits/StrongHits.
This commit is contained in:
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Screens.Testing;
|
using osu.Framework.Screens.Testing;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Modes.Taiko.Objects;
|
using osu.Game.Modes.Taiko.Objects;
|
||||||
|
using osu.Game.Modes.Taiko.Objects.Drawable;
|
||||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Reset();
|
Reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(new CentreHitCircle(new CirclePiece()
|
Add(new CentreHitCirclePiece(new CirclePiece()
|
||||||
{
|
{
|
||||||
KiaiMode = kiai
|
KiaiMode = kiai
|
||||||
})
|
})
|
||||||
@ -38,7 +39,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Position = new Vector2(100, 100)
|
Position = new Vector2(100, 100)
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(new CentreHitCircle(new StrongCirclePiece()
|
Add(new CentreHitCirclePiece(new StrongCirclePiece()
|
||||||
{
|
{
|
||||||
KiaiMode = kiai
|
KiaiMode = kiai
|
||||||
})
|
})
|
||||||
@ -106,7 +107,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
TextSize = SYMBOL_INNER_SIZE,
|
TextSize = CirclePiece.SYMBOL_INNER_SIZE,
|
||||||
Icon = FontAwesome.fa_asterisk,
|
Icon = FontAwesome.fa_asterisk,
|
||||||
Shadow = false
|
Shadow = false
|
||||||
});
|
});
|
||||||
@ -133,34 +134,6 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CentreHitCircle : BaseCircle
|
|
||||||
{
|
|
||||||
public CentreHitCircle(CirclePiece piece)
|
|
||||||
: base(piece)
|
|
||||||
{
|
|
||||||
Piece.Add(new CircularContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(SYMBOL_INNER_SIZE),
|
|
||||||
Masking = true,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Piece.AccentColour = colours.PinkDarker;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class RimHitCircle : BaseCircle
|
private class RimHitCircle : BaseCircle
|
||||||
{
|
{
|
||||||
public RimHitCircle(CirclePiece piece)
|
public RimHitCircle(CirclePiece piece)
|
||||||
@ -170,8 +143,8 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(SYMBOL_SIZE),
|
Size = new Vector2(CirclePiece.SYMBOL_SIZE),
|
||||||
BorderThickness = SYMBOL_BORDER,
|
BorderThickness = CirclePiece.SYMBOL_BORDER,
|
||||||
BorderColour = Color4.White,
|
BorderColour = Color4.White,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
@ -195,10 +168,6 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private abstract class BaseCircle : Container
|
private abstract class BaseCircle : Container
|
||||||
{
|
{
|
||||||
protected const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f;
|
|
||||||
protected const float SYMBOL_BORDER = 8;
|
|
||||||
protected const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER;
|
|
||||||
|
|
||||||
protected readonly CirclePiece Piece;
|
protected readonly CirclePiece Piece;
|
||||||
|
|
||||||
protected BaseCircle(CirclePiece piece)
|
protected BaseCircle(CirclePiece piece)
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Screens.Testing;
|
|||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Taiko.Judgements;
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
using osu.Game.Modes.Taiko.Objects;
|
using osu.Game.Modes.Taiko.Objects;
|
||||||
|
using osu.Game.Modes.Taiko.Objects.Drawable;
|
||||||
using osu.Game.Modes.Taiko.UI;
|
using osu.Game.Modes.Taiko.UI;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
@ -22,6 +23,15 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
AddButton("Hit!", addHitJudgement);
|
AddButton("Hit!", addHitJudgement);
|
||||||
AddButton("Miss :(", addMissJudgement);
|
AddButton("Miss :(", addMissJudgement);
|
||||||
|
AddButton("Centre", () =>
|
||||||
|
{
|
||||||
|
playfield.Add(new DrawableCentreHit(new Hit
|
||||||
|
{
|
||||||
|
StartTime = Time.Current + 1000,
|
||||||
|
PreEmpt = 1000,
|
||||||
|
IsStrong = false
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
Add(playfield = new TaikoPlayfield
|
Add(playfield = new TaikoPlayfield
|
||||||
{
|
{
|
||||||
|
@ -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
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK.Input;
|
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.Objects.Drawables;
|
||||||
using osu.Game.Modes.Taiko.Judgements;
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
using System;
|
using System;
|
||||||
@ -16,6 +19,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract List<Key> HitKeys { get; }
|
protected abstract List<Key> HitKeys { get; }
|
||||||
|
|
||||||
|
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer;
|
||||||
|
|
||||||
private readonly Hit hit;
|
private readonly Hit hit;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -23,10 +28,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool validKeyPressed;
|
private bool validKeyPressed;
|
||||||
|
|
||||||
|
private Container bodyContainer;
|
||||||
|
|
||||||
protected DrawableHit(Hit hit)
|
protected DrawableHit(Hit hit)
|
||||||
: base(hit)
|
: base(hit)
|
||||||
{
|
{
|
||||||
this.hit = hit;
|
this.hit = hit;
|
||||||
|
|
||||||
|
AddInternal(bodyContainer = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckJudgement(bool userTriggered)
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
@ -63,5 +76,26 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
|
|
||||||
return UpdateJudgement(true);
|
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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -52,7 +52,10 @@
|
|||||||
<Compile Include="Judgements\TaikoDrumRollTickJudgement.cs" />
|
<Compile Include="Judgements\TaikoDrumRollTickJudgement.cs" />
|
||||||
<Compile Include="Judgements\TaikoJudgement.cs" />
|
<Compile Include="Judgements\TaikoJudgement.cs" />
|
||||||
<Compile Include="Judgements\TaikoHitResult.cs" />
|
<Compile Include="Judgements\TaikoHitResult.cs" />
|
||||||
|
<Compile Include="Objects\Drawable\CentreHitCirclePiece.cs" />
|
||||||
|
<Compile Include="Objects\Drawable\DrawableCentreHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableHit.cs" />
|
||||||
|
<Compile Include="Objects\Drawable\DrawableStrongCentreHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableStrongHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableStrongHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\Pieces\StrongCirclePiece.cs" />
|
<Compile Include="Objects\Drawable\Pieces\StrongCirclePiece.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableSwell.cs" />
|
<Compile Include="Objects\Drawable\DrawableSwell.cs" />
|
||||||
|
Reference in New Issue
Block a user