1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:53:22 +08:00

Merge pull request #24799 from peppy/move-mod-select-diff-multiplier

Move mod overlay difficulty multiplier display to bottom of screen
This commit is contained in:
Bartłomiej Dach 2023-09-14 12:11:50 +02:00 committed by GitHub
commit 5bda9a3024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 51 deletions

View File

@ -72,6 +72,7 @@ namespace osu.Game.Overlays.Mods
const float shear = ShearedOverlayContainer.SHEAR;
AutoSizeAxes = Axes.Both;
InternalChild = content = new Container
{
Origin = Anchor.BottomRight,
@ -145,22 +146,10 @@ namespace osu.Game.Overlays.Mods
Direction = FillDirection.Horizontal,
Children = new[]
{
circleSizeDisplay = new VerticalAttributeDisplay("CS")
{
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
},
drainRateDisplay = new VerticalAttributeDisplay("HP")
{
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
},
approachRateDisplay = new VerticalAttributeDisplay("AR")
{
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
},
overallDifficultyDisplay = new VerticalAttributeDisplay("OD")
{
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
},
circleSizeDisplay = new VerticalAttributeDisplay("CS") { Shear = new Vector2(-shear, 0), },
drainRateDisplay = new VerticalAttributeDisplay("HP") { Shear = new Vector2(-shear, 0), },
approachRateDisplay = new VerticalAttributeDisplay("AR") { Shear = new Vector2(-shear, 0), },
overallDifficultyDisplay = new VerticalAttributeDisplay("OD") { Shear = new Vector2(-shear, 0), },
}
}
}

View File

@ -1,10 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Mods
@ -13,20 +10,12 @@ namespace osu.Game.Overlays.Mods
{
protected override LocalisableString Label => DifficultyMultiplierDisplayStrings.DifficultyMultiplier;
protected override string CounterFormat => @"N2";
protected override string CounterFormat => @"0.0x";
public DifficultyMultiplierDisplay()
{
Current.Default = 1d;
Current.Value = 1d;
Add(new SpriteIcon
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.Solid.Times,
Size = new Vector2(7),
Margin = new MarginPadding { Top = 1 }
});
}
protected override void LoadComplete()

View File

@ -49,8 +49,6 @@ namespace osu.Game.Overlays.Mods
/// </summary>
protected abstract LocalisableString Label { get; }
protected virtual float ValueAreaWidth => 56;
protected virtual string CounterFormat => @"N0";
protected override Container<Drawable> Content => content;
@ -59,7 +57,7 @@ namespace osu.Game.Overlays.Mods
protected ModCounterDisplay()
{
Height = HEIGHT;
Height = ShearedButton.HEIGHT;
AutoSizeAxes = Axes.X;
InternalChild = new InputBlockingContainer
@ -69,14 +67,15 @@ namespace osu.Game.Overlays.Mods
Masking = true,
CornerRadius = ModSelectPanel.CORNER_RADIUS,
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Children = new Drawable[]
{
contentBackground = new Box
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Y,
Width = ValueAreaWidth + ModSelectPanel.CORNER_RADIUS
RelativeSizeAxes = Axes.Both,
},
new GridContainer
{
@ -85,7 +84,7 @@ namespace osu.Game.Overlays.Mods
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, ValueAreaWidth)
new Dimension(GridSizeMode.Absolute, 56)
},
Content = new[]
{

View File

@ -120,11 +120,12 @@ namespace osu.Game.Overlays.Mods
private ColumnScrollContainer columnScroll = null!;
private ColumnFlowContainer columnFlow = null!;
private FillFlowContainer<ShearedButton> footerButtonFlow = null!;
private FillFlowContainer footerContentFlow = null!;
private DeselectAllModsButton deselectAllModsButton = null!;
private Container aboveColumnsContent = null!;
private DifficultyMultiplierDisplay? multiplierDisplay;
private BeatmapAttributesDisplay? modEffectPreviewPanel;
private BeatmapAttributesDisplay? beatmapAttributesDisplay;
protected ShearedButton BackButton { get; private set; } = null!;
protected ShearedToggleButton? CustomisationButton { get; private set; }
@ -142,8 +143,8 @@ namespace osu.Game.Overlays.Mods
if (beatmap == value) return;
beatmap = value;
if (IsLoaded && modEffectPreviewPanel != null)
modEffectPreviewPanel.BeatmapInfo.Value = beatmap?.BeatmapInfo;
if (IsLoaded && beatmapAttributesDisplay != null)
beatmapAttributesDisplay.BeatmapInfo.Value = beatmap?.BeatmapInfo;
}
}
@ -251,22 +252,32 @@ namespace osu.Game.Overlays.Mods
if (ShowModEffects)
{
aboveColumnsContent.Add(multiplierDisplay = new DifficultyMultiplierDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
});
FooterContent.Add(modEffectPreviewPanel = new BeatmapAttributesDisplay
FooterContent.Add(footerContentFlow = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(30, 10),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding
{
Vertical = PADDING,
Horizontal = 70
Horizontal = 20
},
BeatmapInfo = { Value = beatmap?.BeatmapInfo }
Children = new Drawable[]
{
multiplierDisplay = new DifficultyMultiplierDisplay
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight
},
beatmapAttributesDisplay = new BeatmapAttributesDisplay
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
BeatmapInfo = { Value = beatmap?.BeatmapInfo }
},
}
});
}
@ -339,15 +350,23 @@ namespace osu.Game.Overlays.Mods
SearchTextBox.PlaceholderText = SearchTextBox.HasFocus ? Resources.Localisation.Web.CommonStrings.InputSearch : ModSelectOverlayStrings.TabToSearch;
// only update preview panel's collapsed state after we are fully visible, to ensure all the buttons are where we expect them to be.
if (modEffectPreviewPanel != null && Alpha == 1)
if (beatmapAttributesDisplay != null)
{
float rightEdgeOfLastButton = footerButtonFlow.Last().ScreenSpaceDrawQuad.TopRight.X;
// this is cheating a bit; the 375 value is hardcoded based on how wide the expanded panel _generally_ is.
// this is cheating a bit; the 640 value is hardcoded based on how wide the expanded panel _generally_ is.
// due to the transition applied, the raw screenspace quad of the panel cannot be used, as it will trigger an ugly feedback cycle of expanding and collapsing.
float projectedLeftEdgeOfExpandedModEffectPreviewPanel = footerButtonFlow.ToScreenSpace(footerButtonFlow.DrawSize - new Vector2(375 + 70, 0)).X;
modEffectPreviewPanel.Collapsed.Value = rightEdgeOfLastButton > projectedLeftEdgeOfExpandedModEffectPreviewPanel;
float projectedLeftEdgeOfExpandedBeatmapAttributesDisplay = footerButtonFlow.ToScreenSpace(footerButtonFlow.DrawSize - new Vector2(640, 0)).X;
bool screenIsntWideEnough = rightEdgeOfLastButton > projectedLeftEdgeOfExpandedBeatmapAttributesDisplay;
// only update preview panel's collapsed state after we are fully visible, to ensure all the buttons are where we expect them to be.
if (Alpha == 1)
beatmapAttributesDisplay.Collapsed.Value = screenIsntWideEnough;
footerContentFlow.LayoutDuration = 200;
footerContentFlow.LayoutEasing = Easing.OutQuint;
footerContentFlow.Direction = screenIsntWideEnough ? FillDirection.Vertical : FillDirection.Horizontal;
}
}