mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Split ApproachCircle out into its own class.
This commit is contained in:
parent
4c61a13e71
commit
4db2a1e693
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
@ -15,32 +16,38 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public class DrawableHitCircle : DrawableHitObject
|
public class DrawableHitCircle : DrawableHitObject
|
||||||
{
|
{
|
||||||
private Sprite approachCircle;
|
private OsuBaseHit osuObject;
|
||||||
|
|
||||||
|
private ApproachCircle approachCircle;
|
||||||
private CirclePiece circle;
|
private CirclePiece circle;
|
||||||
private RingPiece ring;
|
private RingPiece ring;
|
||||||
private FlashPiece flash;
|
private FlashPiece flash;
|
||||||
private ExplodePiece explode;
|
private ExplodePiece explode;
|
||||||
private NumberPiece number;
|
private NumberPiece number;
|
||||||
private GlowPiece glow;
|
private GlowPiece glow;
|
||||||
private OsuBaseHit h;
|
|
||||||
private HitExplosion explosion;
|
private HitExplosion explosion;
|
||||||
|
|
||||||
public DrawableHitCircle(HitCircle h) : base(h)
|
public DrawableHitCircle(HitCircle h) : base(h)
|
||||||
{
|
{
|
||||||
this.h = h;
|
osuObject = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Position = h.Position;
|
Position = osuObject.Position;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
glow = new GlowPiece
|
glow = new GlowPiece
|
||||||
{
|
{
|
||||||
Colour = h.Colour
|
Colour = osuObject.Colour
|
||||||
},
|
},
|
||||||
circle = new CirclePiece
|
circle = new CirclePiece
|
||||||
{
|
{
|
||||||
Colour = h.Colour,
|
Colour = osuObject.Colour,
|
||||||
Hit = Hit,
|
Hit = Hit,
|
||||||
},
|
},
|
||||||
number = new NumberPiece(),
|
number = new NumberPiece(),
|
||||||
@ -48,29 +55,16 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
flash = new FlashPiece(),
|
flash = new FlashPiece(),
|
||||||
explode = new ExplodePiece
|
explode = new ExplodePiece
|
||||||
{
|
{
|
||||||
Colour = h.Colour,
|
Colour = osuObject.Colour,
|
||||||
},
|
},
|
||||||
approachCircle = new Sprite
|
approachCircle = new ApproachCircle()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Colour = osuObject.Colour,
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Colour = h.Colour
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//may not be so correct
|
//may not be so correct
|
||||||
Size = circle.DrawSize;
|
Size = circle.DrawSize;
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(BaseGame game)
|
|
||||||
{
|
|
||||||
approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
//force application of the state that was set before we loaded.
|
//force application of the state that was set before we loaded.
|
||||||
UpdateState(State);
|
UpdateState(State);
|
||||||
@ -81,8 +75,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
if (!IsLoaded) return;
|
if (!IsLoaded) return;
|
||||||
|
|
||||||
Flush(true); //move to DrawableHitObject
|
Flush(true); //move to DrawableHitObject
|
||||||
|
approachCircle.Flush(true);
|
||||||
|
|
||||||
double t = HitTime ?? h.StartTime;
|
double t = HitTime ?? osuObject.StartTime;
|
||||||
|
|
||||||
|
Alpha = 0;
|
||||||
|
|
||||||
//sane defaults
|
//sane defaults
|
||||||
ring.Alpha = circle.Alpha = number.Alpha = approachCircle.Alpha = glow.Alpha = 1;
|
ring.Alpha = circle.Alpha = number.Alpha = approachCircle.Alpha = glow.Alpha = 1;
|
||||||
@ -91,18 +88,20 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
|
|
||||||
//always-present transforms
|
//always-present transforms
|
||||||
Transforms.Add(new TransformAlpha { StartTime = t - 1000, EndTime = t - 800, StartValue = 0, EndValue = 1 });
|
Transforms.Add(new TransformAlpha { StartTime = t - 1000, EndTime = t - 800, StartValue = 0, EndValue = 1 });
|
||||||
|
|
||||||
approachCircle.Transforms.Add(new TransformScale { StartTime = t - 1000, EndTime = t, StartValue = new Vector2(2f), EndValue = new Vector2(0.6f) });
|
approachCircle.Transforms.Add(new TransformScale { StartTime = t - 1000, EndTime = t, StartValue = new Vector2(2f), EndValue = new Vector2(0.6f) });
|
||||||
|
|
||||||
//set transform delay to t==hitTime
|
//set transform delay to t==hitTime
|
||||||
Delay(t - Time.Current, true);
|
Delay(t - Time.Current, true);
|
||||||
|
|
||||||
approachCircle.FadeOut();
|
approachCircle.FadeOut();
|
||||||
|
|
||||||
glow.FadeOut(400);
|
glow.FadeOut(400);
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Disarmed:
|
case ArmedState.Disarmed:
|
||||||
Delay(h.Duration + 200);
|
Delay(osuObject.Duration + 200);
|
||||||
FadeOut(200);
|
FadeOut(200);
|
||||||
|
|
||||||
explosion?.Expire();
|
explosion?.Expire();
|
||||||
|
35
osu.Game.Mode.Osu/Objects/Drawables/Pieces/ApproachCircle.cs
Normal file
35
osu.Game.Mode.Osu/Objects/Drawables/Pieces/ApproachCircle.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
public class ApproachCircle : Container
|
||||||
|
{
|
||||||
|
private Sprite approachCircle;
|
||||||
|
|
||||||
|
public ApproachCircle()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
approachCircle = new Sprite()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
approachCircle.Texture = textures.Get(@"Play/osu/approachcircle@2x");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
|
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
|
||||||
<Compile Include="ComboJudgement.cs" />
|
<Compile Include="ComboJudgement.cs" />
|
||||||
<Compile Include="Objects\Drawables\DrawableSlider.cs" />
|
<Compile Include="Objects\Drawables\DrawableSlider.cs" />
|
||||||
|
@ -53,12 +53,6 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
UpdateState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool counted;
|
private bool counted;
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
Loading…
Reference in New Issue
Block a user