diff --git a/Assets/Scenes/01_InitScene.unity b/Assets/Scenes/01_InitScene.unity index b8b4b16..6f9353d 100644 --- a/Assets/Scenes/01_InitScene.unity +++ b/Assets/Scenes/01_InitScene.unity @@ -790,7 +790,7 @@ GameObject: m_Component: - component: {fileID: 559582437} m_Layer: 0 - m_Name: 10001 + m_Name: 10002 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Scripts/Project/CXX/StepStateBase.cs b/Assets/Scripts/Project/CXX/StepStateBase.cs index 731b234..4cabe87 100644 --- a/Assets/Scripts/Project/CXX/StepStateBase.cs +++ b/Assets/Scripts/Project/CXX/StepStateBase.cs @@ -23,6 +23,7 @@ public class StepStateBase : MonoBehaviour public void AddResetFunction(Action callback) { this.callback = callback; + Debug.Log("步骤状态注册成功:" + gameObject.name); } /// @@ -32,6 +33,7 @@ public class StepStateBase : MonoBehaviour { if (callback != null) { + Debug.Log("步骤初始化:" + gameObject.name); callback(initStatePara); } } diff --git a/Assets/Scripts/Project/CXX/StepStateControl.cs b/Assets/Scripts/Project/CXX/StepStateControl.cs index b35c9a6..660d89b 100644 --- a/Assets/Scripts/Project/CXX/StepStateControl.cs +++ b/Assets/Scripts/Project/CXX/StepStateControl.cs @@ -1,7 +1,9 @@ +using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.Rendering.VirtualTexturing; /// /// 步骤状态控制(配置步骤初始状态,断线重连步骤状态加载,步骤状态结果实时提交) @@ -26,17 +28,38 @@ public class StepStateControl : MonoBehaviour m_Steps.ForEach(a=> { a.Init(); }); } + /// + /// 注册当前科目里步骤里某个需要初始化的状态脚本 + /// + /// + public void AddStepStateBase(int[] subProcessIds,string objName,Action callback) + { + List ss=m_Steps.FindAll(a => a.systemId == GameManager.Instance.systemId && a.schemeId == GameManager.RunModelMgr.schemeID && subProcessIds.Contains(a.subProcessId)); + if (ss.Count >0) + { + ss.ForEach(a=> + { + StepStateBase sb = a.stepStateBases.Find(a => a.gameObject.name == objName); + if (sb != null) + { + sb.AddResetFunction(callback); + } + }); + } + } + /// /// 调用初始化步骤 /// /// /// /// - public void InitStepState(int systemId, int schemeId, int subProcessId) + public void InvokeInitStepState(int systemId, int schemeId, int subProcessId) { StepState tmp=m_Steps.Find(a => a.systemId == systemId && a.schemeId == schemeId && a.subProcessId == subProcessId); if (tmp != null) { + Debug.Log("初始化步骤"); //跳场景 tmp.InvokeChangeScene(); //初始化base diff --git a/Assets/Scripts/Project/DataClass/ProcessData/D_SubProcessStep.cs b/Assets/Scripts/Project/DataClass/ProcessData/D_SubProcessStep.cs index 372b393..f916fd6 100644 --- a/Assets/Scripts/Project/DataClass/ProcessData/D_SubProcessStep.cs +++ b/Assets/Scripts/Project/DataClass/ProcessData/D_SubProcessStep.cs @@ -66,6 +66,7 @@ public class D_SubProcessStep : I_Enter, I_Exit { //GetTriggerID(); UnityEngine.Debug.Log("杩涘叆褰撳墠瀛愭祦绋嬫楠:" + id + "_" + subProcessStepName); + StepStateControl.instance.InvokeInitStepState(GameManager.Instance.systemId, schemeId, subProcessId); } /// /// 閫鍑 diff --git a/Assets/Scripts/Project/Objects/Device/Device_Mobile.cs b/Assets/Scripts/Project/Objects/Device/Device_Mobile.cs index 4624829..a6037ae 100644 --- a/Assets/Scripts/Project/Objects/Device/Device_Mobile.cs +++ b/Assets/Scripts/Project/Objects/Device/Device_Mobile.cs @@ -14,6 +14,11 @@ public class Device_Mobile : MonoBehaviour private void Awake() { _highlight = GetComponent(); + //注册状态初始化回调 + StepStateControl.instance.AddStepStateBase(new int[]{3001,3002 },"手机", para => + { + downIndex = int.Parse(para); + }); } private void Start() {