refactor: Window Title According to Network State

This commit is contained in:
Syntriax 2024-02-04 12:23:41 +03:00
parent 65073ec1ca
commit 5afb8b69bf
1 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,4 @@
using System; using System;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
@ -139,13 +139,21 @@ public class GamePong : Game
if (commandLineArguments.Length != 1) if (commandLineArguments.Length != 1)
{ {
if (commandLineArguments[1].Equals("server", StringComparison.OrdinalIgnoreCase)) if (commandLineArguments[1].Equals("server", StringComparison.OrdinalIgnoreCase))
{
pongManager.BehaviourController.AddBehaviour<NetworkServer>().Start(8888, 2); pongManager.BehaviourController.AddBehaviour<NetworkServer>().Start(8888, 2);
Window.Title = "Pong - Server";
}
else else
{
Window.Title = $"Pong - Client -> {commandLineArguments[1]}";
pongManager.BehaviourController.AddBehaviour<NetworkClient>().Connect(commandLineArguments[1], 8888); pongManager.BehaviourController.AddBehaviour<NetworkClient>().Connect(commandLineArguments[1], 8888);
}
} }
else else
{
pongManager.BehaviourController.AddBehaviour<NetworkClient>().Connect("127.0.0.1", 8888); pongManager.BehaviourController.AddBehaviour<NetworkClient>().Connect("127.0.0.1", 8888);
Window.Title = $"Pong - Client -> 127.0.0.1";
}
} }
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)