8.9
This commit is contained in:
parent
1c43c766e6
commit
f529c7b946
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 08b9cbc74133db74f91e0bc265ec8ae1
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,37 +1,70 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using static DeviceQuery;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEditor;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine.UIElements;
|
||||
using static GameManager;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
static GameManager _inst;
|
||||
public static GameManager Inst;
|
||||
|
||||
public DeviceQuery.Root root;
|
||||
/// <summary>
|
||||
/// 场景所有机柜
|
||||
/// 接口地址
|
||||
/// </summary>
|
||||
public List<DeviceQuery> Cabinets;
|
||||
webURL Jk_URL;
|
||||
[Header("设备-查询接口")] public DeviceQuery.Root root_AllDevice;
|
||||
|
||||
///// <summary>
|
||||
///// 场景所有机柜
|
||||
///// </summary>
|
||||
// public List<GameObject> Cabinets_go;
|
||||
/// <summary>
|
||||
/// 场景所有机柜信息
|
||||
/// </summary>
|
||||
[Header("场景所有机柜")] public List<DeviceQuery> Cabinets;
|
||||
|
||||
/// <summary>
|
||||
/// 场景所有机框
|
||||
/// </summary>
|
||||
public List<DeviceQuery> Racks;
|
||||
[Header("场景所有机框信息")] public List<GameObject> Racks_go;
|
||||
/// <summary>
|
||||
/// 场景所有机框信息
|
||||
/// </summary>
|
||||
public List<DeviceList> Racks;
|
||||
|
||||
/// <summary>
|
||||
/// 场景所有机槽
|
||||
/// </summary>
|
||||
public List<DeviceQuery> MachineSlots;
|
||||
[Header("场景所有机槽信息")] public List<GameObject> MachineSlots_go;
|
||||
/// <summary>
|
||||
/// 场景所有机槽信息
|
||||
/// </summary>
|
||||
public List<DeviceList> MachineSlots;
|
||||
|
||||
/// <summary>
|
||||
/// 场景所有板卡
|
||||
/// </summary>
|
||||
public List<DeviceQuery> TmsCards;
|
||||
[Header("场景所有板卡信息")] public List<GameObject> TmsCards_go;
|
||||
/// <summary>
|
||||
/// 场景所有板卡信息
|
||||
/// </summary>
|
||||
public List<DeviceList> TmsCards;
|
||||
|
||||
[Header(""), Header("设备-查询接口")] public PortQuery.Root root_AllPort;
|
||||
|
||||
/// <summary>
|
||||
/// 场景所有端口
|
||||
/// </summary>
|
||||
[Header("场景所有端口信息")] public List<GameObject> TmsPorts_go;
|
||||
/// <summary>
|
||||
/// 场景所有端口信息
|
||||
/// </summary>
|
||||
public List<PortQuery> TmsPorts;
|
||||
private void Awake()
|
||||
{
|
||||
if (_inst != null && _inst != this)
|
||||
|
@ -43,68 +76,94 @@ public class GameManager : MonoBehaviour
|
|||
_inst = this;
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
}
|
||||
|
||||
Jk_URL=new webURL();
|
||||
}
|
||||
private async void OnEnable()
|
||||
|
||||
public IEnumerator dsaklj()
|
||||
{
|
||||
yield return StartCoroutine(LoadJSON(Application.streamingAssetsPath + "/设备查询.json"));
|
||||
#region 正式
|
||||
//await initAsync("");
|
||||
if (root.data == null) return;
|
||||
|
||||
#region 列表清空
|
||||
//Cabinets_go.Clear();
|
||||
Racks_go.Clear();
|
||||
Racks.Clear();
|
||||
MachineSlots_go.Clear();
|
||||
MachineSlots.Clear();
|
||||
TmsCards_go.Clear();
|
||||
TmsCards.Clear();
|
||||
TmsPorts_go.Clear();
|
||||
TmsPorts.Clear();
|
||||
#endregion
|
||||
|
||||
//await initAsync("");//正式
|
||||
if (root_AllDevice.data == null) yield break;
|
||||
|
||||
#region 加载场景所有设备
|
||||
//加载机柜
|
||||
//读取机柜配置
|
||||
if (Cabinets != null)
|
||||
{
|
||||
for (int i = 0; i < Cabinets.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < root.data.Count; j++)
|
||||
for (int j = 0; j < root_AllDevice.data.Count; j++)
|
||||
{
|
||||
if (Cabinets[i].deviceList.deviceCode == root.data[j].deviceCode)
|
||||
if (Cabinets[i].deviceList.deviceCode == root_AllDevice.data[j].deviceCode && root_AllDevice.data[j].type == "1")
|
||||
{
|
||||
Cabinets[i].deviceList = root.data[j];
|
||||
Cabinets[i].deviceList = root_AllDevice.data[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//分类获取设备
|
||||
foreach (var item in root.data)
|
||||
|
||||
//设备信息分类
|
||||
foreach (var item in root_AllDevice.data)
|
||||
{
|
||||
//(机框)
|
||||
if (item.type == 2 && item.deviceType == "1")
|
||||
if (item.type == "2" && item.deviceType == "1")
|
||||
{
|
||||
DeviceQuery deviceQuery = new DeviceQuery();
|
||||
deviceQuery.deviceList = item;
|
||||
Racks.Add(deviceQuery);
|
||||
Racks.Add(item);
|
||||
}
|
||||
//(机槽)
|
||||
else if (item.type == 2 && item.deviceType == "2")
|
||||
else if (item.type == "2" && item.deviceType == "2")
|
||||
{
|
||||
DeviceQuery deviceQuery = new DeviceQuery();
|
||||
deviceQuery.deviceList = item;
|
||||
MachineSlots.Add(deviceQuery);
|
||||
MachineSlots.Add(item);
|
||||
}
|
||||
//(板卡)
|
||||
else if (item.type == 2 && item.deviceType == "3")
|
||||
else if (item.type == "2" && item.deviceType == "3")
|
||||
{
|
||||
DeviceQuery deviceQuery = new DeviceQuery();
|
||||
deviceQuery.deviceList = item;
|
||||
TmsCards.Add(deviceQuery);
|
||||
TmsCards.Add(item);
|
||||
}
|
||||
}
|
||||
//加载设备
|
||||
for (int i = 0; i < Cabinets.Count; i++)
|
||||
|
||||
//动态加载设备(机框)
|
||||
for (int i = 0; i < Racks.Count; i++)
|
||||
{
|
||||
foreach (var item in root.data)
|
||||
foreach (var item in Cabinets)
|
||||
{
|
||||
if (item.type == 2 && item.deviceType == "1" && item.rackId == Cabinets[i].deviceList.id)
|
||||
/*if (item.deviceType == "1")
|
||||
{
|
||||
}*/
|
||||
if (item.deviceList.id == Racks[i].rackId)
|
||||
{
|
||||
//获取模型编号
|
||||
|
||||
string modelNum = Racks[i].modelNum;
|
||||
//获取U位
|
||||
var U = item.devicePosition;
|
||||
|
||||
GameObject go = Instantiate(Resources.Load<GameObject>("古泉站换流站机房/23"));
|
||||
go.transform.SetParent(Cabinets[i].transform.Find("U位/" + U));
|
||||
var U = Racks[i].devicePosition;
|
||||
GameObject go;
|
||||
try
|
||||
{
|
||||
go = Instantiate(Resources.Load<GameObject>("古泉站换流站机房/" + modelNum));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log("模型生成错误:" + e.Message);
|
||||
break;
|
||||
}
|
||||
//写入机框配置
|
||||
go.GetComponent<DeviceQuery>().deviceList = Racks[i];
|
||||
Racks_go.Add(go);
|
||||
go.transform.SetParent(item.transform.Find("U位/" + U));
|
||||
Renderer renderer = go.GetComponentInChildren<Renderer>();
|
||||
if (renderer)
|
||||
{
|
||||
|
@ -116,14 +175,287 @@ public class GameManager : MonoBehaviour
|
|||
a.transform.rotation = Quaternion.identity; //重置其旋转为默认值
|
||||
}
|
||||
Vector3 center = renderer.bounds.center;
|
||||
go.transform.position = Cabinets[i].transform.Find("U位/" + U).position;
|
||||
go.transform.rotation = Cabinets[i].transform.Find("U位/" + U).rotation;
|
||||
go.transform.position = item.transform.Find("U位/" + U).position;
|
||||
go.transform.rotation = item.transform.Find("U位/" + U).rotation;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载设备(机槽)
|
||||
for (int i = 0; i < Racks_go.Count; i++)//遍历机框
|
||||
{
|
||||
//机框下所有设备
|
||||
var jc = Racks_go[i].transform.GetComponentsInChildren<DeviceQuery>().ToList();
|
||||
for (int j = 0; j < jc.Count; j++)
|
||||
{
|
||||
//如果是机槽
|
||||
if (jc[j].deviceList.deviceType == "2")
|
||||
{
|
||||
MachineSlots_go.Add(jc[j].gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//读取机槽配置
|
||||
for (int i = 0; i < MachineSlots_go.Count; i++)
|
||||
{
|
||||
DeviceQuery DP;
|
||||
DP = MachineSlots_go[i].transform.parent.GetComponent<DeviceQuery>();//机槽父物体
|
||||
if (!DP) continue;
|
||||
foreach (var item in MachineSlots)
|
||||
{
|
||||
//机槽在机框里
|
||||
/*if (item.deviceType == "2")
|
||||
{
|
||||
|
||||
}*/
|
||||
if (DP.deviceList.deviceType == "1" && item.shelfId == DP.deviceList.id)
|
||||
{
|
||||
MachineSlots_go[i].GetComponent<DeviceQuery>().deviceList = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载设备(板卡)
|
||||
for (int i = 0; i < MachineSlots_go.Count; i++)//遍历机槽
|
||||
{
|
||||
//机槽下所有设备
|
||||
var bk = MachineSlots_go[i].transform.GetComponentsInChildren<DeviceQuery>().ToList();
|
||||
for (int j = 0; j < bk.Count; j++)
|
||||
{
|
||||
//如果是板卡
|
||||
if (bk[j].deviceList.deviceType == "3")
|
||||
{
|
||||
TmsCards_go.Add(bk[j].gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//读取板卡配置
|
||||
for (int i = 0; i < TmsCards_go.Count; i++)
|
||||
{
|
||||
DeviceQuery DP;
|
||||
DP = TmsCards_go[i].transform.parent.GetComponent<DeviceQuery>();//板卡父物体
|
||||
if (!DP) continue;
|
||||
foreach (var item in TmsCards)
|
||||
{
|
||||
/*if (item.deviceType == "3")
|
||||
{
|
||||
|
||||
}*/
|
||||
//板卡在机槽里
|
||||
if (DP.deviceList.deviceType == "2" && item.slotId == DP.deviceList.id)
|
||||
{
|
||||
TmsCards_go[i].GetComponent<DeviceQuery>().deviceList = item;
|
||||
break;
|
||||
}
|
||||
//板卡在机框里
|
||||
else if (DP.deviceList.deviceType == "1" && item.shelfId == DP.deviceList.id)
|
||||
{
|
||||
TmsCards_go[i].GetComponent<DeviceQuery>().deviceList = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载设备(端口)
|
||||
|
||||
//读取端口配置
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
private async void OnEnable()
|
||||
{
|
||||
//StartCoroutine(dsaklj());
|
||||
#region 正式
|
||||
|
||||
#region 列表清空
|
||||
//Cabinets_go.Clear();
|
||||
Racks_go.Clear();
|
||||
Racks.Clear();
|
||||
MachineSlots_go.Clear();
|
||||
MachineSlots.Clear();
|
||||
TmsCards_go.Clear();
|
||||
TmsCards.Clear();
|
||||
TmsPorts_go.Clear();
|
||||
TmsPorts.Clear();
|
||||
#endregion
|
||||
|
||||
await initAsync("");//正式
|
||||
if (root_AllDevice.data == null) return;
|
||||
|
||||
#region 加载场景所有设备
|
||||
//读取机柜配置
|
||||
if (Cabinets != null)
|
||||
{
|
||||
for (int i = 0; i < Cabinets.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < root_AllDevice.data.Count; j++)
|
||||
{
|
||||
if (Cabinets[i].deviceList.deviceCode == root_AllDevice.data[j].deviceCode && root_AllDevice.data[j].type == "1")
|
||||
{
|
||||
Cabinets[i].deviceList = root_AllDevice.data[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//设备信息分类
|
||||
foreach (var item in root_AllDevice.data)
|
||||
{
|
||||
//(机框)
|
||||
if (item.type == "2" && item.deviceType == "1")
|
||||
{
|
||||
Racks.Add(item);
|
||||
}
|
||||
//(机槽)
|
||||
else if (item.type == "2" && item.deviceType == "2")
|
||||
{
|
||||
MachineSlots.Add(item);
|
||||
}
|
||||
//(板卡)
|
||||
else if (item.type == "2" && item.deviceType == "3")
|
||||
{
|
||||
TmsCards.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载设备(机框)
|
||||
for (int i = 0; i < Racks.Count; i++)
|
||||
{
|
||||
foreach (var item in Cabinets)
|
||||
{
|
||||
/*if (item.deviceType == "1")
|
||||
{
|
||||
}*/
|
||||
if (item.deviceList.id == Racks[i].rackId)
|
||||
{
|
||||
//获取模型编号
|
||||
string modelNum = Racks[i].modelNum;
|
||||
//获取U位
|
||||
var U = Racks[i].devicePosition;
|
||||
GameObject go;
|
||||
try
|
||||
{
|
||||
go = Instantiate(Resources.Load<GameObject>("古泉站换流站机房/" + modelNum));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log("模型生成错误:" + e.Message);
|
||||
break;
|
||||
}
|
||||
//写入机框配置
|
||||
go.GetComponent<DeviceQuery>().deviceList = Racks[i];
|
||||
Racks_go.Add(go);
|
||||
go.transform.SetParent(item.transform.Find("U位/" + U));
|
||||
Renderer renderer = go.GetComponentInChildren<Renderer>();
|
||||
if (renderer)
|
||||
{
|
||||
var bounds = renderer.bounds;
|
||||
var a = go.AddComponent<BoxCollider>();
|
||||
a.isTrigger = false;
|
||||
a.center = bounds.center - go.transform.position;
|
||||
a.size = bounds.size;
|
||||
a.transform.rotation = Quaternion.identity; //重置其旋转为默认值
|
||||
}
|
||||
Vector3 center = renderer.bounds.center;
|
||||
go.transform.position = item.transform.Find("U位/" + U).position;
|
||||
go.transform.rotation = item.transform.Find("U位/" + U).rotation;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载设备(机槽)
|
||||
for (int i = 0; i < Racks_go.Count; i++)//遍历机框
|
||||
{
|
||||
//机框下所有设备
|
||||
var jc = Racks_go[i].transform.GetComponentsInChildren<DeviceQuery>().ToList();
|
||||
for (int j = 0; j < jc.Count; j++)
|
||||
{
|
||||
//如果是机槽
|
||||
if (jc[j].deviceList.deviceType == "2")
|
||||
{
|
||||
MachineSlots_go.Add(jc[j].gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//读取机槽配置
|
||||
for (int i = 0; i < MachineSlots_go.Count; i++)
|
||||
{
|
||||
DeviceQuery DP;
|
||||
DP = MachineSlots_go[i].transform.parent.GetComponent<DeviceQuery>();//机槽父物体
|
||||
if (!DP) continue;
|
||||
foreach (var item in MachineSlots)
|
||||
{
|
||||
//机槽在机框里
|
||||
/*if (item.deviceType == "2")
|
||||
{
|
||||
|
||||
}*/
|
||||
if (DP.deviceList.deviceType == "1" && item.shelfId == DP.deviceList.id)
|
||||
{
|
||||
MachineSlots_go[i].GetComponent<DeviceQuery>().deviceList = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载设备(板卡)
|
||||
for (int i = 0; i < MachineSlots_go.Count; i++)//遍历机槽
|
||||
{
|
||||
//机槽下所有设备
|
||||
var bk = MachineSlots_go[i].transform.GetComponentsInChildren<DeviceQuery>().ToList();
|
||||
for (int j = 0; j < bk.Count; j++)
|
||||
{
|
||||
//如果是板卡
|
||||
if (bk[j].deviceList.deviceType == "3")
|
||||
{
|
||||
TmsCards_go.Add(bk[j].gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//读取板卡配置
|
||||
for (int i = 0; i < TmsCards_go.Count; i++)
|
||||
{
|
||||
DeviceQuery DP;
|
||||
DP = TmsCards_go[i].transform.parent.GetComponent<DeviceQuery>();//板卡父物体
|
||||
if (!DP) continue;
|
||||
foreach (var item in TmsCards)
|
||||
{
|
||||
/*if (item.deviceType == "3")
|
||||
{
|
||||
|
||||
}*/
|
||||
//板卡在机槽里
|
||||
if (DP.deviceList.deviceType == "2" && item.slotId == DP.deviceList.id)
|
||||
{
|
||||
TmsCards_go[i].GetComponent<DeviceQuery>().deviceList = item;
|
||||
break;
|
||||
}
|
||||
//板卡在机框里
|
||||
else if (DP.deviceList.deviceType == "1" && item.shelfId == DP.deviceList.id)
|
||||
{
|
||||
TmsCards_go[i].GetComponent<DeviceQuery>().deviceList = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载设备(端口)
|
||||
|
||||
//读取端口配置
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
////Debug.Log(transform.Find("22 (2)").childCount);
|
||||
//GameObject go = GameObject.Instantiate(Resources.Load<GameObject>("23 (1)"));
|
||||
////go.name = go.name.Replace("(Clone)", "");
|
||||
|
@ -137,6 +469,33 @@ public class GameManager : MonoBehaviour
|
|||
////go.transform.position = new Vector3(go.transform.position.x, go.transform.position.y- center.y, go.transform.position.z);
|
||||
}
|
||||
|
||||
IEnumerator LoadJSON(string url)
|
||||
{
|
||||
UnityWebRequest www = UnityWebRequest.Get(url);
|
||||
yield return www.SendWebRequest();
|
||||
|
||||
if (www.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
Debug.Log(www.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
string jsonData = www.downloadHandler.text;
|
||||
// 解析JSON数据
|
||||
ParseJSON(jsonData);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseJSON(string jsonString)
|
||||
{
|
||||
// 使用JsonUtility类解析JSON数据到自定义的类对象
|
||||
root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonString);
|
||||
|
||||
// 现在你可以访问dataObject中的数据了
|
||||
//Debug.Log("Name: " + dataObject.name);
|
||||
//Debug.Log("Age: " + dataObject.age);
|
||||
}
|
||||
|
||||
#region MyRegion
|
||||
// 将 PlayerPrefs 数据保存为 JSON 文件
|
||||
public static void SavePlayerPrefsToJson(string 文件路径)
|
||||
|
@ -219,11 +578,69 @@ public class GameManager : MonoBehaviour
|
|||
/// <returns></returns>
|
||||
public async Task initAsync(string token)
|
||||
{
|
||||
var jsonResult = await CombineJSON.GetJson_POST("https://jsonplaceholder.typicode.com/posts", token);
|
||||
var jsonResult = await CombineJSON.GetJson_POST(Jk_URL.sb_cx, token);
|
||||
|
||||
root = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
|
||||
root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
|
||||
|
||||
var jsonResult1 = await CombineJSON.GetJson_POST(Jk_URL.dk_cx, token);
|
||||
|
||||
root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
|
||||
//return root;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 接口地址
|
||||
/// </summary>
|
||||
public class webURL
|
||||
{
|
||||
/// <summary>
|
||||
/// 穿透
|
||||
/// </summary>
|
||||
public string ct = "http://yhueay.natappfree.cc/";
|
||||
/// <summary>
|
||||
/// 设备-查询URL
|
||||
/// </summary>
|
||||
public string sb_cx;
|
||||
/// <summary>
|
||||
/// 设备-新增
|
||||
/// </summary>
|
||||
public string sb_xz;
|
||||
/// <summary>
|
||||
/// 设备-删除
|
||||
/// </summary>
|
||||
public string sb_sc;
|
||||
/// <summary>
|
||||
/// 设备-编辑
|
||||
/// </summary>
|
||||
public string sb_bj;
|
||||
/// <summary>
|
||||
/// 端口-查询
|
||||
/// </summary>
|
||||
public string dk_cx;
|
||||
/// <summary>
|
||||
/// 端口-新增
|
||||
/// </summary>
|
||||
public string dk_xz;
|
||||
/// <summary>
|
||||
/// 端口-删除
|
||||
/// </summary>
|
||||
public string dk_sc;
|
||||
/// <summary>
|
||||
/// 端口-编辑
|
||||
/// </summary>
|
||||
public string dk_bj;
|
||||
|
||||
public webURL()
|
||||
{
|
||||
sb_cx = ct + "machineRoom/device/queryList";
|
||||
sb_xz = ct + "machineRoom/device/save";
|
||||
sb_sc = ct + "machineRoom/device/delete";
|
||||
sb_bj = ct + "machineRoom/device/updateById";
|
||||
|
||||
dk_cx = ct + "machineRoom/port/queryList";
|
||||
dk_xz = ct + "machineRoom/port/save";
|
||||
dk_sc = ct + "machineRoom/port/delete";
|
||||
dk_bj = ct + "machineRoom/port/updateById";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,13 @@ public class TOOL : MonoBehaviour
|
|||
{
|
||||
public List<GameObject> gameObjects;
|
||||
// Start is called before the first frame update
|
||||
[ContextMenu("Start")]
|
||||
void Start()
|
||||
{
|
||||
//Debug.Log(transform.root.Find("对联设备").name);
|
||||
//GameObject.Instantiate(Resources.Load<GameObject>("古泉站换流站机房/35"));
|
||||
var dsad = GetComponentInParent<HeatMapFactor>();
|
||||
Debug.Log(dsad.name + "-------------" + dsad.intensity);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -32,12 +35,12 @@ public class TOOL : MonoBehaviour
|
|||
{
|
||||
var D = gameObjects[i].AddComponent<DeviceQuery>();
|
||||
D.deviceList.deviceCode = gameObjects[i].name;
|
||||
D.deviceList.type = 1;
|
||||
D.deviceList.type = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceQuery.deviceList.deviceCode = gameObjects[i].name;
|
||||
deviceQuery.deviceList.type = 1;
|
||||
deviceQuery.deviceList.type = "1";
|
||||
}
|
||||
|
||||
var U = gameObjects[i].transform.Find("U位");
|
||||
|
|
|
@ -53,7 +53,7 @@ public class AddDevice /*: MonoBehaviour*/
|
|||
/// <summary>
|
||||
/// 设备类型:1-机框;2-机槽;3-板卡
|
||||
/// </summary>
|
||||
public int deviceType ;
|
||||
public string deviceType ;
|
||||
/// <summary>
|
||||
/// 设备编号
|
||||
/// </summary>
|
||||
|
|
|
@ -70,7 +70,7 @@ public class CabinetQuery : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 投运时间
|
||||
/// </summary>
|
||||
[Tooltip("投运时间")] public int operationTime;
|
||||
[Tooltip("投运时间")] public string operationTime;
|
||||
/// <summary>
|
||||
/// 产权单位
|
||||
/// </summary>
|
||||
|
|
|
@ -56,7 +56,7 @@ public class DeviceQuery : MonoBehaviour
|
|||
{
|
||||
var go = transform.GetChild(i);
|
||||
|
||||
if (deviceList.type == 2 && deviceList.deviceType == "3")
|
||||
if (deviceList.type == "2" && deviceList.deviceType == "3")
|
||||
{
|
||||
if (!GetComponent<TmsCardQuery>())
|
||||
gameObject.AddComponent<TmsCardQuery>();
|
||||
|
@ -71,9 +71,9 @@ public class DeviceQuery : MonoBehaviour
|
|||
public class DeviceList
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// 设备ID
|
||||
/// </summary>
|
||||
[Tooltip("设备id")] public string id;
|
||||
[Tooltip("设备ID")] public string id;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
|
@ -85,7 +85,7 @@ public class DeviceQuery : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 类型:1-机柜;2-设备
|
||||
/// </summary>
|
||||
[Tooltip("类型:1-机柜;2-设备")] public int type;
|
||||
[Tooltip("类型:1-机柜;2-设备")] public string type;
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
|
@ -103,6 +103,14 @@ public class DeviceQuery : MonoBehaviour
|
|||
/// </summary>
|
||||
[Tooltip("所属机柜id")] public string rackId;
|
||||
/// <summary>
|
||||
/// 所属机框id
|
||||
/// </summary>
|
||||
[Tooltip("所属机框id")] public string shelfId;
|
||||
/// <summary>
|
||||
/// 所属机槽id
|
||||
/// </summary>
|
||||
[Tooltip("所属机槽id")] public string slotId;
|
||||
/// <summary>
|
||||
/// 设备位置
|
||||
/// </summary>
|
||||
[Tooltip("设备位置")] public string devicePosition;
|
||||
|
@ -113,15 +121,35 @@ public class DeviceQuery : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 状态:1-正常;0-禁用
|
||||
/// </summary>
|
||||
[Tooltip("状态:1-正常;0-禁用")] public int status;
|
||||
[Tooltip("状态:1-正常;0-禁用")] public string status;
|
||||
/// <summary>
|
||||
/// 对联设备名称
|
||||
/// </summary>
|
||||
[Tooltip("对联设备名称")] public string conDeviceName;
|
||||
/// <summary>
|
||||
/// 机柜类型:1-通信机柜;2-非通信机柜
|
||||
/// </summary>
|
||||
[Tooltip("机柜类型:1-通信机柜;2-非通信机柜")] public string rackType;
|
||||
/// <summary>
|
||||
/// 柜门是否打开:1-开;0-关
|
||||
/// </summary>
|
||||
[Tooltip("柜门是否打开:1-开;0-关")] public string openFlag;
|
||||
/// <summary>
|
||||
/// 模型编号
|
||||
/// </summary>
|
||||
[Tooltip("模型编号")] public string modelNum;
|
||||
/// <summary>
|
||||
/// U位占用数量
|
||||
/// </summary>
|
||||
[Tooltip("U位占用数量")] public string occupyNum;
|
||||
/// <summary>
|
||||
/// U位剩余数量
|
||||
/// </summary>
|
||||
[Tooltip("U位剩余数量")] public string residueNum;
|
||||
/// <summary>
|
||||
/// 投运时间
|
||||
/// </summary>
|
||||
[Tooltip("投运时间")] public int operationTime;
|
||||
[Tooltip("投运时间")] public string operationTime;
|
||||
/// <summary>
|
||||
/// 负责人
|
||||
/// </summary>
|
||||
|
@ -139,9 +167,9 @@ public class DeviceQuery : MonoBehaviour
|
|||
/// </summary>
|
||||
[Tooltip("电源属性")] public string powerProperties;
|
||||
/// <summary>
|
||||
///
|
||||
/// 维护单位
|
||||
/// </summary>
|
||||
[Tooltip("")] public string maintenanceUnit;
|
||||
[Tooltip("维护单位")] public string maintenanceUnit;
|
||||
/// <summary>
|
||||
/// 机框高度
|
||||
/// </summary>
|
||||
|
@ -213,7 +241,7 @@ public class DeviceQuery : MonoBehaviour
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Tooltip("")] public int createTime;
|
||||
[Tooltip("")] public string createTime;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -119,7 +119,7 @@ public class PortQuery : MonoBehaviour
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Tooltip("")] public int createTime;
|
||||
[Tooltip("")] public string createTime;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -85,7 +85,7 @@ public class TmsCardQuery : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 投运时间
|
||||
/// </summary>
|
||||
[Tooltip("")] public int operationTime;
|
||||
[Tooltip("")] public string operationTime;
|
||||
/// <summary>
|
||||
/// 运行状态
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue