1118OPSSNew/Assets/Zion/Scripts/Score/ScoreObject.cs

69 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using System.Text;
/// <summary>
/// 固定值打分
/// </summary>
public class ScoreObject : ScoreBase
{
/// <summary>
/// 是否有序
/// </summary>
[SerializeField]
public ScoreType scoreType;
/// <summary>
/// 判断标准
/// </summary>
List<ScoreJudge_FixedValue> list;
public override void Init(string subjectName, int code)
{
base.Init(subjectName, code);
list = transform.GetComponentsInChildren<ScoreJudge_FixedValue>(true).ToList();
if(list==null)
{
Debug.LogError("错误,不能为空");
}
else
{
list.ForEach(a =>
{
a.Init(this);
});
}
}
/// <summary>
/// 获取评估点对错
/// </summary>
/// <returns></returns>
public override void SetIsRight()
{
if (!IsRight)
{
switch (scoreType)
{
case ScoreType.:
IsRight= list.All(a => a.Isright);
break;
case ScoreType.:
IsRight= list.All(a => a.Isright && a.index == list.IndexOf(a));
break;
}
if(IsRight)
{
//评估点 | 科目物体名称 | 评估点序号 | 当前index
MyNetMQClient.instance.Send(LoadManage.Instance.currentRoomArea, 70, Encoding.UTF8.GetBytes("评估点|"+transform.parent.name+"|"+code+"|"+Completed));
}
}
}
}