1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-22 19:41:06 +08:00

Update mod preset tooltip design accordingly

This commit is contained in:
Salman Alshamrani
2025-03-23 13:43:38 -04:00
Unverified
parent 9b55325526
commit 623e705704
3 changed files with 94 additions and 26 deletions
+22 -7
View File
@@ -8,6 +8,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Database;
using osu.Game.Graphics;
@@ -75,17 +76,31 @@ namespace osu.Game.Overlays.Mods
TabbableContentContainer = this,
Current = { Value = preset.PerformRead(p => p.Description) },
},
new OsuScrollContainer
new Container
{
RelativeSizeAxes = Axes.X,
Height = 100,
Padding = new MarginPadding(7),
Child = scrollContent = new FillFlowContainer
CornerRadius = 10,
Masking = true,
Children = new Drawable[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(7),
Spacing = new Vector2(7),
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
},
new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(7),
Child = scrollContent = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(7),
Spacing = new Vector2(7),
}
},
}
},
new FillFlowContainer
+58 -17
View File
@@ -1,10 +1,11 @@
// 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 System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
@@ -14,12 +15,20 @@ namespace osu.Game.Overlays.Mods
{
public partial class ModPresetRow : FillFlowContainer
{
private readonly Mod mod;
public ModPresetRow(Mod mod)
{
this.mod = mod;
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Spacing = new Vector2(4);
Spacing = new Vector2(5);
InternalChildren = new Drawable[]
{
new FillFlowContainer
@@ -39,26 +48,58 @@ namespace osu.Game.Overlays.Mods
},
new OsuSpriteText
{
Text = mod.Name,
Font = OsuFont.Default.With(size: 16, weight: FontWeight.SemiBold),
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Margin = new MarginPadding { Bottom = 2 }
}
Origin = Anchor.CentreLeft,
Font = OsuFont.Torus.With(size: 16f, weight: FontWeight.SemiBold),
Colour = colourProvider.Content1,
UseFullGlyphHeight = false,
Text = mod.Name,
},
}
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = 10f },
Alpha = mod.SettingDescription.Any() ? 1 : 0,
Children = new Drawable[]
{
new TextFlowContainer(t =>
{
t.Font = OsuFont.Torus.With(size: 12f, weight: FontWeight.SemiBold);
})
{
AutoSizeAxes = Axes.Both,
Colour = colourProvider.Content2,
Text = string.Join('\n', mod.SettingDescription.Select(svp => svp.setting)),
},
new TextFlowContainer(t =>
{
t.Font = OsuFont.Torus.With(size: 12f, weight: FontWeight.SemiBold);
})
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Colour = colourProvider.Content1,
TextAnchor = Anchor.TopRight,
Text = string.Join('\n', mod.SettingDescription.Select(svp => svp.value)),
},
}
}
};
if (!string.IsNullOrEmpty(mod.SettingDescription))
{
AddInternal(new OsuTextFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 14 },
Text = mod.SettingDescription
});
}
// if (!string.IsNullOrEmpty(mod.SettingDescription))
// {
// AddInternal(new OsuTextFlowContainer
// {
// RelativeSizeAxes = Axes.X,
// AutoSizeAxes = Axes.Y,
// Padding = new MarginPadding { Left = 14 },
// // Text = mod.SettingDescription
// });
// }
}
}
}
+14 -2
View File
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
@@ -14,6 +15,9 @@ namespace osu.Game.Overlays.Mods
{
public partial class ModPresetTooltip : VisibilityContainer, ITooltip<ModPreset>
{
[Cached]
private readonly OverlayColourProvider colourProvider;
protected override Container<Drawable> Content { get; }
private const double transition_duration = 200;
@@ -22,6 +26,8 @@ namespace osu.Game.Overlays.Mods
public ModPresetTooltip(OverlayColourProvider colourProvider)
{
this.colourProvider = colourProvider;
Width = 250;
AutoSizeAxes = Axes.Y;
@@ -39,7 +45,7 @@ namespace osu.Game.Overlays.Mods
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 },
Padding = new MarginPadding(10f),
Spacing = new Vector2(7),
Children = new[]
{
@@ -64,7 +70,13 @@ namespace osu.Game.Overlays.Mods
if (ReferenceEquals(preset, lastPreset))
return;
descriptionText.Text = preset.Description;
if (!string.IsNullOrEmpty(preset.Description))
{
descriptionText.Show();
descriptionText.Text = preset.Description;
}
else
descriptionText.Hide();
lastPreset = preset;