internal static void UpdateDisplayName(string displayName, PlayerIdentityCallback callback = null)
        {
            if (!MainController.Instance.SensitiveWordManager.CheckTextSart(displayName))
            {
                var mainController = MainController.Instance;
                var identityCore   = PlayerIdentityManager.Current;

                mainController.ShowLoading(true);
                identityCore.UpdateUser(new UserInfo
                {
                    userId = identityCore.userInfo.userId,
                    email  = identityCore.userInfo.email,
                    // only update the display name here
                    displayName      = displayName,
                    emailVerified    = identityCore.userInfo.emailVerified,
                    signInProviderId = identityCore.userInfo.signInProviderId,
                    externalId       = identityCore.userInfo.signInProviderId,
                    isAnonymous      = identityCore.userInfo.isAnonymous,
                    photoUrl         = identityCore.userInfo.photoUrl,
                    disabled         = identityCore.userInfo.disabled,
                    externalIds      = identityCore.userInfo.externalIds
                }, result =>
                {
                    mainController.ShowLoading(false);
                    callback?.Invoke(result);
                });
            }
            else
            {
                MainController.Instance.PopupController.ShowError(new Error()
                {
                    message = "用户名格式错误"
                });
            }
        }
Пример #2
0
        private void ScheduleCallback(Callback callback, PlayerIdentityCallback immediateCallback)
        {
            if (callback != null)
            {
                m_EventBacklog.Enqueue(callback);
            }

            if (immediateCallback != null)
            {
                m_EventBacklog.Enqueue(() =>
                {
                    immediateCallback.Invoke(this);
                });
            }
        }