Exemplo n.º 1
0
        internal async Task <bool> RegisterPlayer()
        {
            try
            {
                RegistrationState = "Registering...";
                Registering       = true;
                if (PlayerName.All(char.IsLetterOrDigit))
                {
                    PlayerDescriptor player = await GameLoader.Instance.RegisterPlayer(ServerIP, PlayerName);

                    GameLoader.Instance.Player = player;
                    RegistrationState          = "Logged in!";
                    IsSuccessfullyRegistered   = true;
                }
            }
            catch
            {
                RegistrationState = "Register";
            }
            finally
            {
                Registering = false;
            }
            return(IsSuccessfullyRegistered);
        }
Exemplo n.º 2
0
        internal async Task <PlayerDescriptor> QuitMatch(MatchDescriptor match)
        {
            Endpoint             e        = Endpoint.QuitMatch(match.MatchId, Player.Secret);
            ConnectorPayloadBase payload  = new OptionPayload(Player.Name);
            PlayerDescriptor     response = await _gameServer.PostJSON <PlayerDescriptor>(e, payload);

            return(response);
        }
Exemplo n.º 3
0
        internal async Task <bool> SelectOption(string optionCode)
        {
            PlayerDescriptor response = await GameLoader.Instance.SelectOption(optionCode);

            return(response.ValidMove);
        }