mirror of
https://github.com/ppy/osu
synced 2024-12-28 01:42:57 +00:00
Initialize some bindables for prevent get the null instance.
This commit is contained in:
parent
1f9f2b413e
commit
ce1bb206c8
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
|
||||
{
|
||||
private Bindable<bool> showHealthBar;
|
||||
private readonly Bindable<bool> showHealthBar = new Bindable<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// We never fail, 'yo.
|
||||
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public void ReadFromConfig(OsuConfigManager config)
|
||||
{
|
||||
showHealthBar = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail);
|
||||
config.BindWith(OsuSetting.ShowHealthDisplayWhenCantFail, showHealthBar);
|
||||
}
|
||||
|
||||
public void ApplyToHUD(HUDOverlay overlay)
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
private int retries;
|
||||
|
||||
private BindableNumber<double> health;
|
||||
private readonly BindableNumber<double> health = new BindableDouble();
|
||||
|
||||
public override void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
||||
{
|
||||
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
|
||||
{
|
||||
health = healthProcessor.Health.GetBoundCopy();
|
||||
health.BindTo(healthProcessor.Health);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
private readonly BindableNumber<double> mainVolumeAdjust = new BindableDouble(0.5);
|
||||
private readonly BindableNumber<double> metronomeVolumeAdjust = new BindableDouble(0.5);
|
||||
|
||||
private BindableNumber<int> currentCombo;
|
||||
private readonly BindableNumber<int> currentCombo = new BindableInt();
|
||||
|
||||
[SettingSource("Enable metronome", "Add a metronome beat to help you keep track of the rhythm.")]
|
||||
public BindableBool EnableMetronome { get; } = new BindableBool
|
||||
@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
currentCombo = scoreProcessor.Combo.GetBoundCopy();
|
||||
currentCombo.BindTo(scoreProcessor.Combo);
|
||||
currentCombo.BindValueChanged(combo =>
|
||||
{
|
||||
double dimFactor = MuteComboCount.Value == 0 ? 1 : (double)combo.NewValue / MuteComboCount.Value;
|
||||
|
@ -28,9 +28,9 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
protected const float TRANSITION_DURATION = 100;
|
||||
|
||||
protected BindableNumber<int> CurrentCombo;
|
||||
protected readonly BindableNumber<int> CurrentCombo = new BindableInt();
|
||||
|
||||
protected IBindable<bool> IsBreakTime;
|
||||
protected readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
|
||||
|
||||
protected float ComboBasedAlpha;
|
||||
|
||||
@ -40,14 +40,14 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public void ApplyToPlayer(Player player)
|
||||
{
|
||||
IsBreakTime = player.IsBreakTime.GetBoundCopy();
|
||||
IsBreakTime.BindTo(player.IsBreakTime);
|
||||
}
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
if (HiddenComboCount.Value == 0) return;
|
||||
|
||||
CurrentCombo = scoreProcessor.Combo.GetBoundCopy();
|
||||
CurrentCombo.BindTo(scoreProcessor.Combo);
|
||||
CurrentCombo.BindValueChanged(combo =>
|
||||
{
|
||||
ComboBasedAlpha = Math.Max(MIN_ALPHA, 1 - (float)combo.NewValue / HiddenComboCount.Value);
|
||||
|
Loading…
Reference in New Issue
Block a user