mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge pull request #10010 from bdach/old-style-spinner-alignment
Adjust old-style spinner alignment to be closer to stable
This commit is contained in:
commit
d6e007b312
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -9,6 +9,7 @@ using osu.Game.Beatmaps.ControlPoints;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
@ -62,7 +63,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
drawableSpinner = new TestDrawableSpinner(spinner, auto)
|
drawableSpinner = new TestDrawableSpinner(spinner, auto)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Depth = depthIndex++
|
Depth = depthIndex++,
|
||||||
|
Scale = new Vector2(0.75f)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())
|
||||||
|
@ -22,11 +22,11 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
{
|
{
|
||||||
private DrawableSpinner drawableSpinner;
|
private DrawableSpinner drawableSpinner;
|
||||||
private Sprite disc;
|
private Sprite disc;
|
||||||
|
private Sprite metreSprite;
|
||||||
private Container metre;
|
private Container metre;
|
||||||
|
|
||||||
private const float background_y_offset = 20;
|
|
||||||
|
|
||||||
private const float sprite_scale = 1 / 1.6f;
|
private const float sprite_scale = 1 / 1.6f;
|
||||||
|
private const float final_metre_height = 692 * sprite_scale;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource source, DrawableHitObject drawableObject)
|
private void load(ISkinSource source, DrawableHitObject drawableObject)
|
||||||
@ -35,50 +35,58 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChild = new Container
|
||||||
{
|
{
|
||||||
new Sprite
|
// the old-style spinner 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.
|
||||||
|
Width = 640,
|
||||||
|
Height = 480,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
new Sprite
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
Texture = source.GetTexture("spinner-background"),
|
|
||||||
Y = background_y_offset,
|
|
||||||
Scale = new Vector2(sprite_scale)
|
|
||||||
},
|
|
||||||
disc = new Sprite
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Texture = source.GetTexture("spinner-circle"),
|
|
||||||
Scale = new Vector2(sprite_scale)
|
|
||||||
},
|
|
||||||
metre = new Container
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomCentre,
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
Y = background_y_offset,
|
|
||||||
Masking = true,
|
|
||||||
Child = new Sprite
|
|
||||||
{
|
{
|
||||||
Texture = source.GetTexture("spinner-metre"),
|
Anchor = Anchor.Centre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Origin = Anchor.Centre,
|
||||||
Origin = Anchor.BottomCentre,
|
Texture = source.GetTexture("spinner-background"),
|
||||||
|
Scale = new Vector2(sprite_scale)
|
||||||
},
|
},
|
||||||
Scale = new Vector2(0.625f)
|
disc = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-circle"),
|
||||||
|
Scale = new Vector2(sprite_scale)
|
||||||
|
},
|
||||||
|
metre = new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
// this anchor makes no sense, but that's what stable uses.
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
// adjustment for stable (metre has additional offset)
|
||||||
|
Margin = new MarginPadding { Top = 20 },
|
||||||
|
Masking = true,
|
||||||
|
Child = metreSprite = new Sprite
|
||||||
|
{
|
||||||
|
Texture = source.GetTexture("spinner-metre"),
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Scale = new Vector2(0.625f)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 metreFinalSize;
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
this.FadeOut();
|
this.FadeOut();
|
||||||
drawableSpinner.State.BindValueChanged(updateStateTransforms, true);
|
drawableSpinner.State.BindValueChanged(updateStateTransforms, true);
|
||||||
|
|
||||||
metreFinalSize = metre.Size = metre.Child.Size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStateTransforms(ValueChangedEvent<ArmedState> state)
|
private void updateStateTransforms(ValueChangedEvent<ArmedState> state)
|
||||||
@ -93,7 +101,16 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
disc.Rotation = drawableSpinner.RotationTracker.Rotation;
|
disc.Rotation = drawableSpinner.RotationTracker.Rotation;
|
||||||
metre.Height = getMetreHeight(drawableSpinner.Progress);
|
|
||||||
|
// careful: need to call this exactly once for all calculations in a frame
|
||||||
|
// as the function has a random factor in it
|
||||||
|
var metreHeight = getMetreHeight(drawableSpinner.Progress);
|
||||||
|
|
||||||
|
// hack to make the metre blink up from below than down from above.
|
||||||
|
// move down the container to be able to apply masking for the metre,
|
||||||
|
// and then move the sprite back up the same amount to keep its position absolute.
|
||||||
|
metre.Y = final_metre_height - metreHeight;
|
||||||
|
metreSprite.Y = -metre.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private const int total_bars = 10;
|
private const int total_bars = 10;
|
||||||
@ -108,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
if (RNG.NextBool(((int)progress % 10) / 10f))
|
if (RNG.NextBool(((int)progress % 10) / 10f))
|
||||||
barCount++;
|
barCount++;
|
||||||
|
|
||||||
return (float)barCount / total_bars * metreFinalSize.Y;
|
return (float)barCount / total_bars * final_metre_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user