mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Proxy spinner approach circle before the spinner overlay components
This commit is contained in:
12
osu.Game.Rulesets.Osu/Skinning/IProxiesApproachCircle.cs
Normal file
12
osu.Game.Rulesets.Osu/Skinning/IProxiesApproachCircle.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Skinning
|
||||||
|
{
|
||||||
|
public interface IProxiesApproachCircle
|
||||||
|
{
|
||||||
|
Container ApproachCircleTarget { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -15,8 +15,10 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||||
{
|
{
|
||||||
public abstract class LegacySpinner : CompositeDrawable
|
public abstract class LegacySpinner : CompositeDrawable, IProxiesApproachCircle
|
||||||
{
|
{
|
||||||
|
public const float SPRITE_SCALE = 0.625f;
|
||||||
|
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// All constants are in osu!stable's gamefield space, which is shifted 16px downwards.
|
/// All constants are in osu!stable's gamefield space, which is shifted 16px downwards.
|
||||||
/// This offset is negated in both osu!stable and osu!lazer to bring all constants into window-space.
|
/// This offset is negated in both osu!stable and osu!lazer to bring all constants into window-space.
|
||||||
@ -26,12 +28,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
protected const float SPINNER_Y_CENTRE = SPINNER_TOP_OFFSET + 219f;
|
protected const float SPINNER_Y_CENTRE = SPINNER_TOP_OFFSET + 219f;
|
||||||
|
|
||||||
protected const float SPRITE_SCALE = 0.625f;
|
|
||||||
|
|
||||||
private const float spm_hide_offset = 50f;
|
private const float spm_hide_offset = 50f;
|
||||||
|
|
||||||
protected DrawableSpinner DrawableSpinner { get; private set; }
|
protected DrawableSpinner DrawableSpinner { get; private set; }
|
||||||
|
|
||||||
|
public Container ApproachCircleTarget { get; private set; }
|
||||||
|
|
||||||
private Sprite spin;
|
private Sprite spin;
|
||||||
private Sprite clear;
|
private Sprite clear;
|
||||||
@ -58,8 +59,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
Depth = float.MinValue,
|
Depth = float.MinValue,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
ApproachCircleTarget = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
spin = new Sprite
|
spin = new Sprite
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
|
34
osu.Game.Rulesets.Osu/Skinning/SkinnableSpinnerBody.cs
Normal file
34
osu.Game.Rulesets.Osu/Skinning/SkinnableSpinnerBody.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// 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 System;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Skinning
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A skinnable drawable of the <see cref="OsuSkinComponents.SpinnerBody"/> component, with the approach circle exposed for modification.
|
||||||
|
/// </summary>
|
||||||
|
public class SkinnableSpinnerBody : SkinnableDrawable
|
||||||
|
{
|
||||||
|
private readonly Drawable approachCircleProxy;
|
||||||
|
|
||||||
|
public SkinnableSpinnerBody(Drawable approachCircleProxy, Func<ISkinComponent, Drawable> defaultImplementation = null)
|
||||||
|
: base(new OsuSkinComponent(OsuSkinComponents.SpinnerBody), defaultImplementation)
|
||||||
|
{
|
||||||
|
this.approachCircleProxy = approachCircleProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SkinChanged(ISkinSource skin)
|
||||||
|
{
|
||||||
|
if (Drawable is IProxiesApproachCircle oldProxiesApproachCircle)
|
||||||
|
oldProxiesApproachCircle.ApproachCircleTarget.Remove(approachCircleProxy);
|
||||||
|
|
||||||
|
base.SkinChanged(skin);
|
||||||
|
|
||||||
|
if (Drawable is IProxiesApproachCircle newProxiesApproachCircle)
|
||||||
|
newProxiesApproachCircle.ApproachCircleTarget.Add(approachCircleProxy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user