初始化步骤
This commit is contained in:
parent
8c215ddeac
commit
5f4f46238f
|
@ -790,7 +790,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 559582437}
|
- component: {fileID: 559582437}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: 10001
|
m_Name: 10002
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class StepStateBase : MonoBehaviour
|
||||||
public void AddResetFunction(Action<string> callback)
|
public void AddResetFunction(Action<string> callback)
|
||||||
{
|
{
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
Debug.Log("步骤状态注册成功:" + gameObject.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -32,6 +33,7 @@ public class StepStateBase : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
{
|
{
|
||||||
|
Debug.Log("步骤初始化:" + gameObject.name);
|
||||||
callback(initStatePara);
|
callback(initStatePara);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering.VirtualTexturing;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 步骤状态控制(配置步骤初始状态,断线重连步骤状态加载,步骤状态结果实时提交)
|
/// 步骤状态控制(配置步骤初始状态,断线重连步骤状态加载,步骤状态结果实时提交)
|
||||||
|
@ -26,17 +28,38 @@ public class StepStateControl : MonoBehaviour
|
||||||
m_Steps.ForEach(a=> { a.Init(); });
|
m_Steps.ForEach(a=> { a.Init(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册当前科目里步骤里某个需要初始化的状态脚本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objName"></param>
|
||||||
|
public void AddStepStateBase(int[] subProcessIds,string objName,Action<string> callback)
|
||||||
|
{
|
||||||
|
List<StepState> 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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 调用初始化步骤
|
/// 调用初始化步骤
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="process"></param>
|
/// <param name="process"></param>
|
||||||
/// <param name="subProcess"></param>
|
/// <param name="subProcess"></param>
|
||||||
/// <param name="step"></param>
|
/// <param name="step"></param>
|
||||||
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);
|
StepState tmp=m_Steps.Find(a => a.systemId == systemId && a.schemeId == schemeId && a.subProcessId == subProcessId);
|
||||||
if (tmp != null)
|
if (tmp != null)
|
||||||
{
|
{
|
||||||
|
Debug.Log("初始化步骤");
|
||||||
//跳场景
|
//跳场景
|
||||||
tmp.InvokeChangeScene();
|
tmp.InvokeChangeScene();
|
||||||
//初始化base
|
//初始化base
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class D_SubProcessStep : I_Enter, I_Exit
|
||||||
{
|
{
|
||||||
//GetTriggerID();
|
//GetTriggerID();
|
||||||
UnityEngine.Debug.Log("进入当前子流程步骤:" + id + "_" + subProcessStepName);
|
UnityEngine.Debug.Log("进入当前子流程步骤:" + id + "_" + subProcessStepName);
|
||||||
|
StepStateControl.instance.InvokeInitStepState(GameManager.Instance.systemId, schemeId, subProcessId);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 退出
|
/// 退出
|
||||||
|
|
|
@ -14,6 +14,11 @@ public class Device_Mobile : MonoBehaviour
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_highlight = GetComponent<HighlightEffect>();
|
_highlight = GetComponent<HighlightEffect>();
|
||||||
|
//注册状态初始化回调
|
||||||
|
StepStateControl.instance.AddStepStateBase(new int[]{3001,3002 },"手机", para =>
|
||||||
|
{
|
||||||
|
downIndex = int.Parse(para);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue