Projekt přejmenován. Neko nastaven na výchozí pozici
This commit is contained in:
parent
1a27dd6fab
commit
ceac37920b
104 changed files with 873 additions and 208 deletions
26
ONDClient/GUI/PowerIndicator.cs
Normal file
26
ONDClient/GUI/PowerIndicator.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using GlobalClassLib;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace ONDClient.GUI;
|
||||
|
||||
public class PowerIndicator : TextUIElement {
|
||||
private string label;
|
||||
private ClientPlayer player;
|
||||
private int lastPowerValue;
|
||||
|
||||
public PowerIndicator(Point corner1, SpriteFont font, ClientPlayer player, string label, Alignment alignment = Alignment.LEFT) : base(corner1, font, alignment, autoBounds:true) {
|
||||
this.player = player;
|
||||
this.label = label;
|
||||
lastPowerValue = player.state.power;
|
||||
Text = GetText();
|
||||
}
|
||||
|
||||
public override void Update() {
|
||||
if (player.state.power == lastPowerValue) return;
|
||||
lastPowerValue = player.state.power;
|
||||
Text = GetText();
|
||||
}
|
||||
|
||||
private string GetText() => $"{label}{(int)(((float)player.state.power / Power.MAX_POWER_VALUE) * 100)}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue