mirror of
https://github.com/ppy/osu.git
synced 2025-02-04 20:33:21 +08:00
Define constant input drum width for osu!taiko
This commit is contained in:
parent
0c03326eaf
commit
d4fef99e1f
@ -30,8 +30,11 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(200),
|
Size = new Vector2(180f, 200f),
|
||||||
Child = new InputDrum()
|
Child = new InputDrum
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
|
|||||||
|
|
||||||
public ArgonInputDrum()
|
public ArgonInputDrum()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
|||||||
{
|
{
|
||||||
public DefaultInputDrum()
|
public DefaultInputDrum()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -18,22 +19,20 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal partial class LegacyInputDrum : Container
|
internal partial class LegacyInputDrum : Container
|
||||||
{
|
{
|
||||||
private Container content = null!;
|
|
||||||
private LegacyHalfDrum left = null!;
|
private LegacyHalfDrum left = null!;
|
||||||
private LegacyHalfDrum right = null!;
|
private LegacyHalfDrum right = null!;
|
||||||
|
|
||||||
public LegacyInputDrum()
|
public LegacyInputDrum()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AutoSizeAxes = Axes.X;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin)
|
private void load(ISkinSource skin)
|
||||||
{
|
{
|
||||||
Child = content = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
Size = new Vector2(180, 200),
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Sprite
|
new Sprite
|
||||||
@ -66,33 +65,24 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
const float ratio = 1.6f;
|
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
|
// because the right half is flipped, we need to position using width - position to get the true "topleft" origin position
|
||||||
float negativeScaleAdjust = content.Width / ratio;
|
const float negative_scale_adjust = TaikoPlayfield.INPUT_DRUM_WIDTH / ratio;
|
||||||
|
|
||||||
if (skin.GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value >= 2.1m)
|
if (skin.GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value >= 2.1m)
|
||||||
{
|
{
|
||||||
left.Centre.Position = new Vector2(0, taiko_bar_y) * ratio;
|
left.Centre.Position = new Vector2(0, taiko_bar_y) * ratio;
|
||||||
right.Centre.Position = new Vector2(negativeScaleAdjust - 56, taiko_bar_y) * ratio;
|
right.Centre.Position = new Vector2(negative_scale_adjust - 56, taiko_bar_y) * ratio;
|
||||||
left.Rim.Position = new Vector2(0, 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;
|
right.Rim.Position = new Vector2(negative_scale_adjust - 56, taiko_bar_y) * ratio;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
left.Centre.Position = new Vector2(18, taiko_bar_y + 31) * ratio;
|
left.Centre.Position = new Vector2(18, taiko_bar_y + 31) * ratio;
|
||||||
right.Centre.Position = new Vector2(negativeScaleAdjust - 54, taiko_bar_y + 31) * ratio;
|
right.Centre.Position = new Vector2(negative_scale_adjust - 54, taiko_bar_y + 31) * ratio;
|
||||||
left.Rim.Position = new Vector2(8, taiko_bar_y + 23) * ratio;
|
left.Rim.Position = new Vector2(8, taiko_bar_y + 23) * ratio;
|
||||||
right.Rim.Position = new Vector2(negativeScaleAdjust - 53, taiko_bar_y + 23) * ratio;
|
right.Rim.Position = new Vector2(negative_scale_adjust - 53, taiko_bar_y + 23) * ratio;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
// Relying on RelativeSizeAxes.Both + FillMode.Fit doesn't work due to the precise pixel layout requirements.
|
|
||||||
// This is a bit ugly but makes the non-legacy implementations a lot cleaner to implement.
|
|
||||||
content.Scale = new Vector2(DrawHeight / content.Size.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A half-drum. Contains one centre and one rim hit.
|
/// A half-drum. Contains one centre and one rim hit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -14,12 +14,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal partial class InputDrum : Container
|
internal partial class InputDrum : Container
|
||||||
{
|
{
|
||||||
public InputDrum()
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.X;
|
|
||||||
RelativeSizeAxes = Axes.Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -27,8 +21,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.InputDrum), _ => new DefaultInputDrum())
|
new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.InputDrum), _ => new DefaultInputDrum())
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Both,
|
||||||
AutoSizeAxes = Axes.X,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const float BASE_HEIGHT = 200;
|
public const float BASE_HEIGHT = 200;
|
||||||
|
|
||||||
|
public const float INPUT_DRUM_WIDTH = 180f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the hit target should be nudged further towards the left area, matching the stable "classic" position.
|
/// Whether the hit target should be nudged further towards the left area, matching the stable "classic" position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -49,7 +51,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
private ProxyContainer topLevelHitContainer = null!;
|
private ProxyContainer topLevelHitContainer = null!;
|
||||||
private InputDrum inputDrum = null!;
|
private InputDrum inputDrum = null!;
|
||||||
private Container rightArea = null!;
|
|
||||||
|
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// <see cref="Playfield.AddNested"/> is purposefully not called on this to prevent i.e. being able to interact
|
/// <see cref="Playfield.AddNested"/> is purposefully not called on this to prevent i.e. being able to interact
|
||||||
@ -66,8 +67,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
AutoSizeAxes = Axes.X,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = INPUT_DRUM_WIDTH,
|
||||||
};
|
};
|
||||||
|
|
||||||
InternalChildren = new[]
|
InternalChildren = new[]
|
||||||
@ -76,8 +77,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Name = "Left overlay",
|
Name = "Left overlay",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Y,
|
||||||
FillMode = FillMode.Fit,
|
Width = INPUT_DRUM_WIDTH,
|
||||||
BorderColour = colours.Gray0,
|
BorderColour = colours.Gray0,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
@ -93,10 +94,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
RelativeSizeAxes = Axes.None,
|
RelativeSizeAxes = Axes.None,
|
||||||
Y = 0.2f
|
Y = 0.2f
|
||||||
},
|
},
|
||||||
rightArea = new Container
|
new Container
|
||||||
{
|
{
|
||||||
Name = "Right area",
|
Name = "Right area",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Left = INPUT_DRUM_WIDTH },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -220,14 +222,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
topLevelHitContainer.Add(taikoObject.CreateProxiedContent());
|
topLevelHitContainer.Add(taikoObject.CreateProxiedContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
// todo: input drum width should be constant.
|
|
||||||
rightArea.Padding = new MarginPadding { Left = inputDrum.DrawWidth };
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Pooling support
|
#region Pooling support
|
||||||
|
|
||||||
public override void Add(HitObject h)
|
public override void Add(HitObject h)
|
||||||
|
Loading…
Reference in New Issue
Block a user