From 5e26973e4ea5b9782d9027207a3cdf4183e6e633 Mon Sep 17 00:00:00 2001
From: liuyu <272912176@qq.com>
Date: Sat, 7 Sep 2024 17:17:12 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=8F=8D=E5=B0=84=E4=BF=9D?=
=?UTF-8?q?=E5=AD=98Trigger=E7=8A=B6=E6=80=81=E5=8F=98=E9=87=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Assets/Scripts/CXX/Devices/Device_Seal.cs | 16 +-
.../Devices/杂/接线完好检查/Check_JieXian.cs | 19 +--
.../Device_NamePlate.cs | 18 +--
.../直接接入式电能计量装置/Device_Switch.cs | 27 +---
.../CXX/Devices/计量柜/Device_CabinetDoor.cs | 34 +----
.../CXX/Devices/计量柜/Device_Socket.cs | 19 +--
Assets/Scripts/HQB.meta | 8 +
Assets/Scripts/HQB/ReconnetAtrribute.cs | 15 ++
Assets/Scripts/HQB/ReconnetAtrribute.cs.meta | 11 ++
Assets/Scripts/HQB/ReflectionTest.cs | 41 +++++
Assets/Scripts/HQB/ReflectionTest.cs.meta | 11 ++
.../Scripts/Project/Manager/ReconnectMgr.cs | 140 +++++++++++------
.../Project/Objects/Other/MobileController.cs | 27 ++--
.../Objects/Other/PermanentTriggerBase.cs | 7 +-
Assets/StreamingAssets/realtimeStat.json | 142 ++++++++++++++++++
Assets/StreamingAssets/realtimeStat.json.meta | 7 +
16 files changed, 355 insertions(+), 187 deletions(-)
create mode 100644 Assets/Scripts/HQB.meta
create mode 100644 Assets/Scripts/HQB/ReconnetAtrribute.cs
create mode 100644 Assets/Scripts/HQB/ReconnetAtrribute.cs.meta
create mode 100644 Assets/Scripts/HQB/ReflectionTest.cs
create mode 100644 Assets/Scripts/HQB/ReflectionTest.cs.meta
create mode 100644 Assets/StreamingAssets/realtimeStat.json
create mode 100644 Assets/StreamingAssets/realtimeStat.json.meta
diff --git a/Assets/Scripts/CXX/Devices/Device_Seal.cs b/Assets/Scripts/CXX/Devices/Device_Seal.cs
index 58d533a..ed8ce4a 100644
--- a/Assets/Scripts/CXX/Devices/Device_Seal.cs
+++ b/Assets/Scripts/CXX/Devices/Device_Seal.cs
@@ -11,6 +11,7 @@ public class Device_Seal : Device_Base
///
/// Ƿ
///
+ [ReconnetAtrribute]
public bool isCut;
///
/// λ
@@ -39,19 +40,4 @@ 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/杂/接线完好检查/Check_JieXian.cs b/Assets/Scripts/CXX/Devices/杂/接线完好检查/Check_JieXian.cs
index 0830be6..30b0630 100644
--- a/Assets/Scripts/CXX/Devices/杂/接线完好检查/Check_JieXian.cs
+++ b/Assets/Scripts/CXX/Devices/杂/接线完好检查/Check_JieXian.cs
@@ -10,6 +10,7 @@ public class Check_JieXian : PermanentTriggerBase
///
/// ǷѼ
///
+ [ReconnetAtrribute]
public bool isChecked;
///
///
@@ -75,22 +76,4 @@ public class Check_JieXian : PermanentTriggerBase
base.CallScoreAction(true);
}
}
-
- ///
- ///
- ///
- ///
- ///
- public override string SaveCurrentTriggerStat()
- {
- return isChecked.ToString();
- //throw new System.NotImplementedException();
- }
-
- public override void LoadCurrentTriggerStat(string triggerInfo)
- {
- if (triggerInfo != "")
- isChecked = bool.Parse(triggerInfo);
- //throw new System.NotImplementedException();
- }
}
diff --git a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs
index 07c4965..eca02e6 100644
--- a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs
+++ b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs
@@ -10,6 +10,7 @@ public class Device_NamePlate : Device_Base
///
/// Ƿ
///
+ [ReconnetAtrribute]
public bool isChecked;
///
@@ -54,21 +55,4 @@ 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 236ce2c..bd92498 100644
--- a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_Switch.cs
+++ b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_Switch.cs
@@ -5,6 +5,7 @@ using UnityEngine;
public class Device_Switch : Device_Base
{
+ [ReconnetAtrribute]
public bool isOpen;
///
@@ -63,30 +64,4 @@ 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 9adb4f6..68ee7ef 100644
--- a/Assets/Scripts/CXX/Devices/计量柜/Device_CabinetDoor.cs
+++ b/Assets/Scripts/CXX/Devices/计量柜/Device_CabinetDoor.cs
@@ -17,10 +17,12 @@ public class Device_CabinetDoor : Device_Base
///
/// Ƿ
///
+ [ReconnetAtrribute]
public bool isOpen;
///
/// Ƿ
///
+ [ReconnetAtrribute]
public bool hasElectricity;
public void Open()
{
@@ -90,36 +92,4 @@ public class Device_CabinetDoor : Device_Base
transform.localEulerAngles = Vector3.zero;
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 d3b46e7..b21f5fc 100644
--- a/Assets/Scripts/CXX/Devices/计量柜/Device_Socket.cs
+++ b/Assets/Scripts/CXX/Devices/计量柜/Device_Socket.cs
@@ -10,26 +10,11 @@ public class Device_Socket : Device_Base
///
/// λ
///
+ [ReconnetAtrribute]
public Transform testPosAndRot;
///
/// Ƿ
///
-
+ [ReconnetAtrribute]
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/HQB.meta b/Assets/Scripts/HQB.meta
new file mode 100644
index 0000000..893dcd8
--- /dev/null
+++ b/Assets/Scripts/HQB.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ec21e9d11e37de04fba96037a6515a29
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/HQB/ReconnetAtrribute.cs b/Assets/Scripts/HQB/ReconnetAtrribute.cs
new file mode 100644
index 0000000..17c02f0
--- /dev/null
+++ b/Assets/Scripts/HQB/ReconnetAtrribute.cs
@@ -0,0 +1,15 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System;
+
+[AttributeUsage(AttributeTargets.Field|AttributeTargets.Property, AllowMultiple =false)]
+public class ReconnetAtrribute : Attribute
+{
+ public string Description { get; }
+
+ public ReconnetAtrribute()
+ {
+ Description = "";
+ }
+}
diff --git a/Assets/Scripts/HQB/ReconnetAtrribute.cs.meta b/Assets/Scripts/HQB/ReconnetAtrribute.cs.meta
new file mode 100644
index 0000000..cf64d22
--- /dev/null
+++ b/Assets/Scripts/HQB/ReconnetAtrribute.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 01e2c8f14904bb44c8ebfe71e3089711
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/HQB/ReflectionTest.cs b/Assets/Scripts/HQB/ReflectionTest.cs
new file mode 100644
index 0000000..cda4802
--- /dev/null
+++ b/Assets/Scripts/HQB/ReflectionTest.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using UnityEngine;
+
+public class ReflectionTest : MonoBehaviour
+{
+ public PermanentTriggerBase ptb;
+ public MobileController mc;
+ // Start is called before the first frame update
+ void Start()
+ {
+ FieldInfo[] fieldInfo = ptb.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
+ foreach (FieldInfo field in fieldInfo)
+ {
+ if (field.GetCustomAttribute() != null)
+ {
+ ReconnetAtrribute attribute = field.GetCustomAttribute();
+ object value = field.GetValue(ptb);
+ Debug.Log($"Field: {field.Name}, Value: {value}, Description: {attribute.Description}");
+ if (attribute.Description == "downIndex")
+ {
+ field.SetValue(ptb, 1);
+ }
+ Debug.Log($"=>Field: {field.Name}, Value: {value}, Description: {attribute.Description}");
+ }
+ }
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+ if (Input.GetKeyDown(KeyCode.V))
+ {
+ Debug.Log("X");
+ Debug.Log("===>" + mc.downIndex);
+ }
+ }
+}
diff --git a/Assets/Scripts/HQB/ReflectionTest.cs.meta b/Assets/Scripts/HQB/ReflectionTest.cs.meta
new file mode 100644
index 0000000..ee7af77
--- /dev/null
+++ b/Assets/Scripts/HQB/ReflectionTest.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 10fa826c5945ca84ca64dee6f1d99354
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Project/Manager/ReconnectMgr.cs b/Assets/Scripts/Project/Manager/ReconnectMgr.cs
index 03768b6..744e493 100644
--- a/Assets/Scripts/Project/Manager/ReconnectMgr.cs
+++ b/Assets/Scripts/Project/Manager/ReconnectMgr.cs
@@ -7,6 +7,10 @@ using System.IO;
using LitJson;
using System;
using Unity.Burst.CompilerServices;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.ComponentModel;
///
///
@@ -14,21 +18,21 @@ using Unity.Burst.CompilerServices;
public class ReconnectMgr : SingletonMono
{
[HideInInspector]
- public string localStatFileName = "realtimeStat.json";//ļļ
+ public string localStatFileName = "realtimeStat.json";//ļļ
[HideInInspector]
- public int countDown_AutoSave = 600;//Զʱ
- private TB_UserExamStat UserExamStat = new TB_UserExamStat();
- private string localStatPath = "";
- private Coroutine coroutine;//Զ浹ʱ
+ public int countDown_AutoSave = 600;//Զʱ
+ private TB_UserExamStat UserExamStat = new TB_UserExamStat();
+ private string localStatPath = "";
+ private Coroutine coroutine;//Զ浹ʱ
//[HideInInspector]
//public List experiencedScene = new List();//ûij
///
/// ʼ,¼ʱ
///
- public void Init( )
+ public void Init()
{
- localStatPath = Application.streamingAssetsPath + "/" + localStatFileName;
+ localStatPath = Application.streamingAssetsPath + "/" + localStatFileName;
//UserExamStat.experiencedScene.Clear();//ûij
//experiencedScene.Clear();
}
@@ -48,7 +52,7 @@ public class ReconnectMgr : SingletonMono
ReconnectMgr()//캯
{
- Init( );
+ Init();
}
///
@@ -57,21 +61,21 @@ public class ReconnectMgr : SingletonMono
public void RealtimeStatWriter()
{
//¼ظϢ
- UserExamStat.schemeID = ProcessManager.Instance.schemeID;
+ UserExamStat.schemeID = ProcessManager.Instance.schemeID;
//¼÷
- ScoreBase scoreBase = FindFirstObjectByType();
- UserExamStat.systemID = scoreBase.systemId;
+ ScoreBase scoreBase = FindFirstObjectByType();
+ UserExamStat.systemID = scoreBase.systemId;
UserExamStat.allSubScore.Clear();
- if ( scoreBase != null )
+ if (scoreBase != null)
{
foreach (var item in scoreBase.GetStepScore())
{
ReconnectSubScoreInfo sub = new ReconnectSubScoreInfo();
- sub.index = item.Key;
- sub.subProcessId = item.Value.subProcessId;
- sub.currentScore = item.Value.currentScore;
- sub.isDone = item.Value.isDone;
- UserExamStat.allSubScore.Add( sub );
+ sub.index = item.Key;
+ sub.subProcessId = item.Value.subProcessId;
+ sub.currentScore = item.Value.currentScore;
+ sub.isDone = item.Value.isDone;
+ UserExamStat.allSubScore.Add(sub);
};
//泡ڶϢ
UserExamStat.currentSceneOtherInfo = scoreBase.SaveSceneBufferList();
@@ -85,12 +89,12 @@ public class ReconnectMgr : SingletonMono
foreach (var itemInfo in item.Value)
{
UserExamStat.allToolAndMaterial.Add(((ItemInfo)itemInfo).toolName);
- ReconnectItemInfo rec = new ReconnectItemInfo();//ȡ()пװϵƷ
- rec.toolId = itemInfo.toolId;
- rec.toolName = itemInfo.toolName;
- rec.triggerID = itemInfo.triggerID;
+ ReconnectItemInfo rec = new ReconnectItemInfo();//ȡ()пװϵƷ
+ rec.toolId = itemInfo.toolId;
+ rec.toolName = itemInfo.toolName;
+ rec.triggerID = itemInfo.triggerID;
//rec.toolOrDeviceOrMaterial = item.itemInfo.toolOrDeviceOrMaterial;
- rec.selfPosInToolRoom = itemInfo.selfPosInToolRoom;
+ rec.selfPosInToolRoom = itemInfo.selfPosInToolRoom;
UserExamStat.currentSceneTools.Add(rec);
}
}
@@ -111,14 +115,14 @@ public class ReconnectMgr : SingletonMono
PermanentTriggerBase[] allPermanentTriggers = FindObjectsOfType();
foreach (PermanentTriggerBase item in allPermanentTriggers)
{
- ReconnectTriggerInfo ret = new ReconnectTriggerInfo();
- ret.triggerName = item.triggerName;
- ret.triggerID = item.triggerID;
- ret.selfPosInScene = item.transform.localPosition;
- ret.selfRotInScene = item.transform.localEulerAngles;
- ret.triggerInfo = item.SaveCurrentTriggerStat();
+ ReconnectTriggerInfo ret = new ReconnectTriggerInfo();
+ ret.triggerName = item.triggerName;
+ ret.triggerID = item.triggerID;
+ ret.selfPosInScene = item.transform.localPosition;
+ ret.selfRotInScene = item.transform.localEulerAngles;
+ ret.triggerInfo = GetTriggerAttribute(item);//item.SaveCurrentTriggerStat();
UserExamStat.currentSceneTriggers.Add(ret);
- }
+ }
//תΪJSON
string UserJson = JsonConvert.SerializeObject(UserExamStat, Formatting.Indented);
@@ -126,6 +130,42 @@ public class ReconnectMgr : SingletonMono
File.WriteAllText(localStatPath, UserJson);
}
+ ///
+ /// ȡפ
+ ///
+ ///
+ public string GetTriggerAttribute(PermanentTriggerBase permanentTriggerBase)
+ {
+ JsonData ptbData = new JsonData();
+ FieldInfo[] fieldInfo = permanentTriggerBase.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
+ foreach (FieldInfo field in fieldInfo)
+ {
+ if (field.GetCustomAttribute() != null)
+ {
+ ReconnetAtrribute attribute = field.GetCustomAttribute();
+ object value = field.GetValue(permanentTriggerBase);
+ ptbData[field.Name] = value.ToString();
+ }
+ }
+ //return Regex.Unescape(ptbData.ToJson());
+ return ptbData.ToJson();
+ }
+ public void SetTriggerAttribute(string triggerJson, PermanentTriggerBase permanentTriggerBase)
+ {
+ JsonData ptbData = JsonMapper.ToObject(triggerJson);
+ FieldInfo[] fieldInfo = permanentTriggerBase.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
+ foreach (FieldInfo field in fieldInfo)
+ {
+ if (field.GetCustomAttribute() != null)
+ {
+ ReconnetAtrribute attribute = field.GetCustomAttribute();
+ Type type = field.GetValue(permanentTriggerBase).GetType();
+ string tmp = ptbData[field.Name].ToString();
+ field.SetValue(permanentTriggerBase, Convert.ChangeType(tmp, type));
+ }
+ }
+ }
+
///
/// ȡû״̬(ʹͬ,첽)
///
@@ -135,19 +175,20 @@ public class ReconnectMgr : SingletonMono
{
try
{
- StreamReader sr = new StreamReader(localStatPath);
- string user_last_stat = sr.ReadToEnd();
+ StreamReader sr = new StreamReader(localStatPath);
+ string user_last_stat = sr.ReadToEnd();
sr.Close();
- UserExamStat = JsonMapper.ToObject(user_last_stat);
+ UserExamStat = JsonMapper.ToObject(user_last_stat);
return true;
}
catch (System.Exception e)
- {
+ {
Debug.LogError(e.ToString());
- return false;
+ return false;
}
}
- else {
+ else
+ {
return false;
}
}
@@ -158,7 +199,8 @@ public class ReconnectMgr : SingletonMono
public void RecoverScene()
{
//Ȼָ
- ScenesManager.Instance.LoadSceneAsyn(UserExamStat.sceneName, () => {
+ ScenesManager.Instance.LoadSceneAsyn(UserExamStat.sceneName, () =>
+ {
//Ҳл
if (!GameManager.UIMgr.GetPanel())//office,Ҳܻ
{
@@ -172,8 +214,8 @@ public class ReconnectMgr : SingletonMono
GameManager.EventMgr.EventTrigger(Enum_EventType.SwitchScene, GameManager.RunModelMgr.SceneType);
//ָеװ
- TooRoomMannger tooRoomMannger = FindAnyObjectByType();
- List itemInPack = ToolAndmaterialMgr.Instance.CreateItemInfoByName(UserExamStat.allToolAndMaterial);
+ TooRoomMannger tooRoomMannger = FindAnyObjectByType();
+ List itemInPack = ToolAndmaterialMgr.Instance.CreateItemInfoByName(UserExamStat.allToolAndMaterial);
foreach (ItemInfo item in itemInPack)
{
for (int j = 0; j < UserExamStat.currentSceneTools.Count; j++)
@@ -187,24 +229,24 @@ public class ReconnectMgr : SingletonMono
}
PacksackBagMgr.Instance.AddOneToolOrMater(item);
}
- if ( tooRoomMannger != null )tooRoomMannger.RemoveRepeat();
+ if (tooRoomMannger != null) tooRoomMannger.RemoveRepeat();
//ָѴװ
- List itemWear = ToolAndmaterialMgr.Instance.CreateItemInfoByName(UserExamStat.allWear);
+ List itemWear = ToolAndmaterialMgr.Instance.CreateItemInfoByName(UserExamStat.allWear);
foreach (ItemInfo item in itemWear)
{
PacksackBagMgr.Instance.WearItemState(item, true);
if (tooRoomMannger != null)//ڹ,Ĵ
- {
+ {
tooRoomMannger.Wear(item.toolName, true);
}
}
//ָڸ״̬
- PermanentTriggerBase[] allPermanentTriggers = FindObjectsOfType();
- List allReconTrigs = UserExamStat.currentSceneTriggers;
+ PermanentTriggerBase[] allPermanentTriggers = FindObjectsOfType();
+ List allReconTrigs = UserExamStat.currentSceneTriggers;
foreach (PermanentTriggerBase item in allPermanentTriggers)
- {
+ {
item.gameObject.SetActive(false);
foreach (ReconnectTriggerInfo ret in allReconTrigs)
{
@@ -215,7 +257,8 @@ public class ReconnectMgr : SingletonMono
{
item.transform.localPosition = ret.selfPosInScene;
item.transform.localEulerAngles = ret.selfRotInScene;
- item.LoadCurrentTriggerStat(ret.triggerInfo);
+ SetTriggerAttribute(ret.triggerInfo, item);
+ //item.LoadCurrentTriggerStat(ret.triggerInfo);
}
break;
}
@@ -280,10 +323,11 @@ public class ReconnectMgr : SingletonMono
RealtimeStatWriter();
Debug.Log("ǰ:" + UserExamStat.sceneName);
}
- else if(Input.GetKeyDown(KeyCode.Y))
- {
+ else if (Input.GetKeyDown(KeyCode.Y))
+ {
RealtimeStatReader();
RecoverScene();
}
}
-}
+
+}
\ No newline at end of file
diff --git a/Assets/Scripts/Project/Objects/Other/MobileController.cs b/Assets/Scripts/Project/Objects/Other/MobileController.cs
index 87caa97..3ee2124 100644
--- a/Assets/Scripts/Project/Objects/Other/MobileController.cs
+++ b/Assets/Scripts/Project/Objects/Other/MobileController.cs
@@ -5,9 +5,12 @@ using UnityEngine;
using UnityEngine.EventSystems;
using LitJson;
using Newtonsoft.Json;
+using Unity.VisualScripting;
+using System.Reflection;
public class MobileController : PermanentTriggerBase
{
+ [ReconnetAtrribute]
public int downIndex = 0;
protected override void OnMEnter()
{
@@ -69,17 +72,17 @@ public class MobileController : PermanentTriggerBase
/// ״̬ȡ
///
///
- public override void LoadCurrentTriggerStat(string triggerInfo)
- {
- if (triggerInfo != "")
- {
- this.downIndex = int.Parse(triggerInfo);
- }
- }
+ //public override void LoadCurrentTriggerStat(string triggerInfo)
+ //{
+ // if (triggerInfo != "")
+ // {
+ // this.downIndex = int.Parse(triggerInfo);
+ // }
+ //}
- public override string SaveCurrentTriggerStat()
- {
- return downIndex.ToString();
- //throw new NotImplementedException();
- }
+ //public override string SaveCurrentTriggerStat()
+ //{
+ // return downIndex.ToString();
+ // //throw new NotImplementedException();
+ //}
}
diff --git a/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs b/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs
index f419911..eded40a 100644
--- a/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs
+++ b/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs
@@ -5,13 +5,16 @@ using HighlightPlus;
using UnityEngine.EventSystems;
using System;
using Unity.VisualScripting;
+using System.Runtime.Serialization.Formatters.Binary;
///
/// פ
///
public class PermanentTriggerBase : MonoBehaviour
{
+ [ReconnetAtrribute]
public int triggerID;
+ [ReconnetAtrribute]
public string triggerName;
public HighlightEffect _highlight;
@@ -138,9 +141,9 @@ public class PermanentTriggerBase : MonoBehaviour
///
/// TriggerϢ,οscoreBase
///
- public virtual string SaveCurrentTriggerStat() { return ""; }
+ //public virtual string SaveCurrentTriggerStat() { return ""; }
///
/// TriggerϢ,οscoreBase
///
- public virtual void LoadCurrentTriggerStat(string triggerInfo) { }
+ //public virtual void LoadCurrentTriggerStat(string triggerInfo) { }
}
diff --git a/Assets/StreamingAssets/realtimeStat.json b/Assets/StreamingAssets/realtimeStat.json
new file mode 100644
index 0000000..3aadb29
--- /dev/null
+++ b/Assets/StreamingAssets/realtimeStat.json
@@ -0,0 +1,142 @@
+{
+ "systemID": 10002,
+ "schemeID": 1002,
+ "currentScore": 0.0,
+ "allSubScore": [
+ {
+ "index": 1,
+ "subProcessId": 1,
+ "currentScore": 0.0,
+ "isDone": true
+ },
+ {
+ "index": 2,
+ "subProcessId": 2,
+ "currentScore": 0.0,
+ "isDone": true
+ },
+ {
+ "index": 3,
+ "subProcessId": 3,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 4,
+ "subProcessId": 4,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 5,
+ "subProcessId": 5,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 6,
+ "subProcessId": 6,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 7,
+ "subProcessId": 7,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 8,
+ "subProcessId": 8,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 9,
+ "subProcessId": 9,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 10,
+ "subProcessId": 10,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 11,
+ "subProcessId": 11,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 12,
+ "subProcessId": 12,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 13,
+ "subProcessId": 13,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 14,
+ "subProcessId": 14,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 15,
+ "subProcessId": 15,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 16,
+ "subProcessId": 16,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 17,
+ "subProcessId": 17,
+ "currentScore": 0.0,
+ "isDone": false
+ },
+ {
+ "index": 18,
+ "subProcessId": 18,
+ "currentScore": 0.0,
+ "isDone": false
+ }
+ ],
+ "experiencedScene": [
+ "02_MenuScene",
+ "03_OfficeScene"
+ ],
+ "allToolAndMaterial": [],
+ "allWear": [],
+ "sceneName": "03_OfficeScene",
+ "currentSceneTools": [],
+ "currentSceneTriggers": [
+ {
+ "triggerID": 5005,
+ "triggerName": "手机",
+ "selfPosInScene": {
+ "x": 0.0244421959,
+ "y": 0.885706842,
+ "z": -1.00569367
+ },
+ "selfRotInScene": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "triggerInfo": "{\"downIndex\":\"2\",\"triggerID\":\"5005\",\"triggerName\":\"\\u624B\\u673A\"}"
+ }
+ ],
+ "currentSceneOtherInfo": "{\r\n \"TestPen3list\": [],\r\n \"InSwitchCloseYDList\": [],\r\n \"InSwitchOpenYDList\": [],\r\n \"currentunInstallJieXian\": [],\r\n \"currentInstallJieXian\": [],\r\n \"installCover\": [],\r\n \"currentInstallTestJieXian\": []\r\n}",
+ "experiencedScenes": []
+}
\ 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..b4223da
--- /dev/null
+++ b/Assets/StreamingAssets/realtimeStat.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 61f30bf5680ef6b4590e9fca4c15f30e
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: