diff --git a/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs b/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs index d160c22..168dd65 100644 --- a/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs +++ b/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs @@ -13,7 +13,7 @@ public class ReconnetItemInfo public int toolId; public int triggerID; public string toolName; - public E_ToolOrDeviceOrMaterials toolOrDeviceOrMaterial; + //public E_ToolOrDeviceOrMaterials toolOrDeviceOrMaterial; public Vector3 selfPosInToolRoom; } public class TB_UserExamStat @@ -41,6 +41,6 @@ public class TB_UserExamStat /// /// 当前场景内的所有可触发物品 /// - private List currentSceneTools = new List(); + public List currentSceneTools = new List(); } diff --git a/Assets/Scripts/Project/Manager/ProcessManager.cs b/Assets/Scripts/Project/Manager/ProcessManager.cs index d91321c..a859156 100644 --- a/Assets/Scripts/Project/Manager/ProcessManager.cs +++ b/Assets/Scripts/Project/Manager/ProcessManager.cs @@ -79,8 +79,8 @@ public class ProcessManager : BaseManager { this.schemeID = id; this.mode = mode; - coroutine = GameManager.MonoMgr.StartCoroutine(CountDown(countDown)); - //coroutine = GameManager.MonoMgr.StartCoroutine(AutoSaveStat(countDown));//鑷姩淇濆瓨鐢ㄦ埛鐘舵佷俊鎭 + //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); diff --git a/Assets/Scripts/Project/Manager/ReconnectMgr.cs b/Assets/Scripts/Project/Manager/ReconnectMgr.cs index 2848772..3c6767d 100644 --- a/Assets/Scripts/Project/Manager/ReconnectMgr.cs +++ b/Assets/Scripts/Project/Manager/ReconnectMgr.cs @@ -43,7 +43,6 @@ public class ReconnectMgr : SingletonMono public void RealtimeStatWriter() { - //记录步骤相关各项信息 /*UserExamStat.schemeID = ProcessManager.Instance.schemeID; UserExamStat.processId = ProcessManager.Instance.processId; @@ -73,7 +72,7 @@ public class ReconnectMgr : SingletonMono UserExamStat.sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; //获取场景内所有可以出发的物品 - currentSceneTools.Clear(); + UserExamStat.currentSceneTools.Clear(); BaseToolOrDevice[] allThings = FindObjectsOfType(); foreach (BaseToolOrDevice item in allThings) { @@ -82,9 +81,9 @@ public class ReconnectMgr : SingletonMono rec.toolId = item.itemInfo.toolId; rec.toolName = item.itemInfo.toolName; rec.triggerID = item.itemInfo.triggerID; - rec.toolOrDeviceOrMaterial = item.itemInfo.toolOrDeviceOrMaterial; + //rec.toolOrDeviceOrMaterial = item.itemInfo.toolOrDeviceOrMaterial; rec.selfPosInToolRoom = item.itemInfo.selfPosInToolRoom; - currentSceneTools.Add(rec); + UserExamStat.currentSceneTools.Add(rec); } //转换为JSON string UserJson = JsonConvert.SerializeObject(UserExamStat, Formatting.Indented); @@ -119,6 +118,29 @@ public class ReconnectMgr : SingletonMono } } + /// + /// 恢复现场 + /// + public void RecoverScene() + { + ScenesManager.Instance.LoadSceneAsyn(UserExamStat.sceneName, () => { + BaseToolOrDevice[] allThings = FindObjectsOfType(); + foreach (BaseToolOrDevice item in allThings) + { + item.gameObject.SetActive(false); + foreach (ReconnetItemInfo rec in UserExamStat.currentSceneTools) + { + if (item.itemInfo.toolName.Equals(rec.toolName) && item.itemInfo.toolId == rec.toolId) + { + if (item.itemInfo.selfPosInToolRoom.Equals(rec.selfPosInToolRoom)) + { + item.gameObject.SetActive(true); + } + } + } + } + }); + } // Start is called before the first frame update //void Start() //{ @@ -137,7 +159,7 @@ public class ReconnectMgr : SingletonMono else if(Input.GetKeyDown(KeyCode.R)) { RealtimeStatReader(); - ScenesManager.Instance.LoadScene(UserExamStat.sceneName); + RecoverScene(); /*ProcessManager.Instance.HandoverProcess(UserExamStat.processId, UserExamStat.subProcessId, UserExamStat.subProcessStepId); StepStateControl.instance.InvokeInitStepState(GameManager.Instance.systemId, GameManager.ProcessMgr.d_Scheme.id, UserExamStat.subProcessId); GameManager.EventMgr.EventTrigger(Enum_EventType.SwitchSubProcess, UserExamStat.subProcessId); diff --git a/Assets/StreamingAssets/realtimeStat.json b/Assets/StreamingAssets/realtimeStat.json new file mode 100644 index 0000000..d11c64f --- /dev/null +++ b/Assets/StreamingAssets/realtimeStat.json @@ -0,0 +1,210 @@ +{ + "allToolAndMaterial": [ + "鍥界綉瀹夊叏甯", + "宸ヤ綔鏈" + ], + "allWear": [], + "sceneName": "04_ToolMaterialScene", + "currentSceneTools": [ + { + "toolId": 5008, + "triggerID": 5008, + "toolName": "鍥界綉瀹夊叏甯", + "selfPosInToolRoom": { + "x": 0.263, + "y": 1.60900009, + "z": -1.369 + } + }, + { + "toolId": 5003, + "triggerID": 5003, + "toolName": "缁濈紭铻轰笣鍒", + "selfPosInToolRoom": { + "x": -3.22629857, + "y": 1.129, + "z": -1.12697673 + } + }, + { + "toolId": 5015, + "triggerID": 5015, + "toolName": "鐩掕灏佸嵃", + "selfPosInToolRoom": { + "x": 0.305, + "y": 1.556, + "z": -3.328 + } + }, + { + "toolId": 5010, + "triggerID": 5010, + "toolName": "缁濈紭鎵嬪", + "selfPosInToolRoom": { + "x": 0.265, + "y": 0.6700001, + "z": -1.387 + } + }, + { + "toolId": 5017, + "triggerID": 5017, + "toolName": "涓夌浉鍥涚嚎鐢佃兘琛", + "selfPosInToolRoom": { + "x": -3.2316, + "y": 1.1067, + "z": -2.258 + } + }, + { + "toolId": 5002, + "triggerID": 5002, + "toolName": "鍓ョ嚎閽", + "selfPosInToolRoom": { + "x": -3.1648, + "y": 0.217400074, + "z": -0.731 + } + }, + { + "toolId": 5004, + "triggerID": 5004, + "toolName": "楠岀數绗", + "selfPosInToolRoom": { + "x": -3.212, + "y": 1.128, + "z": -0.672 + } + }, + { + "toolId": 5009, + "triggerID": 5009, + "toolName": "宸ヤ綔鏈", + "selfPosInToolRoom": { + "x": 0.311, + "y": 1.1358, + "z": -1.381 + } + }, + { + "toolId": 5015, + "triggerID": 5015, + "toolName": "鐩掕灏佸嵃", + "selfPosInToolRoom": { + "x": 0.305, + "y": 1.556, + "z": -3.808 + } + }, + { + "toolId": 5003, + "triggerID": 5003, + "toolName": "缁濈紭铻轰笣鍒", + "selfPosInToolRoom": { + "x": -3.223, + "y": 1.124, + "z": -1.649 + } + }, + { + "toolId": 5004, + "triggerID": 5004, + "toolName": "楠岀數绗", + "selfPosInToolRoom": { + "x": -3.21036649, + "y": 1.1167, + "z": -0.173 + } + }, + { + "toolId": 5017, + "triggerID": 5017, + "toolName": "涓夌浉鍥涚嚎鐢佃兘琛", + "selfPosInToolRoom": { + "x": -3.2316, + "y": 1.1067, + "z": -2.7405 + } + }, + { + "toolId": 5002, + "triggerID": 5002, + "toolName": "鍓ョ嚎閽", + "selfPosInToolRoom": { + "x": -3.1648, + "y": 0.217400074, + "z": -0.189 + } + }, + { + "toolId": 5010, + "triggerID": 5010, + "toolName": "缁濈紭鎵嬪", + "selfPosInToolRoom": { + "x": 0.265, + "y": 0.6700001, + "z": -1.849 + } + }, + { + "toolId": 5014, + "triggerID": 5014, + "toolName": "宸ヤ綔璇", + "selfPosInToolRoom": { + "x": 0.238, + "y": 1.134, + "z": -3.807 + } + }, + { + "toolId": 5011, + "triggerID": 5011, + "toolName": "缁濈紭闈", + "selfPosInToolRoom": { + "x": 0.315, + "y": 0.207000017, + "z": -1.377 + } + }, + { + "toolId": 5014, + "triggerID": 5014, + "toolName": "宸ヤ綔璇", + "selfPosInToolRoom": { + "x": 0.238, + "y": 1.134, + "z": -3.353 + } + }, + { + "toolId": 5016, + "triggerID": 5016, + "toolName": "缁濈紭鑳跺甫", + "selfPosInToolRoom": { + "x": 0.281, + "y": 1.55870008, + "z": -4.595 + } + }, + { + "toolId": 5016, + "triggerID": 5016, + "toolName": "缁濈紭鑳跺甫", + "selfPosInToolRoom": { + "x": 0.281, + "y": 1.55870008, + "z": -4.202 + } + }, + { + "toolId": 5011, + "triggerID": 5011, + "toolName": "缁濈紭闈", + "selfPosInToolRoom": { + "x": 0.315, + "y": 0.207000017, + "z": -1.852 + } + } + ] +} \ No newline at end of file diff --git a/Assets/StreamingAssets/realtimeStat.json.meta b/Assets/StreamingAssets/realtimeStat.json.meta new file mode 100644 index 0000000..9bb0cde --- /dev/null +++ b/Assets/StreamingAssets/realtimeStat.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 07217e8cebb016f498b20710d61dc605 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: