From 344a6badcb626b70185fecc11d3a71e83f1670a1 Mon Sep 17 00:00:00 2001 From: liuyu <272912176@qq.com> Date: Mon, 2 Sep 2024 17:17:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8ProcessManager=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98=E7=9A=84=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8D=8F=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Project/Manager/ProcessManager.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) 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; + } + } + } + + /// /// 结束 ///