diff --git a/Assets/Scripts/CXX/Score/ScoreBase.cs b/Assets/Scripts/CXX/Score/ScoreBase.cs index 404e12d..87eb5c6 100644 --- a/Assets/Scripts/CXX/Score/ScoreBase.cs +++ b/Assets/Scripts/CXX/Score/ScoreBase.cs @@ -72,10 +72,15 @@ public abstract class ScoreBase : MonoBehaviour } /// - /// 设置科目得分,用于断线重连恢复 + /// 设置科目得分,用于断线重连恢复 HQB /// public void setCurrentScore(float _score) { this.currentScore = _score; } + + /// + /// 记录现场环境中scoreBase的各项List缓存 + /// + public abstract void SaveSceneBufferList(); } diff --git a/Assets/Scripts/CXX/Score/Score_1002.cs b/Assets/Scripts/CXX/Score/Score_1002.cs index 0b99f60..8cfec02 100644 --- a/Assets/Scripts/CXX/Score/Score_1002.cs +++ b/Assets/Scripts/CXX/Score/Score_1002.cs @@ -3,6 +3,21 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; +using LitJson; + +/// +/// 转存场景buffer +/// +public class BufferTemp_1002 +{ + public List TestPen3list; + public List InSwitchCloseYDList; + public List InSwitchOpenYDList; + public List currentunInstallJieXian; + public List currentInstallJieXian; + public List installCover; + public List currentInstallTestJieXian; +} public class Score_1002 : ScoreBase { @@ -445,4 +460,23 @@ public class Score_1002 : ScoreBase return false; } + + /// + /// 保存场景中List缓存,用于断线重连 + /// + /// + public override void SaveSceneBufferList() + { + BufferTemp_1002 tmp = new BufferTemp_1002(); + tmp.TestPen3list = TestPen3list; + tmp.InSwitchCloseYDList = InSwitchCloseYDList; + tmp.InSwitchOpenYDList = InSwitchOpenYDList; + tmp.currentunInstallJieXian = currentunInstallJieXian; + tmp.currentInstallJieXian = currentInstallJieXian; + tmp.installCover = installCover; + tmp.currentInstallTestJieXian = currentInstallTestJieXian; + string sceneInfo = JsonConvert.SerializeObject(tmp, Formatting.Indented); + Debug.Log("==场景信息:" + sceneInfo); + //throw new System.NotImplementedException(); + } } diff --git a/Assets/Scripts/Project/Manager/ReconnectMgr.cs b/Assets/Scripts/Project/Manager/ReconnectMgr.cs index 668eb98..e757b2a 100644 --- a/Assets/Scripts/Project/Manager/ReconnectMgr.cs +++ b/Assets/Scripts/Project/Manager/ReconnectMgr.cs @@ -123,6 +123,15 @@ public class ReconnectMgr : SingletonMono File.WriteAllText(localStatPath, UserJson); } + /// + /// 记录场景中的信息 + /// + public void RealtimeSceneWriter() + { + ScoreBase scoreBase = FindAnyObjectByType(); + scoreBase.SaveSceneBufferList(); + } + /// /// 读取用户状态(先使用同步,后用异步) /// @@ -271,6 +280,10 @@ public class ReconnectMgr : SingletonMono // Update is called once per frame void Update() { + if (Input.GetKeyDown(KeyCode.U)) + { + RealtimeSceneWriter(); + } if (Input.GetKeyDown(KeyCode.T))//测试用,按T读取状态保存 { RealtimeStatWriter();