Exemplo n.º 1
0
 public LobbyCommandPacket(string playerID, LobbyCommands command, string args = null) : base()
 {
     Type     = PacketType.LobbyCommand;
     PlayerID = playerID;
     Command  = command;
     Data     = args;
 }
Exemplo n.º 2
0
 internal LobbyCommandPacket(string playerID, LobbyCommands command, string args = "") : base()
 {
     Type     = PacketType.LobbyCommand;
     PlayerID = playerID;
     Command  = command;
     Data     = args;
 }
Exemplo n.º 3
0
 public void Send(AbstractCommand c)
 {
     LobbyCommands.Add(new CommandEntry()
     {
         Client = m_Client, Command = c
     });
 }
Exemplo n.º 4
0
        private async Task SendLobbyCommandToClient(PlayerData player, LobbyCommands command)
        {
            LobbyCommandPacket commandPacket = new LobbyCommandPacket(player.PlayerID, command);

            try
            {
                await _connection.ConnectAndWaitResponse(player.IPAddress, NetworkPorts.LobbyClientPort, commandPacket);
            } catch (Exception e)
            {
                log("Failed to send command to remote client: HResult=" + e.HResult);
                log("Command: " + commandPacket.Command + " Player: " + player.PlayerID);
            }
        }
Exemplo n.º 5
0
        private async Task <NetworkPacket> SendLobbyCommand(string playerID, LobbyCommands command, string args = null)
        {
            try
            {
                LobbyCommandPacket commandPacket = new LobbyCommandPacket(playerID, command, args);
                return(await _connection.ConnectAndWaitResponse(_serverAddress, NetworkPorts.LobbyServerPort, commandPacket));
            } catch (Exception)
            {
                // TODO throw custom exception for gameview to deal with
                // for now, fire LobbyCommand.Disconnected.
                LobbyCommandPacket packet = new LobbyCommandPacket("Client", LobbyCommands.Disconnected);
                OnLobbyCommand(packet);
            }

            return(null as NetworkPacket);
        }
Exemplo n.º 6
0
 private async Task SendLobbyCommandToClient(PlayerData player, LobbyCommands command)
 {
     LobbyCommandPacket commandPacket = new LobbyCommandPacket(player.PlayerID, command);
     await _connection.ConnectAndWaitResponse(player.IPAddress, NetworkPorts.LobbyClientPort, commandPacket);
 }