123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class InspectSettlementPanel : MonoBehaviour
- {
- // Use this for initialization
- public TextMesh tagText_WaiXiang, tagTextFuJian, tagText_PeiZhi;//结果面板小标题
- public Transform ResultViewListParent_WaiXiang;//结果列表外箱位置
- public Transform WaiXiangParent;
- public Transform ResultViewListParent_FuJian;//结果列表附件位置
- public Transform FuJianParent;
- public Transform ResultViewListParent_PeiZhi;//结果列表配置位置
- public Transform PeiZhiParent;
- public GameObject resultView;
- //public ReadXMLWaiXiang readXML_WaiXiang;
- //public ReadXMLFuJian readXML_FuJian;
- //public ReadXMLPeiZhi readXML_PeiZhi;
- protected Transform startPos; //生成的位置
- public InspectListPanel inspectList;
- private string waiXiang = "外箱";
- private string fuJiang = "附件";
- private string peiZhi = "配置";
- public TextMesh EquipmentType;//设备型号
- public TextMesh CheckQuantity;//检查数量
- public TextMesh pass_Num;//检查合格通过数量
- public TextMesh pass_No_Num;//检查不合格数量
- public TextMesh player_Name;//检查人员名单
- public TextMesh player_WorkNumber;//检查人员工号
- public TextMesh CheckTimer;//检查时间
- private int passNum;
- private int passNoNum;
-
-
- void Start()
- {
- resultView = Resources.Load("ResultView") as GameObject;
- MakeResultView();
- CheckQuantity.text = "检查项目: " + inspectList.taskList.Count.ToString() + " 项目";
- GetInspectList_ButtonPassNum();
- pass_Num.text = passNum.ToString();
- pass_Num.color = Color.green;
- pass_No_Num.text = passNoNum.ToString();
- pass_No_Num.color = Color.red;
- }
- /// <summary>
- /// 获取合格的数量
- /// </summary>
- void GetInspectList_ButtonPassNum()
- {
- for (int i = 0; i < inspectList.taskList.Count; i++)
- {
- if (inspectList.taskList[i].GetComponent<InspectList_Button>().status == 2)
- {
- passNum++;
- }
- else if (inspectList.taskList[i].GetComponent<InspectList_Button>().status == 3)
- {
- passNoNum++;
- }
- }
- }
- // Update is called once per frame
- void MakeResultView()
- {
- for (int i = 0; i < inspectList.taskList.Count; i++)
- {
- if (inspectList.taskList[i].GetComponent<InspectList_Button>().mainSubtasks == waiXiang)
- {
- if (WaiXiangParent.transform.Find("ResultView" + inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text) == null)
- {
- startPos = ResultViewListParent_WaiXiang.Find(inspectList.taskList[i].GetComponent<InspectList_Button>().endResultViewPos).gameObject.transform;
- GameObject obj = Instantiate(resultView, new Vector3(startPos.position.x, startPos.position.y, startPos.position.z), Quaternion.Euler(0, 0, 0));
- obj.transform.parent = WaiXiangParent.transform;
- obj.transform.localEulerAngles = new Vector3(0f, -180f, 0f);
- obj.name = "ResultView" + inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text;
- obj.GetComponent<inspectResultList_Button>().SetText_ID(inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text);
- obj.GetComponent<inspectResultList_Button>().SetText_Tag(inspectList.taskList[i].GetComponent<InspectList_Button>().text_name.text);
- obj.GetComponent<inspectResultList_Button>().SetText_Status(inspectList.taskList[i].GetComponent<InspectList_Button>().startInspect);
- tagText_WaiXiang.text = inspectList.taskList[i].GetComponent<InspectList_Button>().mainSubtasks + "检查结果";
- }
- }
- if (inspectList.taskList[i].GetComponent<InspectList_Button>().mainSubtasks == fuJiang)
- {
- if (FuJianParent.transform.Find("ResultView" + inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text) == null)
- {
- startPos = ResultViewListParent_FuJian.Find(inspectList.taskList[i].GetComponent<InspectList_Button>().endResultViewPos).gameObject.transform;
- GameObject obj = Instantiate(resultView, new Vector3(startPos.position.x, startPos.position.y, startPos.position.z), Quaternion.Euler(0, 0, 0));
- obj.transform.parent = FuJianParent.transform;
- obj.transform.localEulerAngles = new Vector3(0f, -180f, 0f);
- obj.name = "ResultView" + inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text;
- obj.GetComponent<inspectResultList_Button>().SetText_ID(inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text);
- obj.GetComponent<inspectResultList_Button>().SetText_Tag(inspectList.taskList[i].GetComponent<InspectList_Button>().text_name.text);
- obj.GetComponent<inspectResultList_Button>().SetText_Status(inspectList.taskList[i].GetComponent<InspectList_Button>().startInspect);
- tagTextFuJian.text = inspectList.taskList[i].GetComponent<InspectList_Button>().mainSubtasks + "检查结果";
- }
- }
- if (inspectList.taskList[i].GetComponent<InspectList_Button>().mainSubtasks == peiZhi)
- {
- if (PeiZhiParent.transform.Find("ResultView" + inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text) == null)
- {
- tagText_PeiZhi.text = inspectList.taskList[i].GetComponent<InspectList_Button>().mainSubtasks + "检查结果";
- startPos = ResultViewListParent_PeiZhi.Find(inspectList.taskList[i].GetComponent<InspectList_Button>().endResultViewPos).gameObject.transform;
- GameObject obj = Instantiate(resultView, new Vector3(startPos.position.x, startPos.position.y, startPos.position.z), Quaternion.Euler(0, 0, 0));
- obj.transform.parent = PeiZhiParent.transform;
- obj.transform.localEulerAngles = new Vector3(0f, -180f, 0f);
- obj.name = "ResultView" + inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text;
- obj.GetComponent<inspectResultList_Button>().SetText_ID(inspectList.taskList[i].GetComponent<InspectList_Button>().text_num.text);
- obj.GetComponent<inspectResultList_Button>().SetText_Tag(inspectList.taskList[i].GetComponent<InspectList_Button>().text_name.text);
- obj.GetComponent<inspectResultList_Button>().SetText_Status(inspectList.taskList[i].GetComponent<InspectList_Button>().startInspect);
- }
- }
- }
- }
- }
|