public void UnLinkFacebookLinkTwitter() { // テストデータ作成 NCMBUser user = new NCMBUser(); user.AuthData = facebookParams.param; // authData登録 user.LogInWithAuthDataAsync((NCMBException e) => { Assert.Null(e); }); NCMBTestSettings.AwaitAsync(); // authData追加 user.LinkWithAuthDataAsync(twitterParams.param, (NCMBException e1) => { Assert.Null(e1); }); NCMBTestSettings.AwaitAsync(); Assert.True(user.IsLinkWith("twitter")); // authData削除 user.UnLinkWithAuthDataAsync("facebook", (NCMBException e2) => { Assert.Null(e2); NCMBTestSettings.CallbackFlag = true; }); NCMBTestSettings.AwaitAsync(); // 削除成功の確認 Assert.IsNotEmpty(NCMBUser._getCurrentSessionToken()); Assert.True(user.IsLinkWith("twitter")); Assert.False(user.IsLinkWith("facebook")); Assert.True(NCMBTestSettings.CallbackFlag); NCMBUser.LogOutAsync(); }
public void LogInWithAuthDataAsyncTwitter() { // テストデータ作成 NCMBUser user = new NCMBUser(); user.AuthData = twitterParams.param; // authData登録 user.LogInWithAuthDataAsync((NCMBException e) => { Assert.Null(e); NCMBTestSettings.CallbackFlag = true; }); NCMBTestSettings.AwaitAsync(); Assert.AreEqual("dummyObjectId", user.ObjectId); // twitterパラメータ確認 Dictionary <string, object> authData = user.GetAuthDataForProvider("twitter"); Assert.AreEqual("twitterDummyId", authData["id"]); Assert.AreEqual("twitterDummyScreenName", authData["screen_name"]); Assert.AreEqual("twitterDummyConsumerKey", authData["oauth_consumer_key"]); Assert.AreEqual("twitterDummyConsumerSecret", authData["consumer_secret"]); Assert.AreEqual("twitterDummyAuthToken", authData["oauth_token"]); Assert.AreEqual("twitterDummyAuthSecret", authData["oauth_token_secret"]); // 登録成功の確認 Assert.NotNull(NCMBUser._getCurrentSessionToken()); Assert.True(user.IsLinkWith("twitter")); Assert.True(NCMBTestSettings.CallbackFlag); NCMBUser.LogOutAsync(); }
// 初期化 public static void Initialize(string filePath = null) { if (GameObject.Find("NCMBManager") == null) { GameObject manager = new GameObject(); manager.name = "NCMBManager"; manager.AddComponent <NCMBManager> (); } if (GameObject.Find("NCMBSettings") == null) { GameObject settings = new GameObject(); settings.name = "NCMBSettings"; settings.AddComponent <NCMBSettings> (); } NCMBSettings.Initialize( APP_KEY, CLIENT_KEY, DOMAIN_URL, API_VERSION ); CallbackFlag = false; if (GameObject.Find("settings") == null) { GameObject o = new GameObject("settings"); System.Object obj = o.AddComponent <NCMBSettings> (); FieldInfo field = obj.GetType().GetField("filePath", BindingFlags.Static | BindingFlags.NonPublic); field.SetValue(obj, Application.persistentDataPath); } NCMBUser.LogOutAsync(); MockServer.startMock(filePath); }
public void Logout(EventHandler successEventHandler = null, EventHandler failureEventHandler = null) { //ネット接続があるか?// if (Application.internetReachability == NetworkReachability.NotReachable) { if (failureEventHandler != null) { failureEventHandler(this, EventArgs.Empty); } Debug.Log("ネットワークに接続していません。"); return; } NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { if (failureEventHandler != null) { failureEventHandler(this, EventArgs.Empty); } Debug.Log("ログアウトに失敗!"); } else { if (successEventHandler != null) { successEventHandler(this, EventArgs.Empty); } Debug.Log("ログアウトに成功!"); } }); }
public void LinkWithAuthDataAsyncInvalidTwitter() { // テストデータ作成 NCMBUser user = new NCMBUser(); user.AuthData = facebookParams.param; // authData登録 user.LogInWithAuthDataAsync((NCMBException e) => { Assert.Null(e); }); NCMBTestSettings.AwaitAsync(); // authData追加 user.LinkWithAuthDataAsync(invalidTwitterParams.param, (NCMBException e) => { Assert.AreEqual(NCMBException.OAUTH_ERROR, e.ErrorCode); NCMBTestSettings.CallbackFlag = true; }); NCMBTestSettings.AwaitAsync(); // 追加失敗の確認 Assert.IsNotEmpty(NCMBUser._getCurrentSessionToken()); Assert.True(user.IsLinkWith("facebook")); Assert.False(user.IsLinkWith("twitter")); Assert.True(NCMBTestSettings.CallbackFlag); NCMBUser.LogOutAsync(); }
// ログアウト public static void logOut() { NCMBUser.LogOutAsync((NCMBException e) => { // 接続成功したら if (e == null) { LogInNow = false; // saveLogInNow(); userName = "******"; successConnect = true; Debug.Log("ログアウトしたよ"); PlayerInformation.resetInformation(); PhotonNetwork.playerName = userName; Debug.Log(PhotonNetwork.player.NickName); //playerの名前を確認 SceneManager.LoadScene("Title"); return; } else { successConnect = false; Debug.Log(e.ErrorCode + ":" + e.Message); return; } }); }
public IEnumerator LoginLogoutAddUser() { // テストデータ作成 NCMBUser.LogInAsync("tarou", "tarou", (e1) => { Assert.Null(e1); NCMBTestSettings.CallbackFlag = true; NCMBUser.LogOutAsync(); NCMBUser.LogInAsync("tarou", "tarou", (e2) => { Assert.Null(e2); NCMBUser user = new NCMBUser(); user.UserName = "******"; user.Password = "******"; user.SignUpAsync((NCMBException e3) => { Assert.Null(e3); NCMBTestSettings.CallbackFlag = true; }); }); }); yield return(NCMBTestSettings.AwaitAsync()); Assert.True(NCMBTestSettings.CallbackFlag); Assert.AreEqual("dummySessionToken", NCMBUser._getCurrentSessionToken()); Assert.AreEqual("tarou", NCMBUser.CurrentUser.UserName); }
/// <summary> /// 非同期処理でユーザのログアウトを行います。<br/> /// </summary> public static IObservable <Unit> LogOutAsync() { return(Observable.Create <Unit>(observer => { var gate = new object(); var isDisposed = false; NCMBUser.LogOutAsync(error => { lock (gate) { if (isDisposed) { return; } if (error == null) { observer.OnNext(Unit.Default); observer.OnCompleted(); } else { observer.OnError(error); } } }); return Disposable.Create(() => { lock (gate) { isDisposed = true; } }); })); }
public IEnumerator LogOutCoroutine(Action <CommunicationResult> communicationCallback) { bool isConnecting = true; CommunicationResult cr = new CommunicationResult(); NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { cr.ErroMessage = e.ErrorMessage; cr.ErrorCode = e.ErrorCode; cr.IsSuccess = false; } else { cr.IsSuccess = true; } isConnecting = false; }); while (isConnecting) { yield return(null); } communicationCallback(cr); }
public IEnumerator LoginLogoutDeleteUser() { // テストデータ作成 NCMBUser.LogInAsync("tarou", "tarou", (e1) => { Assert.Null(e1); NCMBTestSettings.CallbackFlag = true; NCMBUser.LogOutAsync(); NCMBUser.LogInAsync("tarou", "tarou", (e2) => { Assert.Null(e2); NCMBUser user = new NCMBUser(); user.ObjectId = "anotherObjectId"; user.DeleteAsync((NCMBException e3) => { Assert.Null(e3); NCMBTestSettings.CallbackFlag = true; }); }); }); yield return(NCMBTestSettings.AwaitAsync()); Assert.True(NCMBTestSettings.CallbackFlag); Assert.AreEqual("dummySessionToken", NCMBUser._getCurrentSessionToken()); Assert.AreEqual("tarou", NCMBUser.CurrentUser.UserName); }
public void UnLinkWithAuthDataAsyncTwitter() { // テストデータ作成 NCMBUser user = new NCMBUser(); user.AuthData = twitterParams.param; // authData登録 user.LogInWithAuthDataAsync((NCMBException e) => { Assert.Null(e); }); NCMBTestSettings.AwaitAsync(); Assert.True(user.IsLinkWith("twitter")); // authData削除 user.UnLinkWithAuthDataAsync("twitter", (NCMBException e1) => { Assert.Null(e1); NCMBTestSettings.CallbackFlag = true; }); NCMBTestSettings.AwaitAsync(); // 削除成功の確認 Assert.False(user.IsLinkWith("twitter")); Assert.True(NCMBTestSettings.CallbackFlag); NCMBUser.LogOutAsync(); }
public void LogInWithAuthDataAsyncFacebook() { // テストデータ作成 NCMBUser user = new NCMBUser(); user.AuthData = facebookParams.param; // authData登録 user.LogInWithAuthDataAsync((NCMBException e) => { Assert.Null(e); NCMBTestSettings.CallbackFlag = true; }); NCMBTestSettings.AwaitAsync(); Assert.AreEqual("dummyObjectId", user.ObjectId); // facebookパラメータ確認 Dictionary <string, object> authData = user.GetAuthDataForProvider("facebook"); Assert.AreEqual("facebookDummyId", authData["id"]); Assert.AreEqual("facebookDummyAccessToken", authData["access_token"]); Assert.AreEqual("2017-02-07T01:02:03.004Z", authData["expiration_date"]); // 登録成功の確認 Assert.IsNotEmpty(NCMBUser._getCurrentSessionToken()); Assert.True(user.IsLinkWith("facebook")); Assert.True(NCMBTestSettings.CallbackFlag); NCMBUser.LogOutAsync(); }
public void LogOut() { if (isLogedIn) { NCMBUser.LogOutAsync(); isLogedIn = false; SetActive(); } }
// mobile backendに接続してログアウト ------------------------ public void logOut() { NCMBUser.LogOutAsync((NCMBException e) => { if (e == null) { currentPlayerName = null; } }); }
public void logout() { try { NCMBUser.LogOutAsync(); } catch (NCMBException e) { UnityEngine.Debug.Log("エラー: " + e.ErrorMessage); } LoadingScene.LoadNextScene("SignScenes"); }
public void OnQuitGame() { NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { Application.Quit(); } else { Application.Quit(); } }); }
public void Logout_user() { NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { UnityEngine.Debug.Log("ログアウトに失敗: " + e.ErrorMessage); } else { UnityEngine.Debug.Log("ログアウトに成功"); Application.LoadLevel("Loginsignin"); } }); }
public void OnClickStartButton() { NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { UnityEngine.Debug.Log("ログアウトに失敗: " + e.ErrorMessage); } else { UnityEngine.Debug.Log("ログアウトに成功"); SceneManager.LoadScene("start"); } }); }
/// <summary> /// ログアウトする /// </summary> /// <param name="callback">コールバック関数</param> public void LogOut(ErrorCallBack callback) { if (!GetIsLogIn) { callback(new NCMBException(NCMBUTErrorMessage.NOT_LOGIN_ERROR)); return; } NCMBUser.LogOutAsync((NCMBException error) => { callback(error); return; }); }
// Start is called before the first frame update void Start() { NCMBUser.LogOutAsync(); player.OnTouchGravity += GameOverGravity; player.OnFallStage += GameOverFall; playerRigidbody = SystemManager.player.gameObject.GetComponent <Rigidbody>(); SystemManager.gravity.SetGravityPower(levelManager.GetGravityPower(currentLevel)); itemManager.SetItemSpawnSpan(levelManager.GetItemSpan(currentLevel)); itemManager.SetJammerSpawnSpan(levelManager.GetjammerSpan(currentLevel)); user_auth.logIn(); startMenuCanvas.CreateRankingBoard(); }
/// <summary> /// mobile backendに接続してログアウト /// </summary> public void LogOut() { NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { Debug.LogError("ログアウトに失敗 : " + e.ErrorMessage); } else { Debug.Log(currentPlayerName + " ログアウトします。"); currentPlayerName = null; } }); }
/// <summary> /// ログアウトする /// </summary> public void Logout() { NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { Debug.LogError("Failed to logout: " + e.ErrorMessage); } else { Debug.Log("Logout successfully."); InitUserInfo(null); } }); }
// 初期化 public static void Initialize() { NCMBSettings.Initialize( APP_KEY, CLIENT_KEY ); CallbackFlag = false; GameObject o = new GameObject("settings"); System.Object obj = o.AddComponent <NCMBSettings> (); FieldInfo field = obj.GetType().GetField("filePath", BindingFlags.Static | BindingFlags.NonPublic); field.SetValue(obj, Application.persistentDataPath); NCMBUser.LogOutAsync(); }
public void Logout_user() { NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { UnityEngine.Debug.Log("ログアウトに失敗: " + e.ErrorMessage); } else { UnityEngine.Debug.Log("ログアウトに成功"); #if UNITY_2019_3_OR_NEWER SceneManager.LoadScene("Loginsignin"); #else Application.LoadLevel("Loginsignin"); #endif } }); }
public IEnumerator UpdateUserNotLoginYet() { NCMBUser.LogOutAsync((NCMBException e) => { Assert.Null(e); Assert.Null(NCMBUser.CurrentUser); NCMBUser user = new NCMBUser(); user.ObjectId = "anotherObjectId"; user.UserName = "******"; user.SaveAsync((NCMBException e1) => { Assert.Null(e1); NCMBTestSettings.CallbackFlag = true; }); }); yield return(NCMBTestSettings.AwaitAsync()); Assert.True(NCMBTestSettings.CallbackFlag); Assert.Null(NCMBUser.CurrentUser); }
public IEnumerator LogoutAsyncError() { NCMBTestSettings.CallbackFlag = false; // テストデータ作成 NCMBUser.LogInAsync("tarou", "tarou", (e) => { Assert.Null(e); NCMBTestSettings.CallbackFlag = true; }); yield return(NCMBTestSettings.AwaitAsync()); NCMBTestSettings.CallbackFlag = false; NCMBUser.LogOutAsync((e) => { Assert.NotNull(e); NCMBTestSettings.CallbackFlag = true; }); yield return(NCMBTestSettings.AwaitAsync()); Assert.True(NCMBTestSettings.CallbackFlag); }
// ログアウト public void OnClick_Logout() { NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { Debug.LogWarning("ログアウトに失敗: " + e.ErrorMessage); } else { Debug.Log("ログアウトに成功"); SceneManager.LoadScene(Define.GAME_LOGIN); } }); // ランキング用オブジェクト破棄(ユーザー情報破棄) var RankingObj = GameObject.FindGameObjectWithTag("QuickRanking"); if (RankingObj != null) { Destroy(RankingObj); } }
public void SignUpAsyncTest() { // テストデータ作成 NCMBUser user = new NCMBUser(); user.UserName = "******"; user.Password = "******"; user.Email = "*****@*****.**"; // 会員登録 user.SignUpAsync((NCMBException e) => { Assert.Null(e); NCMBTestSettings.CallbackFlag = true; }); NCMBTestSettings.AwaitAsync(); Assert.AreEqual("dummyObjectId", user.ObjectId); // 登録成功の確認 Assert.IsNotEmpty(NCMBUser._getCurrentSessionToken()); Assert.True(NCMBTestSettings.CallbackFlag); NCMBUser.LogOutAsync(); }
// ログアウト public void OnClick_Logout() { // 部屋作成済みの場合退出 OnClick_RoomOut(); NCMBUser.LogOutAsync((NCMBException e) => { if (e != null) { Debug.LogWarning("ログアウトに失敗: " + e.ErrorMessage); } else { Debug.Log("ログアウトに成功"); SceneManager.LoadScene(Define.GAME_LOGIN); } }); // ユーザー情報破棄 if (GameObject.Find("QuickRanking") != null) { Destroy(GameObject.Find("QuickRanking")); } }