mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 20:52:54 +08:00
Add back legacy implementations
This commit is contained in:
parent
023feaf438
commit
2b71ffa2ed
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Scale = new Vector2(Spinner.Scale),
|
Scale = new Vector2(Spinner.Scale),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerDisc), _ => new DefaultSpinnerDisc()),
|
new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBody), _ => new DefaultSpinnerDisc()),
|
||||||
RotationTracker = new SpinnerRotationTracker(Spinner)
|
RotationTracker = new SpinnerRotationTracker(Spinner)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -17,8 +17,6 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
SliderFollowCircle,
|
SliderFollowCircle,
|
||||||
SliderBall,
|
SliderBall,
|
||||||
SliderBody,
|
SliderBody,
|
||||||
SpinnerDisc,
|
SpinnerBody
|
||||||
SpinnerBackground,
|
|
||||||
SpinnerCentre
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
80
osu.Game.Rulesets.Osu/Skinning/LegacyNewStyleSpinner.cs
Normal file
80
osu.Game.Rulesets.Osu/Skinning/LegacyNewStyleSpinner.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// 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.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Skinning
|
||||||
|
{
|
||||||
|
public class LegacyNewStyleSpinner : CompositeDrawable
|
||||||
|
{
|
||||||
|
private Sprite discBottom;
|
||||||
|
private Sprite discTop;
|
||||||
|
private Sprite spinningMiddle;
|
||||||
|
|
||||||
|
private DrawableSpinner drawableSpinner;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource source, DrawableHitObject drawableObject)
|
||||||
|
{
|
||||||
|
drawableSpinner = (DrawableSpinner)drawableObject;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
discBottom = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-bottom")
|
||||||
|
},
|
||||||
|
discTop = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-top")
|
||||||
|
},
|
||||||
|
new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-middle")
|
||||||
|
},
|
||||||
|
spinningMiddle = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-middle2")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
this.FadeOut();
|
||||||
|
drawableSpinner.State.BindValueChanged(updateStateTransforms, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStateTransforms(ValueChangedEvent<ArmedState> state)
|
||||||
|
{
|
||||||
|
var spinner = drawableSpinner.HitObject;
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt / 2, true))
|
||||||
|
this.FadeInFromZero(spinner.TimePreempt / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
spinningMiddle.Rotation = discTop.Rotation = drawableSpinner.RotationTracker.Rotation;
|
||||||
|
discBottom.Rotation = discTop.Rotation / 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
64
osu.Game.Rulesets.Osu/Skinning/LegacyOldStyleSpinner.cs
Normal file
64
osu.Game.Rulesets.Osu/Skinning/LegacyOldStyleSpinner.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// 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.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Skinning
|
||||||
|
{
|
||||||
|
public class LegacyOldStyleSpinner : CompositeDrawable
|
||||||
|
{
|
||||||
|
private DrawableSpinner drawableSpinner;
|
||||||
|
private Sprite disc;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource source, DrawableHitObject drawableObject)
|
||||||
|
{
|
||||||
|
drawableSpinner = (DrawableSpinner)drawableObject;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-background")
|
||||||
|
},
|
||||||
|
disc = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-circle")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
this.FadeOut();
|
||||||
|
drawableSpinner.State.BindValueChanged(updateStateTransforms, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStateTransforms(ValueChangedEvent<ArmedState> state)
|
||||||
|
{
|
||||||
|
var spinner = drawableSpinner.HitObject;
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt / 2, true))
|
||||||
|
this.FadeInFromZero(spinner.TimePreempt / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
disc.Rotation = drawableSpinner.RotationTracker.Rotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -104,25 +103,11 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
Spacing = new Vector2(-overlap, 0)
|
Spacing = new Vector2(-overlap, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
case OsuSkinComponents.SpinnerDisc:
|
case OsuSkinComponents.SpinnerBody:
|
||||||
if (Source.GetTexture("spinner-background") != null)
|
if (Source.GetTexture("spinner-top") != null)
|
||||||
return new Sprite { Texture = Source.GetTexture("spinner-circle") };
|
return new LegacyNewStyleSpinner();
|
||||||
else if (Source.GetTexture("spinner-top") != null)
|
else if (Source.GetTexture("spinner-background") != null)
|
||||||
return new Sprite { Texture = Source.GetTexture("spinner-top") };
|
return new LegacyOldStyleSpinner();
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
case OsuSkinComponents.SpinnerBackground:
|
|
||||||
if (Source.GetTexture("spinner-background") != null)
|
|
||||||
return new Sprite { Texture = Source.GetTexture("spinner-background") };
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
case OsuSkinComponents.SpinnerCentre:
|
|
||||||
if (Source.GetTexture("spinner-background") != null)
|
|
||||||
return Drawable.Empty();
|
|
||||||
else if (Source.GetTexture("spinner-top") != null)
|
|
||||||
return new Sprite { Texture = Source.GetTexture("spinner-middle2") };
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user