AccountService
How do I use Account Service
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: AccountService.cs
Copy
27 private Action
File name: AccountService.cs
Copy
42 public AccountService()
43 {
44 WebRequest.DefaultWebProxy = null;
45 ServicePointManager.ServerCertificateValidationCallback = Validator;
46 }
File name: AccountService.cs
Copy
93 public void RegisterByEmailAsync(string email, Origin origin, Action94 {
95 this.registrationCallback = callback;
96 this.AppId = string.Empty;
97 this.Message = string.Empty;
98 this.ReturnCode = -1;
99
100 try
101 {
102 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(this.RegistrationUri(email, (byte)origin));
103 req.Timeout = 5000;
104 req.BeginGetResponse(this.OnRegisterByEmailCompleted, req);
105 }
106 catch (Exception ex)
107 {
108 this.Message = "Failed to connect to Cloud Account Service. Please register via account website.";
109 this.Exception = ex;
110 if (this.registrationCallback != null)
111 {
112 this.registrationCallback(this);
113 }
114 }
115 }
File name: PhotonEditor.cs
Copy
792 protected virtual void RegisterWithEmail(string email)
793 {
794 EditorUtility.DisplayProgressBar(CurrentLang.ConnectionTitle, CurrentLang.ConnectionInfo, 0.5f);
795 var client = new AccountService();
796 client.RegisterByEmail(email, RegisterOrigin); // this is the synchronous variant using the static RegisterOrigin. "result" is in the client
797
798 EditorUtility.ClearProgressBar();
799 if (client.ReturnCode == 0)
800 {
801 PhotonEditor.Current.UseCloud(client.AppId, 0);
802 PhotonEditor.Save();
803 this.ReApplySettingsToWindow();
804 this.photonSetupState = PhotonSetupStates.SetupPhotonCloud;
805 }
806 else
807 {
808 if (client.Message.Contains(CurrentLang.EmailInUseLabel))
809 {
810 this.photonSetupState = PhotonSetupStates.EmailAlreadyRegistered;
811 }
812 else
813 {
814 EditorUtility.DisplayDialog(CurrentLang.ErrorTextTitle, client.Message, CurrentLang.OkButton);
815 // Debug.Log(client.Exception);
816 this.photonSetupState = PhotonSetupStates.RegisterForPhotonCloud;
817 }
818 }
819 }
Download file with original file name:AccountService
AccountService 105 lượt xem
Gõ tìm kiếm nhanh...