using System.Collections; using TMPro; using Blue; using GHZLangChao; using SC.XR.Unity; using UnityEngine; using UnityEngine.UI; public class ShowXunJian_UIItem : MonoBehaviour, IController { [SerializeField] private Button mNormal_Btn; //正常 [SerializeField] private Button Warning_Btn; //异常 [SerializeField] private GameObject NormalBG1_go; [SerializeField] private GameObject NormalBG2_go; [SerializeField] private GameObject WarningBG1_go; [SerializeField] private GameObject WarningBG2_go; [SerializeField] private GameObject NormalPanel_go; [SerializeField] private GameObject WarningPanel_go; [SerializeField] private SCInputField LabelText_Input; [SerializeField] private GameObject mErrorBtn_go; public Image Screenshot_0_Image; public Image Screenshot_1_Image; public Image Screenshot_2_Image; private void Start() { mNormal_Btn.onClick.AddListener(NormalClick); Warning_Btn.onClick.AddListener(WarningClick); LabelText_Input.onValueChanged.AddListener(NewStr => mOutliers = NewStr); } private void OnEnable() { StartCoroutine(SetCurrentUIItem()); } private IEnumerator SetCurrentUIItem() { yield return new WaitForSeconds(0.01f); StartXunJian.Instance.currentUIItem = this; } private int mItemID; // 检查项目的编号 1-12 private bool mNormal = true; //是否正常 private string mOutliers = ""; // 标签 private int mInspectionId; // 巡检编号,巡检开始时返回的id public void Set() { this.GetService().Set(mItemID, mNormal, mOutliers, mInspectionId, new string[3] { "1", "2", "3" }); } public void InitData(int ItemID, int InspectionId, InspectionStep InspectionStep = null) { mItemID = ItemID; mInspectionId = InspectionId; if (InspectionStep != null) { if (InspectionStep.normal) NormalClick(); else WarningClick(); if (!string.IsNullOrWhiteSpace(InspectionStep.outliers)) { LabelText_Input.text = InspectionStep.outliers; mOutliers = InspectionStep.outliers; } foreach (var imageIndex in InspectionStep.images) { LangChaoMinIo.Instance.getFile(this.GetService().InspectionInfo.id , mItemID.ToString(), imageIndex, Texture2D => { }); } } } private float mErrorBtn_go_offset = 319; public void SetlabelBtnCount(string[] labelList) { foreach (string label in labelList) { GameObject go = Instantiate(mErrorBtn_go, mErrorBtn_go.transform.parent); go.GetComponentInChildren().text = label; go.name = label; Vector3 v3 = mErrorBtn_go.transform.localPosition; v3.x += mErrorBtn_go_offset; go.transform.localPosition = v3; go.SetActive(true); go.GetComponent