using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace FNAF_Clone.GUI; public class LoadingUIElement : TextUIElement { private string expectedEndpoint; private Client.ConnectionState lastState = Client.ConnectionState.IDLE; public LoadingUIElement(Point corner1, SpriteFont font, string expectedEndpoint, Alignment alignment = Alignment.CENTER, bool autoBounds = true) : base(corner1, font, alignment, autoBounds) { this.expectedEndpoint = expectedEndpoint; Active = true; // Color = Color.LightGray; } public override void Update() { if(lastState == Client.State) return; lastState = Client.State; switch (Client.State){ case Client.ConnectionState.CONNECTING: Text = "Connecting to " + expectedEndpoint; break; case Client.ConnectionState.CONNECTED: Text = "Connected to " + expectedEndpoint; break; case Client.ConnectionState.ACCEPTED: Text = "Waiting for opponent..."; break; case Client.ConnectionState.GAME_STARTING: Text = "Opponent: " + Client.Opponent.username; Color = Color.White; // ScaleMultiplier = 1.5f; break; } } }