mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Merge remote-tracking branch 'upstream/master' into legacy-cursor-middle
This commit is contained in:
@ -9,14 +9,19 @@ using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
@ -38,6 +43,8 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
}
|
||||
|
||||
private readonly bool hasHitCircle;
|
||||
|
||||
protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, string filename)
|
||||
: base(skin)
|
||||
{
|
||||
@ -51,8 +58,6 @@ namespace osu.Game.Skinning
|
||||
Samples = audioManager.GetSampleStore(storage);
|
||||
Textures = new TextureStore(new TextureLoaderStore(storage));
|
||||
|
||||
bool hasHitCircle = false;
|
||||
|
||||
using (var testStream = storage.GetStream("hitcircle"))
|
||||
hasHitCircle |= testStream != null;
|
||||
|
||||
@ -77,7 +82,19 @@ namespace osu.Game.Skinning
|
||||
if (GetTexture("cursor") != null)
|
||||
return new LegacyCursor();
|
||||
|
||||
break;
|
||||
return null;
|
||||
|
||||
case "Play/osu/sliderball":
|
||||
if (GetTexture("sliderb") != null)
|
||||
return new LegacySliderBall();
|
||||
|
||||
return null;
|
||||
|
||||
case "Play/osu/hitcircle":
|
||||
if (hasHitCircle)
|
||||
return new LegacyMainCirclePiece();
|
||||
|
||||
return null;
|
||||
|
||||
case "Play/Miss":
|
||||
componentName = "hit0";
|
||||
@ -117,6 +134,16 @@ namespace osu.Game.Skinning
|
||||
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)
|
||||
{
|
||||
float ratio = 2;
|
||||
@ -264,10 +291,70 @@ namespace osu.Game.Skinning
|
||||
new NonPlayfieldSprite
|
||||
{
|
||||
Texture = skin.GetTexture("cursor"),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class LegacyMainCirclePiece : CompositeDrawable
|
||||
{
|
||||
public LegacyMainCirclePiece()
|
||||
{
|
||||
Size = new Vector2(128);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user