Browse Source

刀片机数据显示

DGJ 1 year ago
parent
commit
b6b4e92e98

+ 12 - 1
Assets/Game/Blue/Controller/Item/DeviceInfo_Item.cs

@@ -3,6 +3,7 @@ using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using UnityEngine;
 using UnityEngine.UI;
+using TMPro;
 
 namespace GHZLangChao
 {
@@ -11,6 +12,10 @@ namespace GHZLangChao
         private DeviceParameters DeviceParameter;
         public Transform currentPos;
         public DataItem item;
+        public TMP_Text deviceName;
+        public TMP_Text type;
+        public TMP_Text model;
+        public TMP_Text ip;
 
         [SerializeField] private Button DetailsBtn;
 
@@ -26,6 +31,12 @@ namespace GHZLangChao
             this.DeviceParameter = DeviceParameter;
             this.i = i;
             this.item = item;
+
+            deviceName.text = DeviceParameter.cabinetNumber;
+            type.text = DeviceParameter.deviceType;
+            model.text = DeviceParameter.deviceBrand;
+            ip.text = DeviceParameter.managementIP;
+
         }
 
         public void InitNull()
@@ -35,7 +46,7 @@ namespace GHZLangChao
 
         private void ClickDetails()
         {
-            DeviceParameter.deviceModel = "NetView400" + i;
+          //  DeviceParameter.deviceModel = "NetView400" + i;
 
             //  Vector3 currentPos = transform.position; // 为了将详情面板移动到面前
 

+ 5 - 1
Assets/Game/PrefabTemplate/DeviceInfo.prefab

@@ -100,6 +100,10 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   currentPos: {fileID: 2284758589063455848}
   item: {fileID: 0}
+  deviceName: {fileID: 265063370514153538}
+  type: {fileID: 3248626657665077643}
+  model: {fileID: 3699973549033135167}
+  ip: {fileID: 5578282032324244354}
   DetailsBtn: {fileID: 2794290623388440201}
 --- !u!114 &2794290623388440201
 MonoBehaviour:
@@ -904,7 +908,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_text: 1
+  m_text: 0
   m_isRightToLeft: 0
   m_fontAsset: {fileID: 11400000, guid: 53b37c1f568195149b410dacded90c09, type: 2}
   m_sharedMaterial: {fileID: 1738077909898060448, guid: 53b37c1f568195149b410dacded90c09, type: 2}

+ 2 - 1
Assets/Scripts/Data/DataItem.cs

@@ -71,10 +71,11 @@ public class DataItem : MonoBehaviour
     public List<DeviceInfo_Item> DeviceInfoList = new List<DeviceInfo_Item>();
     public void SetDeviceParametersData(List<DeviceParameters> DeviceParameterList)
     {
+        Debug.Log(DeviceParameterList.Count);
         this.DeviceParameterList = DeviceParameterList;
         for (int i = 0; i < DeviceInfoList.Count;i++)
         {
-            if (DeviceParameterList[i] == null)
+            if (DeviceParameterList[i].cabinetNumber == null||string.IsNullOrEmpty(DeviceParameterList[i].cabinetNumber))
                 DeviceInfoList[i].InitNull();
             else
                 DeviceInfoList[i].Init(DeviceParameterList[i], i, this);// 数据只有一个,所以都是0

+ 1 - 1
Assets/Scripts/Data/MachineRoomData.cs

@@ -325,7 +325,7 @@ public class DeviceParameters
     /// <summary>
     ///  设备ID
     /// </summary>
-    public string deviceId { get; set; }
+    public string id { get; set; }
     /// <summary>
     /// 设备名称
     /// </summary>