| using System.Collections; | 
| using System.Collections.Generic; | 
| using UnityEngine; | 
|   | 
| public class RoleLoginState : NetState | 
| { | 
|     const int OVERTIME_THRESHOLD_1 = 20; | 
|     const int OVERTIME_THRESHOLD_2 = 10; | 
|   | 
|     float timer1 = 0f; | 
|     float timer2 = 0f; | 
|   | 
|     public override void OnEnter() | 
|     { | 
|         base.OnEnter(); | 
|         timer1 = 0f; | 
|         timer2 = 0f; | 
|     } | 
|   | 
|     protected override void Update() | 
|     { | 
|         if (GameNetSystem.Instance.netState != GameNetSystem.NetState.RoleLogin) | 
|         { | 
|             return; | 
|         } | 
|   | 
|         timer1 += Time.deltaTime; | 
|         if (timer1 > OVERTIME_THRESHOLD_1) | 
|         { | 
|             GameNetSystem.Instance.Disconnect(); | 
|             UIManager.Instance.OpenWindow<DisconnectHintWin>(); | 
|         } | 
|   | 
|   | 
|         timer2 += Time.deltaTime; | 
|         if (timer2 > OVERTIME_THRESHOLD_2) | 
|         { | 
|             GameNetSystem.Instance.Disconnect(); | 
|             UIManager.Instance.OpenWindow<DisconnectHintWin>(); | 
|         } | 
|     } | 
|   | 
|     public override void OnExit() | 
|     { | 
|         base.OnExit(); | 
|     } | 
|   | 
| } |