示例#1
0
        public bool JoinGame(Partida game)
        {
            var joinGameRequest = EngineNetwork.CreatePackage(new object[] {
                (byte)NetworkClientRequests.JoinGame, id, game.Id,
            });

            EngineNetwork.Send(joinGameRequest);
            List <string> packageReceived = EngineNetwork.Receive();

            if (packageReceived.Count == 0)
            {
                return(false);
            }
            else if (packageReceived.Count == 1)
            {
                if (byte.Parse(packageReceived[0]) != (byte)NetworkServerResponses.PlayerJoined)
                {
                    return(false);
                }
            }
            return(true);
        }