public void Login(LoginCallback callback = null) { NotificationManager.Instance.ShowNotification(NotificationType.Load, "Authenticating"); loginAPI.Authenticate(delegate(bool result, string id) { if (result) { NotificationManager.Instance.HideNotification(); NotificationManager.Instance.ShowNotification(NotificationType.Load, "Logging in"); // API authentication success, get user's name, email, then login to db loginAPI.GetName(delegate(bool nameResult, string name) { if (nameResult) { loginAPI.GetEmail(delegate(bool emailResult, string email) { if (emailResult) { NotificationManager.Instance.HideNotification(); //database login to load /*DBLogin(id, name, email, delegate (Dictionary<string, object> accountResult) * { * if (accountResult.TryGetValue("accountinfo", out object accountinfo)) * { * string accountinfostr = Json.Serialize(accountinfo); * Dictionary<string, object> accountinfodic = Json.Deserialize(accountinfostr) as Dictionary<string, object>; *//* foreach (KeyValuePair<string, object> entry in accountinfodic) * { * Debug.Log(entry.Key + ", " + entry.Value); // data from db * }*//* * * UserId = id; * UserName = name; * UserEmail = email; * UserLoggedIn = true; * callback?.Invoke(UserId, UserName, UserEmail); * } * else * { * NotificationManager.Instance.ShowNotification(NotificationType.Notice, "Error: accountinfo not found.", true); * } * });*/ } else { NotificationManager.Instance.HideNotification(); NotificationManager.Instance.ShowNotification(NotificationType.Notice, "Failed to get email.", true); } }); } else { NotificationManager.Instance.HideNotification(); NotificationManager.Instance.ShowNotification(NotificationType.Notice, "Failed to get name.", true); } }); } else { NotificationManager.Instance.HideNotification(); NotificationManager.Instance.ShowNotification(NotificationType.Notice, "Authentication failed.", true); } }); }