private void HandleInGameCommands(String[] message, String plainText) { //In game GameCommandTypes messageType = GameCommandTypes.Chat; int clientID = -1; int lockstep = -1; String[] data = { "-1" }; try { messageType = (GameCommandTypes)Convert.ToInt32(message[1]); clientID = Convert.ToInt32(message[2]); lockstep = Convert.ToInt32(message[3]); data = message[4].Split(' '); } catch { Console.WriteLine("CLIENT: Network error 3"); } finally { switch (messageType) { case GameCommandTypes.Chat: Console.WriteLine(message[4]); break; case GameCommandTypes.SpawnAgent: commandManager.AddCommand(new SpawnAgentCommand(lockstep, int.Parse(data[0]), int.Parse(data[1]), int.Parse(data[2]), int.Parse(data[3]))); world.AgentCount++; break; } } }
public GameCommand(GameCommandTypes type, Type subPhase, string rawParameters) { Type = type; SubPhase = subPhase; RawParameters = rawParameters; Parameters = new JSONObject(rawParameters); }
public static GameCommand GenerateGameCommand(string textjson, bool isRpc = false) { JSONObject json = new JSONObject(textjson); GameCommandTypes commandType = (GameCommandTypes)Enum.Parse(typeof(GameCommandTypes), json["command"].str); Type subPhase = System.Type.GetType(json["subphase"].str); string parameters = json["parameters"].ToString(); return(GenerateGameCommand(commandType, subPhase, parameters, isRpc)); }
private void HandleInGameRequests(String[] message, String plainText) { //In game GameCommandTypes messageType = GameCommandTypes.Chat; int clientID = -1; int lockstep = -1; String[] data = { "-1" }; try { messageType = (GameCommandTypes)Convert.ToInt32(message[1]); clientID = Convert.ToInt32(message[2]); lockstep = Convert.ToInt32(message[3]); data = message[4].Split(' '); } catch { } finally { switch (messageType) { case GameCommandTypes.Chat: Console.WriteLine(message[4]); ForwardMessage(plainText); break; case GameCommandTypes.SpawnAgent: commandManager.AddCommand(new SpawnAgentCommand(lockstep, int.Parse(data[0]), int.Parse(data[1]), int.Parse(data[2]), world.AgentCount)); plainText += " " + (world.AgentCount).ToString(); world.AgentCount++; ForwardMessage(plainText); break; } } }
public DamageDeckSyncCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public ConfirmCritCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public HotacFreeTargetLockCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
protected Request(GameCommandTypes commandType, int lockstep) { this.lockstep = lockstep; this.clientID = GameEngine.GetInstance().Client.ClientID; this.commandType = (int)commandType; }
public SquadsSyncCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public ShipPlacementCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public ActIvateAndMoveCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public CancelShipSelectionCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public SyncDiceResultsCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public SelectShipCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public DecisionCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public static GameCommand GenerateGameCommand(GameCommandTypes commandType, Type subPhase, string parameters = null, bool isRpc = false) { GameCommand command = null; switch (commandType) { case GameCommandTypes.DamageDecksSync: command = new DamageDeckSyncCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SquadsSync: command = new SquadsSyncCommand(commandType, subPhase, parameters); break; case GameCommandTypes.Decision: command = new DecisionCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ObstaclePlacement: command = new ObstaclePlacementCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ShipPlacement: command = new ShipPlacementCommand(commandType, subPhase, parameters); break; case GameCommandTypes.AssignManeuver: command = new AssignManeuverCommand(commandType, subPhase, parameters); break; case GameCommandTypes.PressNext: command = new PressNextCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ActivateAndMove: command = new ActIvateAndMoveCommand(commandType, subPhase, parameters); break; case GameCommandTypes.DeclareAttack: command = new DeclareAttackCommand(commandType, subPhase, parameters); break; case GameCommandTypes.DiceModification: command = new DiceModificationCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SelectShip: command = new SelectShipCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SyncDiceResults: command = new SyncDiceResultsCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SyncDiceRerollSelected: command = new SyncDiceRerollSelectedCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ConfirmCrit: command = new ConfirmCritCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ConfirmDiceCheck: command = new ConfirmDiceCheckCommand(commandType, subPhase, parameters); break; case GameCommandTypes.PressSkip: command = new PressSkipCommand(commandType, subPhase, parameters); break; case GameCommandTypes.HotacSwerve: command = new HotacSwerveCommand(commandType, subPhase, parameters); break; case GameCommandTypes.HotacFreeTargetLock: command = new HotacFreeTargetLockCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SyncPlayerWithInitiative: command = new SyncPlayerWithInitiativeCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SystemActivation: command = new SystemActivationCommand(commandType, subPhase, parameters); break; case GameCommandTypes.CombatActivation: command = new CombatActivationCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SelectObstacle: command = new SelectObstacleCommand(commandType, subPhase, parameters); break; default: Console.Write("Constructor for GameCommand is not found", LogTypes.Errors, true, "red"); break; } string receivedString = (isRpc) ? " (rpc)": ""; Console.Write("Command is generated" + receivedString + ": " + command.Type, LogTypes.GameCommands, false, "aqua"); return(command); }
public static void SendCommand(GameCommandTypes commandType, Type subPhase, string parameters = null) { SendCommand(GenerateGameCommand(commandType, subPhase, parameters)); }
public PressNextCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public DiceModificationCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public SyncPlayerWithInitiativeCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public HotacSwerveCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public MoveObstacleCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public CombatActivationCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public SelectShipToAssignManeuverCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public SyncDiceRerollSelectedCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public DeclareAttackCommand(GameCommandTypes type, Type subPhase, string rawParameters) : base(type, subPhase, rawParameters) { }
public static GameCommand GenerateGameCommand(GameCommandTypes commandType, Type subPhase, string parameters = null, bool isRpc = false) { GameCommand command = null; switch (commandType) { case GameCommandTypes.DamageDecksSync: command = new DamageDeckSyncCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SquadsSync: command = new SquadsSyncCommand(commandType, subPhase, parameters); break; case GameCommandTypes.Decision: command = new DecisionCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ObstaclePlacement: command = new ObstaclePlacementCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ShipPlacement: command = new ShipPlacementCommand(commandType, subPhase, parameters); break; case GameCommandTypes.AssignManeuver: command = new AssignManeuverCommand(commandType, subPhase, parameters); break; case GameCommandTypes.PressNext: command = new PressNextCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ActivateAndMove: command = new ActivateAndMoveCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SelectShipToAssignManeuver: command = new SelectShipToAssignManeuverCommand(commandType, subPhase, parameters); break; case GameCommandTypes.DeclareAttack: command = new DeclareAttackCommand(commandType, subPhase, parameters); break; case GameCommandTypes.DiceModification: command = new DiceModificationCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SelectShip: command = new SelectShipCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SyncDiceResults: command = new SyncDiceResultsCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SyncDiceRerollSelected: command = new SyncDiceRerollSelectedCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ConfirmCrit: command = new ConfirmCritCommand(commandType, subPhase, parameters); break; case GameCommandTypes.ConfirmDiceCheck: command = new ConfirmDiceCheckCommand(commandType, subPhase, parameters); break; case GameCommandTypes.PressSkip: command = new PressSkipCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SyncPlayerWithInitiative: command = new SyncPlayerWithInitiativeCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SystemActivation: command = new SystemActivationCommand(commandType, subPhase, parameters); break; case GameCommandTypes.CombatActivation: command = new CombatActivationCommand(commandType, subPhase, parameters); break; case GameCommandTypes.SelectObstacle: command = new SelectObstacleCommand(commandType, subPhase, parameters); break; case GameCommandTypes.BombPlacement: command = new BombPlacementCommand(commandType, subPhase, parameters); break; case GameCommandTypes.MoveObstacle: command = new MoveObstacleCommand(commandType, subPhase, parameters); break; case GameCommandTypes.CancelShipSelection: command = new CancelShipSelectionCommand(commandType, subPhase, parameters); break; default: break; } return(command); }