Ejemplo n.º 1
0
        private void OnLoginBtnClick()
        {
            if (m_IsShowPassworld)
            {
                Debug.LogEditorInfor("OnLoginBtnClick  >密码>" + m_InputFieldProPasswordInputField.text);
            }

            int playerNameCharCount     = System.Text.Encoding.Default.GetBytes(m_inputNameInputField.text).Length;
            int playerPasswordCharCount = System.Text.Encoding.Default.GetBytes(m_InputFieldProPasswordInputField.text).Length;

            if (playerNameCharCount < S_MinPlayerNameCharLimt || playerNameCharCount > S_MaxPlayerNameCharLimt)
            {
                Debug.LogError("用户名不合法");
                UIHelper.Instance.ShowTipsViewSync(string.Format(m_PlayerNameCharLimitStr, S_MinPlayerNameCharLimt, S_MaxPlayerNameCharLimt), 2);
                return;
            }
            if (playerPasswordCharCount < S_MinPlayerPasswordCharLimt || playerPasswordCharCount > S_MaxPlayerPasswordCharLimt)
            {
                Debug.LogError("用户密码不合法");
                UIHelper.Instance.ShowTipsViewSync(string.Format(m_PlayerPasswordCharLimitStr, S_MinPlayerPasswordCharLimt, S_MaxPlayerPasswordCharLimt), 2);
                return;
            }

            string inputPassworld = m_InputFieldProPasswordInputField.text;

            inputPassworld = inputPassworld.Trim();
            if (inputPassworld != m_RealPassworld)
            {
                if (m_LoginAccount == null)
                {
                    m_LoginAccount = new LocalAccountInfor(m_PreviousInputPlayerName, m_PreviousInputPlayerPassword);
                }

                Debug.Log("保存账户信息");
                LocalAccountMgr.Instance.UpdateLocalAccount(m_LoginAccount);
            } //更新本地账户列表



            if (UIViewReference.Instance.UiAssetUpdateView != null && UIViewReference.Instance.UiAssetUpdateView.IsActivate)
            {
                UIViewReference.Instance.UiAssetUpdateView.ClosePage(UIParameterArgs.Create(), UIParameterArgs.Create());
            }



            UIViewReference.Instance.UiCanvasMaskView.OpenWidget(UIManagerHelper.Instance.WidgetParentTrans, 0, true, UIParameterArgs.Create());

            AppSceneManager.Instance.LoadSceneAsync(SceneNameEnum.StartUp, LoadSceneModeEnum.KeepPrevious, (isComplete) =>
            {
                UIViewReference.Instance.UiCanvasMaskView.CloseWidget(false, UIParameterArgs.Create(false, true));
                if (isComplete)
                {
                    Debug.LogInfor("应用已经起来了..Go!!!");
                }
            }, () => { Debug.LogInfor("卸载其他场景完成"); }
                                                    );
        }
Ejemplo n.º 2
0
 private void ShowDefaultView()
 {
     m_LoginAccount = LocalAccountMgr.Instance.GetLastLoginInAccount();
     if (m_LoginAccount == null)
     {
         m_inputNameInputField.text             = "";
         m_InputFieldProPasswordInputField.text = "";
         m_btnLoginButton.interactable          = false;
     }
     else
     {
         m_inputNameInputField.text             = m_LoginAccount.AccountName;
         m_RealPassworld                        = LocalAccountMgr.Instance.GetAccountPassworld(m_LoginAccount.AccountPassworld);
         m_InputFieldProPasswordInputField.text = m_RealPassworld;
         m_btnLoginButton.interactable          = true;
     }
     ShowPassworld();
     OnCompleteShowWindow();
 }