mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 12:12:56 +08:00
commit
fbc5285a1f
@ -6,33 +6,29 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
|
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
|
||||||
{
|
{
|
||||||
public ApproachCircle ApproachCircle;
|
public ApproachCircle ApproachCircle;
|
||||||
private readonly CirclePiece circle;
|
|
||||||
private readonly RingPiece ring;
|
|
||||||
private readonly FlashPiece flash;
|
|
||||||
private readonly ExplodePiece explode;
|
|
||||||
private readonly NumberPiece number;
|
|
||||||
private readonly GlowPiece glow;
|
|
||||||
|
|
||||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||||
|
|
||||||
public OsuAction? HitAction => circle.HitAction;
|
public OsuAction? HitAction => hitArea.HitAction;
|
||||||
|
|
||||||
private readonly Container explodeContainer;
|
|
||||||
|
|
||||||
private readonly Container scaleContainer;
|
private readonly Container scaleContainer;
|
||||||
|
|
||||||
|
private readonly HitArea hitArea;
|
||||||
|
|
||||||
public DrawableHitCircle(HitCircle h)
|
public DrawableHitCircle(HitCircle h)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
@ -43,19 +39,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
scaleContainer = new Container
|
scaleContainer = new Container
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Child = explodeContainer = new Container
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
glow = new GlowPiece(),
|
hitArea = new HitArea
|
||||||
circle = new CirclePiece
|
|
||||||
{
|
{
|
||||||
Hit = () =>
|
Hit = () =>
|
||||||
{
|
{
|
||||||
@ -66,25 +56,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
number = new NumberPiece
|
new SkinnableDrawable("Play/osu/hitcircle", _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
|
||||||
{
|
|
||||||
Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
|
|
||||||
},
|
|
||||||
ring = new RingPiece(),
|
|
||||||
flash = new FlashPiece(),
|
|
||||||
explode = new ExplodePiece(),
|
|
||||||
ApproachCircle = new ApproachCircle
|
ApproachCircle = new ApproachCircle
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Scale = new Vector2(4),
|
Scale = new Vector2(4),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//may not be so correct
|
Size = hitArea.DrawSize;
|
||||||
Size = circle.DrawSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -98,13 +80,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
||||||
scaleBindable.BindTo(HitObject.ScaleBindable);
|
scaleBindable.BindTo(HitObject.ScaleBindable);
|
||||||
|
|
||||||
AccentColour.BindValueChanged(colour =>
|
AccentColour.BindValueChanged(accent => ApproachCircle.Colour = accent.NewValue, true);
|
||||||
{
|
|
||||||
explode.Colour = colour.NewValue;
|
|
||||||
glow.Colour = colour.NewValue;
|
|
||||||
circle.Colour = colour.NewValue;
|
|
||||||
ApproachCircle.Colour = colour.NewValue;
|
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
@ -139,8 +115,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
protected override void UpdateStateTransforms(ArmedState state)
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
glow.FadeOut(400);
|
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Idle:
|
case ArmedState.Idle:
|
||||||
@ -148,7 +122,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
Expire(true);
|
Expire(true);
|
||||||
|
|
||||||
circle.HitAction = null;
|
hitArea.HitAction = null;
|
||||||
|
|
||||||
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
|
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
|
||||||
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
|
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
|
||||||
@ -163,29 +137,50 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
ApproachCircle.FadeOut(50);
|
ApproachCircle.FadeOut(50);
|
||||||
|
|
||||||
const double flash_in = 40;
|
// todo: temporary / arbitrary
|
||||||
flash.FadeTo(0.8f, flash_in)
|
this.Delay(800).Expire();
|
||||||
.Then()
|
|
||||||
.FadeOut(100);
|
|
||||||
|
|
||||||
explode.FadeIn(flash_in);
|
|
||||||
explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad);
|
|
||||||
|
|
||||||
using (BeginDelayedSequence(flash_in, true))
|
|
||||||
{
|
|
||||||
//after the flash, we can hide some elements that were behind it
|
|
||||||
ring.FadeOut();
|
|
||||||
circle.FadeOut();
|
|
||||||
number.FadeOut();
|
|
||||||
|
|
||||||
this.FadeOut(800);
|
|
||||||
}
|
|
||||||
|
|
||||||
Expire();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable ProxiedLayer => ApproachCircle;
|
public Drawable ProxiedLayer => ApproachCircle;
|
||||||
|
|
||||||
|
private class HitArea : Drawable, IKeyBindingHandler<OsuAction>
|
||||||
|
{
|
||||||
|
// IsHovered is used
|
||||||
|
public override bool HandlePositionalInput => true;
|
||||||
|
|
||||||
|
public Func<bool> Hit;
|
||||||
|
|
||||||
|
public OsuAction? HitAction;
|
||||||
|
|
||||||
|
public HitArea()
|
||||||
|
{
|
||||||
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(OsuAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case OsuAction.LeftButton:
|
||||||
|
case OsuAction.RightButton:
|
||||||
|
if (IsHovered && (Hit?.Invoke() ?? false))
|
||||||
|
{
|
||||||
|
HitAction = action;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnReleased(OsuAction action) => false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Skinning;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
{
|
{
|
||||||
public class CirclePiece : Container, IKeyBindingHandler<OsuAction>
|
public class CirclePiece : CompositeDrawable
|
||||||
{
|
{
|
||||||
// IsHovered is used
|
|
||||||
public override bool HandlePositionalInput => true;
|
|
||||||
|
|
||||||
public Func<bool> Hit;
|
|
||||||
|
|
||||||
public OsuAction? HitAction;
|
|
||||||
|
|
||||||
public CirclePiece()
|
public CirclePiece()
|
||||||
{
|
{
|
||||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
@ -27,28 +20,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
InternalChild = new SkinnableDrawable("Play/osu/hitcircle", _ => new DefaultCirclePiece());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(OsuAction action)
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
switch (action)
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
case OsuAction.LeftButton:
|
new Sprite
|
||||||
case OsuAction.RightButton:
|
|
||||||
if (IsHovered && (Hit?.Invoke() ?? false))
|
|
||||||
{
|
{
|
||||||
HitAction = action;
|
Anchor = Anchor.Centre,
|
||||||
return true;
|
Origin = Anchor.Centre,
|
||||||
|
Texture = textures.Get(@"Play/osu/disc"),
|
||||||
|
},
|
||||||
|
new TrianglesPiece
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Blending = BlendingMode.Additive,
|
||||||
|
Alpha = 0.5f,
|
||||||
}
|
}
|
||||||
|
};
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnReleased(OsuAction action) => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|
||||||
{
|
|
||||||
public class DefaultCirclePiece : Container
|
|
||||||
{
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Sprite
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Texture = textures.Get(@"Play/osu/disc"),
|
|
||||||
},
|
|
||||||
new TrianglesPiece
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Blending = BlendingMode.Additive,
|
|
||||||
Alpha = 0.5f,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,94 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
public class MainCirclePiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly CirclePiece circle;
|
||||||
|
private readonly RingPiece ring;
|
||||||
|
private readonly FlashPiece flash;
|
||||||
|
private readonly ExplodePiece explode;
|
||||||
|
private readonly NumberPiece number;
|
||||||
|
private readonly GlowPiece glow;
|
||||||
|
|
||||||
|
public MainCirclePiece(int index)
|
||||||
|
{
|
||||||
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
glow = new GlowPiece(),
|
||||||
|
circle = new CirclePiece(),
|
||||||
|
number = new NumberPiece
|
||||||
|
{
|
||||||
|
Text = (index + 1).ToString(),
|
||||||
|
},
|
||||||
|
ring = new RingPiece(),
|
||||||
|
flash = new FlashPiece(),
|
||||||
|
explode = new ExplodePiece(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||||
|
|
||||||
|
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(DrawableHitObject drawableObject)
|
||||||
|
{
|
||||||
|
state.BindTo(drawableObject.State);
|
||||||
|
state.BindValueChanged(updateState, true);
|
||||||
|
|
||||||
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
|
accentColour.BindValueChanged(colour =>
|
||||||
|
{
|
||||||
|
explode.Colour = colour.NewValue;
|
||||||
|
glow.Colour = colour.NewValue;
|
||||||
|
circle.Colour = colour.NewValue;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||||
|
{
|
||||||
|
glow.FadeOut(400);
|
||||||
|
|
||||||
|
switch (state.NewValue)
|
||||||
|
{
|
||||||
|
case ArmedState.Hit:
|
||||||
|
const double flash_in = 40;
|
||||||
|
const double flash_out = 100;
|
||||||
|
|
||||||
|
flash.FadeTo(0.8f, flash_in)
|
||||||
|
.Then()
|
||||||
|
.FadeOut(flash_out);
|
||||||
|
|
||||||
|
explode.FadeIn(flash_in);
|
||||||
|
this.ScaleTo(1.5f, 400, Easing.OutQuad);
|
||||||
|
|
||||||
|
using (BeginDelayedSequence(flash_in, true))
|
||||||
|
{
|
||||||
|
//after the flash, we can hide some elements that were behind it
|
||||||
|
ring.FadeOut();
|
||||||
|
circle.FadeOut();
|
||||||
|
number.FadeOut();
|
||||||
|
|
||||||
|
this.FadeOut(800);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,15 +6,22 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
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.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -36,6 +43,8 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly bool hasHitCircle;
|
||||||
|
|
||||||
protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, string filename)
|
protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, string filename)
|
||||||
: base(skin)
|
: base(skin)
|
||||||
{
|
{
|
||||||
@ -49,8 +58,6 @@ namespace osu.Game.Skinning
|
|||||||
Samples = audioManager.GetSampleStore(storage);
|
Samples = audioManager.GetSampleStore(storage);
|
||||||
Textures = new TextureStore(new TextureLoaderStore(storage));
|
Textures = new TextureStore(new TextureLoaderStore(storage));
|
||||||
|
|
||||||
bool hasHitCircle = false;
|
|
||||||
|
|
||||||
using (var testStream = storage.GetStream("hitcircle"))
|
using (var testStream = storage.GetStream("hitcircle"))
|
||||||
hasHitCircle |= testStream != null;
|
hasHitCircle |= testStream != null;
|
||||||
|
|
||||||
@ -71,6 +78,12 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
switch (componentName)
|
switch (componentName)
|
||||||
{
|
{
|
||||||
|
case "Play/osu/hitcircle":
|
||||||
|
if (!hasHitCircle)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new LegacyMainCirclePiece();
|
||||||
|
|
||||||
case "Play/Miss":
|
case "Play/Miss":
|
||||||
componentName = "hit0";
|
componentName = "hit0";
|
||||||
break;
|
break;
|
||||||
@ -243,5 +256,70 @@ namespace osu.Game.Skinning
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LegacyMainCirclePiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
public LegacyMainCirclePiece()
|
||||||
|
{
|
||||||
|
Size = new Vector2(128);
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||||
|
|
||||||
|
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
||||||
|
{
|
||||||
|
Sprite hitCircleSprite;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
hitCircleSprite = new Sprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("hitcircle"),
|
||||||
|
Colour = drawableObject.AccentColour.Value,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new SkinnableSpriteText("Play/osu/number-text", _ => new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.Numeric.With(size: 40),
|
||||||
|
UseFullGlyphHeight = false,
|
||||||
|
}, confineMode: ConfineMode.NoScaling)
|
||||||
|
{
|
||||||
|
Text = (((IHasComboInformation)drawableObject.HitObject).IndexInCurrentCombo + 1).ToString()
|
||||||
|
},
|
||||||
|
new Sprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("hitcircleoverlay"),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
state.BindTo(drawableObject.State);
|
||||||
|
state.BindValueChanged(updateState, true);
|
||||||
|
|
||||||
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
|
accentColour.BindValueChanged(colour => hitCircleSprite.Colour = colour.NewValue, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||||
|
{
|
||||||
|
const double legacy_fade_duration = 240;
|
||||||
|
|
||||||
|
switch (state.NewValue)
|
||||||
|
{
|
||||||
|
case ArmedState.Hit:
|
||||||
|
this.FadeOut(legacy_fade_duration, Easing.Out);
|
||||||
|
this.ScaleTo(1.4f, legacy_fade_duration, Easing.Out);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user