mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge pull request #8681 from peppy/fix-drum-alignment
Fix osu!taiko input drum alignment for old skin versions
This commit is contained in:
commit
825a9bcf42
@ -0,0 +1,5 @@
|
||||
[General]
|
||||
Name: an old skin
|
||||
Author: an old guy
|
||||
|
||||
// no version specified means v1
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
@ -18,9 +18,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
/// </summary>
|
||||
internal class LegacyInputDrum : Container
|
||||
{
|
||||
private LegacyHalfDrum left;
|
||||
private LegacyHalfDrum right;
|
||||
|
||||
public LegacyInputDrum()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Size = new Vector2(180, 200);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -32,25 +35,47 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
{
|
||||
Texture = skin.GetTexture("taiko-bar-left")
|
||||
},
|
||||
new LegacyHalfDrum(false)
|
||||
left = new LegacyHalfDrum(false)
|
||||
{
|
||||
Name = "Left Half",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
RimAction = TaikoAction.LeftRim,
|
||||
CentreAction = TaikoAction.LeftCentre
|
||||
},
|
||||
new LegacyHalfDrum(true)
|
||||
right = new LegacyHalfDrum(true)
|
||||
{
|
||||
Name = "Right Half",
|
||||
Anchor = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
Origin = Anchor.TopRight,
|
||||
Scale = new Vector2(-1, 1),
|
||||
RimAction = TaikoAction.RightRim,
|
||||
CentreAction = TaikoAction.RightCentre
|
||||
}
|
||||
};
|
||||
|
||||
// this will be used in the future for stable skin alignment. keeping here for reference.
|
||||
const float taiko_bar_y = 0;
|
||||
|
||||
// stable things
|
||||
const float ratio = 1.6f;
|
||||
|
||||
// because the right half is flipped, we need to position using width - position to get the true "topleft" origin position
|
||||
float negativeScaleAdjust = Width / ratio;
|
||||
|
||||
if (skin.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value >= 2.1m)
|
||||
{
|
||||
left.Centre.Position = new Vector2(0, taiko_bar_y) * ratio;
|
||||
right.Centre.Position = new Vector2(negativeScaleAdjust - 56, taiko_bar_y) * ratio;
|
||||
left.Rim.Position = new Vector2(0, taiko_bar_y) * ratio;
|
||||
right.Rim.Position = new Vector2(negativeScaleAdjust - 56, taiko_bar_y) * ratio;
|
||||
}
|
||||
else
|
||||
{
|
||||
left.Centre.Position = new Vector2(18, taiko_bar_y + 31) * ratio;
|
||||
right.Centre.Position = new Vector2(negativeScaleAdjust - 54, taiko_bar_y + 31) * ratio;
|
||||
left.Rim.Position = new Vector2(8, taiko_bar_y + 23) * ratio;
|
||||
right.Rim.Position = new Vector2(negativeScaleAdjust - 53, taiko_bar_y + 23) * ratio;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -68,8 +93,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
/// </summary>
|
||||
public TaikoAction CentreAction;
|
||||
|
||||
private readonly Sprite rimHit;
|
||||
private readonly Sprite centreHit;
|
||||
public readonly Sprite Rim;
|
||||
public readonly Sprite Centre;
|
||||
|
||||
[Resolved]
|
||||
private DrumSampleMapping sampleMappings { get; set; }
|
||||
@ -80,18 +105,16 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rimHit = new Sprite
|
||||
Rim = new Sprite
|
||||
{
|
||||
Anchor = flipped ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||
Origin = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||
Scale = new Vector2(-1, 1),
|
||||
Origin = flipped ? Anchor.TopLeft : Anchor.TopRight,
|
||||
Alpha = 0,
|
||||
},
|
||||
centreHit = new Sprite
|
||||
Centre = new Sprite
|
||||
{
|
||||
Anchor = flipped ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||
Origin = flipped ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||
Alpha = 0,
|
||||
Origin = flipped ? Anchor.TopRight : Anchor.TopLeft,
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -99,8 +122,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource skin)
|
||||
{
|
||||
rimHit.Texture = skin.GetTexture(@"taiko-drum-outer");
|
||||
centreHit.Texture = skin.GetTexture(@"taiko-drum-inner");
|
||||
Rim.Texture = skin.GetTexture(@"taiko-drum-outer");
|
||||
Centre.Texture = skin.GetTexture(@"taiko-drum-inner");
|
||||
}
|
||||
|
||||
public bool OnPressed(TaikoAction action)
|
||||
@ -110,12 +133,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
|
||||
if (action == CentreAction)
|
||||
{
|
||||
target = centreHit;
|
||||
target = Centre;
|
||||
drumSample.Centre?.Play();
|
||||
}
|
||||
else if (action == RimAction)
|
||||
{
|
||||
target = rimHit;
|
||||
target = Rim;
|
||||
drumSample.Rim?.Play();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Skinning
|
||||
new Color4(242, 24, 57, 255)
|
||||
);
|
||||
|
||||
Configuration.LegacyVersion = 2.0m;
|
||||
Configuration.LegacyVersion = 2.7m;
|
||||
}
|
||||
|
||||
public static SkinInfo Info { get; } = new SkinInfo
|
||||
|
Loading…
Reference in New Issue
Block a user