2021-05-07 15:10:57 +08: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.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Configuration;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2023-05-18 17:53:43 +08:00
|
|
|
using osu.Game.Scoring.Legacy;
|
2021-05-07 15:10:57 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play.HUD
|
|
|
|
{
|
|
|
|
public abstract partial class GameplayScoreCounter : ScoreCounter
|
|
|
|
{
|
2023-05-29 17:48:17 +08:00
|
|
|
private Bindable<ScoringMode> scoreDisplayMode = null!;
|
|
|
|
|
|
|
|
private Bindable<long> totalScoreBindable = null!;
|
2021-05-07 15:10:57 +08:00
|
|
|
|
2021-10-10 16:41:16 +08:00
|
|
|
protected GameplayScoreCounter()
|
|
|
|
: base(6)
|
2021-05-07 15:10:57 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuConfigManager config, ScoreProcessor scoreProcessor)
|
|
|
|
{
|
2023-05-29 18:00:01 +08:00
|
|
|
totalScoreBindable = scoreProcessor.TotalScore.GetBoundCopy();
|
|
|
|
totalScoreBindable.BindValueChanged(_ => updateDisplayScore());
|
|
|
|
|
2021-05-07 15:10:57 +08:00
|
|
|
scoreDisplayMode = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode);
|
|
|
|
scoreDisplayMode.BindValueChanged(scoreMode =>
|
|
|
|
{
|
|
|
|
switch (scoreMode.NewValue)
|
|
|
|
{
|
|
|
|
case ScoringMode.Standardised:
|
|
|
|
RequiredDisplayDigits.Value = 6;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ScoringMode.Classic:
|
|
|
|
RequiredDisplayDigits.Value = 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(scoreMode));
|
|
|
|
}
|
2023-05-29 18:00:01 +08:00
|
|
|
|
|
|
|
updateDisplayScore();
|
2021-05-07 15:10:57 +08:00
|
|
|
}, true);
|
|
|
|
|
2023-05-29 18:00:01 +08:00
|
|
|
void updateDisplayScore() => Current.Value = scoreProcessor.GetDisplayScore(scoreDisplayMode.Value);
|
2021-05-07 15:10:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|