1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using UI.Login;
- using FairyGUI;
- using UnityEngine;
- namespace GFGGame
- {
- public class LoginInputView : BaseWindow
- {
- private UI_LoginInputUI _ui;
- public override void Dispose()
- {
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- _ui = UI_LoginInputUI.Create();
- this.viewCom = _ui.target;
- this.viewCom.Center();
- this.modal = true;
- _ui.m_btnSure.onClick.Add(OnClickBtnSure);
- _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
- _ui.m_btnRegister.onClick.Add(OnClickBtnRegister);
- }
- protected override void OnShown()
- {
- base.OnShown();
- string account = PlayerPrefs.GetString(GameConst.ACCOUNT_LAST_LOGIN_KEY);
- if (account != null)
- {
- _ui.m_inputAccount.text = account;
- }
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- private void OnClickBtnSure()
- {
- var account = _ui.m_inputAccount.text;
- var password = _ui.m_inputPassword.text;
- if (string.IsNullOrEmpty(account))
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入账号");
- return;
- }
- if (!string.IsNullOrEmpty(password))
- {
- LoginController.Login(account, password).Coroutine();
- }
- else if(LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL)
- {
- LoginController.LoginTest(account).Coroutine();
- }
- else
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入密码");
- }
- }
- private void OnClickBtnCancel()
- {
- this.Hide();
- }
- //private void OnClickBtnTourist()
- //{
- // if (GameGlobal.isOfflineVisitor)
- // {
- // LoginProxy.LoginAsVisitor();
- // }
- // else
- // {
- // Alert.Show("游客账号无法保证您的账号安全,且受到充值和时长限制,无法体验全部游戏内容。强烈建议您注册账号登录游戏。")
- // .SetLeftButton(true, "进入游戏", (object data) =>
- // {
- // LoginProxy.LoginAsVisitor();
- // })
- // .SetRightButton(true, "前往注册", (object data) =>
- // {
- // ViewManager.Show<RegisterView>();
- // })
- // .SetClickBlankToClose(true);
- // }
- //}
- private void OnClickBtnRegister()
- {
- ViewManager.Show<RegisterView>();
- }
- }
- }
|