using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using System.Text;
///
/// 固定值打分
///
public class ScoreObject : ScoreBase
{
///
/// 是否有序
///
[SerializeField]
public ScoreType scoreType;
///
/// 判断标准
///
List list;
public override void Init(string subjectName, int code)
{
base.Init(subjectName, code);
list = transform.GetComponentsInChildren(true).ToList();
if(list==null)
{
Debug.LogError("错误,不能为空");
}
else
{
list.ForEach(a =>
{
a.Init(this);
});
}
}
///
/// 获取评估点对错
///
///
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));
}
}
}
}