Add showModdedValue parameter to StatisticRow

This commit is contained in:
Adam Baker 2022-07-22 05:43:05 -05:00
parent bfafb4480e
commit 28586c704d

View File

@ -57,7 +57,7 @@ namespace osu.Game.Screens.Select.Details
} }
} }
public AdvancedStats() public AdvancedStats(bool updateWithModSelection = true)
{ {
Child = new FillFlowContainer Child = new FillFlowContainer
{ {
@ -65,11 +65,11 @@ namespace osu.Game.Screens.Select.Details
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new[] Children = new[]
{ {
FirstValue = new StatisticRow(), // circle size/key amount FirstValue = new StatisticRow(updateWithModSelection), // circle size/key amount
HpDrain = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsDrain }, HpDrain = new StatisticRow(updateWithModSelection) { Title = BeatmapsetsStrings.ShowStatsDrain },
Accuracy = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAccuracy }, Accuracy = new StatisticRow(updateWithModSelection) { Title = BeatmapsetsStrings.ShowStatsAccuracy },
ApproachRate = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAr }, ApproachRate = new StatisticRow(updateWithModSelection) { Title = BeatmapsetsStrings.ShowStatsAr },
starDifficulty = new StatisticRow(10, true) { Title = BeatmapsetsStrings.ShowStatsStars }, starDifficulty = new StatisticRow(updateWithModSelection, 10, true) { Title = BeatmapsetsStrings.ShowStatsStars },
}, },
}; };
} }
@ -183,6 +183,7 @@ namespace osu.Game.Screens.Select.Details
private readonly OsuSpriteText name, valueText; private readonly OsuSpriteText name, valueText;
private readonly Bar bar; private readonly Bar bar;
public readonly Bar ModBar; public readonly Bar ModBar;
private readonly bool showModdedValue;
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -203,6 +204,9 @@ namespace osu.Game.Screens.Select.Details
if (value == this.value) if (value == this.value)
return; return;
if (!showModdedValue)
value.adjustedValue = null;
this.value = value; this.value = value;
bar.Length = value.baseValue / maxValue; bar.Length = value.baseValue / maxValue;
@ -225,13 +229,14 @@ namespace osu.Game.Screens.Select.Details
set => bar.AccentColour = value; set => bar.AccentColour = value;
} }
public StatisticRow(float maxValue = 10, bool forceDecimalPlaces = false) public StatisticRow(bool showModdedValue, float maxValue = 10, bool forceDecimalPlaces = false)
{ {
this.maxValue = maxValue; this.maxValue = maxValue;
this.forceDecimalPlaces = forceDecimalPlaces; this.forceDecimalPlaces = forceDecimalPlaces;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Vertical = 2.5f }; Padding = new MarginPadding { Vertical = 2.5f };
this.showModdedValue = showModdedValue;
Children = new Drawable[] Children = new Drawable[]
{ {