288 lines
8.8 KiB
C#
288 lines
8.8 KiB
C#
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
[System.Serializable]
|
||
public class DeviceInfor : MonoBehaviour
|
||
{
|
||
|
||
public DeviceQuery deviceQuery;
|
||
/// <summary>
|
||
/// 模型编号
|
||
/// </summary>
|
||
[Header("模型编号")]
|
||
public Text modelNum;
|
||
///// <summary>
|
||
///// 设备类型
|
||
///// </summary>
|
||
//[Header("设备类型")]
|
||
//public Text type;
|
||
/// <summary>
|
||
/// 设备类型
|
||
/// </summary>
|
||
[Header("设备类型")]
|
||
public Text deviceTypeCode;
|
||
//public Text type;
|
||
/// <summary>
|
||
/// 设备类型
|
||
/// </summary>
|
||
[Header("设备类型")]
|
||
public Text deviceType;
|
||
//public Text type;
|
||
/// <summary>
|
||
/// 网络等级
|
||
/// </summary>
|
||
[Header("网络等级")]
|
||
public Text networkLevel;
|
||
/// <summary>
|
||
/// 投运时间
|
||
/// </summary>
|
||
[Header("投运时间")]
|
||
public Text operationTime;
|
||
/// <summary>
|
||
/// 板卡类型
|
||
/// </summary>
|
||
[Header("板卡类型")]
|
||
public Text cardType;
|
||
/// <summary>
|
||
/// 板卡槽位(设备位置)
|
||
/// </summary>
|
||
[Header("板卡槽位")]
|
||
public Text devicePosition;
|
||
/// <summary>
|
||
/// 名称
|
||
/// </summary>
|
||
[Header("名称")]
|
||
public Text deviceName;
|
||
/// <summary>
|
||
/// 编号
|
||
/// </summary>
|
||
[Header("编号")]
|
||
public Text deviceCode;
|
||
/// <summary>
|
||
/// 状态
|
||
/// </summary>
|
||
[Header("状态")]
|
||
public Text status;
|
||
|
||
/// <summary>
|
||
/// 机柜型号
|
||
/// </summary>
|
||
[Header("机柜型号")]
|
||
public Text machineModel;
|
||
/// <summary>
|
||
/// 板卡功能
|
||
/// </summary>
|
||
[Header("板卡功能")]
|
||
public Text cardFunction;
|
||
/// <summary>
|
||
/// 功能说明
|
||
/// </summary>
|
||
[Header("功能说明")]
|
||
public Text functionDescription;
|
||
/// <summary>
|
||
/// 生产厂家
|
||
/// </summary>
|
||
[Header("生产厂家")]
|
||
public Text manufacturer;
|
||
/// <summary>
|
||
/// 设备主任(负责人)
|
||
/// </summary>
|
||
[Header("设备主任")]
|
||
public Text directorName;
|
||
/// <summary>
|
||
/// 电话
|
||
/// </summary>
|
||
[Header("电话")]
|
||
public Text phone;
|
||
|
||
//public Text
|
||
|
||
public Button close_bt;
|
||
/// <summary>
|
||
/// 控制大小
|
||
/// </summary>
|
||
public GameObject contentSizeFitter;
|
||
|
||
public void OnEnable()
|
||
{
|
||
clr();
|
||
deviceQuery = new DeviceQuery();
|
||
deviceQuery = GameManager.Inst.now_CK_Device.GetComponent<DeviceQuery>();
|
||
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;
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="isType">是否是机柜</param>
|
||
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>().text = isType ? "板卡名称:":"设备名称:";//gameObject.SetActive(isType);
|
||
machineModel.transform.parent.parent.GetComponent<Text>().text = isType ? "板卡型号:" : "设备型号:";
|
||
status.transform.parent.parent.GetComponent<Text>().text = isType ? "板卡状态:" : "运行状态:";
|
||
|
||
contentSizeFitter.SetActive(true);
|
||
Invoke("Add", 0.5f);
|
||
}
|
||
|
||
void Add()
|
||
{
|
||
contentSizeFitter.SetActive(false);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 当前设备类型
|
||
/// </summary>
|
||
public enum DeviceType
|
||
{
|
||
dev1, dev2, dev3
|
||
}
|
||
|
||
public class Contact
|
||
{
|
||
public List<string> strings;
|
||
} |