2019-01-24 17:43:03 +09:00
|
|
|
|
// 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.
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2018-11-20 16:51:59 +09:00
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2023-11-04 21:55:46 +02:00
|
|
|
|
using osu.Framework.Graphics.Cursor;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
|
using osu.Game.Beatmaps;
|
2019-12-12 23:41:46 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2023-11-04 21:57:42 +02:00
|
|
|
|
using System.Linq;
|
2020-07-16 21:08:08 +09:00
|
|
|
|
using System.Threading;
|
2021-02-25 16:05:08 +09:00
|
|
|
|
using System.Threading.Tasks;
|
2022-01-03 17:31:12 +09:00
|
|
|
|
using osu.Framework.Extensions;
|
2021-02-22 17:14:00 +09:00
|
|
|
|
using osu.Framework.Localisation;
|
2019-12-20 18:00:04 +09:00
|
|
|
|
using osu.Framework.Threading;
|
2020-02-01 16:16:15 +01:00
|
|
|
|
using osu.Framework.Utils;
|
2019-12-20 18:00:04 +09:00
|
|
|
|
using osu.Game.Configuration;
|
2022-01-27 20:53:48 -08:00
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2020-07-16 21:08:08 +09:00
|
|
|
|
using osu.Game.Rulesets;
|
2023-11-23 23:30:18 +02:00
|
|
|
|
using osu.Game.Overlays.Mods;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select.Details
|
|
|
|
|
{
|
2023-12-14 16:11:08 +01:00
|
|
|
|
public partial class AdvancedStats : Container, IHasCustomTooltip<AdjustedAttributesTooltip.Data>
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2019-12-12 23:41:46 +08:00
|
|
|
|
[Resolved]
|
2023-01-05 12:49:45 +03:00
|
|
|
|
private BeatmapDifficultyCache difficultyCache { get; set; }
|
2019-12-12 23:41:46 +08:00
|
|
|
|
|
2020-07-16 21:08:08 +09:00
|
|
|
|
[Resolved]
|
2023-01-05 12:49:45 +03:00
|
|
|
|
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
2020-07-16 21:08:08 +09:00
|
|
|
|
|
|
|
|
|
[Resolved]
|
2023-01-05 12:49:45 +03:00
|
|
|
|
private OsuGameBase game { get; set; }
|
|
|
|
|
|
|
|
|
|
private IBindable<RulesetInfo> gameRuleset;
|
2020-07-16 21:08:08 +09:00
|
|
|
|
|
2020-02-01 15:50:33 +01:00
|
|
|
|
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
|
|
|
|
private readonly StatisticRow starDifficulty;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2023-12-14 16:11:08 +01:00
|
|
|
|
public ITooltip<AdjustedAttributesTooltip.Data> GetCustomTooltip() => new AdjustedAttributesTooltip();
|
|
|
|
|
public AdjustedAttributesTooltip.Data TooltipContent { get; private set; }
|
2023-11-04 21:55:46 +02:00
|
|
|
|
|
2021-10-29 17:58:46 +09:00
|
|
|
|
private IBeatmapInfo beatmapInfo;
|
2019-02-28 13:31:40 +09:00
|
|
|
|
|
2021-10-29 17:58:46 +09:00
|
|
|
|
public IBeatmapInfo BeatmapInfo
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2021-10-02 12:44:22 +09:00
|
|
|
|
get => beatmapInfo;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
set
|
|
|
|
|
{
|
2021-10-02 12:44:22 +09:00
|
|
|
|
if (value == beatmapInfo) return;
|
2019-02-28 13:31:40 +09:00
|
|
|
|
|
2021-10-02 12:44:22 +09:00
|
|
|
|
beatmapInfo = value;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2019-12-12 23:41:46 +08:00
|
|
|
|
updateStatistics();
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-19 19:09:47 +09:00
|
|
|
|
public AdvancedStats(int columns = 1)
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2023-12-19 19:09:47 +09:00
|
|
|
|
switch (columns)
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2023-12-19 19:09:47 +09:00
|
|
|
|
case 1:
|
|
|
|
|
Child = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
FirstValue = new StatisticRow(), // circle size/key amount
|
|
|
|
|
HpDrain = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsDrain },
|
|
|
|
|
Accuracy = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAccuracy },
|
|
|
|
|
ApproachRate = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAr },
|
|
|
|
|
starDifficulty = new StatisticRow(10, true) { Title = BeatmapsetsStrings.ShowStatsStars },
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
Child = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Full,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2023-12-20 12:42:06 +09:00
|
|
|
|
FirstValue = new StatisticRow
|
|
|
|
|
{
|
|
|
|
|
Width = 0.5f,
|
|
|
|
|
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
|
|
|
|
|
}, // circle size/key amount
|
|
|
|
|
HpDrain = new StatisticRow
|
|
|
|
|
{
|
|
|
|
|
Title = BeatmapsetsStrings.ShowStatsDrain,
|
|
|
|
|
Width = 0.5f,
|
|
|
|
|
Padding = new MarginPadding { Left = 5, Vertical = 2.5f },
|
|
|
|
|
},
|
|
|
|
|
Accuracy = new StatisticRow
|
|
|
|
|
{
|
|
|
|
|
Title = BeatmapsetsStrings.ShowStatsAccuracy,
|
|
|
|
|
Width = 0.5f,
|
|
|
|
|
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
|
|
|
|
|
},
|
|
|
|
|
ApproachRate = new StatisticRow
|
|
|
|
|
{
|
|
|
|
|
Title = BeatmapsetsStrings.ShowStatsAr,
|
|
|
|
|
Width = 0.5f,
|
|
|
|
|
Padding = new MarginPadding { Left = 5, Vertical = 2.5f },
|
|
|
|
|
},
|
|
|
|
|
starDifficulty = new StatisticRow(10, true)
|
|
|
|
|
{
|
|
|
|
|
Title = BeatmapsetsStrings.ShowStatsStars,
|
|
|
|
|
Width = 0.5f,
|
|
|
|
|
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
|
|
|
|
|
},
|
2023-12-19 19:09:47 +09:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2019-12-13 09:39:54 +08:00
|
|
|
|
private void load(OsuColour colours)
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
|
|
|
|
starDifficulty.AccentColour = colours.Yellow;
|
2019-12-18 17:41:30 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
2023-01-05 12:49:45 +03:00
|
|
|
|
// the cached ruleset bindable might be a decoupled bindable provided by SongSelect,
|
|
|
|
|
// which we can't rely on in combination with the game-wide selected mods list,
|
|
|
|
|
// since mods could be updated to the new ruleset instances while the decoupled bindable is held behind,
|
|
|
|
|
// therefore resulting in performing difficulty calculation with invalid states.
|
|
|
|
|
gameRuleset = game.Ruleset.GetBoundCopy();
|
|
|
|
|
gameRuleset.BindValueChanged(_ => updateStatistics());
|
|
|
|
|
|
2019-12-20 18:00:04 +09:00
|
|
|
|
mods.BindValueChanged(modsChanged, true);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-11 14:54:50 +09:00
|
|
|
|
private ModSettingChangeTracker modSettingChangeTracker;
|
2021-02-10 19:39:47 +09:00
|
|
|
|
private ScheduledDelegate debouncedStatisticsUpdate;
|
2019-12-20 18:00:04 +09:00
|
|
|
|
|
|
|
|
|
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
|
|
|
|
{
|
2021-02-11 14:54:50 +09:00
|
|
|
|
modSettingChangeTracker?.Dispose();
|
2019-12-20 18:00:04 +09:00
|
|
|
|
|
2021-02-11 14:54:50 +09:00
|
|
|
|
modSettingChangeTracker = new ModSettingChangeTracker(mods.NewValue);
|
2022-06-24 21:25:23 +09:00
|
|
|
|
modSettingChangeTracker.SettingChanged += _ =>
|
2019-12-20 18:00:04 +09:00
|
|
|
|
{
|
2021-02-10 19:39:47 +09:00
|
|
|
|
debouncedStatisticsUpdate?.Cancel();
|
|
|
|
|
debouncedStatisticsUpdate = Scheduler.AddDelayed(updateStatistics, 100);
|
|
|
|
|
};
|
2019-12-20 18:00:04 +09:00
|
|
|
|
|
|
|
|
|
updateStatistics();
|
2019-12-12 23:41:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateStatistics()
|
|
|
|
|
{
|
2021-10-29 17:58:46 +09:00
|
|
|
|
IBeatmapDifficultyInfo baseDifficulty = BeatmapInfo?.Difficulty;
|
2023-11-23 23:30:18 +02:00
|
|
|
|
BeatmapDifficulty adjustedDifficulty = null;
|
2019-12-12 23:41:46 +08:00
|
|
|
|
|
2023-12-13 16:42:20 +09:00
|
|
|
|
IRulesetInfo ruleset = gameRuleset?.Value ?? beatmapInfo.Ruleset;
|
|
|
|
|
|
2023-12-14 14:31:19 +02:00
|
|
|
|
if (baseDifficulty != null)
|
2023-08-24 16:49:42 +03:00
|
|
|
|
{
|
2023-12-14 14:31:19 +02:00
|
|
|
|
BeatmapDifficulty originalDifficulty = new BeatmapDifficulty(baseDifficulty);
|
2023-11-04 17:25:09 +02:00
|
|
|
|
|
|
|
|
|
foreach (var mod in mods.Value.OfType<IApplicableToDifficulty>())
|
2023-11-12 18:05:18 +02:00
|
|
|
|
mod.ApplyToDifficulty(originalDifficulty);
|
2023-11-04 17:25:09 +02:00
|
|
|
|
|
2023-11-23 23:30:18 +02:00
|
|
|
|
adjustedDifficulty = originalDifficulty;
|
|
|
|
|
|
2023-11-12 18:05:18 +02:00
|
|
|
|
if (gameRuleset != null)
|
|
|
|
|
{
|
|
|
|
|
double rate = 1;
|
|
|
|
|
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
|
|
|
|
|
rate = mod.ApplyToRate(0, rate);
|
2023-11-04 17:25:09 +02:00
|
|
|
|
|
2023-12-13 16:42:20 +09:00
|
|
|
|
adjustedDifficulty = ruleset.CreateInstance().GetRateAdjustedDisplayDifficulty(originalDifficulty, rate);
|
2023-11-23 23:30:18 +02:00
|
|
|
|
|
2023-12-14 16:11:08 +01:00
|
|
|
|
TooltipContent = new AdjustedAttributesTooltip.Data(originalDifficulty, adjustedDifficulty);
|
2023-11-12 18:05:18 +02:00
|
|
|
|
}
|
2023-08-24 16:49:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-13 13:32:27 +09:00
|
|
|
|
switch (ruleset.OnlineID)
|
2020-01-28 17:21:24 +09:00
|
|
|
|
{
|
|
|
|
|
case 3:
|
2023-12-09 22:09:49 +09:00
|
|
|
|
// Account for mania differences locally for now.
|
|
|
|
|
// Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes.
|
2023-12-13 13:32:27 +09:00
|
|
|
|
ILegacyRuleset legacyRuleset = (ILegacyRuleset)ruleset.CreateInstance();
|
2023-12-09 22:09:49 +09:00
|
|
|
|
|
|
|
|
|
// For the time being, the key count is static no matter what, because:
|
|
|
|
|
// a) The method doesn't have knowledge of the active keymods. Doing so may require considerations for filtering.
|
|
|
|
|
// b) Using the difficulty adjustment mod to adjust OD doesn't have an effect on conversion.
|
|
|
|
|
int keyCount = baseDifficulty == null ? 0 : legacyRuleset.GetKeyCount(BeatmapInfo);
|
|
|
|
|
|
2022-01-27 20:53:48 -08:00
|
|
|
|
FirstValue.Title = BeatmapsetsStrings.ShowStatsCsMania;
|
2023-12-09 22:09:49 +09:00
|
|
|
|
FirstValue.Value = (keyCount, keyCount);
|
|
|
|
|
|
2020-01-28 17:21:24 +09:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2022-01-27 20:53:48 -08:00
|
|
|
|
FirstValue.Title = BeatmapsetsStrings.ShowStatsCs;
|
2023-11-04 17:25:09 +02:00
|
|
|
|
FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize);
|
2020-01-28 17:21:24 +09:00
|
|
|
|
break;
|
|
|
|
|
}
|
2019-12-12 23:41:46 +08:00
|
|
|
|
|
2023-11-04 17:25:09 +02:00
|
|
|
|
HpDrain.Value = (baseDifficulty?.DrainRate ?? 0, adjustedDifficulty?.DrainRate);
|
|
|
|
|
Accuracy.Value = (baseDifficulty?.OverallDifficulty ?? 0, adjustedDifficulty?.OverallDifficulty);
|
|
|
|
|
ApproachRate.Value = (baseDifficulty?.ApproachRate ?? 0, adjustedDifficulty?.ApproachRate);
|
2020-07-16 21:08:08 +09:00
|
|
|
|
|
|
|
|
|
updateStarDifficulty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private CancellationTokenSource starDifficultyCancellationSource;
|
|
|
|
|
|
2023-01-05 12:50:38 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Updates the displayed star difficulty statistics with the values provided by the currently-selected beatmap, ruleset, and selected mods.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// This is scheduled to avoid scenarios wherein a ruleset changes first before selected mods do,
|
|
|
|
|
/// potentially resulting in failure during difficulty calculation due to incomplete bindable state updates.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
private void updateStarDifficulty() => Scheduler.AddOnce(() =>
|
2020-07-16 21:08:08 +09:00
|
|
|
|
{
|
|
|
|
|
starDifficultyCancellationSource?.Cancel();
|
|
|
|
|
|
2021-10-02 12:44:22 +09:00
|
|
|
|
if (BeatmapInfo == null)
|
2020-07-16 21:08:08 +09:00
|
|
|
|
return;
|
|
|
|
|
|
2020-07-24 16:11:28 +09:00
|
|
|
|
starDifficultyCancellationSource = new CancellationTokenSource();
|
2020-07-16 21:08:08 +09:00
|
|
|
|
|
2023-01-05 12:49:45 +03:00
|
|
|
|
var normalStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, gameRuleset.Value, null, starDifficultyCancellationSource.Token);
|
|
|
|
|
var moddedStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, gameRuleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
2020-07-21 23:13:04 +09:00
|
|
|
|
|
2022-01-03 17:31:12 +09:00
|
|
|
|
Task.WhenAll(normalStarDifficultyTask, moddedStarDifficultyTask).ContinueWith(_ => Schedule(() =>
|
2021-02-25 16:05:08 +09:00
|
|
|
|
{
|
2022-01-06 22:54:43 +09:00
|
|
|
|
var normalDifficulty = normalStarDifficultyTask.GetResultSafely();
|
2022-01-07 17:33:38 +09:00
|
|
|
|
var moddedDifficulty = moddedStarDifficultyTask.GetResultSafely();
|
2022-01-03 17:31:12 +09:00
|
|
|
|
|
2022-01-07 17:33:38 +09:00
|
|
|
|
if (normalDifficulty == null || moddedDifficulty == null)
|
2021-11-20 16:54:58 +01:00
|
|
|
|
return;
|
|
|
|
|
|
2023-11-04 17:25:09 +02:00
|
|
|
|
starDifficulty.Value = ((float)normalDifficulty.Value.Stars, (float)moddedDifficulty.Value.Stars);
|
2021-02-25 16:05:08 +09:00
|
|
|
|
}), starDifficultyCancellationSource.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Current);
|
2023-01-05 12:50:38 +03:00
|
|
|
|
});
|
2020-07-21 23:13:04 +09:00
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(isDisposing);
|
2021-02-11 14:54:50 +09:00
|
|
|
|
modSettingChangeTracker?.Dispose();
|
2020-07-21 23:13:04 +09:00
|
|
|
|
starDifficultyCancellationSource?.Cancel();
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:32:20 +09:00
|
|
|
|
public partial class StatisticRow : Container, IHasAccentColour
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
|
|
|
|
private const float value_width = 25;
|
|
|
|
|
private const float name_width = 70;
|
|
|
|
|
|
|
|
|
|
private readonly float maxValue;
|
|
|
|
|
private readonly bool forceDecimalPlaces;
|
2019-12-18 17:12:41 +09:00
|
|
|
|
private readonly OsuSpriteText name, valueText;
|
2020-02-01 15:50:33 +01:00
|
|
|
|
private readonly Bar bar;
|
|
|
|
|
public readonly Bar ModBar;
|
2019-12-13 09:39:54 +08:00
|
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
|
private OsuColour colours { get; set; }
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2021-02-22 17:14:00 +09:00
|
|
|
|
public LocalisableString Title
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2019-02-28 13:58:19 +09:00
|
|
|
|
get => name.Text;
|
|
|
|
|
set => name.Text = value;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-04 17:25:09 +02:00
|
|
|
|
private (float baseValue, float? adjustedValue)? value;
|
2019-12-13 09:39:54 +08:00
|
|
|
|
|
2023-11-04 17:25:09 +02:00
|
|
|
|
public (float baseValue, float? adjustedValue) Value
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2023-11-04 17:25:09 +02:00
|
|
|
|
get => value ?? (0, null);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
set
|
|
|
|
|
{
|
2019-12-18 17:12:41 +09:00
|
|
|
|
if (value == this.value)
|
|
|
|
|
return;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2019-12-18 17:12:41 +09:00
|
|
|
|
this.value = value;
|
|
|
|
|
|
|
|
|
|
bar.Length = value.baseValue / maxValue;
|
|
|
|
|
|
|
|
|
|
valueText.Text = (value.adjustedValue ?? value.baseValue).ToString(forceDecimalPlaces ? "0.00" : "0.##");
|
2020-02-01 15:50:33 +01:00
|
|
|
|
ModBar.Length = (value.adjustedValue ?? 0) / maxValue;
|
2019-12-18 17:12:41 +09:00
|
|
|
|
|
2020-02-01 16:16:15 +01:00
|
|
|
|
if (Precision.AlmostEquals(value.baseValue, value.adjustedValue ?? value.baseValue, 0.05f))
|
|
|
|
|
ModBar.AccentColour = valueText.Colour = Color4.White;
|
|
|
|
|
else if (value.adjustedValue > value.baseValue)
|
2020-02-01 15:50:33 +01:00
|
|
|
|
ModBar.AccentColour = valueText.Colour = colours.Red;
|
2019-12-18 17:12:41 +09:00
|
|
|
|
else if (value.adjustedValue < value.baseValue)
|
2020-02-01 15:50:33 +01:00
|
|
|
|
ModBar.AccentColour = valueText.Colour = colours.BlueDark;
|
2019-12-13 09:39:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 18:19:50 +09:00
|
|
|
|
public Color4 AccentColour
|
|
|
|
|
{
|
2019-02-28 13:58:19 +09:00
|
|
|
|
get => bar.AccentColour;
|
|
|
|
|
set => bar.AccentColour = value;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public StatisticRow(float maxValue = 10, bool forceDecimalPlaces = false)
|
|
|
|
|
{
|
|
|
|
|
this.maxValue = maxValue;
|
|
|
|
|
this.forceDecimalPlaces = forceDecimalPlaces;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2020-02-16 21:43:33 +01:00
|
|
|
|
Padding = new MarginPadding { Vertical = 2.5f };
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Width = name_width,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2020-02-16 21:43:33 +01:00
|
|
|
|
// osu-web uses 1.25 line-height, which at 12px font size makes the element 14px tall - this compentates that difference
|
|
|
|
|
Padding = new MarginPadding { Vertical = 1 },
|
2018-04-13 18:19:50 +09:00
|
|
|
|
Child = name = new OsuSpriteText
|
|
|
|
|
{
|
2020-02-16 21:43:33 +01:00
|
|
|
|
Font = OsuFont.GetFont(size: 12)
|
2018-04-13 18:19:50 +09:00
|
|
|
|
},
|
|
|
|
|
},
|
2023-12-19 19:18:36 +09:00
|
|
|
|
new Container
|
2019-12-13 09:39:54 +08:00
|
|
|
|
{
|
2023-12-19 19:18:36 +09:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-12-13 09:39:54 +08:00
|
|
|
|
Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 },
|
2023-12-19 19:18:36 +09:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 5,
|
|
|
|
|
|
|
|
|
|
CornerRadius = 2,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
bar = new Bar
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
BackgroundColour = Color4.White.Opacity(0.5f),
|
|
|
|
|
},
|
|
|
|
|
ModBar = new Bar
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Alpha = 0.5f,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
2019-12-13 09:39:54 +08:00
|
|
|
|
},
|
2018-04-13 18:19:50 +09:00
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Width = value_width,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
2019-12-18 17:12:41 +09:00
|
|
|
|
Child = valueText = new OsuSpriteText
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2020-02-16 21:43:33 +01:00
|
|
|
|
Font = OsuFont.GetFont(size: 12)
|
2018-04-13 18:19:50 +09:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|