mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 08:22:56 +08:00
Inline "legacy coordinates container" and add "spinner Y centre" const
This commit is contained in:
parent
bb79da1aac
commit
0549395869
@ -37,9 +37,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
AddInternal(scaleContainer = new Container
|
AddInternal(scaleContainer = new Container
|
||||||
{
|
{
|
||||||
Scale = new Vector2(SPRITE_SCALE),
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Y = SPINNER_Y_CENTRE,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
glow = new Sprite
|
glow = new Sprite
|
||||||
|
@ -37,21 +37,21 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
new Sprite
|
new Sprite
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Texture = source.GetTexture("spinner-background"),
|
Texture = source.GetTexture("spinner-background"),
|
||||||
Scale = new Vector2(SPRITE_SCALE)
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
|
Y = SPINNER_Y_CENTRE,
|
||||||
},
|
},
|
||||||
disc = new Sprite
|
disc = new Sprite
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Texture = source.GetTexture("spinner-circle"),
|
Texture = source.GetTexture("spinner-circle"),
|
||||||
Scale = new Vector2(SPRITE_SCALE)
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
|
Y = SPINNER_Y_CENTRE,
|
||||||
},
|
},
|
||||||
new LegacyCoordinatesContainer
|
metre = new Container
|
||||||
{
|
|
||||||
Child = metre = new Container
|
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
// this anchor makes no sense, but that's what stable uses.
|
// this anchor makes no sense, but that's what stable uses.
|
||||||
@ -67,7 +67,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
Scale = new Vector2(SPRITE_SCALE)
|
Scale = new Vector2(SPRITE_SCALE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +16,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
public abstract class LegacySpinner : CompositeDrawable
|
public abstract class LegacySpinner : CompositeDrawable
|
||||||
{
|
{
|
||||||
/// <summary>
|
protected static readonly float SPINNER_TOP_OFFSET = MathF.Ceiling(45f * SPRITE_SCALE);
|
||||||
/// An offset that simulates stable's spinner top offset, can be used with <see cref="LegacyCoordinatesContainer"/>
|
protected static readonly float SPINNER_Y_CENTRE = SPINNER_TOP_OFFSET + 219f;
|
||||||
/// for positioning some legacy spinner components perfectly as in stable.
|
|
||||||
/// (e.g. 'spin' sprite, 'clear' sprite, metre in old-style spinners)
|
|
||||||
/// </summary>
|
|
||||||
public static readonly float SPINNER_TOP_OFFSET = MathF.Ceiling(45f * SPRITE_SCALE);
|
|
||||||
|
|
||||||
protected const float SPRITE_SCALE = 0.625f;
|
protected const float SPRITE_SCALE = 0.625f;
|
||||||
|
|
||||||
@ -33,19 +29,27 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
// legacy spinners relied heavily on absolute screen-space coordinate values.
|
||||||
|
// wrap everything in a container simulating absolute coords to preserve alignment
|
||||||
|
// as there are skins that depend on it.
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
Size = new Vector2(640, 480);
|
||||||
|
|
||||||
|
// stable applies this adjustment conditionally, locally in the spinner.
|
||||||
|
// in lazer this is handled at a higher level in OsuPlayfieldAdjustmentContainer,
|
||||||
|
// therefore it's safe to apply it unconditionally in this component.
|
||||||
|
Position = new Vector2(0, -8f);
|
||||||
|
|
||||||
DrawableSpinner = (DrawableSpinner)drawableHitObject;
|
DrawableSpinner = (DrawableSpinner)drawableHitObject;
|
||||||
|
|
||||||
AddInternal(new LegacyCoordinatesContainer
|
AddRangeInternal(new[]
|
||||||
{
|
|
||||||
Depth = float.MinValue,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
spin = new Sprite
|
spin = new Sprite
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
Depth = float.MinValue,
|
||||||
Texture = source.GetTexture("spinner-spin"),
|
Texture = source.GetTexture("spinner-spin"),
|
||||||
Scale = new Vector2(SPRITE_SCALE),
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
Y = SPINNER_TOP_OFFSET + 335,
|
Y = SPINNER_TOP_OFFSET + 335,
|
||||||
@ -55,11 +59,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
Depth = float.MinValue,
|
||||||
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,
|
||||||
},
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,27 +140,5 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
if (DrawableSpinner != null)
|
if (DrawableSpinner != null)
|
||||||
DrawableSpinner.ApplyCustomUpdateState -= UpdateStateTransforms;
|
DrawableSpinner.ApplyCustomUpdateState -= UpdateStateTransforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A <see cref="Container"/> simulating osu!stable's absolute screen-space,
|
|
||||||
/// for perfect placements of legacy spinner components with legacy coordinates.
|
|
||||||
/// </summary>
|
|
||||||
protected class LegacyCoordinatesContainer : Container
|
|
||||||
{
|
|
||||||
public LegacyCoordinatesContainer()
|
|
||||||
{
|
|
||||||
// legacy spinners relied heavily on absolute screen-space coordinate values.
|
|
||||||
// wrap everything in a container simulating absolute coords to preserve alignment
|
|
||||||
// as there are skins that depend on it.
|
|
||||||
Anchor = Anchor.Centre;
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
Size = new Vector2(640, 480);
|
|
||||||
|
|
||||||
// stable applies this adjustment conditionally, locally in the spinner.
|
|
||||||
// in lazer this is handled at a higher level in OsuPlayfieldAdjustmentContainer,
|
|
||||||
// therefore it's safe to apply it unconditionally in this component.
|
|
||||||
Position = new Vector2(0, -8f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user