using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [System.Serializable] public class DeviceInfor : MonoBehaviour { ///// ///// 设备类型 ///// //[Header("设备类型")] public DeviceType devtype; ///// ///// 端口位置集 ///// //[Header("端口位置集")] public List ports=new List(); ///// ///// 区域 ///// //[Header("区域")] public string area; ///// ///// 列 ///// //[Header("列")] public string row; ///// ///// 层 ///// //[Header("层")] public string tier; ///// ///// 当前设备所有端口线的信息 ///// //public List> lineInfors; public DeviceQuery deviceQuery; public Text modelNum; public Text type; public Text deviceType; public Text devicePosition; public Text deviceName; public Text deviceCode; public Text status; /// /// 生产厂家 /// public Text manufacturer; /// /// 负责人 /// public Text directorName; /// /// /// public Text phone; //public Text public Button close_bt; public void OnEnable() { clr(); deviceQuery = new DeviceQuery(); deviceQuery = GameManager.Inst.now_CK_Device.GetComponent(); syncInfo(); } private void Start() { close_bt.onClick.AddListener(() => { gameObject.SetActive(false); GameManager.Inst.now_CK_Device = null; if (CabinetUIManager.Instance.current_menu == Menu.M_数字孪生_场景管理) GameManager.Inst.objectToShow_add.SetActive(true); }); } public void clr() { modelNum.text = null; type.text = null; deviceType.text = null; devicePosition.text = null; deviceName.text = null; deviceCode.text = null; status.text = null; manufacturer.text = null; directorName.text = null; phone.text = null; } public void syncInfo() { modelNum.text = deviceQuery.deviceList.modelNum; deviceType.text = deviceQuery.deviceList.deviceType; if (deviceQuery.deviceList.type == "1") type.text = "机柜"; else if (deviceQuery.deviceList.type == "2") type.text = "设备"; else type.text = null; if (deviceQuery.deviceList.deviceType == "1") deviceType.text = "机框"; else if (deviceQuery.deviceList.deviceType == "2") deviceType.text = "机槽"; else if (deviceQuery.deviceList.deviceType == "3") deviceType.text = "板卡"; else deviceType.text = null; devicePosition.text = deviceQuery.deviceList.devicePosition; deviceName.text = deviceQuery.deviceList.deviceName; deviceCode.text = deviceQuery.deviceList.deviceCode; if (deviceQuery.deviceList.status == "1") status.text = "正常"; else if (deviceQuery.deviceList.status == "0") status.text = "禁用"; else status.text = null; manufacturer.text = deviceQuery.deviceList.manufacturer; directorName.text = deviceQuery.deviceList.directorName; phone.text = deviceQuery.deviceList.phone; } } /// /// 当前设备类型 /// public enum DeviceType { dev1, dev2, dev3 } public class Contact { public List strings; }