mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
|
// 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;
|
||
|
|
||
|
namespace osu.Game.Screens.Play.HUD
|
||
|
{
|
||
|
public abstract class GameplayScoreCounter : ScoreCounter
|
||
|
{
|
||
|
private Bindable<ScoringMode> scoreDisplayMode;
|
||
|
|
||
|
protected GameplayScoreCounter(int leading = 0, bool useCommaSeparator = false)
|
||
|
: base(leading, useCommaSeparator)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
[BackgroundDependencyLoader]
|
||
|
private void load(OsuConfigManager config, ScoreProcessor scoreProcessor)
|
||
|
{
|
||
|
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));
|
||
|
}
|
||
|
}, true);
|
||
|
|
||
|
Current.BindTo(scoreProcessor.TotalScore);
|
||
|
}
|
||
|
}
|
||
|
}
|