using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Rendering.VirtualTexturing; /// /// 步骤状态控制(配置步骤初始状态,断线重连步骤状态加载,步骤状态结果实时提交) /// public class StepStateControl : MonoBehaviour { //场景初始化 //背包初始化 //提示初始化 //设备初始化 //工具和材料初始化 //自定义初始化 public static StepStateControl instance; List m_Steps; private void Awake() { DontDestroyOnLoad(gameObject); instance = this; m_Steps = transform.GetComponentsInChildren(true).ToList(); m_Steps.ForEach(a=> { a.Init(); }); } ///// ///// 注册科目回调(主要切换场景) ///// ///// ///// ///// //public void AddStepState(int systemId, int schemeId, int subProcessId, Action callback) //{ // StepState ss = m_Steps.Find(a => a.systemId == systemId && a.schemeId == schemeId && a.subProcessId== subProcessId); // if(ss!=null) // { // ss.AddResetChangeScene(callback); // } //} /// /// 注册当前科目里步骤里某个需要初始化的状态脚本 /// /// 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 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 //tmp.stepStateBases.ForEach(a => //{ // a.InvokeInitStepStae(); //}); } } /// /// 提交步骤完成状态 /// /// /// /// /// public void SubmitStepState() { } }