Exemplo n.º 1
0
        public async Task <uint> JoinGameLadder(Race race, int startPort)
        {
            RequestJoinGame joinGame = new RequestJoinGame();

            joinGame.Race = race;

            joinGame.SharedPort           = startPort + 1;
            joinGame.ServerPorts          = new PortSet();
            joinGame.ServerPorts.GamePort = startPort + 2;
            joinGame.ServerPorts.BasePort = startPort + 3;

            joinGame.ClientPorts.Add(new PortSet());
            joinGame.ClientPorts[0].GamePort = startPort + 4;
            joinGame.ClientPorts[0].BasePort = startPort + 5;

            joinGame.Options       = new InterfaceOptions();
            joinGame.Options.Raw   = true;
            joinGame.Options.Score = true;

            Request request = new Request();

            request.JoinGame = joinGame;

            Response response = await proxy.SendRequest(request);

            return(response.JoinGame.PlayerId);
        }
Exemplo n.º 2
0
    public void JoinGame()
    {
        RequestJoinGame request = new RequestJoinGame();

        request.send();
        cManager.send(request);
    }
Exemplo n.º 3
0
        private async Task <uint> JoinGame(Race race)
        {
            var joinGame = new RequestJoinGame();

            joinGame.Race = race;

            joinGame.Options       = new InterfaceOptions();
            joinGame.Options.Raw   = true;
            joinGame.Options.Score = true;

            var request = new Request();

            request.JoinGame = joinGame;
            var response = CheckResponse(await proxy.SendRequest(request));

            if (response.JoinGame.Error != ResponseJoinGame.Types.Error.Unset)
            {
                Logger.Error("JoinGame error: {0}", response.JoinGame.Error.ToString());
                if (!String.IsNullOrEmpty(response.JoinGame.ErrorDetails))
                {
                    Logger.Error(response.JoinGame.ErrorDetails);
                }
            }

            return(response.JoinGame.PlayerId);
        }
Exemplo n.º 4
0
        public async Task <uint> JoinGame(Race race)
        {
            var joinGame = new RequestJoinGame();

            joinGame.Race = race;

            joinGame.Options = new InterfaceOptions();
            joinGame.Options.FeatureLayer = new SpatialCameraSetup {
                CropToPlayableArea = true, AllowCheatingLayers = false, MinimapResolution = new Size2DI {
                    X = 16, Y = 16
                }, Resolution = new Size2DI {
                    X = 128, Y = 128
                }, Width = 10
            };
            joinGame.Options.Raw                   = true;
            joinGame.Options.Score                 = true;
            joinGame.Options.ShowCloaked           = true;
            joinGame.Options.ShowBurrowedShadows   = true;
            joinGame.Options.RawCropToPlayableArea = true;
            joinGame.Options.RawAffectsSelection   = true;

            var request = new Request();

            request.JoinGame = joinGame;
            var response = await Proxy.SendRequest(request);

            return(response.JoinGame.PlayerId);
        }
        public bool JoinGameAgainstBot(Race race)
        {
            var joinGame = new RequestJoinGame
            {
                Race    = race,
                Options = new InterfaceOptions {
                    Raw = true
                },
                SharedPort  = SHARED_PORT,
                ServerPorts = new PortSet {
                    BasePort = SERVER_BASE_PORT, GamePort = SERVER_GAME_PORT
                }
            };

            joinGame.ClientPorts.Add(new PortSet {
                BasePort = CLIENT_BASE_PORT, GamePort = CLIENT_GAME_PORT
            });

            var joinGameResponse = Call(
                new Request
            {
                JoinGame = joinGame
            },
                timeoutMs: JOIN_GAME_TIMEOUT_MS);

            return(joinGameResponse.Result.Status == Status.InGame);
        }
        public async Task <bool> InitiateGameAgainstBot(string map, Race race1, Race race2)
        {
            var createGameRequest = new Request
            {
                CreateGame = new RequestCreateGame
                {
                    LocalMap = new LocalMap {
                        MapPath = map
                    }
                }
            };

            createGameRequest.CreateGame.PlayerSetup.Add(
                new PlayerSetup
            {
                Type = PlayerType.Participant,
                Race = race1
            });
            createGameRequest.CreateGame.PlayerSetup.Add(
                new PlayerSetup
            {
                Type = PlayerType.Participant,
                Race = race2
            });

            var createGameResponse = Call(createGameRequest);

            if (createGameResponse.Result.Status != Status.InitGame)
            {
                return(false);
            }

            var joinGame = new RequestJoinGame
            {
                Race    = race1,
                Options = new InterfaceOptions {
                    Raw = true
                },
                SharedPort  = SHARED_PORT,
                ServerPorts = new PortSet {
                    BasePort = SERVER_BASE_PORT, GamePort = SERVER_GAME_PORT
                }
            };

            joinGame.ClientPorts.Add(new PortSet {
                BasePort = CLIENT_BASE_PORT, GamePort = CLIENT_GAME_PORT
            });

            var joinGameResponse = await Call(
                new Request
            {
                JoinGame = joinGame
            },
                timeoutMs : JOIN_GAME_TIMEOUT_MS);

            return(joinGameResponse.Status == Status.InGame);
        }
Exemplo n.º 7
0
        public async Task JoinGame(Race race)
        {
            var joinGame = new RequestJoinGame
            {
                Race    = race,
                Options = new InterfaceOptions {
                    Raw = true, Score = true
                }
            };

            var request = new Request {
                JoinGame = joinGame
            };
            await _connectionService.SendRequestAsync(request);
        }
Exemplo n.º 8
0
        public async Task <uint> JoinGame(Race race)
        {
            RequestJoinGame joinGame = new RequestJoinGame();

            joinGame.Race = race;

            joinGame.Options       = new InterfaceOptions();
            joinGame.Options.Raw   = true;
            joinGame.Options.Score = true;

            Request request = new Request();

            request.JoinGame = joinGame;
            Response response = await proxy.SendRequest(request);

            return(response.JoinGame.PlayerId);
        }
Exemplo n.º 9
0
        public async Task <uint> JoinGame(Race race)
        {
            RequestJoinGame joinGame = new RequestJoinGame
            {
                Race    = race,
                Options = new InterfaceOptions {
                    Raw = true, Score = true
                }
            };


            Request request = new Request {
                JoinGame = joinGame
            };
            Response response = await proxy.SendRequest(request);

            return(response.JoinGame.PlayerId);
        }
Exemplo n.º 10
0
        public async Task <uint> JoinGameLadder(Race race, int startPort)
        {
            var joinGame = new RequestJoinGame();

            joinGame.Race = race;

            joinGame.SharedPort           = startPort + 1;
            joinGame.ServerPorts          = new PortSet();
            joinGame.ServerPorts.GamePort = startPort + 2;
            joinGame.ServerPorts.BasePort = startPort + 3;

            joinGame.ClientPorts.Add(new PortSet());
            joinGame.ClientPorts[0].GamePort = startPort + 4;
            joinGame.ClientPorts[0].BasePort = startPort + 5;

            joinGame.Options = new InterfaceOptions();
            joinGame.Options.FeatureLayer = new SpatialCameraSetup {
                CropToPlayableArea = true, AllowCheatingLayers = false, MinimapResolution = new Size2DI {
                    X = 16, Y = 16
                }, Resolution = new Size2DI {
                    X = 128, Y = 128
                }, Width = 10
            };
            joinGame.Options.Raw                   = true;
            joinGame.Options.Score                 = true;
            joinGame.Options.ShowCloaked           = true;
            joinGame.Options.RawCropToPlayableArea = true;
            joinGame.Options.RawAffectsSelection   = true;

            var request = new Request();

            request.JoinGame = joinGame;

            var response = await Proxy.SendRequest(request);

            return(response.JoinGame.PlayerId);
        }
Exemplo n.º 11
0
        private async Task <uint> JoinGameLadder(Race race, int startPort)
        {
            var joinGame = new RequestJoinGame();

            joinGame.Race = race;

            joinGame.SharedPort           = startPort + 1;
            joinGame.ServerPorts          = new PortSet();
            joinGame.ServerPorts.GamePort = startPort + 2;
            joinGame.ServerPorts.BasePort = startPort + 3;

            joinGame.ClientPorts.Add(new PortSet());
            joinGame.ClientPorts[0].GamePort = startPort + 4;
            joinGame.ClientPorts[0].BasePort = startPort + 5;

            joinGame.Options       = new InterfaceOptions();
            joinGame.Options.Raw   = true;
            joinGame.Options.Score = true;

            var request = new Request();

            request.JoinGame = joinGame;

            var response = CheckResponse(await proxy.SendRequest(request));

            if (response.JoinGame.Error != ResponseJoinGame.Types.Error.Unset)
            {
                Logger.Error("JoinGame error: {0}", response.JoinGame.Error.ToString());
                if (!String.IsNullOrEmpty(response.JoinGame.ErrorDetails))
                {
                    Logger.Error(response.JoinGame.ErrorDetails);
                }
            }

            return(response.JoinGame.PlayerId);
        }