| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 | 
							- using UI.Login;
 
- using FairyGUI;
 
- using UnityEngine;
 
- using System.ComponentModel;
 
- using System;
 
- using System.Collections.Generic;
 
- namespace GFGGame
 
- {
 
-     public class LoginInputView : BaseWindow
 
-     {
 
-         private UI_LoginInputUI _ui;
 
-         private List<AccountPasswordModel> _accountPasswordList;
 
-         public override void Dispose()
 
-         {
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_LoginInputUI.PACKAGE_NAME;
 
-             _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);
 
-             _ui.m_btnSkipAccount.onClick.Add(OnClickBtnOpenZhAccount);
 
-             _ui.m_btnSkipPasword.onClick.Add(OnClickBtnOpenZhUpPassword);
 
-             _ui.m_comAccount.m_selBtin.onClick.Add(OnClickOpenAccountListBtn);
 
-             _ui.m_comAccount.m_txtAccount.restrict = "[0-9A-Za-z_]";
 
-             _ui.m_comAccount.m_list.itemRenderer = RenderListItem;
 
-             if (LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL)
 
-             {
 
-                 _ui.m_inputPassword.promptText = "[color=#B8A492]当前支持免密登录[/color]";
 
-             }
 
-             InitChanelBox();
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             _accountPasswordList = AccountManager.Instance.GetAccounts();
 
-             string account = null;
 
-             string password = null;
 
-             if (_accountPasswordList != null && _accountPasswordList.Count > 0)
 
-             {
 
-                 account = _accountPasswordList[0].Account;
 
-                 password = _accountPasswordList[0].Password;
 
-             }
 
-             if (account != null)
 
-             {
 
-                 _ui.m_comAccount.m_txtAccount.text = account;
 
-             }
 
-             if (password != null)
 
-             {
 
-                 _ui.m_inputPassword.text = password;
 
-             }
 
-             UpdateChannelBox(false);
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.LOGIN_FAIL, OnLoginFail);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.LOGIN_FAIL, OnLoginFail);
 
-         }
 
-         private void OnClickBtnOpenZhAccount()
 
-         {
 
-             ViewManager.Show<ZhaoHuiAccountView>();
 
-         }
 
-         private void OnClickBtnOpenZhUpPassword(EventContext context)
 
-         {
 
-             string account = context.data as string;
 
-             ViewManager.Show<ZhaoHuiPasswordView>(account);
 
-         }
 
-         private void OnClickBtnSure()
 
-         {
 
-             var account = _ui.m_comAccount.m_txtAccount.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.Login(account, password).Coroutine();
 
-             }
 
-             else
 
-             {
 
-                 PromptController.Instance.ShowFloatTextPrompt("请输入密码");
 
-             }
 
-         }
 
-         private void OnClickBtnCancel()
 
-         {
 
-             this.Hide();
 
-         }
 
-         private void OnClickBtnRegister()
 
-         {
 
-             ViewManager.Show<RegisterView>();
 
-         }
 
-         private void OnClickOpenAccountListBtn()
 
-         {
 
-             if (_accountPasswordList.Count == 0)
 
-             {
 
-                 _ui.m_comAccount.m_list.selectedIndex = 0;
 
-                 return;
 
-             }
 
-             if (_ui.m_comAccount.m_c1.selectedIndex == 0)
 
-             {
 
-                 //显示账号缓存列表
 
-                 OnShowAccountList();
 
-             }
 
-             else
 
-             {
 
-                 //隐藏账号缓存列表
 
-                 OnHideAccountList();
 
-             }
 
-         }
 
-         //显示账号缓存列表
 
-         private void OnShowAccountList()
 
-         {
 
-             _accountPasswordList = AccountManager.Instance.GetAccounts();
 
-             _ui.m_comAccount.m_list.numItems = _accountPasswordList.Count;
 
-             _ui.m_comAccount.m_c1.selectedIndex = 1;
 
-         }
 
-         //隐藏账号缓存列表
 
-         private void OnHideAccountList()
 
-         {
 
-             _ui.m_comAccount.m_c1.selectedIndex = 0;
 
-         }
 
-         //绑定数据到账号缓存列表
 
-         private void RenderListItem(int index, GObject obj)
 
-         {
 
-             AccountPasswordModel accountPassword = _accountPasswordList[index];
 
-             UI_ButAccountItem item = UI_ButAccountItem.Proxy(obj);
 
-             item.m_txtAccountItem.text = accountPassword.Account;
 
-             item.target.data = accountPassword;
 
-             item.target.onClick.Add(OnClickSelAccount);
 
-             item.m_btnDel.data = accountPassword.Account;
 
-             item.m_btnDel.onClick.Add(OnClickDelAccountCache);
 
-             UI_ButAccountItem.ProxyEnd();
 
-         }
 
-         //从账号缓存列表中选择账号
 
-         private void OnClickSelAccount(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             AccountPasswordModel accountPassword = obj.data as AccountPasswordModel;
 
-             _ui.m_comAccount.m_txtAccount.text = accountPassword?.Account;
 
-             _ui.m_inputPassword.text = accountPassword?.Password;
 
-             OnHideAccountList();
 
-         }
 
-         //删除账号缓存列表
 
-         private void OnClickDelAccountCache(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             string account = obj.data.ToString();
 
-             AccountManager.Instance.DeleteAccount(account);
 
-             _accountPasswordList = AccountManager.Instance.GetAccounts();
 
-             _ui.m_comAccount.m_list.numItems = _accountPasswordList.Count;
 
-             if (_accountPasswordList.Count == 0)
 
-             {
 
-                 _ui.m_comAccount.m_list.selectedIndex = 0;
 
-             }
 
-             if (_accountPasswordList.Count == 0)
 
-             {
 
-                 _ui.m_comAccount.m_txtAccount.text = null;
 
-                 _ui.m_inputPassword.text = null;
 
-             }
 
-             else
 
-             {
 
-                 _ui.m_comAccount.m_txtAccount.text = _accountPasswordList[0].Account;
 
-                 _ui.m_inputPassword.text = _accountPasswordList[0].Password;
 
-             }
 
-         }
 
-         private void OnLoginFail(EventContext context)
 
-         {
 
-             string account = (string)context.data;
 
-             _ui.m_comAccount.m_txtAccount.text = account;
 
-         }
 
-         private void InitChanelBox()
 
-         {
 
- #if !UNITY_EDITOR
 
-             _ui.m_boxChooseCanal.visible = false;
 
-             return;
 
- #endif
 
-             _ui.m_boxChooseCanal.visible = LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL;
 
-             if (!_ui.m_boxChooseCanal.visible) return;
 
-             var enumType = typeof(ChannelID);
 
-             var arr = Enum.GetValues(enumType);
 
-             List<string> items = new List<string>();
 
-             List<string> numbers = new List<string>();
 
-             foreach (var value in arr)
 
-             {
 
-                 var fieldInfo = enumType.GetField((value).ToString());
 
-                 if (fieldInfo != null && Attribute.IsDefined(fieldInfo, typeof(DescriptionAttribute)))
 
-                 {
 
-                     DescriptionAttribute attribute =
 
-                         (DescriptionAttribute)Attribute.GetCustomAttribute(fieldInfo, typeof(DescriptionAttribute));
 
-                     items.Add(attribute.Description);
 
-                     numbers.Add(Convert.ToInt32(value).ToString());
 
-                 }
 
-             }
 
-             _ui.m_boxChooseCanal.items = items.ToArray();
 
-             _ui.m_boxChooseCanal.values = numbers.ToArray();
 
-             _ui.m_boxChooseCanal.value = LauncherConfig.ChannelId + "";
 
-             _ui.m_boxChooseCanal.onChanged.Add(onBoxChannelChanged);
 
-         }
 
-         private void onBoxChannelChanged()
 
-         {
 
-             UpdateChannelBox(true);
 
-         }
 
-         private void UpdateChannelBox(bool showAlert = true)
 
-         {
 
-             if (!_ui.m_boxChooseCanal.visible) return;
 
-             LauncherConfig.ChannelId = int.Parse(_ui.m_boxChooseCanal.value);
 
-             ET.Log.Debug("打印测试======选择的渠道==========" + (_ui.m_boxChooseCanal.value));
 
-             if (_ui.m_boxChooseCanal.value == (int)ChannelID.Test + "")
 
-             {
 
-                 if (showAlert)
 
-                 {
 
-                     AlertSystem.Show("切换其他渠道后不支持切回测试渠道,请重启游戏!");
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 GameConfig.LoginAddress = "http://10.108.64.127:10005";
 
-             }
 
-             ET.Log.Debug($"===选择的渠道=== {_ui.m_boxChooseCanal.value} {GameConfig.LoginAddress}");
 
-         }
 
-     }
 
- }
 
 
  |