mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 08:47:23 +08:00
Use bindable for HealthDisplay.
This commit is contained in:
parent
8c7bb4990c
commit
cd149f04fc
@ -14,6 +14,8 @@ namespace osu.Game.Modes.UI
|
|||||||
private Box background;
|
private Box background;
|
||||||
private Box fill;
|
private Box fill;
|
||||||
|
|
||||||
|
public BindableDouble Current = new BindableDouble();
|
||||||
|
|
||||||
public HealthDisplay()
|
public HealthDisplay()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -30,13 +32,12 @@ namespace osu.Game.Modes.UI
|
|||||||
Scale = new Vector2(0, 1),
|
Scale = new Vector2(0, 1),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Current.ValueChanged += current_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Current;
|
private void current_ValueChanged(object sender, EventArgs e)
|
||||||
|
|
||||||
public void Set(double value)
|
|
||||||
{
|
{
|
||||||
Current = value;
|
|
||||||
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
|
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Modes.UI
|
|||||||
processor.TotalScore.ValueChanged += delegate { ScoreCounter?.Set((ulong)processor.TotalScore.Value); };
|
processor.TotalScore.ValueChanged += delegate { ScoreCounter?.Set((ulong)processor.TotalScore.Value); };
|
||||||
processor.Accuracy.ValueChanged += delegate { AccuracyCounter?.Set((float)processor.Accuracy.Value); };
|
processor.Accuracy.ValueChanged += delegate { AccuracyCounter?.Set((float)processor.Accuracy.Value); };
|
||||||
processor.Combo.ValueChanged += delegate { ComboCounter?.Set((ulong)processor.Combo.Value); };
|
processor.Combo.ValueChanged += delegate { ComboCounter?.Set((ulong)processor.Combo.Value); };
|
||||||
processor.Health.ValueChanged += delegate { HealthDisplay?.Set(processor.Health.Value); };
|
if (HealthDisplay != null) processor.Health.Weld(HealthDisplay.Current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user