Add HP/VT bars
This commit is contained in:
@@ -24,6 +24,13 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
|
||||
[Node] public Label HPNumber { get; set; } = default!;
|
||||
|
||||
[Node] public Label VTNumber { get; set; } = default!;
|
||||
|
||||
[Node] public Label EXPNumber { get; set; } = default!;
|
||||
|
||||
[Node] public ProgressBar HPProgressBar { get; set; } = default!;
|
||||
|
||||
[Node] public ProgressBar VTProgressBar { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
|
||||
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
|
||||
@@ -37,30 +44,45 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
|
||||
Player.Stats.MaximumVT.Sync += MaximumVT_Sync;
|
||||
|
||||
Player.Stats.CurrentLevel.Sync += CurrentLevel_Sync;
|
||||
Player.Stats.CurrentExp.Sync += CurrentExp_Sync;
|
||||
Player.Stats.ExpToNextLevel.Sync += ExpToNextLevel_Sync;
|
||||
}
|
||||
|
||||
private void CurrentLevel_Sync(int obj)
|
||||
{
|
||||
LevelNumber.Text = $"{obj}";
|
||||
LevelNumber.Text = $"LVL. {obj}";
|
||||
}
|
||||
|
||||
private void MaximumVT_Sync(int obj)
|
||||
{
|
||||
VTNumber.Text = $"{Player.Stats.CurrentVT.Value}/{obj}";
|
||||
VTProgressBar.MaxValue = obj;
|
||||
}
|
||||
|
||||
private void CurrentVT_Sync(int obj)
|
||||
{
|
||||
VTNumber.Text = $"{obj}/{Player.Stats.MaximumVT.Value}";
|
||||
VTProgressBar.Value = obj;
|
||||
}
|
||||
|
||||
private void MaximumHP_Sync(int obj)
|
||||
{
|
||||
HPNumber.Text = $"{Player.Stats.CurrentHP.Value}/{obj}";
|
||||
HPProgressBar.MaxValue = obj;
|
||||
}
|
||||
|
||||
private void CurrentHP_Sync(int obj)
|
||||
{
|
||||
HPNumber.Text = $"{obj}/{Player.Stats.MaximumHP.Value}";
|
||||
HPProgressBar.Value = obj;
|
||||
}
|
||||
|
||||
private void CurrentExp_Sync(double obj)
|
||||
{
|
||||
EXPNumber.Text = $"XP {(int)obj}/{Player.Stats.ExpToNextLevel.Value}";
|
||||
}
|
||||
private void ExpToNextLevel_Sync(int obj)
|
||||
{
|
||||
EXPNumber.Text = $"XP {Player.Stats.CurrentExp.Value}/{obj}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user