mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 22:12:53 +08:00
Move implementation and colour logic to legacy implementation
This commit is contained in:
parent
7cab0fcfb8
commit
fb1f77bd04
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
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.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -57,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
// TODO: support skin filename animation (sliderb0, sliderb1...)
|
// TODO: support skin filename animation (sliderb0, sliderb1...)
|
||||||
Child = new SkinnableDrawable("Play/osu/sliderb", _ => new DefaultSliderBall()),
|
Child = new SkinnableDrawable("Play/osu/sliderball", _ => new DefaultSliderBall()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -204,10 +203,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
|
|
||||||
public class DefaultSliderBall : CompositeDrawable
|
public class DefaultSliderBall : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
|
||||||
|
|
||||||
private Drawable drawableBall;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
||||||
{
|
{
|
||||||
@ -225,15 +220,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
BorderThickness = 10,
|
BorderThickness = 10,
|
||||||
BorderColour = Color4.White,
|
BorderColour = Color4.White,
|
||||||
Alpha = 1,
|
Alpha = 1,
|
||||||
Child = drawableBall = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White,
|
||||||
Alpha = 0.4f,
|
Alpha = 0.4f,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
accentColour.BindTo(drawableObject.AccentColour);
|
|
||||||
accentColour.BindValueChanged(colour => drawableBall.Colour = colour.NewValue, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ 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.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -15,6 +16,7 @@ using osu.Framework.IO.Stores;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -71,6 +73,12 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
switch (componentName)
|
switch (componentName)
|
||||||
{
|
{
|
||||||
|
case "Play/osu/sliderball":
|
||||||
|
if (GetTexture("sliderb") != null)
|
||||||
|
return new LegacySliderBall();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case "Play/Miss":
|
case "Play/Miss":
|
||||||
componentName = "hit0";
|
componentName = "hit0";
|
||||||
break;
|
break;
|
||||||
@ -109,6 +117,16 @@ namespace osu.Game.Skinning
|
|||||||
return new Sprite { Texture = texture };
|
return new Sprite { Texture = texture };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LegacySliderBall : Sprite
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("sliderb");
|
||||||
|
Colour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Color4.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Texture GetTexture(string componentName)
|
public override Texture GetTexture(string componentName)
|
||||||
{
|
{
|
||||||
float ratio = 2;
|
float ratio = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user