mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Split total pp into 2 lines
This commit is contained in:
parent
48aa1677dc
commit
39524f3dd2
@ -72,16 +72,73 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
UpdateDisplay(performance);
|
UpdateDisplay(performance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable createAttributeItem(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
|
private Drawable createItemForTotal(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
|
||||||
{
|
{
|
||||||
bool isTotal = attribute.PropertyName == nameof(PerformanceAttributes.Total);
|
return
|
||||||
float fraction = (float)(attribute.Value / perfectAttribute.Value);
|
new GridContainer
|
||||||
if (float.IsNaN(fraction))
|
{
|
||||||
fraction = 0;
|
AutoSizeAxes = Axes.Both,
|
||||||
string text = fraction.ToLocalisableString("0%").ToString();
|
Margin = new MarginPadding { Bottom = 10 },
|
||||||
|
ColumnDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(GridSizeMode.Absolute, 250),
|
||||||
|
new Dimension(GridSizeMode.AutoSize)
|
||||||
|
},
|
||||||
|
RowDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
new Dimension(GridSizeMode.AutoSize)
|
||||||
|
},
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
||||||
|
Text = attribute.DisplayName,
|
||||||
|
Colour = titleColor
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Font = OsuFont.GetFont(weight: FontWeight.SemiBold),
|
||||||
|
Text = Math.Round(attribute.Value, MidpointRounding.AwayFromZero).ToLocalisableString(),
|
||||||
|
Colour = titleColor
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
||||||
|
Text = "Maximum",
|
||||||
|
Colour = OsuColour.Gray(0.7f)
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
||||||
|
Text = Math.Round(perfectAttribute.Value, MidpointRounding.AwayFromZero).ToLocalisableString(),
|
||||||
|
Colour = OsuColour.Gray(0.7f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (isTotal)
|
private Drawable createItemForAttribute(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
|
||||||
text = (int)Math.Round(attribute.Value, MidpointRounding.AwayFromZero) + "/" + (int)Math.Round(perfectAttribute.Value, MidpointRounding.AwayFromZero);
|
{
|
||||||
|
float percentage = (float)(attribute.Value / perfectAttribute.Value);
|
||||||
|
if (float.IsNaN(percentage))
|
||||||
|
percentage = 0;
|
||||||
|
string text = percentage.ToLocalisableString("0%").ToString();
|
||||||
|
|
||||||
return new GridContainer
|
return new GridContainer
|
||||||
{
|
{
|
||||||
@ -106,7 +163,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
||||||
Text = attribute.DisplayName,
|
Text = attribute.DisplayName,
|
||||||
Colour = isTotal ? titleColor : textColour
|
Colour = textColour
|
||||||
},
|
},
|
||||||
new Bar
|
new Bar
|
||||||
{
|
{
|
||||||
@ -115,8 +172,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
Width = 130,
|
Width = 130,
|
||||||
Height = 5,
|
Height = 5,
|
||||||
BackgroundColour = Color4.White.Opacity(0.5f),
|
BackgroundColour = Color4.White.Opacity(0.5f),
|
||||||
Colour = isTotal ? titleColor : textColour,
|
Colour = textColour,
|
||||||
Length = fraction,
|
Length = percentage,
|
||||||
Margin = new MarginPadding { Left = 5, Right = 5 }
|
Margin = new MarginPadding { Left = 5, Right = 5 }
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
@ -125,7 +182,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.SemiBold),
|
Font = OsuFont.GetFont(weight: FontWeight.SemiBold),
|
||||||
Text = text,
|
Text = text,
|
||||||
Colour = isTotal ? titleColor : textColour
|
Colour = textColour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +199,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
|
|
||||||
foreach (PerformanceDisplayAttribute attr in displayAttributes)
|
foreach (PerformanceDisplayAttribute attr in displayAttributes)
|
||||||
{
|
{
|
||||||
Content.Add(createAttributeItem(attr, perfectDisplayAttributes.First(a => a.PropertyName == attr.PropertyName)));
|
Content.Add(attr.PropertyName == nameof(PerformanceAttributes.Total)
|
||||||
|
? createItemForTotal(attr, perfectDisplayAttributes.First(a => a.PropertyName == attr.PropertyName))
|
||||||
|
: createItemForAttribute(attr, perfectDisplayAttributes.First(a => a.PropertyName == attr.PropertyName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user