| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 | 
							- using UnityEngine;
 
- using FairyGUI;
 
- using UI.Login;
 
- using ET;
 
- namespace GFGGame
 
- {
 
-     public class LoginView : BaseView
 
-     {
 
-         private UI_LoginUI _ui;
 
-         private GameObject _scenePrefab;
 
-         private GameObject _sceneObject;
 
-         public override void Dispose()
 
-         {
 
-             _ui = null;
 
-             if (_scenePrefab != null)
 
-             {
 
-                 GameObject.Destroy(_scenePrefab);
 
-                 _scenePrefab = 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("SceneMain"));
 
-         }
 
-         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_imgLogo.visible = LauncherConfig.netType != LauncherConfig.EnumNetType.TEMP;
 
-             EventAgent.AddEventListener(ConstMessage.SERVER_CHANGE, OnSeverChangeListener);
 
-             _ui.m_btnChange.onClick.Add(OnBtnChangeClick);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
 
-             if (_sceneObject == null)
 
-             {
 
-                 _sceneObject = GameObject.Instantiate(_scenePrefab);
 
-             }
 
-             SceneController.UpdateLoginScene(_sceneObject);
 
-             _ui.m_btnLogout.visible = GameController.CheckLoginCache(false);
 
-             if (!_ui.m_btnLogout.visible)
 
-             {
 
-                 ViewManager.Show<LoginInputView>();
 
-             }
 
-             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
 
-             ServerInfo recentlyServerInfo = serverInfosComponent.recentlyServerInfo;
 
-             UpdateServer(recentlyServerInfo);
 
-             //尝试自动登录
 
-             if (serverInfosComponent.ServerInfoList.Count <= 0)
 
-             {
 
-                 OnClickBtnStart();
 
-             }
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             if (_sceneObject != null)
 
-             {
 
-                 GameObject.Destroy(_sceneObject);
 
-                 _sceneObject = null;
 
-             }
 
-             base.OnHide();
 
-         }
 
-         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);
 
-         }
 
-         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()
 
-         {
 
-             ViewManager.Show<SystemNoticeView>();
 
-         }
 
-         private async void OnClickBtnStart()
 
-         {
 
-             var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
 
-             if (serverInfosComponent.ServerInfoList.Count <= 0)
 
-             {
 
-                 if (!GameController.CheckLoginCache(true))
 
-                 {
 
-                     ViewManager.Show<LoginInputView>();
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 await LoginController.GetRoles();
 
-             }
 
-         }
 
-         private void OnClickBtnLogout()
 
-         {
 
-             _ui.m_btnLogout.visible = false;
 
-             GameController.Logout();
 
-             ViewManager.Show<LoginInputView>();
 
-         }
 
-     }
 
- }
 
 
  |