예제 #1
0
    void OnLoginRequestComplete(Response response, int _clientId)
    {
        Debug.Log($"Status Code: {response.StatusCode}");
        Debug.Log($"Data: {response.Data}");
        Debug.Log($"Error: {response.Error}");


        if (!string.IsNullOrEmpty(response.Error) && response.StatusCode != 200)
        {
            ServerSend.LoginFailed(_clientId);
        }
        else if (string.IsNullOrEmpty(response.Error) && !string.IsNullOrEmpty(response.Data) && response.StatusCode == 200)
        {
            LoginObject loginObject = LoginObject.createFromJSON(response.Data);

            Server.clients[_clientId].objectId = loginObject._id;


            if (loginObject.characters.Length == 0)
            {
                ServerSend.ToCharacterCreation(_clientId);
            }
            if (loginObject.characters.Length > 0)
            {
                ServerSend.ToCharacterSelection(_clientId, loginObject);
            }
        }
    }
예제 #2
0
    void OnCreateCharacterRequestComplete(Response response, int _clientId)
    {
        Debug.Log($"Status Code: {response.StatusCode}");
        Debug.Log($"Data: {response.Data}");
        Debug.Log($"Error: {response.Error}");


        if (!string.IsNullOrEmpty(response.Error) && response.StatusCode != 201)
        {
            Debug.Log("Failed");
        }
        else if (string.IsNullOrEmpty(response.Error) && !string.IsNullOrEmpty(response.Data) && response.StatusCode == 201)
        {
            LoginObject userData = LoginObject.createFromJSON(response.Data);

            ServerSend.ToCharacterSelection(_clientId, userData);
        }
    }