66 lines
2.0 KiB
C#
66 lines
2.0 KiB
C#
using System.Collections.Generic;
|
||
using Framework.ProcessMode;
|
||
using Newtonsoft.Json;
|
||
|
||
namespace DefaultNamespace.ProcessMode
|
||
{
|
||
/// <summary>
|
||
/// 主流程
|
||
/// </summary>
|
||
public class ProcessStep
|
||
{
|
||
public string StepDescription { get; set; } // 步骤描述
|
||
public List<ProcessStepDescription> Actions { get; private set; } // 动作列表
|
||
public bool IsCompleted { get; set; } // 是否已经完成
|
||
|
||
public int StepNumber { get; set; }// 步骤编号
|
||
|
||
/// <summary>
|
||
/// 步骤得分
|
||
/// </summary>
|
||
[JsonProperty("Score")]
|
||
public float Score { get; set; } // 步骤得分
|
||
|
||
/// <summary>
|
||
/// 默认构造函数,用于JSON反序列化
|
||
/// </summary>
|
||
public ProcessStep()
|
||
{
|
||
StepDescription = "";
|
||
Actions = new List<ProcessStepDescription>();
|
||
IsCompleted = false;
|
||
StepNumber = 0;
|
||
Score = 0.0f;
|
||
}
|
||
|
||
public ProcessStep(string stepDescription, List<ProcessStepDescription> actions)
|
||
{
|
||
StepDescription = stepDescription;
|
||
Actions = actions;
|
||
IsCompleted = false;
|
||
Score = 0.0f; // 默认步骤得分为0
|
||
}
|
||
|
||
/// <summary>
|
||
/// 带分数的构造函数
|
||
/// </summary>
|
||
/// <param name="stepDescription">步骤描述</param>
|
||
/// <param name="actions">动作列表</param>
|
||
/// <param name="score">步骤得分</param>
|
||
public ProcessStep(string stepDescription, List<ProcessStepDescription> actions, float score)
|
||
{
|
||
StepDescription = stepDescription;
|
||
Actions = actions;
|
||
IsCompleted = false;
|
||
Score = score;
|
||
}
|
||
|
||
public void PlayAnimation(int index)
|
||
{
|
||
if (index >= 0 && index < Actions.Count)
|
||
{
|
||
Actions[index].Action?.Invoke(); // 执行动画
|
||
}
|
||
}
|
||
}
|
||
} |