mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 18:13:00 +08:00
Remove DrumRollCirclePiece, cleanup CirclePiece a bit.
This commit is contained in:
parent
a4f3816626
commit
41aaf42183
@ -92,22 +92,20 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Position = new Vector2(350, 500)
|
||||
});
|
||||
|
||||
Add(new DrumRollCirclePiece(new CirclePiece
|
||||
{
|
||||
KiaiMode = kiai
|
||||
})
|
||||
Add(new CirclePiece
|
||||
{
|
||||
Position = new Vector2(575, 100),
|
||||
Width = 0.25f,
|
||||
Position = new Vector2(575, 100)
|
||||
AccentColour = Color4.Orange,
|
||||
KiaiMode = kiai,
|
||||
});
|
||||
|
||||
Add(new DrumRollCirclePiece(new StrongCirclePiece
|
||||
{
|
||||
KiaiMode = kiai
|
||||
})
|
||||
Add(new StrongCirclePiece
|
||||
{
|
||||
Position = new Vector2(575, 300),
|
||||
Width = 0.25f,
|
||||
Position = new Vector2(575, 300)
|
||||
AccentColour = Color4.Orange,
|
||||
KiaiMode = kiai
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
@ -13,7 +17,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
private readonly DrumRoll drumRoll;
|
||||
|
||||
private readonly DrumRollCirclePiece circle;
|
||||
private readonly CirclePiece circle;
|
||||
|
||||
private Color4 baseColour;
|
||||
private Color4 finalColour;
|
||||
|
||||
public DrawableDrumRoll(DrumRoll drumRoll)
|
||||
: base(drumRoll)
|
||||
@ -23,7 +30,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Width = (float)(drumRoll.Duration / drumRoll.PreEmpt);
|
||||
|
||||
Add(circle = new DrumRollCirclePiece(CreateCirclePiece()));
|
||||
Add(circle = CreateCirclePiece());
|
||||
|
||||
foreach (var tick in drumRoll.Ticks)
|
||||
{
|
||||
@ -39,10 +46,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
}
|
||||
}
|
||||
|
||||
private void onTickJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> obj)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit);
|
||||
circle.Completion = (float)countHit / NestedHitObjects.Count();
|
||||
circle.Background.Colour = baseColour = colours.YellowDark;
|
||||
finalColour = colours.YellowDarker;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -56,6 +64,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
LifetimeEnd = drumRoll.EndTime + drumRoll.PreEmpt;
|
||||
}
|
||||
|
||||
private void onTickJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> obj)
|
||||
{
|
||||
int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit);
|
||||
float completion = (float)countHit / NestedHitObjects.Count();
|
||||
|
||||
circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1);
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (userTriggered)
|
||||
|
@ -35,8 +35,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
accentColour = value;
|
||||
|
||||
innerBackground.Colour = AccentColour;
|
||||
triangles.Colour = AccentColour;
|
||||
background.Colour = AccentColour;
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
@ -66,10 +65,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
protected override Container<Framework.Graphics.Drawable> Content => SymbolContainer;
|
||||
protected readonly Container SymbolContainer;
|
||||
|
||||
private readonly Container background;
|
||||
private readonly Container innerLayer;
|
||||
private readonly Container innerCircleContainer;
|
||||
private readonly Box innerBackground;
|
||||
private readonly Triangles triangles;
|
||||
|
||||
public CirclePiece()
|
||||
{
|
||||
@ -85,22 +82,22 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
innerCircleContainer = new CircularContainer
|
||||
background = new CircularContainer
|
||||
{
|
||||
Name = "Inner Circle",
|
||||
Name = "Background",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
innerBackground = new Box
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
triangles = new Triangles
|
||||
new Triangles
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -149,7 +146,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
|
||||
private void resetEdgeEffects()
|
||||
{
|
||||
innerCircleContainer.EdgeEffect = new EdgeEffect
|
||||
background.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = AccentColour,
|
||||
|
@ -1,57 +0,0 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// A circle piece used for drumrolls.
|
||||
/// </summary>
|
||||
public class DrumRollCirclePiece : Container
|
||||
{
|
||||
private float completion;
|
||||
/// <summary>
|
||||
/// The amount of the drumroll that has been completed, as a percentage of the number
|
||||
/// of ticks in the drumroll. This determines the internal colour of the drumroll.
|
||||
/// </summary>
|
||||
public float Completion
|
||||
{
|
||||
get { return completion; }
|
||||
set
|
||||
{
|
||||
completion = MathHelper.Clamp(value, 0, 1);
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly CirclePiece circle;
|
||||
|
||||
private Color4 baseColour;
|
||||
private Color4 finalColour;
|
||||
|
||||
public DrumRollCirclePiece(CirclePiece piece)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
Add(circle = piece);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circle.AccentColour = baseColour = colours.YellowDark;
|
||||
finalColour = colours.YellowDarker;
|
||||
}
|
||||
}
|
||||
}
|
@ -64,7 +64,6 @@
|
||||
<Compile Include="Objects\Drawable\DrawableDrumRollTick.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableSwell.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\DrumRollCirclePiece.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\RimHitSymbolPiece.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\StrongCirclePiece.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\CirclePiece.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user