| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 | 
							- using UnityEngine;
 
- using FairyGUI;
 
- using UI.Login;
 
- using ET;
 
- using TapTap.Bootstrap;
 
- using System;
 
- using TapTap.Common;
 
- using System.Threading.Tasks;
 
- namespace GFGGame
 
- {
 
-     public class LoginView : BaseView
 
-     {
 
-         private UI_LoginUI _ui;
 
-         private GameObject _scenePrefab;
 
-         private GameObject _sceneObject;
 
-         public override void Dispose()
 
-         {
 
-             if (_sceneObject != null)
 
-             {
 
-                 GameObject.DestroyImmediate(_sceneObject);
 
-                 _sceneObject = null;
 
-             }
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void Init()
 
-         {
 
-             base.Init();
 
-             packageName = UI_LoginUI.PACKAGE_NAME;
 
-             _ui = UI_LoginUI.Create();
 
-             viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneLogin"));
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             _ui.m_txtVersion.text = GameGlobal.version;
 
-             _ui.m_btnNotice.onClick.Add(OnClickBtnNotice);
 
-             _ui.m_btnStart.onClick.Add(OnClickBtnStart);
 
-             _ui.m_btnLogout.onClick.Add(OnClickBtnLogout);
 
-             _ui.m_btnAge.onClick.Add(OnClickBtnAge);
 
-             _ui.m_btnTapLogin.onClick.Add(OnClickBtnStart);
 
-             _ui.m_imgLogo.visible = LauncherConfig.netType != LauncherConfig.EnumNetType.TEMP;
 
-             _ui.m_btnChange.onClick.Add(OnBtnChangeClick);
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.SERVER_CHANGE, OnSeverChangeListener);
 
-             EventAgent.AddEventListener(ConstMessage.LOGIN_SUCCESS, OnLoginSuccess);
 
-             EventAgent.AddEventListener(ConstMessage.ON_PLATFORM_SDK_INITED, OnPlatformInitet);
 
-             EventAgent.AddEventListener(ConstMessage.ON_PLATFORM_SDK_LOGINED, OnPlatformLogined);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
 
-             if (_sceneObject == null)
 
-             {
 
-                 _sceneObject = GameObject.Instantiate(_scenePrefab);
 
-             }
 
-             SceneController.UpdateLoginScene(_sceneObject);
 
-             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
 
-             ServerInfo recentlyServerInfo = serverInfosComponent.recentlyServerInfo;
 
-             UpdateServer(recentlyServerInfo);
 
-             _ui.m_btnStart.visible = false;
 
-             _ui.m_btnTapLogin.visible = false;
 
-             _ui.m_btnLogout.visible = false;
 
-             if(QDManager.isInited)
 
-             {
 
-                 EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_INITED, true);
 
-             }
 
-             else
 
-             {
 
-                 //初始化平台配置
 
-                 QDManager.InitPlatform();
 
-             }
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             if (_sceneObject != null)
 
-             {
 
-                 GameObject.Destroy(_sceneObject);
 
-                 _sceneObject = null;
 
-             }
 
-             base.OnHide();
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.SERVER_CHANGE, OnSeverChangeListener);
 
-             EventAgent.RemoveEventListener(ConstMessage.LOGIN_SUCCESS, OnLoginSuccess);
 
-             EventAgent.RemoveEventListener(ConstMessage.ON_PLATFORM_SDK_INITED, OnPlatformInitet);
 
-             EventAgent.RemoveEventListener(ConstMessage.ON_PLATFORM_SDK_LOGINED, OnPlatformLogined);
 
-         }
 
-         private void UpdateServer(ServerInfo info)
 
-         {
 
-             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
 
-             if (serverInfosComponent.ServerInfoList.Count == 0)
 
-             {
 
-                 _ui.m_btnChange.visible = false;
 
-                 return;
 
-             }
 
-             _ui.m_btnChange.visible = serverInfosComponent.ServerInfoList.Count > 1;
 
-             _ui.m_btnChange.title = string.Format("{0}区  {1}", NumberUtil.GetChiniseNumberText((int)info.Id), info.ServerName);
 
-             LogServerHelperHttp.SendNodeLog((int)LogNode.ShowSelectServer);
 
-         }
 
-         private void OnPlatformInitet(EventContext context)
 
-         {
 
-             ViewManager.Hide<ModalStatusView>();
 
-             var success = (bool)context.data;
 
-             Debug.Log($"InitPlatform success {success}");
 
-             if (success)
 
-             {
 
-                 QDManager.isInited = true;
 
-                 _ui.m_btnTapLogin.visible = QDManager.IsTaptap;
 
-                 _ui.m_btnStart.visible = !QDManager.IsTaptap;
 
-                 //尝试自动登录
 
-                 OnClickBtnStart();
 
-             }
 
-             else
 
-             {
 
-                 AlertSystem.Show("初始化平台sdk失败!")
 
-                 .SetRightButton(true, "重试", (t) => { QDManager.InitPlatform(); });
 
-             }
 
-             
 
-         }
 
-         private void OnPlatformLogined(EventContext context)
 
-         {
 
-             var account = (string)context.data;
 
-             if(!string.IsNullOrEmpty(account))
 
-             {
 
-                 _ui.m_btnTapLogin.visible = false;
 
-                 if(QDManager.IsHYKB)
 
-                 {
 
-                     //好游快爆因为SDK的防沉迷会使游戏失去焦点,需要检测焦点
 
-                     Timers.inst.AddUpdate(CheckHykbLoginServer);
 
-                 }
 
-                 else
 
-                 {
 
-                     LoginController.LoginTest(account).Coroutine();
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 ViewManager.Hide<ModalStatusView>();
 
-                 //尝试自动登录
 
-                 OnClickBtnStart();
 
-             }
 
-         }
 
-         private void CheckHykbLoginServer(object p)
 
-         {
 
-             if(Application.isFocused)
 
-             {
 
-                 LoginController.LoginTest(QDHYKBManager.Instance.UserId).Coroutine();
 
-                 Timers.inst.Remove(CheckHykbLoginServer);
 
-             }
 
-         }
 
-         private void OnLoginSuccess(EventContext context)
 
-         {
 
-             _ui.m_btnLogout.visible = true;
 
-             _ui.m_btnStart.visible = true;
 
-         }
 
-         private void OnSeverChangeListener(EventContext context)
 
-         {
 
-             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
 
-             UpdateServer(serverInfosComponent.ServerInfoList[serverInfosComponent.CurrentServerId]);
 
-         }
 
-         private void OnBtnChangeClick()
 
-         {
 
-             ViewManager.Show<ServerListView>();
 
-         }
 
-         private void OnClickBtnNotice()
 
-         {
 
-             if (NoticeDataManager.Instance.LastNoticeInfo == null || NoticeDataManager.Instance.LastNoticeInfo.noticeId == 0)
 
-             {
 
-                 PromptController.Instance.ShowFloatTextPrompt("暂无公告发布");
 
-                 return;
 
-             }
 
-             ViewManager.Show<SystemNoticeView>(new object[] { NoticeDataManager.Instance.LastNoticeInfo.title, NoticeDataManager.Instance.LastNoticeInfo.content });
 
-         }
 
-         private void OnClickBtnStart()
 
-         {
 
-             var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
 
-             if (serverInfosComponent.ServerInfoList.Count <= 0)
 
-             {
 
-                 if (QDManager.IsTaptap)
 
-                 {
 
-                     QDTapTapManager.Instance.Login();
 
-                 }
 
-                 else if (QDManager.IsHYKB)
 
-                 {
 
-                     QDHYKBManager.Instance.Login();
 
-                 }
 
-                 else if(QDManager.IsBiliBili)
 
-                 {
 
-                     QDBiliBiliManager.Instance.Login();
 
-                 }
 
-                 else
 
-                 {
 
-                     bool login = GameController.CheckLoginCache(true);
 
-                     if (!login)
 
-                     {
 
-                         ViewManager.Show<LoginInputView>();
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 LoginController.GetRoles().Coroutine();
 
-             }
 
-         }
 
-         private void OnClickBtnLogout()
 
-         {
 
-             GameController.QuitToLoginView(true);
 
-         }
 
-         private void OnClickBtnAge()
 
-         {
 
-             ViewManager.Show<SystemNoticeView>(new object[] { LoginController.ageTipsTitle, LoginController.ageTips });
 
-         }
 
-     }
 
- }
 
 
  |