Beispiel #1
0
        public CreateGameResponse CreateGame(CreateGameRequest createGameRequest, Operations.ErrorCode expectedResult)
        {
            var request = CreateOperationRequest(OperationCode.CreateGame);

            if (createGameRequest.GameId != null)
            {
                request.Parameters[ParameterCode.RoomName] = createGameRequest.GameId;
            }

            if (createGameRequest.LobbyName != null)
            {
                request.Parameters[(byte)Operations.ParameterCode.LobbyName] = createGameRequest.LobbyName;
            }

            if (createGameRequest.LobbyType != 0)
            {
                request.Parameters[(byte)Operations.ParameterCode.LobbyType] = createGameRequest.LobbyType;
            }

            if (createGameRequest.GameProperties != null)
            {
                request.Parameters[(byte)Operations.ParameterCode.GameProperties] = createGameRequest.GameProperties;
            }

            var response = this.SendRequestAndWaitForResponse(request, (short)expectedResult);

            return(GetCreateGameResponse(response));
        }
Beispiel #2
0
        public JoinGameResponse JoinGame(string gameId, Operations.ErrorCode expectedResult)
        {
            var joinRequest = new JoinGameRequest {
                GameId = gameId
            };

            return(JoinGame(joinRequest, expectedResult));
        }
Beispiel #3
0
        public CreateGameResponse CreateGame(string gameId, Operations.ErrorCode expectedResult)
        {
            var createGameRequest = new CreateGameRequest {
                GameId = gameId
            };

            return(this.CreateGame(createGameRequest, expectedResult));
        }
Beispiel #4
0
        public JoinGameResponse JoinGame(JoinGameRequest joinRequest, Operations.ErrorCode expectedResult)
        {
            var request = CreateOperationRequest((byte)Operations.OperationCode.JoinGame);

            if (joinRequest.GameId != null)
            {
                request.Parameters.Add((byte)Operations.ParameterCode.GameId, joinRequest.GameId);
            }

            if (joinRequest.CreateIfNotExists)
            {
                request.Parameters.Add((byte)Operations.ParameterCode.CreateIfNotExists, joinRequest.CreateIfNotExists);
            }

            var operationResponse = this.SendRequestAndWaitForResponse(request, (short)expectedResult);

            return(GetJoinGameResponse(operationResponse));
        }
Beispiel #5
0
        public CreateGameResponse CreateGame(string gameId, bool isVisible, bool isOpen, byte maxPlayer, Operations.ErrorCode expectedResult)
        {
            var createGameRequest = new CreateGameRequest
            {
                GameId         = gameId,
                GameProperties = new Hashtable()
            };

            createGameRequest.GameProperties[(byte)GameParameter.IsVisible] = isVisible;
            createGameRequest.GameProperties[(byte)GameParameter.IsOpen]    = isOpen;
            createGameRequest.GameProperties[(byte)GameParameter.MaxPlayer] = maxPlayer;

            return(this.CreateGame(createGameRequest, expectedResult));
        }