106 lines
2.3 KiB
C#
106 lines
2.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using UnityEngine;
|
|
/// <summary>
|
|
/// 方案/设备/系统
|
|
/// </summary>
|
|
public class D_Scheme
|
|
{
|
|
#region 变量
|
|
/// <summary>
|
|
/// 自身Id
|
|
/// </summary>
|
|
public int id;
|
|
|
|
/// <summary>
|
|
/// 方案名称
|
|
/// </summary>
|
|
public string schemeName;
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 存放所有流程
|
|
/// </summary>
|
|
public List<D_Process> processes =new List<D_Process>();
|
|
|
|
/// <summary>
|
|
/// 当前流程
|
|
/// </summary>
|
|
private D_Process currentProcess;
|
|
|
|
/// <summary>
|
|
/// 当前流程
|
|
/// </summary>
|
|
public D_Process CurrentProcess
|
|
{
|
|
get => currentProcess;
|
|
set
|
|
{
|
|
currentProcess = value;
|
|
CurrentProcessId = currentProcess.id;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 当前流程id
|
|
/// </summary>
|
|
private int currentProcessId;
|
|
|
|
/// <summary>
|
|
/// 当前流程id
|
|
/// </summary>
|
|
public int CurrentProcessId
|
|
{
|
|
get => currentProcessId;
|
|
set
|
|
{
|
|
currentProcessId = value;
|
|
GameManager.ProcessMgr.processId = currentProcessId;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化
|
|
/// </summary>
|
|
public void Init()
|
|
{
|
|
if (processes == null || processes.Count == 0)
|
|
return;
|
|
CurrentProcess = processes[0];
|
|
CurrentProcess.Init();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 切换流程
|
|
/// </summary>
|
|
public void HandoverProcess(int processId, int subProcessId, int subProcessStepId)
|
|
{
|
|
if (CurrentProcess != null)
|
|
CurrentProcess.Exit();
|
|
CurrentProcess = GetProcess(processId);
|
|
CurrentProcess.Enter();
|
|
UnityEngine.Debug.Log("切换流程到:" + processId);
|
|
CurrentProcess.HandoverSubProcess(subProcessId, subProcessStepId);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据id获取 流程对象
|
|
/// </summary>
|
|
/// <param name="processId"></param>
|
|
/// <returns></returns>
|
|
private D_Process GetProcess(int processId)
|
|
{
|
|
for (int i = 0; i < processes.Count; i++)
|
|
{
|
|
if (processes[i].id == processId)
|
|
{
|
|
return processes[i];
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|