| | |
| | | using UnityEngine; |
| | | using Snxxz.UI; |
| | | |
| | | public class RoleLoginState : NetState |
| | | { |
| | | 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; |
| | | 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(); |
| | | WindowCenter.Instance.Open<DisconnectHintWin>(); |
| | | } |
| | | |
| | | if (StageManager.Instance.isServerPreparing) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | timer2 += Time.deltaTime; |
| | | if (timer2 > OVERTIME_THRESHOLD_2) |
| | | { |
| | | GameNetSystem.Instance.Disconnect(); |
| | | WindowCenter.Instance.Open<DisconnectHintWin>(); |
| | | } |
| | | protected override void Update()
|
| | | {
|
| | | if (GameNetSystem.Instance.netState != GameNetSystem.NetState.RoleLogin)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | timer1 += Time.deltaTime;
|
| | | if (timer1 > OVERTIME_THRESHOLD_1)
|
| | | {
|
| | | GameNetSystem.Instance.Disconnect();
|
| | | WindowCenter.Instance.Open<DisconnectHintWin>();
|
| | | }
|
| | |
|
| | | if (StageManager.Instance.isServerPreparing)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | timer2 += Time.deltaTime;
|
| | | if (timer2 > OVERTIME_THRESHOLD_2)
|
| | | {
|
| | | GameNetSystem.Instance.Disconnect();
|
| | | WindowCenter.Instance.Open<DisconnectHintWin>();
|
| | | }
|
| | | } |
| | | |
| | | public override void OnExit() |
| | | { |
| | | base.OnExit(); |
| | | public override void OnExit()
|
| | | {
|
| | | base.OnExit();
|
| | | } |
| | | |
| | | } |