Exemplo n.º 1
0
    /// <summary>
    /// Creates a new team memeber
    /// </summary>
    public void CreateMember()
    {
        User result = null;

        if (UserObject.password == string.Empty)
        {
            result = new User();
            Enjin.InviteUser(UserObject.email, UserObject.name);
        }
        else
        {
            result = Enjin.CreateUser(UserObject.name, UserObject.email, UserObject.password, RolesList[RoleDropDownSelection].name);
        }

        if (result != null && Enjin.ServerResponse == ResponseCodes.SUCCESS)
        {
            if (UserObject.password == string.Empty)
            {
                EnjinEditor.DisplayDialog("SUCCESS", "User " + UserObject.name + " successfully created and invite sent.");
            }
            else
            {
                EnjinEditor.DisplayDialog("SUCCESS", "User " + UserObject.name + " successfully created.");
            }

            EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADTEAM);
            EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADIDENTITIES);
            SetTeamState(TeamState.VIEWLIST);
        }
        else
        {
            EnjinEditor.DisplayDialog("FAILED", "Eamil address: " + UserObject.email + " has already been registered. Please enter a different email address");
        }
    }
Exemplo n.º 2
0
    // Upon project start, execute the battery of Enjin SDK runtime function tests.
    void Start()
    {
        Debug.Log("=== Executing Enjin SDK runtime tests. ===");
        Enjin.IsDebugLogActive = DEBUG;

        Debug.Log("(1/8) Initializing the platform for use as game server ... ");
        Enjin.StartPlatform(PLATFORM_URL, SERVER_EMAIL, SERVER_PASSWORD, APP_ID);
        DEVELOPER_TOKEN = Enjin.AccessToken;
        Debug.Log(" ... PASSED.");

        Debug.Log("(2/8) Creating a new testing account ... ");
        long   timestamp    = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
        string testName     = "test" + timestamp;
        string testEmail    = testName + "@mail.com";
        string testPassword = "******";
        User   testUser     = new User
        {
            name     = testName,
            email    = testEmail,
            password = testPassword
        };

        Enjin.CreateUser(testUser.name, testUser.email, testUser.password, "Platform Owner");
        if (Enjin.ServerResponse == ResponseCodes.SUCCESS)
        {
            Debug.Log(" ... PASSED.");

            Debug.Log("(3/8) Verifying login credentials for the testing account ... ");
            loginUser = Enjin.VerifyLogin(testEmail, testPassword);
            LoginState loginState = Enjin.LoginState;
            if (loginState == LoginState.VALID)
            {
                Debug.Log(" ... PASSED.");
                TESTER_TOKEN = loginUser.access_token;
                foreach (Identity identity in loginUser.identities)
                {
                    if (identity.app_id == APP_ID)
                    {
                        Debug.Log("****** " + identity.app_id + " / " + APP_ID + ": " + identity.linking_code);
                        testingIdentityID = identity.id;
                    }
                }
                testingIdentity = Enjin.GetIdentity(testingIdentityID);
                string linkingCode = testingIdentity.linking_code;

                Debug.Log("(4/8) Establishing wallet link for the testing account. Please link with code " + linkingCode + " ... ");
                Enjin.ListenForLink(testingIdentityID, linkingData =>
                {
                    USER_ADDRESS = linkingData.data.ethereum_address;
                    Debug.Log(" ... PASSED.");
                    sequenceOne = true;
                });
            }
            else
            {
                Debug.LogError(" ... FAILED.");
            }
        }
        else
        {
            Debug.LogError(" ... FAILED.");
        }
    }