diff --git a/Assets/Scripts/Project/Manager/ProcessManager.cs b/Assets/Scripts/Project/Manager/ProcessManager.cs index eeca618..cb11082 100644 --- a/Assets/Scripts/Project/Manager/ProcessManager.cs +++ b/Assets/Scripts/Project/Manager/ProcessManager.cs @@ -55,6 +55,11 @@ public class ProcessManager : BaseManager /// public int countDown = 0; + /// + /// 断线重连接自动保存倒计时 + /// + public int countDown_AutoSave = 0; + /// /// 实训/考试时长 /// @@ -75,6 +80,7 @@ public class ProcessManager : BaseManager this.schemeID = id; this.mode = mode; coroutine = GameManager.MonoMgr.StartCoroutine(CountDown(countDown)); + //coroutine = GameManager.MonoMgr.StartCoroutine(AutoSaveStat(countDown));//自动保存用户状态信息 d_Scheme = DataManager.Instance.GetSchemeData(id); ReportManager.Instance.creport = DataManager.Instance.GetSchemeReport(id); GameManager.ToolAndmaterialMgr.Init(d_Scheme.ToolOrMaterilOrDevice); @@ -299,6 +305,29 @@ public class ProcessManager : BaseManager } } + /// + /// 自动保存用户状态, + /// + /// + private IEnumerator AutoSaveStat(int time) + { + countDown_AutoSave = time; + WaitForSeconds waitForSeconds = new WaitForSeconds(1); + while (countDown_AutoSave > 0) + { + yield return waitForSeconds; + countDown_AutoSave--; + Debug.Log("自动保存倒计时:" + countDown_AutoSave); + if (countDown_AutoSave <= 0) + { + ReconnectMgr.Instance.RealtimeStatWriter();//需要在GameManager里面初始化 + Debug.Log("完成状态自动保存"); + countDown_AutoSave = time; + } + } + } + + /// /// 结束 ///