123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- namespace Assets
- {
- /// <summary> 请求状态枚举 </summary>
- public enum RequestState
- {
- Success,
- /// <summary> 不在白名单 </summary>
- HashFailed,
- /// <summary> Mac地址错误 </summary>
- MacFailed,
- /// <summary> 请求超时 </summary>
- TimeOut,
- /// <summary> 频繁请求,请求超限制 </summary>
- Frequently,
- /// <summary> 网络连接失败 </summary>
- URLFailed,
- }
- public class DlgLoginFaild : BasePanel
- {
- public Button confirm;
- public TextMeshProUGUI faildMsg;
- RequestState requestState;
- public override void OnCloseWindow()
- {
- }
- public override void OnDestroyWindow()
- {
- }
- public override void OnInitWindow()
- {
- OnShowWindow();
- LanguageMatchManager.Instance.changeLanguage += () =>
- {
- faildMsg.text = LanguageMatchManager.Instance.GetLanByKey(requestState.ToString());
- };
- }
- public void Update()
- {
- }
- public override void OnShowWindow()
- {
- switch (StepManager.requestCode)
- {
- case 1:
- //网络连接失败
- requestState = RequestState.URLFailed;
- break;
- case 1001:
- //Mac地址错误
- requestState = RequestState.MacFailed;
- break;
- case 1002:
- //登录超时
- requestState = RequestState.URLFailed;
- break;
- case 1003:
- //频繁请求,请求超限制
- requestState = RequestState.URLFailed;
- break;
- case 1004:
- //不在白名单
- requestState = RequestState.HashFailed;
- break;
- case 1005:
- //Mac未绑定
- requestState = RequestState.MacFailed;
- break;
- case 1006:
- //账号已绑定Mac地址
- requestState = RequestState.MacFailed;
- break;
- case 1007:
- //Mac请求网络错误
- requestState = RequestState.URLFailed;
- break;
- case 1008:
- //Login请求网络错误
- requestState = RequestState.URLFailed;
- break;
- }
- faildMsg.text = LanguageMatchManager.Instance.GetLanByKey(requestState.ToString());
- }
- private void Awake()
- {
- confirm.onClick.AddListener(() =>
- {
- UIManager.Instance.HideUI(WindowID.DlgLoginFaild);
- UIManager.Instance.HideUI(WindowID.DlgLoading);
- });
- }
- }
- }
|