public BattleMapPlayer(BattleMapPlayer Clone) { if (Clone == null) { Team = -1; OnlinePlayerType = PlayerTypeNA; return; } ConnectionID = Clone.ConnectionID; Name = Clone.Name; Guild = Clone.Guild; License = Clone.License; Ranking = Clone.Ranking; IsOnline = Clone.IsOnline; Team = Clone.Team; Level = Clone.Level; Money = Clone.Money; IsPlayerControlled = Clone.IsPlayerControlled; Color = Clone.Color; GameplayType = Clone.GameplayType; InputManager = Clone.InputManager; LocalPlayerIndex = Clone.LocalPlayerIndex; OnlinePlayerType = Clone.OnlinePlayerType; OnlineClient = Clone.OnlineClient; Inventory = Clone.Inventory; }
public IOnlineConnection OnlineClient;//Used by the server public Player(string ID, string Name, string PlayerType, bool IsOnline, int Team) { this.ConnectionID = ID; this.Name = Name; this.PlayerType = PlayerType; this.IsOnline = IsOnline; this.Team = Team; GameplayType = GameplayTypes.MouseAndKeyboard; Equipment = new PlayerEquipment(); }
public IOnlineConnection OnlineClient;//Used by the server public Player(string ID, string Name, string PlayerType, int Team) { this.ConnectionID = ID; this.Name = Name; this.PlayerType = PlayerType; this.Team = Team; Guild = string.Empty; GameplayType = GameplayTypes.MouseAndKeyboard; Equipment = new PlayerInventory(); }
public BattleMapPlayer(string ID, string Name, string OnlinePlayerType, bool IsOnline, int Team, bool IsPlayerControlled, Color Color) { this.ConnectionID = ID; this.Name = Name; this.OnlinePlayerType = OnlinePlayerType; this.IsOnline = IsOnline; this.Team = Team; this.IsPlayerControlled = IsPlayerControlled; this.Color = Color; Guild = string.Empty; Inventory = new PlayerInventory(); GameplayType = GameplayTypes.MouseAndKeyboard; InputManager = new KeyboardInput(); }
public BattleMapPlayer(string ID, string Name, PlayerTypes OnlinePlayerType, bool IsOnline, int Team, bool IsPlayerControlled, Color Color) { this.ConnectionID = ID; this.Name = Name; this.IsOnline = IsOnline; this.Team = Team; this.IsPlayerControlled = IsPlayerControlled; this.Color = Color; Guild = string.Empty; Inventory = new PlayerInventory(); if (OnlinePlayerType == PlayerTypes.Offline) { this.OnlinePlayerType = PlayerTypeOffline; } else if (OnlinePlayerType == PlayerTypes.Online) { this.OnlinePlayerType = PlayerTypeOnline; } else if (OnlinePlayerType == PlayerTypes.Host) { this.OnlinePlayerType = PlayerTypeHost; } else if (OnlinePlayerType == PlayerTypes.Player) { this.OnlinePlayerType = PlayerTypePlayer; } else if (OnlinePlayerType == PlayerTypes.Ready) { this.OnlinePlayerType = PlayerTypeReady; } else { this.OnlinePlayerType = PlayerTypeSpectator; } GameplayType = GameplayTypes.MouseAndKeyboard; InputManager = new KeyboardInput(); }
public RobotInput GetRobotInput(GameplayTypes GameplayType, RobotAnimation Owner, Rectangle CameraBounds) { switch (GameplayType) { case GameplayTypes.MouseAndKeyboard: return(new KeyboardAndMouseRobotInput(Owner, CameraBounds)); case GameplayTypes.Controller1: return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.One)); case GameplayTypes.Controller2: return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Two)); case GameplayTypes.Controller3: return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Three)); case GameplayTypes.Controller4: return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Four)); } return(new NullRobotInput()); }
public Player(string ID, string Name, PlayerTypes PlayerType, int Team) { this.ConnectionID = ID; this.Name = Name; this.Team = Team; Guild = string.Empty; if (PlayerType == PlayerTypes.Offline) { this.PlayerType = PlayerTypeOffline; } else if (PlayerType == PlayerTypes.Online) { this.PlayerType = PlayerTypeOnline; } else if (PlayerType == PlayerTypes.Host) { this.PlayerType = PlayerTypeHost; } else if (PlayerType == PlayerTypes.Player) { this.PlayerType = PlayerTypePlayer; } else if (PlayerType == PlayerTypes.Ready) { this.PlayerType = PlayerTypeReady; } else { this.PlayerType = PlayerTypeSpectator; } GameplayType = GameplayTypes.MouseAndKeyboard; Equipment = new PlayerInventory(); }
public void ReloadData() { if (_AsyncReadThread != null) { if (_AsyncReadThread.IsAlive) { return; // Already fetching data } } _AsyncReadThread = new Thread(() => { if (isStopping) { return; } try { // Consume a message semaphore.WaitOne((int)receiveTimeout.TotalMilliseconds, true); if (message == null) { //selfReference.UpdateText("No message received!" + "\n"); } else { if (lastMessage != null) { if (lastMessage.NMSMessageId == message.NMSMessageId) { return; //sameMessage } else { this.lastMessage = message; } } else { this.lastMessage = message; } message.Acknowledge(); if (debug) { selfReference.UpdateText("Received message with text: " + message.Text); } GameplayTypes gameTypes = GameplayTypes.NONE; if (message.Properties.Contains("GameType")) { gameTypes = (GameplayTypes)Enum.Parse(typeof(GameplayTypes), message.Properties.GetString("GameType")); } switch (gameTypes) { case GameplayTypes.Connect: HandleConnectionMessage(); break; case GameplayTypes.Disconnect: HandleDisconnectMessage(); break; case GameplayTypes.Initialised: HandleInitialisedMessage(); break; case GameplayTypes.Movement: break; case GameplayTypes.Turn: break; case GameplayTypes.Surrender: break; default: //No Default Handler break; } } } catch (Exception e) { //selfReference.UpdateText(e.Message + " -" + e.GetBaseException().ToString() + "\n"); } }); _AsyncReadThread.Start(); }
public RobotInput GetRobotInput(GameplayTypes GameplayType, RobotAnimation Owner, Rectangle CameraBounds) { return(new KeyboardSpaceshipVehicleInput(Owner, CameraBounds)); }
public void UpdateControls(GameplayTypes GameplayType, Rectangle CameraBounds) { InputManager = InputManagerHelper.GetRobotInput(GameplayType, this, CameraBounds); }
public RobotInput GetRobotInput(GameplayTypes GameplayType, RobotAnimation Owner, Rectangle CameraBounds) { return(new NullRobotInput()); }