void Update() { // If user presses Space, then perform the login operation. if (Input.GetKeyDown(KeyCode.Space)) { Debug.Log("Starting login process..."); LoginOperation.Create(LoginCriteria.Create("greg7", "asdf2")).ExecuteAsync(Callback); // Alternatively, executes the operation synchronously. // This WILL block until the web operation is completed (sometimes it takes as long as ~250 frames), so asynchronous is preferred to prevent gameplay hiccups. //LoginOperationResult result = operation.Execute(); Debug.Log("Finished login operation!"); } if (Input.GetKeyDown(KeyCode.R)) { RegisterOperationCriteria criteria = RegisterOperationCriteria.Builder.Create() .Username("greg900563") .Password("") .Email("*****@*****.**") .DateOfBirth(new DateTime(1989, 11, 25)) .Gender(RegistrationCriteriaGender.Male) .ZipCode("52333").Build(); RegisterOperation registerOperation = RegisterOperation.Create(criteria); registerOperation.ExecuteAsync(RegisterCallback); } }
// Use this for initialization void Start() { LoginOperationResult result = LoginOperation.Create(LoginCriteria.Create("greg", "asdf")).Execute(); switch (result.LoginOperationStatus) { case (LoginOperationStatus.Success): break; default: Debug.LogError("Could not log in!"); return; } GetGroupsOperationResult getGroupsResult = GetGroupsOperation.Create(new GetGroupsOperationCriteria(result.AuthenticationToken)).Execute(); getGroupsResult.PrintResultSetData(); }