using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using DG.Tweening; using CCS.App; public class InspectList_Button : MonoBehaviour { public TextMesh text_num, text_name, text_isOk; public Material material_Undetected, material_To_be_tested, material_qualified, material_Unqualified; public int status;//状态 public int jiluStaatus; public bool isChange;//是否在修改状态下 public string content; public string mainSubtasks;//标题 public string endResultViewPos;//生成结算面板 的结束位置 public int viewTag;//标签 1 2 用来判断 该条用语音还是 扫码 1扫码 二 语音 public string code;//料号 public StartInspect startInspect = StartInspect.Undetected; public void OnSelect(bool isSelect) { Debug.Log("选择了"+ isSelect); if (isSelect) { this.GetComponent().material = material_To_be_tested; text_isOk.text = "待结测"; } else { SetBtnState(); } } //void Update() //{ // switch (status) // { // case 0://未检测 // startInspect = StartInspect.Undetected; // break; // case 1://待检测 // startInspect = StartInspect.To_be_tested; // break; // case 2://合格 // startInspect = StartInspect.qualified; // break; // case 3://不合格 // startInspect = StartInspect.Unqualified; // break; // } // if (startInspect == StartInspect.Undetected) // { // this.GetComponent().material = material_Undetected; // text_isOk.text = "未检测"; // } // else if (startInspect == StartInspect.To_be_tested) // { // this.GetComponent().material = material_To_be_tested; // text_isOk.text = "待结测"; // } // else if (startInspect == StartInspect.qualified) // { // this.GetComponent().material = material_qualified; // text_isOk.text = "合格"; // } // else if (startInspect == StartInspect.Unqualified) // { // this.GetComponent().material = material_Unqualified; // text_isOk.text = "不合格"; // } //} void OnEnable() { SetBtnState(); //switch (status) //{ // case 0://未检测 // startInspect = StartInspect.Undetected; // break; // case 1://待检测 // startInspect = StartInspect.To_be_tested; // break; // case 2://合格 // startInspect = StartInspect.qualified; // break; // case 3://不合格 // startInspect = StartInspect.Unqualified; // break; //} //if (startInspect == StartInspect.Undetected) //{ // this.GetComponent().material = material_Undetected; // text_isOk.text = "未检测"; //} //else if (startInspect == StartInspect.To_be_tested) //{ // this.GetComponent().material = material_To_be_tested; // text_isOk.text = "待结测"; //} //else if (startInspect == StartInspect.qualified) //{ // this.GetComponent().material = material_qualified; // text_isOk.text = "合格"; //} //else if (startInspect == StartInspect.Unqualified) //{ // this.GetComponent().material = material_Unqualified; // text_isOk.text = "不合格"; //} } public void SetBtnState() { switch (startInspect) { case StartInspect.Undetected: this.GetComponent().material = material_Undetected; text_isOk.text = "未检测"; break; case StartInspect.To_be_tested: break; case StartInspect.qualified: this.GetComponent().material = material_qualified; text_isOk.text = "合格"; break; case StartInspect.Unqualified: this.GetComponent().material = material_Unqualified; text_isOk.text = "不合格"; break; default: break; } } }