Power - spotřebovává se když jsou zavřené dveře. Hráči mohou zavírat pouze dveře na svojí polovině mapy. Oprava bugu v MovementOpportunity, který způsoboval zpožďování intervalu.
This commit is contained in:
parent
7656707177
commit
25a62af483
22 changed files with 240 additions and 59 deletions
26
FNAF_Clone/GUI/PowerIndicator.cs
Normal file
26
FNAF_Clone/GUI/PowerIndicator.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using GlobalClassLib;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace FNAF_Clone.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)}";
|
||||
}
|
||||
|
|
@ -9,8 +9,9 @@ public class TimerUIElement : TextUIElement{
|
|||
private Stopwatch stopwatch = new();
|
||||
|
||||
|
||||
public TimerUIElement(Point corner1, SpriteFont font) : base(corner1, corner1, font) {
|
||||
public TimerUIElement(Point corner1, SpriteFont font) : base(corner1, font) {
|
||||
Text = "00:00.000";
|
||||
Bounds = (corner1, corner1 + new Point((int)Measure().X, (int)Measure().Y));
|
||||
}
|
||||
|
||||
public override void Update() {
|
||||
|
|
|
|||
|
|
@ -79,28 +79,18 @@ public class UIManager {
|
|||
|
||||
timerElement = new(new(0, 0), PixelMonoFont);
|
||||
overlayScreen.AddElement("timer", timerElement);
|
||||
officeScreen.AddElement("power-p1-office", new PowerIndicator(new(timerElement.Bounds.Item1.X, timerElement.Bounds.Item2.Y + 5), PixelMonoFont, Client.Player, "POWER: "));
|
||||
|
||||
|
||||
TextUIElement powerLabel = (TextUIElement)
|
||||
monitorScreen.AddElement("power-label", new TextUIElement(new(510, 150), PixelMonoFont){Text = "POWER:"});
|
||||
TextUIElement powerP1 = (TextUIElement)
|
||||
monitorScreen.AddElement("power-p2", new PowerIndicator(new(powerLabel.Bounds.Item1.X + 10, powerLabel.Bounds.Item2.Y + 10), PixelMonoFont, Client.Opponent, ""){Color = new Color(220, 10, 10, 255)});
|
||||
monitorScreen.AddElement("power-p1", new PowerIndicator( new (powerP1.Bounds.Item1.X, powerP1.Bounds.Item2.Y + 5), PixelMonoFont, Client.Player, ""){Color = new Color(15, 190, 247, 255)});
|
||||
|
||||
winScreen.AddElement("win-text", new TextUIElement(new(320, 180), PixelMonoFont, TextUIElement.Alignment.CENTER){Text = "YOU WIN", Color = Color.Green});
|
||||
loseScreen.AddElement("lose-text", new TextUIElement(new(320, 180), PixelMonoFont, TextUIElement.Alignment.CENTER){Text = "YOU LOSE", Color = Color.Red});
|
||||
|
||||
// overlayScreen.AddElement("test", new TextBoxUIElement(PixelMonoFont, Point.Zero, new(200, 100)));
|
||||
|
||||
// Main menu
|
||||
// TextUIElement serverIpLabel = (TextUIElement) menuScreen.AddElement("server-ip-label", new TextUIElement(new (20, 20), PixelMonoFont){Text = "ENTER SERVER IP: ", Color = Color.Gray});
|
||||
// TextBoxUIElement serverIpTextBox = (TextBoxUIElement)menuScreen.AddElement("server-ip-textbox",
|
||||
// new TextBoxUIElement(PixelMonoFont,
|
||||
// new(serverIpLabel.Bounds.Item1.X + (int)serverIpLabel.Measure().X, serverIpLabel.Bounds.Item1.Y),
|
||||
// new(640, serverIpLabel.Bounds.Item2.Y + (int)serverIpLabel.Measure().Y)));
|
||||
// serverIpTextBox.OnFocused = () => {
|
||||
// serverIpTextBox.Color = Color.LightGreen;
|
||||
// serverIpLabel.Color = Color.DarkGreen;
|
||||
// };
|
||||
// serverIpTextBox.OnUnfocused = () => {
|
||||
// serverIpTextBox.Color = Color.White;
|
||||
// serverIpLabel.Color = Color.Gray;
|
||||
// };
|
||||
|
||||
|
||||
MenuInputField usernameField = (MenuInputField)menuScreen.AddElement("username-field", new MenuInputField(PixelMonoFont, new(20, 20), "USERNAME: "));
|
||||
MenuInputField field = (MenuInputField)menuScreen.AddElement("server-ip-field", new MenuInputField(PixelMonoFont, new(usernameField.Bounds.Item1.X, usernameField.Bounds.Item2.Y + 20), "SERVER IP: ", "127.0.0.1"));
|
||||
UIElement connectButton = menuScreen.AddElement("server-ip-submit", new TextUIElement(new Point(field.Bounds.Item1.X, field.Bounds.Item2.Y), PixelMonoFont)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue