1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 12:02:54 +08:00

Merge pull request #8624 from Joehuu/fix-results-star-display-alignment

Fix results star rating display not being centered when no mods are present
This commit is contained in:
Dan Balasescu 2020-04-07 12:52:19 +09:00 committed by GitHub
commit 7a1104b575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 36 deletions

View File

@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Position = new Vector2(0, 25),
Position = new Vector2(-5, 25),
Current = { BindTarget = modSelect.SelectedMods }
}
};

View File

@ -161,7 +161,7 @@ namespace osu.Game.Screens.Multi
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Spacing = new Vector2(15, 0),
Children = new Drawable[]
{
authorText = new LinkFlowContainer { AutoSizeAxes = Axes.Both },

View File

@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play.HUD
}
}
protected readonly FillFlowContainer<ModIcon> IconsContainer;
private readonly FillFlowContainer<ModIcon> iconsContainer;
private readonly OsuSpriteText unrankedText;
public ModDisplay()
@ -50,13 +50,12 @@ namespace osu.Game.Screens.Play.HUD
Children = new Drawable[]
{
IconsContainer = new ReverseChildIDFillFlowContainer<ModIcon>
iconsContainer = new ReverseChildIDFillFlowContainer<ModIcon>
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Left = 10, Right = 10 },
},
unrankedText = new OsuSpriteText
{
@ -69,11 +68,11 @@ namespace osu.Game.Screens.Play.HUD
Current.ValueChanged += mods =>
{
IconsContainer.Clear();
iconsContainer.Clear();
foreach (Mod mod in mods.NewValue)
{
IconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
}
if (IsLoaded)
@ -92,7 +91,7 @@ namespace osu.Game.Screens.Play.HUD
base.LoadComplete();
appearTransform();
IconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
}
private void appearTransform()
@ -104,20 +103,20 @@ namespace osu.Game.Screens.Play.HUD
expand();
using (IconsContainer.BeginDelayedSequence(1200))
using (iconsContainer.BeginDelayedSequence(1200))
contract();
}
private void expand()
{
if (ExpansionMode != ExpansionMode.AlwaysContracted)
IconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, Easing.OutQuint);
iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, Easing.OutQuint);
}
private void contract()
{
if (ExpansionMode != ExpansionMode.AlwaysExpanded)
IconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint);
iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint);
}
protected override bool OnHover(HoverEvent e)

View File

@ -285,7 +285,7 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = 20, Right = 10 },
Margin = new MarginPadding { Top = 20, Right = 20 },
};
protected virtual HitErrorDisplay CreateHitErrorDisplayOverlay() => new HitErrorDisplay(scoreProcessor, drawableRuleset?.FirstAvailableHitWindows);

View File

@ -30,6 +30,9 @@ namespace osu.Game.Screens.Ranking.Expanded
private readonly ScoreInfo score;
private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>();
private FillFlowContainer starAndModDisplay;
private RollingCounter<long> scoreCounter;
/// <summary>
@ -119,11 +122,12 @@ namespace osu.Game.Screens.Ranking.Expanded
Alpha = 0,
AlwaysPresent = true
},
new FillFlowContainer
starAndModDisplay = new FillFlowContainer
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
new StarRatingDisplay(beatmap)
@ -131,15 +135,6 @@ namespace osu.Game.Screens.Ranking.Expanded
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft
},
new ModDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
DisplayUnrankedText = false,
ExpansionMode = ExpansionMode.AlwaysExpanded,
Scale = new Vector2(0.5f),
Current = { Value = score.Mods }
}
}
},
new FillFlowContainer
@ -214,6 +209,19 @@ namespace osu.Game.Screens.Ranking.Expanded
}
}
};
if (score.Mods.Any())
{
starAndModDisplay.Add(new ModDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
DisplayUnrankedText = false,
ExpansionMode = ExpansionMode.AlwaysExpanded,
Scale = new Vector2(0.5f),
Current = { Value = score.Mods }
});
}
}
protected override void LoadComplete()

View File

@ -27,18 +27,19 @@ namespace osu.Game.Screens.Select
}
protected readonly OsuSpriteText MultiplierText;
private readonly FooterModDisplay modDisplay;
private readonly ModDisplay modDisplay;
private Color4 lowMultiplierColour;
private Color4 highMultiplierColour;
public FooterButtonMods()
{
ButtonContentContainer.Add(modDisplay = new FooterModDisplay
ButtonContentContainer.Add(modDisplay = new ModDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
DisplayUnrankedText = false,
Scale = new Vector2(0.8f)
Scale = new Vector2(0.8f),
ExpansionMode = ExpansionMode.AlwaysContracted,
});
ButtonContentContainer.Add(MultiplierText = new OsuSpriteText
{
@ -84,16 +85,5 @@ namespace osu.Game.Screens.Select
else
modDisplay.FadeOut();
}
private class FooterModDisplay : ModDisplay
{
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false;
public FooterModDisplay()
{
ExpansionMode = ExpansionMode.AlwaysContracted;
IconsContainer.Margin = new MarginPadding();
}
}
}
}