mirror of
https://github.com/ppy/osu
synced 2025-01-31 10:22:02 +00:00
Move legacy spinner bonus counter to LegacySpinner
This commit is contained in:
parent
8fdab5a7de
commit
774ebf50bc
@ -32,6 +32,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
private Sprite spin;
|
private Sprite spin;
|
||||||
private Sprite clear;
|
private Sprite clear;
|
||||||
|
|
||||||
|
private LegacySpriteText bonusCounter;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
||||||
{
|
{
|
||||||
@ -45,36 +47,58 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
DrawableSpinner = (DrawableSpinner)drawableHitObject;
|
DrawableSpinner = (DrawableSpinner)drawableHitObject;
|
||||||
|
|
||||||
AddRangeInternal(new[]
|
AddInternal(new Container
|
||||||
{
|
{
|
||||||
spin = new Sprite
|
Depth = float.MinValue,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
spin = new Sprite
|
||||||
Origin = Anchor.Centre,
|
{
|
||||||
Depth = float.MinValue,
|
Anchor = Anchor.TopCentre,
|
||||||
Texture = source.GetTexture("spinner-spin"),
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(SPRITE_SCALE),
|
Texture = source.GetTexture("spinner-spin"),
|
||||||
Y = SPINNER_TOP_OFFSET + 335,
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
},
|
Y = SPINNER_TOP_OFFSET + 335,
|
||||||
clear = new Sprite
|
},
|
||||||
{
|
clear = new Sprite
|
||||||
Alpha = 0,
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Alpha = 0,
|
||||||
Origin = Anchor.Centre,
|
Anchor = Anchor.TopCentre,
|
||||||
Depth = float.MinValue,
|
Origin = Anchor.Centre,
|
||||||
Texture = source.GetTexture("spinner-clear"),
|
Texture = source.GetTexture("spinner-clear"),
|
||||||
Scale = new Vector2(SPRITE_SCALE),
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
Y = SPINNER_TOP_OFFSET + 115,
|
Y = SPINNER_TOP_OFFSET + 115,
|
||||||
},
|
},
|
||||||
|
bonusCounter = ((LegacySpriteText)source.GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreText))).With(s =>
|
||||||
|
{
|
||||||
|
s.Alpha = 0f;
|
||||||
|
s.Anchor = Anchor.TopCentre;
|
||||||
|
s.Origin = Anchor.Centre;
|
||||||
|
s.Font = s.Font.With(fixedWidth: false);
|
||||||
|
s.Scale = new Vector2(SPRITE_SCALE);
|
||||||
|
s.Y = SPINNER_TOP_OFFSET + 299;
|
||||||
|
}),
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IBindable<double> gainedBonus;
|
||||||
|
|
||||||
private readonly Bindable<bool> completed = new Bindable<bool>();
|
private readonly Bindable<bool> completed = new Bindable<bool>();
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
gainedBonus = DrawableSpinner.GainedBonus.GetBoundCopy();
|
||||||
|
gainedBonus.BindValueChanged(bonus =>
|
||||||
|
{
|
||||||
|
bonusCounter.Text = $"{bonus.NewValue}";
|
||||||
|
bonusCounter.FadeOutFromOne(800, Easing.Out);
|
||||||
|
bonusCounter.ScaleTo(SPRITE_SCALE * 2f).Then().ScaleTo(SPRITE_SCALE * 1.28f, 800, Easing.Out);
|
||||||
|
});
|
||||||
|
|
||||||
completed.BindValueChanged(onCompletedChanged, true);
|
completed.BindValueChanged(onCompletedChanged, true);
|
||||||
|
|
||||||
DrawableSpinner.ApplyCustomUpdateState += UpdateStateTransforms;
|
DrawableSpinner.ApplyCustomUpdateState += UpdateStateTransforms;
|
||||||
|
@ -1,56 +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.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
||||||
using osu.Game.Skinning;
|
|
||||||
using osuTK;
|
|
||||||
using static osu.Game.Rulesets.Osu.Skinning.Legacy.LegacySpinner;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|
||||||
{
|
|
||||||
public class LegacySpinnerBonusCounter : CompositeDrawable
|
|
||||||
{
|
|
||||||
private LegacySpriteText bonusCounter;
|
|
||||||
|
|
||||||
private DrawableSpinner drawableSpinner;
|
|
||||||
|
|
||||||
private IBindable<double> gainedBonus;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
|
||||||
{
|
|
||||||
drawableSpinner = (DrawableSpinner)drawableHitObject;
|
|
||||||
|
|
||||||
InternalChild = new LegacyCoordinatesContainer
|
|
||||||
{
|
|
||||||
Child = bonusCounter = ((LegacySpriteText)source.GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreText))).With(s =>
|
|
||||||
{
|
|
||||||
s.Alpha = 0f;
|
|
||||||
s.Anchor = Anchor.TopCentre;
|
|
||||||
s.Origin = Anchor.Centre;
|
|
||||||
s.Font = s.Font.With(fixedWidth: false);
|
|
||||||
s.Scale = new Vector2(SPRITE_SCALE);
|
|
||||||
s.Y = LegacyCoordinatesContainer.SPINNER_TOP_OFFSET + 299;
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
gainedBonus = drawableSpinner.GainedBonus.GetBoundCopy();
|
|
||||||
gainedBonus.BindValueChanged(bonus =>
|
|
||||||
{
|
|
||||||
bonusCounter.Text = $"{bonus.NewValue}";
|
|
||||||
bonusCounter.FadeOutFromOne(800, Easing.Out);
|
|
||||||
bonusCounter.ScaleTo(SPRITE_SCALE * 2f).Then().ScaleTo(SPRITE_SCALE * 1.28f, 800, Easing.Out);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user