using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [System.Serializable] public class DeviceInfor : MonoBehaviour { public DeviceQuery deviceQuery; /// /// 模型编号 /// [Header("模型编号")] public Text modelNum; ///// ///// 设备类型 ///// //[Header("设备类型")] //public Text type; /// /// 设备类型 /// [Header("设备类型")] public Text deviceTypeCode; //public Text type; /// /// 设备类型 /// [Header("设备类型")] public Text deviceType; //public Text type; /// /// 网络等级 /// [Header("网络等级")] public Text networkLevel; /// /// 投运时间 /// [Header("投运时间")] public Text operationTime; /// /// 板卡类型 /// [Header("板卡类型")] public Text cardType; /// /// 板卡槽位(设备位置) /// [Header("板卡槽位")] public Text devicePosition; /// /// 名称 /// [Header("名称")] public Text deviceName; /// /// 编号 /// [Header("编号")] public Text deviceCode; /// /// 状态 /// [Header("状态")] public Text status; /// /// 机柜型号 /// [Header("机柜型号")] public Text machineModel; /// /// 板卡功能 /// [Header("板卡功能")] public Text cardFunction; /// /// 功能说明 /// [Header("功能说明")] public Text functionDescription; /// /// 生产厂家 /// [Header("生产厂家")] public Text manufacturer; /// /// 设备主任(负责人) /// [Header("设备主任")] public Text directorName; /// /// 电话 /// [Header("电话")] public Text phone; //public Text public Button close_bt; /// /// 控制大小 /// public GameObject contentSizeFitter; 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); GameManager.Inst.search_box.SetActive(true); } }); } public void clr() { modelNum.text = null; //type.text = null; deviceTypeCode.text = null; cardType.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; if (deviceQuery.deviceList.deviceTypeCode == "1") deviceTypeCode.text = "传输设备"; else if (deviceQuery.deviceList.deviceTypeCode == "2") deviceTypeCode.text = "交换设备"; else if (deviceQuery.deviceList.deviceTypeCode == "3") deviceTypeCode.text = "电源设备"; else if (deviceQuery.deviceList.deviceTypeCode == "4") deviceTypeCode.text = "综合数据网设备"; else if (deviceQuery.deviceList.deviceTypeCode == "5") deviceTypeCode.text = "光纤配线设备"; else if (deviceQuery.deviceList.deviceTypeCode == "6") deviceTypeCode.text = "数字配线设备"; else if (deviceQuery.deviceList.deviceTypeCode == "7") deviceTypeCode.text = "音频配线设备"; else deviceTypeCode.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; Debug.Log("deviceType:" + deviceQuery.deviceList.cardType); if (deviceQuery.deviceList.cardType == "1") cardType.text = "处理板"; else if (deviceQuery.deviceList.cardType == "2") cardType.text = "交叉板"; else if (deviceQuery.deviceList.cardType == "3") cardType.text = "光口板"; else if (deviceQuery.deviceList.cardType == "4") cardType.text = "线路板"; else if (deviceQuery.deviceList.cardType == "5") cardType.text = "主控板"; else if (deviceQuery.deviceList.cardType == "6") cardType.text = "以太网板"; else if (deviceQuery.deviceList.cardType == "7") cardType.text = "电源板"; else cardType.text = null; if (deviceQuery.deviceList.networkLevel == "1") networkLevel.text = "国网"; else if (deviceQuery.deviceList.networkLevel == "2") networkLevel.text = "华东网"; else if (deviceQuery.deviceList.networkLevel == "3") networkLevel.text = "省网"; else if (deviceQuery.deviceList.networkLevel == "4") networkLevel.text = "地区网"; else deviceType.text = null; devicePosition.text = deviceQuery.deviceList.devicePosition; operationTime.text = deviceQuery.deviceList.operationTime; 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; machineModel.text = deviceQuery.deviceList.machineModel;//机柜型号 functionDescription.text = deviceQuery.deviceList.functionDescription;//功能说明 cardFunction.text = deviceQuery.deviceList.cardFunction;//功能说明 manufacturer.text = deviceQuery.deviceList.manufacturer; directorName.text = deviceQuery.deviceList.directorName; phone.text = CombineJSON.Decrypt(deviceQuery.deviceList.phone); UIShow(deviceQuery.deviceList.deviceType == "3"); } //类型:1-机柜;2-设备 //private String type; /// /// /// /// 是否是机柜 private void UIShow(bool isType) { //机柜显示 deviceCode.transform.parent.parent.gameObject.SetActive(!isType); deviceTypeCode.transform.parent.parent.gameObject.SetActive(!isType); networkLevel.transform.parent.parent.gameObject.SetActive(!isType); functionDescription.transform.parent.parent.gameObject.SetActive(!isType); operationTime.transform.parent.parent.gameObject.SetActive(!isType); manufacturer.transform.parent.parent.gameObject.SetActive(!isType); directorName.transform.parent.parent.gameObject.SetActive(!isType); phone.transform.parent.parent.gameObject.SetActive(!isType); //设备显示 devicePosition.transform.parent.parent.gameObject.SetActive(isType); cardType.transform.parent.parent.gameObject.SetActive(isType); cardFunction.transform.parent.parent.gameObject.SetActive(isType); //都显示 deviceName.transform.parent.parent.gameObject.SetActive(true); machineModel.transform.parent.parent.gameObject.SetActive(true); status.transform.parent.parent.gameObject.SetActive(true); deviceName.transform.parent.parent.GetComponent().text = isType ? "板卡名称:":"设备名称:";//gameObject.SetActive(isType); machineModel.transform.parent.parent.GetComponent().text = isType ? "板卡型号:" : "设备型号:"; status.transform.parent.parent.GetComponent().text = isType ? "板卡状态:" : "运行状态:"; contentSizeFitter.SetActive(true); Invoke("Add", 0.5f); } void Add() { contentSizeFitter.SetActive(false); } } /// /// 当前设备类型 /// public enum DeviceType { dev1, dev2, dev3 } public class Contact { public List strings; }