mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 21:23:04 +08:00
Add drawable Swell.
This commit is contained in:
parent
2211c08441
commit
3f6b17c0bf
@ -62,7 +62,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Position = new Vector2(350, 300)
|
||||
});
|
||||
|
||||
Add(new SwellCircle(new CirclePiece()
|
||||
Add(new SwellCirclePiece(new CirclePiece
|
||||
{
|
||||
KiaiMode = kiai
|
||||
})
|
||||
@ -70,7 +70,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Position = new Vector2(100, 500)
|
||||
});
|
||||
|
||||
Add(new SwellCircle(new StrongCirclePiece()
|
||||
Add(new SwellCirclePiece(new StrongCirclePiece
|
||||
{
|
||||
KiaiMode = kiai
|
||||
})
|
||||
@ -97,28 +97,6 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
});
|
||||
}
|
||||
|
||||
private class SwellCircle : BaseCircle
|
||||
{
|
||||
public SwellCircle(CirclePiece piece)
|
||||
: base(piece)
|
||||
{
|
||||
Piece.Add(new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = SYMBOL_INNER_SIZE,
|
||||
Icon = FontAwesome.fa_asterisk,
|
||||
Shadow = false
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Piece.AccentColour = colours.YellowDark;
|
||||
}
|
||||
}
|
||||
|
||||
private class DrumRollCircle : BaseCircle
|
||||
{
|
||||
public DrumRollCircle(CirclePiece piece)
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable;
|
||||
using osu.Game.Modes.Taiko.UI;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
@ -22,6 +23,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
AddButton("Hit!", addHitJudgement);
|
||||
AddButton("Miss :(", addMissJudgement);
|
||||
AddButton("Swell", addSwell);
|
||||
|
||||
Add(playfield = new TaikoPlayfield
|
||||
{
|
||||
@ -60,6 +62,16 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
});
|
||||
}
|
||||
|
||||
private void addSwell()
|
||||
{
|
||||
playfield.Add(new DrawableSwell(new Swell
|
||||
{
|
||||
StartTime = Time.Current + 1000,
|
||||
EndTime = Time.Current + 5000,
|
||||
PreEmpt = 1000
|
||||
}));
|
||||
}
|
||||
|
||||
private class DrawableTestHit : DrawableHitObject<TaikoHitObject, TaikoJudgement>
|
||||
{
|
||||
public DrawableTestHit(TaikoHitObject hitObject)
|
||||
|
@ -1,15 +1,30 @@
|
||||
// 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 OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableSwell : DrawableTaikoHitObject
|
||||
{
|
||||
private const float target_ring_thick_border = 4f;
|
||||
private const float target_ring_thin_border = 1f;
|
||||
private const float target_ring_scale = 5f;
|
||||
private const float inner_ring_alpha = 0.35f;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of times the user has hit this swell.
|
||||
/// </summary>
|
||||
@ -17,10 +32,94 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
private readonly Swell swell;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
private readonly CircularContainer targetRing;
|
||||
private readonly CircularContainer innerRing;
|
||||
|
||||
public DrawableSwell(Swell swell)
|
||||
: base(swell)
|
||||
{
|
||||
this.swell = swell;
|
||||
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
bodyContainer = new Container
|
||||
{
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
innerRing = new CircularContainer
|
||||
{
|
||||
Name = "Inner ring",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2),
|
||||
Masking = true,
|
||||
Children = new []
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = inner_ring_alpha,
|
||||
}
|
||||
}
|
||||
},
|
||||
targetRing = new CircularContainer
|
||||
{
|
||||
Name = "Target ring (thick border)",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2),
|
||||
Masking = true,
|
||||
BorderThickness = target_ring_thick_border,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Name = "Target ring (thin border)",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = target_ring_thin_border,
|
||||
BorderColour = Color4.White,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new SwellCirclePiece(new CirclePiece())
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
innerRing.Colour = colours.YellowDark;
|
||||
targetRing.BorderColour = colours.YellowDark.Opacity(0.25f);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
LifetimeEnd = swell.EndTime + HitObject.PreEmpt;
|
||||
|
||||
targetRing.Delay(HitObject.StartTime - Time.Current).ScaleTo(target_ring_scale, 600, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
@ -32,6 +131,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
userHits++;
|
||||
|
||||
innerRing.FadeTo(1);
|
||||
innerRing.FadeTo(inner_ring_alpha, 500, EasingTypes.OutQuint);
|
||||
innerRing.ScaleTo(1f + (target_ring_scale - 1) * userHits / swell.RequiredHits, 1200, EasingTypes.OutElastic);
|
||||
|
||||
if (userHits == swell.RequiredHits)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
@ -55,6 +158,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
break;
|
||||
case ArmedState.Miss:
|
||||
bodyContainer.FadeOut(100);
|
||||
break;
|
||||
case ArmedState.Hit:
|
||||
bodyContainer.ScaleTo(1.2f, 400, EasingTypes.OutQuad);
|
||||
bodyContainer.FadeOut(600, EasingTypes.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateScrollPosition(double time)
|
||||
|
@ -0,0 +1,35 @@
|
||||
// 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;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
public class SwellCirclePiece : Container
|
||||
{
|
||||
private readonly CirclePiece circle;
|
||||
|
||||
public SwellCirclePiece(CirclePiece piece)
|
||||
{
|
||||
Add(circle = piece);
|
||||
|
||||
circle.Add(new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = CirclePiece.SYMBOL_INNER_SIZE,
|
||||
Icon = FontAwesome.fa_asterisk,
|
||||
Shadow = false
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circle.AccentColour = colours.YellowDark;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
/// <summary>
|
||||
/// The number of hits required to complete the swell successfully.
|
||||
/// </summary>
|
||||
public int RequiredHits { get; protected set; }
|
||||
public int RequiredHits { get; protected set; } = 10;
|
||||
|
||||
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
|
||||
{
|
||||
|
@ -57,6 +57,7 @@
|
||||
<Compile Include="Objects\Drawable\Pieces\StrongCirclePiece.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableSwell.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\SwellCirclePiece.cs" />
|
||||
<Compile Include="Objects\DrumRoll.cs" />
|
||||
<Compile Include="Objects\DrumRollTick.cs" />
|
||||
<Compile Include="Objects\Hit.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user