Skip to content

Commit f9c73e6

Browse files
authored
Merge pull request #32151 from peppy/mania-barline
Add support for legacy osu!mania barline height and colour spec
2 parents 7f99e60 + cb29459 commit f9c73e6

File tree

8 files changed

+58
-5
lines changed

8 files changed

+58
-5
lines changed

osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,17 @@ public DrawableBarLine(BarLine barLine)
2626
: base(barLine)
2727
{
2828
RelativeSizeAxes = Axes.X;
29+
Height = 1;
2930
}
3031

31-
[BackgroundDependencyLoader]
32+
[BackgroundDependencyLoader(true)]
3233
private void load()
3334
{
3435
AddInternal(new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.BarLine), _ => new DefaultBarLine())
3536
{
3637
Anchor = Anchor.Centre,
3738
Origin = Anchor.Centre,
3839
});
39-
40-
Major.BindValueChanged(major => Height = major.NewValue ? 1.7f : 1.2f, true);
4140
}
4241

4342
protected override void OnApply()

osu.Game.Rulesets.Mania/Skinning/Default/DefaultBarLine.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public partial class DefaultBarLine : CompositeDrawable
2424
[BackgroundDependencyLoader]
2525
private void load(DrawableHitObject drawableHitObject)
2626
{
27-
RelativeSizeAxes = Axes.Both;
27+
RelativeSizeAxes = Axes.X;
2828

2929
// Avoid flickering due to no anti-aliasing of boxes by default.
3030
var edgeSmoothness = new Vector2(0.3f);
@@ -75,6 +75,8 @@ protected override void LoadComplete()
7575

7676
private void updateMajor(ValueChangedEvent<bool> major)
7777
{
78+
Height = major.NewValue ? 1.7f : 1.2f;
79+
7880
mainLine.Alpha = major.NewValue ? 0.5f : 0.2f;
7981
leftAnchor.Alpha = rightAnchor.Alpha = major.NewValue ? mainLine.Alpha * 0.3f : 0;
8082
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2+
// See the LICENCE file in the repository root for full licence text.
3+
4+
using osu.Framework.Allocation;
5+
using osu.Framework.Graphics;
6+
using osu.Framework.Graphics.Containers;
7+
using osu.Framework.Graphics.Shapes;
8+
using osu.Game.Skinning;
9+
using osuTK;
10+
using osuTK.Graphics;
11+
12+
namespace osu.Game.Rulesets.Mania.Skinning.Legacy
13+
{
14+
public partial class LegacyBarLine : CompositeDrawable
15+
{
16+
[BackgroundDependencyLoader]
17+
private void load(ISkinSource skin)
18+
{
19+
float skinHeight = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.BarLineHeight)?.Value ?? 1;
20+
21+
RelativeSizeAxes = Axes.X;
22+
Height = 1.2f * skinHeight;
23+
Colour = skin.GetManiaSkinConfig<Color4>(LegacyManiaSkinConfigurationLookups.BarLineColour)?.Value ?? Color4.White;
24+
25+
// Avoid flickering due to no anti-aliasing of boxes by default.
26+
var edgeSmoothness = new Vector2(0.3f);
27+
28+
AddInternal(new Box
29+
{
30+
Name = "Bar line",
31+
EdgeSmoothness = edgeSmoothness,
32+
Anchor = Anchor.BottomCentre,
33+
Origin = Anchor.BottomCentre,
34+
RelativeSizeAxes = Axes.Both,
35+
});
36+
}
37+
}
38+
}

osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public override Drawable GetDrawableComponent(ISkinComponentLookup lookup)
163163
return new LegacyStageForeground();
164164

165165
case ManiaSkinComponents.BarLine:
166-
return null; // Not yet implemented.
166+
return new LegacyBarLine();
167167

168168
default:
169169
throw new UnsupportedSkinComponentException(lookup);

osu.Game/Skinning/LegacyManiaSkinConfiguration.cs

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class LegacyManiaSkinConfiguration : IHasCustomColours
4141
public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR;
4242
public float ComboPosition = 111 * POSITION_SCALE_FACTOR;
4343
public float ScorePosition = 300 * POSITION_SCALE_FACTOR;
44+
public float BarLineHeight = 1;
4445
public bool ShowJudgementLine = true;
4546
public bool KeysUnderNotes;
4647
public int LightFramePerSecond = 60;

osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public enum LegacyManiaSkinConfigurationLookups
7070
RightStageImage,
7171
BottomStageImage,
7272

73+
BarLineHeight,
74+
BarLineColour,
75+
7376
// ReSharper disable once InconsistentNaming
7477
Hit300g,
7578

osu.Game/Skinning/LegacyManiaSkinDecoder.cs

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ private void flushPendingLines()
8686
parseArrayValue(pair.Value, currentConfig.ColumnWidth);
8787
break;
8888

89+
case "BarlineHeight":
90+
currentConfig.BarLineHeight = float.Parse(pair.Value, CultureInfo.InvariantCulture);
91+
break;
92+
8993
case "HitPosition":
9094
currentConfig.HitPosition = (480 - Math.Clamp(float.Parse(pair.Value, CultureInfo.InvariantCulture), 240, 480)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
9195
break;

osu.Game/Skinning/LegacySkin.cs

+6
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,15 @@ protected override void ParseConfigurationStream(Stream stream)
198198
case LegacyManiaSkinConfigurationLookups.ComboBreakColour:
199199
return SkinUtils.As<TValue>(getCustomColour(existing, "ColourBreak"));
200200

201+
case LegacyManiaSkinConfigurationLookups.BarLineColour:
202+
return SkinUtils.As<TValue>(getCustomColour(existing, "ColourBarline"));
203+
201204
case LegacyManiaSkinConfigurationLookups.MinimumColumnWidth:
202205
return SkinUtils.As<TValue>(new Bindable<float>(existing.MinimumColumnWidth));
203206

207+
case LegacyManiaSkinConfigurationLookups.BarLineHeight:
208+
return SkinUtils.As<TValue>(new Bindable<float>(existing.BarLineHeight));
209+
204210
case LegacyManiaSkinConfigurationLookups.NoteBodyStyle:
205211

206212
if (existing.NoteBodyStyle != null)

0 commit comments

Comments
 (0)