1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-17 21:13:01 +08:00

Merge pull request #32457 from peppy/mod-display-vertical-flow

Allow vertical layout for skinnable mod display
This commit is contained in:
Bartłomiej Dach
2025-03-19 11:39:58 +01:00
committed by GitHub
Unverified
4 changed files with 22 additions and 3 deletions
@@ -17,7 +17,13 @@ namespace osu.Game.Localisation.SkinComponents
/// <summary>
/// "Whether to show extended information for each mod."
/// </summary>
public static LocalisableString ShowExtendedInformationDescription => new TranslatableString(getKey(@"whether_to_show_extended_information"), @"Whether to show extended information for each mod.");
public static LocalisableString ShowExtendedInformationDescription =>
new TranslatableString(getKey(@"whether_to_show_extended_information"), @"Whether to show extended information for each mod.");
/// <summary>
/// "Display direction"
/// </summary>
public static LocalisableString DisplayDirection => new TranslatableString(getKey(@"display_direction"), "Display direction");
/// <summary>
/// "Expansion mode"
+8 -2
View File
@@ -67,6 +67,12 @@ namespace osu.Game.Screens.Play.HUD
}
}
public FillDirection FillDirection
{
get => iconsContainer.Direction;
set => iconsContainer.Direction = value;
}
private readonly FillFlowContainer<ModIcon> iconsContainer;
public ModDisplay(bool showExtendedInformation = true)
@@ -122,13 +128,13 @@ namespace osu.Game.Screens.Play.HUD
private void expand(double duration = 500)
{
if (ExpansionMode != ExpansionMode.AlwaysContracted)
iconsContainer.TransformSpacingTo(new Vector2(5, 0), duration, Easing.OutQuint);
iconsContainer.TransformSpacingTo(new Vector2(5, -10), duration, Easing.OutQuint);
}
private void contract(double duration = 500)
{
if (ExpansionMode != ExpansionMode.AlwaysExpanded)
iconsContainer.TransformSpacingTo(new Vector2(-25, 0), duration, Easing.OutQuint);
iconsContainer.TransformSpacingTo(new Vector2(-25), duration, Easing.OutQuint);
}
protected override bool OnHover(HoverEvent e)
@@ -30,6 +30,9 @@ namespace osu.Game.Screens.Play.HUD
[SettingSource(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.ExpansionMode), nameof(SkinnableModDisplayStrings.ExpansionModeDescription))]
public Bindable<ExpansionMode> ExpansionModeSetting { get; } = new Bindable<ExpansionMode>();
[SettingSource(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.DisplayDirection))]
public Bindable<Direction> Direction { get; } = new Bindable<Direction>();
[BackgroundDependencyLoader]
private void load()
{
@@ -50,6 +53,7 @@ namespace osu.Game.Screens.Play.HUD
ShowExtendedInformation.BindValueChanged(_ => modDisplay.ShowExtendedInformation = ShowExtendedInformation.Value, true);
ExpansionModeSetting.BindValueChanged(_ => modDisplay.ExpansionMode = ExpansionModeSetting.Value, true);
Direction.BindValueChanged(_ => modDisplay.FillDirection = Direction.Value == Framework.Graphics.Direction.Horizontal ? FillDirection.Horizontal : FillDirection.Vertical, true);
FinishTransforms(true);
}
+3
View File
@@ -147,6 +147,9 @@ namespace osu.Game.Screens.Play
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
// This display is potentially a duplicate of users with a local ModDisplay in their skins.
// It would be very nice to remove this, but the version here has special logic with regards to replays
// and initial states, so needs a bit of thought before doing so.
ModDisplay = CreateModsContainer(),
}
},