示例#1
0
    public async Task CheckMatchmakingTicketStatus()
    {
        BLEDebug.LogInfo("Checking MatchMaking Ticket Status");
        FlatJSON fJSON = new FlatJSON();

        fJSON.Add("TicketId", TicketId);
        HttpContent         req    = fJSON.SerializeContent();
        HttpResponseMessage result = await client.PostAsync("https://echelon.3pointlabs.org/matchmaking/status", req);

        string body = await result.Content.ReadAsStringAsync();

        BLEDebug.LogInfo("Ticket " + body);
        fJSON.Deserialize(body);

        fJSON.TryGetStringValue("Status", out _Status);

        if (Status == "COMPLETED")
        {
            fJSON.TryGetStringValue("GameSessionArn", out _GameSessionArn);
            fJSON.TryGetStringValue("IpAddress", out _IpAddress);
            fJSON.TryGetStringValue("DnsName", out _DnsName);
            fJSON.TryGetIntValue("Port", out _TcpPort);
            fJSON.TryGetStringValue("PlayerSessionId", out _PlayerSessionId);
            FindAvailableUDPPort();
        }
    }
示例#2
0
    public async Task Login(string username, string password)
    {
        CurrentLoginStatus = LoginStatus.LOGGING_IN;
        BLEDebug.LogInfo("Logging In");
        FlatJSON fJSON = new FlatJSON();

        fJSON.Add("username", username);
        fJSON.Add("password", password);
        HttpContent req = fJSON.SerializeContent();

        var result = await client.PostAsync("https://echelon.3pointlabs.org/auth/login", req);

        string body = await result.Content.ReadAsStringAsync();

        BLEDebug.LogInfo("Auth " + body);
        fJSON.Deserialize(body);
        fJSON.TryGetStringValue("username", out _PlayerId);
        fJSON.TryGetStringValue("idToken", out idToken);
        fJSON.TryGetStringValue("refreshToken", out refreshToken);
        fJSON.TryGetStringValue("accessToken", out accessToken);
        if (idToken != null)
        {
            // Set Token for Authentication
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(idToken);
            CurrentLoginStatus = LoginStatus.LOGGED_IN;
        }
        else
        {
            CurrentLoginStatus = LoginStatus.FAILED;
        }
    }
示例#3
0
    public async Task CreateMatchmakingTicket()
    {
        BLEDebug.LogInfo("Creating MatchMaking Ticket");
        FlatJSON fJSON = new FlatJSON();

        HttpContent         req    = fJSON.SerializeContent();
        HttpResponseMessage result = await client.PostAsync("https://echelon.3pointlabs.org/matchmaking/ticket", req);

        string body = await result.Content.ReadAsStringAsync();

        BLEDebug.LogInfo("Ticket" + body);
        fJSON.Deserialize(body);

        fJSON.TryGetStringValue("TicketId", out TicketId);
        fJSON.TryGetStringValue("Status", out _Status);
    }
示例#4
0
    public async Task SetCustomization(string cModelId)
    {
        _CharacterModelId = cModelId;
        BLEDebug.LogInfo("Setting CharacterModelId");
        FlatJSON fJSON = new FlatJSON();

        fJSON.Add("characterModelId", _CharacterModelId);
        HttpContent         req    = fJSON.SerializeContent();
        HttpResponseMessage result = await client.PutAsync("https://echelon.3pointlabs.org/profile/customization", req);

        string body = await result.Content.ReadAsStringAsync();

        BLEDebug.LogInfo("CharacterModel " + body);
        fJSON.Deserialize(body);

        // fJSON.TryGetStringValue("characterModelId", out _CharacterModelId);
    }