Skip to content

Commit aa35ac2

Browse files
authored
Merge pull request #32457 from peppy/mod-display-vertical-flow
Allow vertical layout for skinnable mod display
2 parents e51b666 + ad96cff commit aa35ac2

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

osu.Game/Localisation/SkinComponents/SkinnableModDisplayStrings.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ public static class SkinnableModDisplayStrings
1717
/// <summary>
1818
/// "Whether to show extended information for each mod."
1919
/// </summary>
20-
public static LocalisableString ShowExtendedInformationDescription => new TranslatableString(getKey(@"whether_to_show_extended_information"), @"Whether to show extended information for each mod.");
20+
public static LocalisableString ShowExtendedInformationDescription =>
21+
new TranslatableString(getKey(@"whether_to_show_extended_information"), @"Whether to show extended information for each mod.");
22+
23+
/// <summary>
24+
/// "Display direction"
25+
/// </summary>
26+
public static LocalisableString DisplayDirection => new TranslatableString(getKey(@"display_direction"), "Display direction");
2127

2228
/// <summary>
2329
/// "Expansion mode"

osu.Game/Screens/Play/HUD/ModDisplay.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ public bool ShowExtendedInformation
6767
}
6868
}
6969

70+
public FillDirection FillDirection
71+
{
72+
get => iconsContainer.Direction;
73+
set => iconsContainer.Direction = value;
74+
}
75+
7076
private readonly FillFlowContainer<ModIcon> iconsContainer;
7177

7278
public ModDisplay(bool showExtendedInformation = true)
@@ -122,13 +128,13 @@ private void updateExpansionMode(double duration = 500)
122128
private void expand(double duration = 500)
123129
{
124130
if (ExpansionMode != ExpansionMode.AlwaysContracted)
125-
iconsContainer.TransformSpacingTo(new Vector2(5, 0), duration, Easing.OutQuint);
131+
iconsContainer.TransformSpacingTo(new Vector2(5, -10), duration, Easing.OutQuint);
126132
}
127133

128134
private void contract(double duration = 500)
129135
{
130136
if (ExpansionMode != ExpansionMode.AlwaysExpanded)
131-
iconsContainer.TransformSpacingTo(new Vector2(-25, 0), duration, Easing.OutQuint);
137+
iconsContainer.TransformSpacingTo(new Vector2(-25), duration, Easing.OutQuint);
132138
}
133139

134140
protected override bool OnHover(HoverEvent e)

osu.Game/Screens/Play/HUD/SkinnableModDisplay.cs

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public partial class SkinnableModDisplay : CompositeDrawable, ISerialisableDrawa
3030
[SettingSource(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.ExpansionMode), nameof(SkinnableModDisplayStrings.ExpansionModeDescription))]
3131
public Bindable<ExpansionMode> ExpansionModeSetting { get; } = new Bindable<ExpansionMode>();
3232

33+
[SettingSource(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.DisplayDirection))]
34+
public Bindable<Direction> Direction { get; } = new Bindable<Direction>();
35+
3336
[BackgroundDependencyLoader]
3437
private void load()
3538
{
@@ -50,6 +53,7 @@ protected override void LoadComplete()
5053

5154
ShowExtendedInformation.BindValueChanged(_ => modDisplay.ShowExtendedInformation = ShowExtendedInformation.Value, true);
5255
ExpansionModeSetting.BindValueChanged(_ => modDisplay.ExpansionMode = ExpansionModeSetting.Value, true);
56+
Direction.BindValueChanged(_ => modDisplay.FillDirection = Direction.Value == Framework.Graphics.Direction.Horizontal ? FillDirection.Horizontal : FillDirection.Vertical, true);
5357

5458
FinishTransforms(true);
5559
}

osu.Game/Screens/Play/HUDOverlay.cs

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ public HUDOverlay([CanBeNull] DrawableRuleset drawableRuleset, IReadOnlyList<Mod
147147
Direction = FillDirection.Vertical,
148148
Children = new Drawable[]
149149
{
150+
// This display is potentially a duplicate of users with a local ModDisplay in their skins.
151+
// It would be very nice to remove this, but the version here has special logic with regards to replays
152+
// and initial states, so needs a bit of thought before doing so.
150153
ModDisplay = CreateModsContainer(),
151154
}
152155
},

0 commit comments

Comments
 (0)