diff --git a/Assets/Scripts/CXX/Devices/Device_Base.cs b/Assets/Scripts/CXX/Devices/Device_Base.cs
index 3c22536..503e9d9 100644
--- a/Assets/Scripts/CXX/Devices/Device_Base.cs
+++ b/Assets/Scripts/CXX/Devices/Device_Base.cs
@@ -3,7 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
-public class Device_Base : PermanentTriggerBase
+public abstract class Device_Base : PermanentTriggerBase
{
///
/// 设备类型
diff --git a/Assets/Scripts/CXX/Devices/Device_Seal.cs b/Assets/Scripts/CXX/Devices/Device_Seal.cs
index 30367e8..58d533a 100644
--- a/Assets/Scripts/CXX/Devices/Device_Seal.cs
+++ b/Assets/Scripts/CXX/Devices/Device_Seal.cs
@@ -39,4 +39,19 @@ public class Device_Seal : Device_Base
isCut = false;
gameObject.SetActive(true);
}
+ ///
+ /// 断线重连
+ ///
+ ///
+ ///
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ if (triggerInfo != "")
+ isCut = bool.Parse(triggerInfo);
+ }
+
+ public override string SaveCurrentTriggerStat()
+ {
+ return isCut.ToString();
+ }
}
diff --git a/Assets/Scripts/CXX/Devices/鏉/浣庡帇鐢垫祦浜掓劅鍣/Device_LowVoltageCurrentTransformer.cs b/Assets/Scripts/CXX/Devices/鏉/浣庡帇鐢垫祦浜掓劅鍣/Device_LowVoltageCurrentTransformer.cs
index 60d64d6..f9153ca 100644
--- a/Assets/Scripts/CXX/Devices/鏉/浣庡帇鐢垫祦浜掓劅鍣/Device_LowVoltageCurrentTransformer.cs
+++ b/Assets/Scripts/CXX/Devices/鏉/浣庡帇鐢垫祦浜掓劅鍣/Device_LowVoltageCurrentTransformer.cs
@@ -7,5 +7,17 @@ using UnityEngine;
///
public class Device_LowVoltageCurrentTransformer : Device_Base
{
-
+ ///
+ /// 不需要
+ ///
+ ///
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+
+ }
+
+ public override string SaveCurrentTriggerStat()
+ {
+ return "";
+ }
}
diff --git a/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_3Phase4WireMeter.cs b/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_3Phase4WireMeter.cs
index 0299b84..51c92c5 100644
--- a/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_3Phase4WireMeter.cs
+++ b/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_3Phase4WireMeter.cs
@@ -218,4 +218,19 @@ public class Device_3Phase4WireMeter : Device_Base
CallScoreAction(true);
});
}
+
+ ///
+ /// 不需要
+ ///
+ ///
+ public override string SaveCurrentTriggerStat()
+ {
+ return "";
+ //throw new System.NotImplementedException();
+ }
+
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ //throw new System.NotImplementedException();
+ }
}
diff --git a/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_NamePlate.cs b/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_NamePlate.cs
index ecb116a..07c4965 100644
--- a/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_NamePlate.cs
+++ b/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_NamePlate.cs
@@ -54,4 +54,21 @@ public class Device_NamePlate : Device_Base
}
}
}
+ ///
+ /// 断线重连
+ ///
+ ///
+ ///
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ if (triggerInfo != "")
+ isChecked = bool.Parse(triggerInfo);
+ //throw new System.NotImplementedException();
+ }
+
+ public override string SaveCurrentTriggerStat()
+ {
+ return isChecked.ToString();
+ //throw new System.NotImplementedException();
+ }
}
diff --git a/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_Switch.cs b/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_Switch.cs
index aafe47d..236ce2c 100644
--- a/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_Switch.cs
+++ b/Assets/Scripts/CXX/Devices/鐩存帴鎺ュ叆寮忕數鑳借閲忚缃/Device_Switch.cs
@@ -63,5 +63,30 @@ public class Device_Switch : Device_Base
transform.localEulerAngles = new Vector3(0, 45, 0);
}
+ ///
+ /// 断线重连
+ ///
+ ///
+ ///
+ public override string SaveCurrentTriggerStat()
+ {
+ return isOpen.ToString();
+ //throw new NotImplementedException();
+ }
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ if (triggerInfo != "")
+ {
+ if (bool.Parse(triggerInfo))
+ {
+ OpenState();
+ }
+ else
+ {
+ CloseState();
+ }
+ }
+ //throw new NotImplementedException();
+ }
}
diff --git a/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_CabinetDoor.cs b/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_CabinetDoor.cs
index c294e27..f7d7641 100644
--- a/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_CabinetDoor.cs
+++ b/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_CabinetDoor.cs
@@ -1,4 +1,6 @@
using DG.Tweening;
+using LitJson;
+using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -89,4 +91,35 @@ public class Device_CabinetDoor : Device_Base
transform.Find("计量柜锁2/计量柜锁3").localEulerAngles = Vector3.zero;
}
+ ///
+ /// 断线重连
+ ///
+ ///
+ ///
+ class tempCabin {
+ public bool isOpen;
+ public bool hasElectricity;
+ }
+ public override string SaveCurrentTriggerStat()
+ {
+ tempCabin tmp = new tempCabin();
+ tmp.hasElectricity = hasElectricity;
+ tmp.isOpen = isOpen;
+ return JsonConvert.SerializeObject(tmp);
+ //throw new System.NotImplementedException();
+ }
+
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ tempCabin tmp = JsonMapper.ToObject(triggerInfo);
+ tmp.hasElectricity= hasElectricity;
+ if (tmp.isOpen)
+ {
+ OpenState();
+ }else
+ {
+ CloseState();
+ }
+ //throw new System.NotImplementedException();
+ }
}
diff --git a/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Socket.cs b/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Socket.cs
index 2974b16..d3b46e7 100644
--- a/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Socket.cs
+++ b/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Socket.cs
@@ -16,4 +16,20 @@ public class Device_Socket : Device_Base
///
public bool hasElectricity;
+
+ ///
+ /// 断线重连保存
+ ///
+ ///
+ ///
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ if (triggerInfo != "")
+ hasElectricity = bool.Parse(triggerInfo);
+ }
+
+ public override string SaveCurrentTriggerStat()
+ {
+ return hasElectricity.ToString();
+ }
}
diff --git a/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Sundries.cs b/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Sundries.cs
index b6e806a..ef6c81c 100644
--- a/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Sundries.cs
+++ b/Assets/Scripts/CXX/Devices/璁¢噺鏌/Device_Sundries.cs
@@ -16,4 +16,19 @@ public class Device_Sundries : Device_Base
}
}
+
+ ///
+ /// 不需要
+ ///
+ ///
+ ///
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public override string SaveCurrentTriggerStat()
+ {
+ return "";
+ }
}
diff --git a/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs b/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs
index 10b8c4e..52c36cb 100644
--- a/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs
+++ b/Assets/Scripts/ExcelData/DataContainer/TB_UserExamStat.cs
@@ -24,6 +24,7 @@ public class ReconnectTriggerInfo
public string triggerName;
public Vector3 selfPosInScene;
public Vector3 selfRotInScene;
+ public string triggerInfo;
}
diff --git a/Assets/Scripts/Project/Manager/ReconnectMgr.cs b/Assets/Scripts/Project/Manager/ReconnectMgr.cs
index 971cd12..e40fddd 100644
--- a/Assets/Scripts/Project/Manager/ReconnectMgr.cs
+++ b/Assets/Scripts/Project/Manager/ReconnectMgr.cs
@@ -116,6 +116,7 @@ public class ReconnectMgr : SingletonMono
ret.triggerID = item.triggerID;
ret.selfPosInScene = item.transform.localPosition;
ret.selfRotInScene = item.transform.localEulerAngles;
+ ret.triggerInfo = item.SaveCurrentTriggerStat();
UserExamStat.currentSceneTriggers.Add(ret);
}
@@ -219,6 +220,7 @@ public class ReconnectMgr : SingletonMono
item.gameObject.SetActive(true);
item.transform.localPosition = ret.selfPosInScene;
item.transform.localEulerAngles = ret.selfRotInScene;
+ item.LoadCurrentTriggerStat(ret.triggerInfo);
break;
}
}
diff --git a/Assets/Scripts/Project/Objects/Other/MirrorController.cs b/Assets/Scripts/Project/Objects/Other/MirrorController.cs
index f8369e4..0e325cd 100644
--- a/Assets/Scripts/Project/Objects/Other/MirrorController.cs
+++ b/Assets/Scripts/Project/Objects/Other/MirrorController.cs
@@ -17,5 +17,15 @@ public class MirrorController : PermanentTriggerBase
}
}
+ ///
+ /// 不需要断线重连恢复
+ ///
+ ///
+ ///
+ public override string SaveCurrentTriggerStat()
+ {
+ return "";
+ }
+ public override void LoadCurrentTriggerStat(string triggerInfo){ }
}
diff --git a/Assets/Scripts/Project/Objects/Other/MobileController.cs b/Assets/Scripts/Project/Objects/Other/MobileController.cs
index df8c153..f131630 100644
--- a/Assets/Scripts/Project/Objects/Other/MobileController.cs
+++ b/Assets/Scripts/Project/Objects/Other/MobileController.cs
@@ -3,6 +3,8 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
+using LitJson;
+using Newtonsoft.Json;
public class MobileController : PermanentTriggerBase
{
@@ -49,4 +51,22 @@ public class MobileController : PermanentTriggerBase
});
}
}
+
+ ///
+ /// 断线重连的状态保存与读取
+ ///
+ ///
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ if (triggerInfo != "")
+ {
+ this.downIndex = int.Parse(triggerInfo);
+ }
+ }
+
+ public override string SaveCurrentTriggerStat()
+ {
+ return downIndex.ToString();
+ //throw new NotImplementedException();
+ }
}
diff --git a/Assets/Scripts/Project/Objects/Other/NPCController.cs b/Assets/Scripts/Project/Objects/Other/NPCController.cs
index a12bc36..81e94aa 100644
--- a/Assets/Scripts/Project/Objects/Other/NPCController.cs
+++ b/Assets/Scripts/Project/Objects/Other/NPCController.cs
@@ -7,6 +7,7 @@ public class NPCController : PermanentTriggerBase
public List npcSpeack;
public int speackIndex = 0;
public SpriteRenderer spriteRenderer;
+
protected override void OnMDown()
{
base.OnMDown();
@@ -42,4 +43,22 @@ public class NPCController : PermanentTriggerBase
speackIndex = 0;
}
}
+
+ ///
+ /// 断线重连保存
+ ///
+ ///
+ ///
+ public override void LoadCurrentTriggerStat(string triggerInfo)
+ {
+ if (triggerInfo != "")
+ {
+ speackIndex = int.Parse(triggerInfo);
+ }
+ }
+
+ public override string SaveCurrentTriggerStat()
+ {
+ return speackIndex.ToString() ;
+ }
}
diff --git a/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs b/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs
index cbe6a46..36c5a1b 100644
--- a/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs
+++ b/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs
@@ -9,7 +9,7 @@ using Unity.VisualScripting;
///
/// 常驻交互
///
-public class PermanentTriggerBase : MonoBehaviour
+public abstract class PermanentTriggerBase : MonoBehaviour
{
public int triggerID;
public string triggerName;
@@ -130,4 +130,13 @@ public class PermanentTriggerBase : MonoBehaviour
{
scoreAction?.Invoke(triggerName==null?this.triggerName:triggerName, para, systemcid, shchmeid);
}
+
+ ///
+ /// 保存Trigger的自身具体信息,参考scoreBase
+ ///
+ public abstract string SaveCurrentTriggerStat();
+ ///
+ /// 加载Trigger的自身具体信息,参考scoreBase
+ ///
+ public abstract void LoadCurrentTriggerStat(string triggerInfo);
}
diff --git a/Assets/StreamingAssets/realtimeStat.json b/Assets/StreamingAssets/realtimeStat.json
index fff05ab..2ab28dd 100644
--- a/Assets/StreamingAssets/realtimeStat.json
+++ b/Assets/StreamingAssets/realtimeStat.json
@@ -7,13 +7,13 @@
"index": 1,
"subProcessId": 1,
"currentScore": 0.0,
- "isDone": false
+ "isDone": true
},
{
"index": 2,
"subProcessId": 2,
"currentScore": 0.0,
- "isDone": false
+ "isDone": true
},
{
"index": 3,
@@ -129,7 +129,8 @@
"x": 0.0,
"y": 0.0,
"z": 0.0
- }
+ },
+ "triggerInfo": "2"
}
],
"currentSceneOtherInfo": "{\r\n \"TestPen3list\": [],\r\n \"InSwitchCloseYDList\": [],\r\n \"InSwitchOpenYDList\": [],\r\n \"currentunInstallJieXian\": [],\r\n \"currentInstallJieXian\": [],\r\n \"installCover\": [],\r\n \"currentInstallTestJieXian\": []\r\n}"