GQ_Communicate/GQ_URP/GQ/Assets/script/GameManager.cs

2534 lines
88 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using static DeviceQuery;
using static ENVQuery;
using static PortQuery;
using static TmsAlarmQuery;
public class GameManager : MonoBehaviour
{
public static GameManager Inst;
/// <summary>
/// 接口地址
/// </summary>
public webURL Jk_URL;
/// <summary>
/// 全局变量
/// </summary>
public GlobalParameter arguments = new GlobalParameter();
/// <summary>
/// 是否加载完成
/// </summary>
public bool isLoading = false;
string ct = null;
//[Header("机柜点位集合")]
//public List<Transform> Cabinets_POS;
[Header("机柜区域集合")]
public List<Transform> Cabinet_quYu;
[Header("当前设备ID")] public string nowDeviceID = null;
[Header("当前点击设备")] public GameObject nowDevice = null;
[Header("上一个设备ID")] public string lastDeviceID = null;
[Header("上一个点击设备")] public GameObject lastDevice = null;
/// <summary>
/// 当前聚焦机柜
/// </summary>
[Header("当前聚焦机柜")] public GameObject nowCabine;
/// <summary>
/// 当前查看的设备
/// </summary>
[Header("当前查看的设备")] public GameObject now_CK_Device = null;
[Header("设备------------------------查询接口")] public DeviceQuery.Root root_AllDevice;
///// <summary>
///// 场景所有机柜
///// </summary>
// public List<GameObject> Cabinets_go;
/// <summary>
/// 场景所有机柜
/// </summary>
[Header("场景所有机柜")] public List<GameObject> Cabinets_go;
/// <summary>
/// 场景所有机柜信息
/// </summary>
public List<DeviceList> Cabinets;
/// <summary>
/// 场景所有机框
/// </summary>
[Header("场景所有机框信息")] public List<GameObject> Racks_go = new List<GameObject>();
/// <summary>
/// 场景所有机框信息
/// </summary>
public List<DeviceList> Racks;
/// <summary>
/// 场景所有机槽
/// </summary>
[Header("场景所有机槽信息")] public List<GameObject> MachineSlots_go = new List<GameObject>();
/// <summary>
/// 场景所有机槽信息
/// </summary>
public List<DeviceList> MachineSlots;
/// <summary>
/// 场景所有板卡
/// </summary>
[Header("场景所有板卡信息")] public List<GameObject> TmsCards_go = new List<GameObject>();
/// <summary>
/// 场景所有板卡信息
/// </summary>
public List<DeviceList> TmsCards;
[Header("端口------------------------查询接口")] public PortQuery.Root root_AllPort;
/// <summary>
/// 场景所有端口
/// </summary>
[Header("场景所有端口信息")] public List<GameObject> TmsPorts_go = new List<GameObject>();
/// <summary>
/// 场景所有端口信息
/// </summary>
public List<PortList> TmsPorts;
[HideInInspector] public int nowLayerMask = 6;
[Header("环境------------------------查询接口")] public ENVQuery.Root root_AllENV = new ENVQuery.Root();
public List<ENVList> ENVs;
[Header("告警------------------------查询接口")] public TmsAlarmQuery.Root root_AllAlarm = new TmsAlarmQuery.Root();
public List<TmsAlarmList> tmsAlarms;
///// <summary>
///// 搜索框
///// </summary>
//[Header("--------------------------------")]
//public GameObject search_box;
[Header("----------弹窗--------------")]
public List<GameObject> pop_ups;
/// <summary>
/// 场景方大状态
/// </summary>
[Header("----------场景放大状态--------------")]
public bool magnifyState = false;
[Header("----------是否在循环读取信息--------------")]
public bool isgonging = false;
public EditorMenu editorMenu;
public GameObject stagingPanel;
[Header("-------------- 搜索框------------------")]
//public GameObject objectToShow;
public GameObject search_box;
public GameObject objectToShow_add;
[Header("-------------- 所有机柜门------------------")]
public List<RoomDoor> roomDoors;
private void Awake()
{
if (Inst != this && Inst != null)
{
Destroy(this.gameObject);
}
else
{
Inst = this;
DontDestroyOnLoad(this.gameObject);
}
//StartCoroutine(LoadAddress());
}
private void Start()
{
Debug.Log("版本号 11.0.3");
roomDoors = CabinetUIManager.Instance.transform.GetChild(0).GetComponentsInChildren<RoomDoor>(true).ToList();
editorMenu.editorBtn.onClick.AddListener(() =>
{
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && nowDevice != null)
{
if (nowDevice.GetComponent<DeviceQuery>() == null)
return;
if (nowDevice.GetComponent<DeviceQuery>().deviceList.deviceType == "3")
return;
if (string.IsNullOrEmpty(nowDeviceID))
{
PatternChoose.Inst.sb_xz_page.SetActive(true);//√
//objectToShow_add.gameObject.SetActive(false);
var SN1 = objectToShow_add.GetComponent<SearchName1>();
SN1.hide_menu();
objectToShow_add.SetActive(false);
}
else
{
PatternChoose.Inst.sb_bj_page.SetActive(true);//√
//objectToShow_add.gameObject.SetActive(false);
var SN1 = objectToShow_add.GetComponent<SearchName1>();
SN1.hide_menu();
objectToShow_add.SetActive(false);
}
}
editorMenu.gameObject.SetActive(false);
});
///---------------新加------------------------
editorMenu.deleteBtn.onClick.AddListener(() =>
{
DeleteFunction();
editorMenu.gameObject.SetActive(false);
});
PatternChoose.Inst.sb_xz_page.transform.Find("删除").GetComponent<Button>().onClick.AddListener(() =>
{
if (GameManager.Inst.nowDevice.GetComponent<DeviceQuery>().deviceList.deviceType == "3")
return;
DeleteFunction();
PatternChoose.Inst.sb_xz_page.gameObject.SetActive(false);
});
PatternChoose.Inst.sb_bj_page.transform.Find("删除").GetComponent<Button>().onClick.AddListener(() =>
{
if (GameManager.Inst.nowDevice.GetComponent<DeviceQuery>().deviceList.deviceType == "3")
return;
DeleteFunction();
PatternChoose.Inst.sb_bj_page.gameObject.SetActive(false);
});
///---------------新加------------------------
//editorMenu.deleteBtn.onClick.AddListener(() =>
//{
// if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && nowDevice != null)
// {
// if (nowDevice.GetComponent<DeviceQuery>() == null) return;
// if (string.IsNullOrEmpty(nowDeviceID))
// {
// editorMenu.gameObject.SetActive(false);
// var nub = nowDevice.GetComponent<DeviceItem>().volume;
// var _star = nowDevice.transform.parent.name;
// var star = Convert.ToInt32(_star) - 1;
// var p = nowDevice.transform.parent.parent;
// for (int i = star; i < star + Convert.ToInt32(nub); i++)
// {
// p.GetChild(i).GetComponent<UPosItem>().isOccupied = false;
// }
// DestroyImmediate(nowDevice);
// }
// else
// {
// var delete = PatternChoose.Inst.transform.Find("设备类").GetComponent<DeleteDevice>();
// //DeleteDevice delete = new DeleteDevice();
// delete.mybody.ids.Add(nowDeviceID);
// StartCoroutine(delete.SaveJsonCoroutine((x) =>
// {
// editorMenu.gameObject.SetActive(false);
// var nub = nowDevice.GetComponent<DragTest1>().volume;
// var _star = nowDevice.transform.parent.name;
// var star = Convert.ToInt32(_star) - 1;
// var p = nowDevice.transform.parent.parent;
// for (int i = star; i < star + Convert.ToInt32(nub); i++)
// {
// p.GetChild(i).GetComponent<UPosItem>().isOccupied = false;
// p.GetChild(i).GetComponent<UPosItem>().instruct.color = new Color(0, 1, 0, 1);
// }
// DestroyImmediate(nowDevice);
// }));
// }
// }
// editorMenu.gameObject.SetActive(false);
//});
//Debug.Log("版本号 1.1.1");
editorMenu.checkBtn.onClick.AddListener(() =>
{
editorMenu.gameObject.SetActive(false);
checkDevice_cjgl();
});
}
/// <summary>
/// 查看设备
/// </summary>
public void checkDevice_cjgl()
{
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && now_CK_Device != null)
{
if (now_CK_Device.GetComponent<DeviceQuery>() == null)
return;
PatternChoose.Inst.sb_ck_page.SetActive(true);
var SN1 = objectToShow_add.GetComponent<SearchName1>();
SN1.hide_menu();
objectToShow_add.SetActive(false);
}
}
public void checkDevice()
{
if (now_CK_Device.GetComponent<DeviceQuery>() == null)
return;
PatternChoose.Inst.sb_ck_page.SetActive(true);
}
public void DeleteFunction()
{
SecondConfirmPanel.DeleteConform((isdelete) =>
{
if (!isdelete)
return;
else
{
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && nowDevice != null)
{
if (nowDevice.GetComponent<DeviceQuery>() == null)
{
GameManager.Inst.objectToShow_add.SetActive(true);
return;
}
if (string.IsNullOrEmpty(nowDeviceID))
{
DeviceItem di = nowDevice.GetComponent<DeviceItem>();
UPosItem upi = nowDevice.transform.parent.GetComponent<UPosItem>();
upi.uPosManager.SetCurrentUPosIsOccupied(di.startIndex, di.volume, false);
DestroyImmediate(nowDevice);
}
else
{
var delete = PatternChoose.Inst.transform.Find("设备类").GetComponent<DeleteDevice>();
//DeleteDevice delete = new DeleteDevice();
delete.mybody.ids.Add(nowDeviceID);
StartCoroutine(delete.SaveJsonCoroutine((x) =>
{
DeviceItem di = nowDevice.GetComponent<DeviceItem>();
UPosItem upi = nowDevice.transform.parent.GetComponent<UPosItem>();
upi.uPosManager.SetCurrentUPosIsOccupied(di.startIndex, di.volume, false);
DestroyImmediate(nowDevice);
}));
}
GameManager.Inst.objectToShow_add.SetActive(true);
}
}
}, "是否删除");
}
private void OnEnable()
{
//StartCoroutine(LoadJSON(Application.streamingAssetsPath + "/设备查询.json"));
//StartCoroutine(LoadJSON(Application.streamingAssetsPath + "/端口查询.json"));
//StartCoroutine(LoadJSON(Application.streamingAssetsPath + "/告警查询.json"));
//StartCoroutine(LoadJSON(Application.streamingAssetsPath + "/环境查询.json"));
//return;
#region
//TransparentGlowManage.Inst.addScript();
//await init_Device();
//await init_Port();
//await init_TmsAlarm();
//await init_ENV();
//if (root_AllDevice.data == null) return;
//#region 加载场景
//Load_Device();
//Load_Port();
//Load_TmsAlarm();
//Load_ENV();
//#endregion
#endregion
}
/// <summary>
/// 加载环境
/// </summary>
public void Load_ENV()
{
if (root_AllENV == null) return;
/***********************************************************/
//环境信息-保存
for (int i = 0; i < root_AllENV.data.Count; i++)
ENVs.Add(root_AllENV.data[i]);
for (int i = 0; i < ENVs.Count; i++)
{
bool isFind = false;
var rackId = ENVs[i].rackId;
foreach (var item in Cabinets_go)
{
var D = item.GetComponent<DeviceQuery>().deviceList;
if (D.id == rackId)
{
//温度
if (ENVs[i].pointType == "1")
{
item.GetComponent<ENVQuery>().eNVList_W = ENVs[i];
isFind = true;
break;
}
//湿度
else if (ENVs[i].pointType == "2")
{
item.GetComponent<ENVQuery>().eNVList_S = ENVs[i];
isFind = true;
break;
}
//烟感
else if (ENVs[i].pointType == "3")
{
item.GetComponent<ENVQuery>().eNVList_Y = ENVs[i];
isFind = true;
break;
}
//水浸
else if (ENVs[i].pointType == "4")
{
item.GetComponent<ENVQuery>().eNVList_J = ENVs[i];
isFind = true;
break;
}
}
}
if (isFind) continue;
var machine_room = GameObject.Find("机房");
if (machine_room && rackId == machine_room.GetComponent<DeviceQuery>().deviceList.id)
{
//温度
if (ENVs[i].pointType == "1")
{
machine_room.GetComponent<ENVQuery>().eNVList_W = ENVs[i];
isFind = true;
}
//湿度
else if (ENVs[i].pointType == "2")
{
machine_room.GetComponent<ENVQuery>().eNVList_S = ENVs[i];
isFind = true;
}
//烟感
else if (ENVs[i].pointType == "3")
{
machine_room.GetComponent<ENVQuery>().eNVList_Y = ENVs[i];
isFind = true;
}
//水浸
else if (ENVs[i].pointType == "4")
{
machine_room.GetComponent<ENVQuery>().eNVList_J = ENVs[i];
isFind = true;
}
}
if (isFind) continue;
var accumulator_room = GameObject.Find("蓄电池室");
if (accumulator_room && rackId == accumulator_room.GetComponent<DeviceQuery>().deviceList.id)
{
//温度
if (ENVs[i].pointType == "1")
{
accumulator_room.GetComponent<ENVQuery>().eNVList_W = ENVs[i];
isFind = true;
}
//湿度
else if (ENVs[i].pointType == "2")
{
accumulator_room.GetComponent<ENVQuery>().eNVList_S = ENVs[i];
isFind = true;
}
//烟感
else if (ENVs[i].pointType == "3")
{
accumulator_room.GetComponent<ENVQuery>().eNVList_Y = ENVs[i];
isFind = true;
}
//水浸
else if (ENVs[i].pointType == "4")
{
accumulator_room.GetComponent<ENVQuery>().eNVList_J = ENVs[i];
isFind = true;
}
}
if (isFind) continue;
}
Debug.Log("环境加载完成");
}
/// <summary>
/// 加载告警
/// </summary>
public void Load_TmsAlarm()
{
if (root_AllAlarm == null) return;
/***********************************************************/
//告警信息-保存
for (int i = 0; i < root_AllAlarm.data.Count; i++)
tmsAlarms.Add(root_AllAlarm.data[i]);
for (int i = 0; i < tmsAlarms.Count; i++)
{
bool isFind = false;
var deviceId = tmsAlarms[i].deviceId;
///设备id
foreach (var item in Cabinets_go)
{
var D = item.GetComponent<DeviceQuery>().deviceList;
if (D.id == deviceId)
{
item.GetComponent<TmsAlarmQuery>().tmsAlarmLists.Add(tmsAlarms[i]);
isFind = true;
break;
}
}
if (isFind) continue;
foreach (var item in Racks_go)
{
var D = item.GetComponent<DeviceQuery>().deviceList;
if (D.id == deviceId)
{
item.GetComponent<TmsAlarmQuery>().tmsAlarmLists.Add(tmsAlarms[i]);
isFind = true;
break;
}
}
if (isFind) continue;
foreach (var item in MachineSlots_go)
{
var D = item.GetComponent<DeviceQuery>().deviceList;
if (D.id == deviceId)
{
item.GetComponent<TmsAlarmQuery>().tmsAlarmLists.Add(tmsAlarms[i]);
isFind = true;
break;
}
}
if (isFind) continue;
foreach (var item in TmsCards_go)
{
var D = item.GetComponent<DeviceQuery>().deviceList;
if (D.id == deviceId)
{
item.GetComponent<TmsAlarmQuery>().tmsAlarmLists.Add(tmsAlarms[i]);
isFind = true;
break;
}
}
}
Debug.Log("告警加载完成");
}
/// <summary>
/// 加载端口
/// </summary>
private void Load_Port()
{
if (root_AllPort == null) return;
/***********************************************************/
//端口信息-保存
foreach (var item in root_AllPort.data)
TmsPorts.Add(item);
//动态加载设备(端口)
for (int i = 0; i < TmsCards_go.Count; i++)//遍历板卡
{
//板卡下所有设备
var dk = TmsCards_go[i].transform.GetComponentsInChildren<PortQuery>().ToList();
if (dk == null) continue;
for (int j = 0; j < dk.Count; j++)
{
TmsPorts_go.Add(dk[j].gameObject);
}
}
for (int i = 0; i < Racks_go.Count; i++)//遍历机框
{
//机框下所有设备
var dk = Racks_go[i].transform.GetComponentsInChildren<PortQuery>().ToList();
if (dk == null) continue;
for (int j = 0; j < dk.Count; j++)
{
TmsPorts_go.Add(dk[j].gameObject);
}
}
for (int i = 0; i < MachineSlots_go.Count; i++)//遍历机槽
{
//机槽下所有设备
var dk = MachineSlots_go[i].transform.GetComponentsInChildren<PortQuery>().ToList();
if (dk == null) continue;
for (int j = 0; j < dk.Count; j++)
{
TmsPorts_go.Add(dk[j].gameObject);
}
}
//读取端口配置
for (int i = 0; i < TmsPorts_go.Count; i++)
{
PortQuery P;
DeviceQuery DP;
P = TmsPorts_go[i].GetComponent<PortQuery>();
//DP = TmsPorts_go[i].transform.parent.GetComponent<DeviceQuery>();
var _DP = FindParent(TmsPorts_go[i], IsFindRacks_goORTmsCards_go);
if (!_DP) continue;
DP = _DP.GetComponent<DeviceQuery>();
if (!DP) continue;
foreach (var item in TmsPorts)
{
if (item.deviceId == DP.deviceList.id && item.portPosition == P.portList.portPosition)
{
TmsPorts_go[i].GetComponent<PortQuery>().portList = item;
break;
}
}
}
Array.ForEach(GameObject.FindObjectsOfType<PortQuery>(), item =>
{
if (!item.gameObject.GetComponent<ClickEvent>()) item.gameObject.AddComponent<ClickEvent>();
});
Debug.Log("端口加载完成");
}
/// <summary>
/// 加载设备
/// </summary>
private void Load_Device()
{
Debug.Log("##01");
if (root_AllDevice == null) return;
Debug.Log("##02");
//信息分类-保存
foreach (var item in root_AllDevice.data)
{
//(机柜)
if (item.type == "1")
Cabinets.Add(item);
//(机框)
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);
}
Debug.Log("##03");
//读取机柜配置
#region
//if (Cabinets_POS != null)
//{
// for (int i = 0; i < Cabinets_POS.Count; i++)
// {
// for (int j = 0; j < Cabinets.Count; j++)
// {
// if (Cabinets_POS[i].name == Cabinets[j].devicePosition && Cabinets[j].type == "1")
// {
// GameObject go;
// try
// {
// go = Instantiate(Resources.Load<GameObject>("古泉站换流站机房/" + ""));//??
// }
// catch (Exception e)
// {
// Debug.Log("模型生成错误:" + e.Message);
// break;
// }
// var n = Cabinets_POS[i].name.Split('-');//拆分区域-编号
// go.name = Cabinets_POS[i].name;
// go.transform.SetParent(Cabinet_quYu[CengJi(n[0])]);
// go.transform.position = Cabinets_POS[i].position;
// go.transform.rotation = Cabinets_POS[i].rotation;
// go.GetComponent<DeviceQuery>().deviceList = root_AllDevice.data[j];
// Cabinets_go.Add(go);
// break;
// }
// }
// }
//}
#endregion
//读取机柜配置
for (int i = 0; i < Cabinets_go.Count; i++)
{
var n = Cabinets_go[i].GetComponent<DeviceQuery>().deviceList;
for (int j = 0; j < Cabinets.Count; j++)
{
if (n.devicePosition == Cabinets[j].devicePosition)
{
n = Cabinets[j];
Cabinets_go[i].GetComponent<DeviceQuery>().deviceList = n;
//AssignFields(n, Cabinets[j]);
break;
}
}
}
Debug.Log("##04 Count:" + ENVs.Count);
//读取机柜环境配置
for (int j = 0; j < ENVs.Count;)
{
Debug.Log("##04.1 Count:" + ENVs.Count);
for (int i = 0; i < Cabinets_go.Count; i++)
{
Debug.Log("##04.2 i:" + i);
var n = Cabinets_go[i].GetComponent<DeviceQuery>().deviceList;
Debug.Log("##04.3 Count:" + ENVs.Count);
var e = Cabinets_go[i].GetComponent<ENVQuery>();
Debug.Log("##04.4 Count:" + ENVs.Count);
//if (ENVs[j].pointDeviceId == n.id)
if (ENVs[j].rackId == n.id)
{
if (ENVs[j].pointType == "1")
{
Debug.Log("##04.4.1 Count:" + ENVs.Count);
e.eNVList_W = ENVs[j];
j++;
break;
}
else if (ENVs[j].pointType == "2")
{
Debug.Log("##04.4.2 Count:" + ENVs.Count);
e.eNVList_S = ENVs[j];
j++;
break;
}
else if (ENVs[j].pointType == "3")
{
Debug.Log("##04.4.3 Count:" + ENVs.Count);
e.eNVList_Y = ENVs[j];
j++;
break;
}
else if (ENVs[j].pointType == "4")
{
Debug.Log("##04.4.4 Count:" + ENVs.Count);
e.eNVList_S = ENVs[j];
j++;
break;
}
}
Debug.Log("##04.5 Count:" + ENVs.Count);
}
Debug.Log("j:" + j);
}
Debug.Log("##05");
//动态加载设备(机框)
for (int i = 0; i < Racks.Count; i++)
{
foreach (var item in Cabinets_go)
{
if (item.GetComponent<DeviceQuery>().deviceList.id == Racks[i].rackId && !string.IsNullOrEmpty(Racks[i].modelNum))
{
//获取模型编号
string modelNum = Racks[i].modelNum;
//获取U位
var U = Racks[i].devicePosition;
GameObject go;
try
{
go = Instantiate(Resources.Load<GameObject>("古泉站机房模型90个型号/" + modelNum));
//写入机框配置
go.GetComponent<DeviceQuery>().deviceList = Racks[i];
Racks_go.Add(go);
Renderer renderer = go.GetComponentInChildren<Renderer>();
if (renderer)
{
var initrot = go.transform.rotation;
go.transform.rotation = Quaternion.identity;
var bounds = renderer.bounds;
var a = go.AddComponent<BoxCollider>();
a.enabled = false;
a.isTrigger = false;
a.center = bounds.center - go.transform.position;
a.size = bounds.size;
//a.transform.rotation = Quaternion.identity; //重置其旋转为默认值
go.transform.rotation = initrot;
}
Vector3 center = renderer.bounds.center;
go.transform.position = item.transform.Find("U位/" + U).position;
var anchorPos = go.transform.Find("锚点").gameObject;
var collider = item.transform.Find("U位/" + U).GetComponent<Collider>();
//go.transform.position = new Vector3(anchorPos.transform.position.x, anchorPos.transform.position.y + collider.bounds.size.y / 2, anchorPos.transform.position.z);
var uPosition = item.transform.Find("U位/" + U).position;
var colliderBounds = collider.bounds;
float yOffset = colliderBounds.extents.y - colliderBounds.center.y;
go.transform.position = new Vector3(uPosition.x, uPosition.y + colliderBounds.extents.y + yOffset, uPosition.z);
//go.transform.rotation = item.transform.Find("U位/" + U).rotation;
go.name = Racks[i].id;
DragController drag = gameObject.GetComponent<DeviceManager>().dragController.GetComponent<DragController>();
drag.oriObjectPrefab = go.GetComponent<DragTest1>();
drag.uPosManger = item.transform.Find("U位").GetComponent<UPosManger>();
drag.CountUPos(drag.oriObjectPrefab, Convert.ToInt32(Racks[i].devicePosition) - 1);
go.transform.SetParent(item.transform.Find("U位/" + U));
//模型错误微调
Model_error(modelNum, go);
}
catch (Exception e)
{
Debug.LogError("模型生成错误:" + item.name + "\n" + e.Message + "\n" + e.StackTrace);
break;
}
}
}
}
Debug.Log("##06");
//动态加载设备(机槽)
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);
}
}
}
Debug.Log("##07");
//读取机槽配置
for (int i = 0; i < MachineSlots_go.Count; i++)
{
DeviceQuery D;
DeviceQuery DP;
D = MachineSlots_go[i].transform.GetComponent<DeviceQuery>();//机槽
//DP = MachineSlots_go[i].transform.parent.GetComponent<DeviceQuery>();//机槽父物体
var _DP = FindParent(MachineSlots_go[i], IsFindRacks_go);//机槽父物体
if (!_DP) continue;
DP = _DP.GetComponent<DeviceQuery>();
if (!DP) continue;
foreach (var item in MachineSlots)
{
//机槽在机框里
/*if (item.deviceType == "2")
{
}*/
if (DP.deviceList.deviceType == "1" && item.shelfId == DP.deviceList.id && item.devicePosition == D.deviceList.devicePosition)
{
MachineSlots_go[i].GetComponent<DeviceQuery>().deviceList = item;
break;
}
}
}
Debug.Log("##08");
//动态加载设备(板卡)
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);
}
}
}
Debug.Log("##09");
for (int i = 0; i < Racks_go.Count; i++)//遍历机框
{
//机框下所有设备
var bk = Racks_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);
}
}
#region new
//var jk = Racks_go[i].GetComponent<DeviceQuery>();
//for (int j = 0; j < TmsCards.Count; j++)
//{
// if (TmsCards[j].shelfId == jk.deviceList.id)
// {
// //获取模型编号
// string modelNum = TmsCards[j].modelNum;
// //获取U位
// var U = TmsCards[j].devicePosition;
// GameObject go;
// try
// {
// go = Instantiate(Resources.Load<GameObject>("古泉站机房模型90个型号/" + modelNum));
// //写入板卡配置
// go.GetComponent<DeviceQuery>().deviceList = Racks[i];
// Racks_go.Add(go);
// DragController drag = gameObject.GetComponent<DeviceManager>().dragController.GetComponent<DragController>();
// drag.oriObjectPrefab = go.GetComponent<DragTest1>();
// drag.uPosManger = jk.transform.Find("U位").GetComponent<UPosManger>();
// drag.CountUPos(drag.oriObjectPrefab, Convert.ToInt32(U) - 1);
// break;
// }
// catch (Exception e)
// {
// Debug.LogError("板卡模型生成错误:" + modelNum + "\n" + e.Message + "\n" + e.StackTrace);
// break;
// }
// }
//}
#endregion
}
Debug.Log("##010");
//读取板卡配置
for (int i = 0; i < TmsCards_go.Count; i++)
{
DeviceQuery DP;
DeviceQuery D;
//DP = TmsCards_go[i].transform.parent.GetComponent<DeviceQuery>();//板卡父物体
var _DP = FindParent(TmsCards_go[i], IsFindRacks_goORTmsCards_go);
D = TmsCards_go[i].transform.GetComponent<DeviceQuery>();//板卡
if (!_DP) continue;
DP = _DP.GetComponent<DeviceQuery>();
foreach (var item in TmsCards)
{
/*if (item.deviceType == "3")
{
}*/
//板卡在机槽里
if (DP.deviceList.deviceType == "2" && item.slotId == DP.deviceList.id && item.devicePosition == D.deviceList.devicePosition)
{
TmsCards_go[i].GetComponent<DeviceQuery>().deviceList = item;
break;
}
//板卡在机框里
else if (DP.deviceList.deviceType == "1" && item.shelfId == DP.deviceList.id && item.devicePosition == D.deviceList.devicePosition)
{
TmsCards_go[i].GetComponent<DeviceQuery>().deviceList = item;
break;
}
}
}
Debug.Log("设备加载完成");
}
/// <summary>
/// 查询所有设备
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public IEnumerator init_Device(Action<string> callback)
{
for (int i = Racks_go.Count - 1; i >= 0; i--)
{
DestroyImmediate(Racks_go[i]);
}
//Debug.Log("@@12-1");
for (int i = MachineSlots_go.Count - 1; i >= 0; i--)
{
DestroyImmediate(MachineSlots_go[i]);
}
//Debug.Log("@@12-2");
for (int i = TmsCards_go.Count - 1; i >= 0; i--)
{
DestroyImmediate(TmsCards_go[i]);
}
//Debug.Log("@@12-3");
Cabinets.Clear();
Racks_go.Clear();
Racks.Clear();
MachineSlots_go.Clear();
MachineSlots.Clear();
TmsCards_go.Clear();
TmsCards.Clear();
//Debug.Log("@@12-4");
//var jsonResult = await CombineJSON.GetJson_POST(Jk_URL.sb_cx, token);
//root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
//StartCoroutine(
// CombineJSON.GetJson_POST(Jk_URL.sb_cx, token, (jsonResult) =>
// {
// root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
// Debug.Log("设备查询完成" + "URL:" + Jk_URL.sb_cx + "Token:" + token + "返回内容" + jsonResult);
// })
//);
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.sb_cx, arguments.token, (jsonResult) =>
{
if (string.IsNullOrEmpty(jsonResult))
{
callback.Invoke(null);
}
try
{
root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
Debug.Log("设备查询完成" /*+ "URL:" + Jk_URL.sb_cx + "Token:" + arguments.token + "返回内容" + jsonResult*/);
callback?.Invoke("1");
}
catch (Exception e)
{
Debug.LogWarning("序列化-设备查询错误:" + e.Message);
callback.Invoke(null);
}
})
); ;
}
/// <summary>
/// 查询所有端口
/// </summary>
/// <returns></returns>
public IEnumerator init_Port(Action<string> callback)
{
for (int i = 0; i < TmsPorts_go.Count; i++)
{
DestroyImmediate(TmsPorts_go[i]);
}
TmsPorts_go.Clear();
TmsPorts.Clear();
//var jsonResult1 = await CombineJSON.GetJson_POST(Jk_URL.dk_cx, token);
//root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
//StartCoroutine(
//CombineJSON.GetJson_POST(Jk_URL.dk_cx, token, (jsonResult1) =>
//{
// root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
// Debug.Log("端口查询完成" + "URL:" + Jk_URL.dk_cx + "Token:" + token + "返回内容" + jsonResult1);
//})
//);
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.dk_cx, arguments.token, (jsonResult1) =>
{
if (string.IsNullOrEmpty(jsonResult1))
{
callback.Invoke(null);
}
try
{
root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
Debug.Log("端口查询完成" /*+ "URL:" + Jk_URL.dk_cx + "Token:" + arguments.token + "返回内容" + jsonResult1*/);
callback?.Invoke("1");
}
catch (Exception e)
{
Debug.LogWarning("序列化-端口查询错误:" + e.Message);
callback.Invoke(null);
}
})
); ;
}
/// <summary>
/// 查询所有环境
/// </summary>
/// <returns></returns>
public IEnumerator init_ENV(Action<string> callback)
{
ENVs.Clear();
//var jsonResult2 = await CombineJSON.GetJson_POST(Jk_URL.hj_cx, token);
//root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
//StartCoroutine(
//CombineJSON.GetJson_POST(Jk_URL.hj_cx, token, (jsonResult2) =>
//{
// root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
// Debug.Log("环境查询完成" + "URL:" + Jk_URL.hj_cx + "Token:" + token + "返回内容" + jsonResult2);
//})
//);
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.hj_cx, arguments.token, (jsonResult2) =>
{
if (string.IsNullOrEmpty(jsonResult2))
{
callback.Invoke(null);
}
try
{
root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
ENVs.Clear();
Debug.Log("环境查询完成" /*+ "URL:" + Jk_URL.hj_cx + "Token:" + arguments.token + "返回内容" + jsonResult2*/);
callback?.Invoke("1");
}
catch (Exception e)
{
Debug.LogWarning("序列化-环境查询错误:" + e.Message);
}
})
);
}
/// <summary>
/// 查询所有告警
/// </summary>
/// <returns></returns>
public IEnumerator init_TmsAlarm(Action<string> callback)
{
Array.ForEach(GameObject.FindObjectsOfType<TmsAlarmQuery>(), itme =>
{
itme.tmsAlarmLists.Clear();
});
tmsAlarms.Clear();
//var jsonResult3 = await CombineJSON.GetJson_POST(Jk_URL.gj_cx, token);
//root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
//StartCoroutine(
//CombineJSON.GetJson_POST(Jk_URL.gj_cx, token, (jsonResult3) =>
//{
// root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
// Debug.Log("告警查询完成" + "URL:" + Jk_URL.gj_cx + "Token:" + token + "返回内容" + jsonResult3);
//})
//);
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.gj_cx, arguments.token, (jsonResult3) =>
{
if (string.IsNullOrEmpty(jsonResult3))
{
callback.Invoke(null);
}
else
{
try
{
//if (!string.IsNullOrEmpty(jsonResult3))
{
root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
if (root_AllAlarm.message == "操作成功")
{
Array.ForEach(GameObject.FindObjectsOfType<TmsAlarmQuery>(), itme =>
{
itme.tmsAlarmLists.Clear();
});
tmsAlarms.Clear();
Debug.Log("告警查询完成" /*+ "URL:" + Jk_URL.gj_cx + "Token:" + arguments.token + "返回内容" + jsonResult3*/);
callback?.Invoke(jsonResult3);
}
else
{
Debug.Log("告警查询失败:" + root_AllAlarm.message);
callback?.Invoke(null);
}
}
//else
//{
// callback?.Invoke(null);
//}
}
catch (Exception e)
{
Debug.LogWarning("序列化-告警查询错误:" + e.Message);
callback.Invoke(null);
}
}
})
);
}
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)
{
try
{
root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonString);
}
catch
{
try
{
root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonString);
}
catch
{
try
{
root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonString);
}
catch
{
try
{
root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonString);
}
catch
{
}
}
}
}
}
/// <summary>
/// 获取层级
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public int CengJi(string s)
{
int cj = 0;
switch (s)
{
case "A":
cj = 0;
break;
case "B":
cj = 1;
break;
case "C":
cj = 2;
break;
case "D":
cj = 3;
break;
case "E":
cj = 4;
break;
case "F":
cj = 5;
break;
case "G":
cj = 6;
break;
case "H":
cj = 7;
break;
case "I":
cj = 8;
break;
default:
break;
}
return cj;
}
/// <summary>
/// 根据配置生成线缆
/// </summary>
[ContextMenu("根据配置生成线缆")]
public void FindPortPos()
{
var pqs = Array.FindAll(GameObject.FindObjectsOfType<PortQuery>(), itme =>
{
PortQuery pq = itme.GetComponent<PortQuery>();
if (!string.IsNullOrEmpty(pq.portList.id))
return true;
else
return false;
//return true;
})/*.Select(item => item.gameObject).ToArray()*/;
var P_list = FindObjectGroups(pqs.ToList());
CreateLine createLine = PatternChoose.Inst.huaXian.GetComponent<CreateLine>();
createLine.list7.Clear();
foreach (var item in P_list)
{
createLine.list7.Add(item[0].transform);
createLine.list7.Add(item[1].transform);
}
createLine.F7();
}
public List<List<PortQuery>> FindObjectGroups(List<PortQuery> objects)
{
List<List<PortQuery>> objectGroups = new List<List<PortQuery>>();
for (int i = 0; i < objects.Count; i++)
{
PortQuery objectA = objects[i];
for (int j = i + 1; j < objects.Count; j++)
{
PortQuery objectB = objects[j];
if (objectA.portList.conDevice == objectB.portList.deviceId && objectA.portList.port == objectB.portList.conPort &&
objectB.portList.conDevice == objectA.portList.deviceId && objectB.portList.port == objectA.portList.conPort)
{
bool isDuplicate = false;
foreach (List<PortQuery> group in objectGroups)
{
if (group.Contains(objectA) || group.Contains(objectB))
{
isDuplicate = true;
break;
}
}
if (!isDuplicate)
{
List<PortQuery> newGroup = new List<PortQuery>();
newGroup.Add(objectA);
newGroup.Add(objectB);
objectGroups.Add(newGroup);
}
}
}
}
return objectGroups;
}
public void AssignFields<T, U>(T target, U source)
{
Type typeTarget = typeof(T);
Type typeSource = typeof(U);
PropertyInfo[] propertiesTarget = typeTarget.GetProperties();
PropertyInfo[] propertiesSource = typeSource.GetProperties();
foreach (PropertyInfo propertyTarget in propertiesTarget)
{
PropertyInfo propertySource = Array.Find(propertiesSource, p => p.Name == propertyTarget.Name);
if (propertySource != null)
{
object propertyValue = propertySource.GetValue(source);
propertyTarget.SetValue(target, propertyValue);
}
}
}
/// <summary>
/// 显示机柜容量
/// </summary>
[ContextMenu("显示机柜容量")]
public void DisplayCapacity(Toggle t)
{
GameObject go;
if (!t.isOn)
{
CloseHighlight();
return;
}
//CloseHighlight();
Color c1 = new Color(1, 109f / 255, 0, 1);//小
Color c2 = new Color(1, 240f / 255, 0, 1);
Color c3 = new Color(1, 168f / 255, 0, 1);
Color c4 = new Color(112f / 255, 240f / 255, 73f / 255, 1);// 大
for (int i = 0; i < Cabinets_go.Count; i++)
{
var D = Cabinets_go[i].GetComponent<DeviceQuery>().deviceList;
//var H = Cabinets_go[i].GetComponent<HighlightEffect>();
//try
//{
// go = Cabinets_go[i].transform.Find(Cabinets_go[i].name).gameObject;
//}
//catch (Exception)
//{
// go = Cabinets_go[i];
//}
//var M = go.GetComponent<Renderer>().materials[0];
//var M_old = Cabinets_go[i].GetComponent<TransparentGlow>().empty[0];
//var M_new = new Material(M_old);
var hight = Cabinets_go[i].transform.Find("高亮").gameObject;
if (string.IsNullOrEmpty(D.residueNum)) continue;
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.25f))
{
//M_new.SetColor(c1);
//ChangeMaterialColor(go, 0, c1);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/1Tou");
}
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.5f))
{
// M_new.color = c2;
//ChangeMaterialColor(go, 0, c2);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/2Tou");
}
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.75f))
{
//M_new.color = c3;
//ChangeMaterialColor(go, 0, c3);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
}
else if (Convert.ToSingle(D.residueNum) <= (42))
{
//M_new.color = c4;
//ChangeMaterialColor(go, 0, c4);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/4Tou");
}
}
}
/// <summary>
/// 显示机柜容量
/// </summary>
/// <param name="t"></param>
public void DisplayCapacity(bool t)
{
GameObject go;
if (!t)
{
CloseHighlight();
return;
}
//CloseHighlight();
Color c1 = new Color(1, 109f / 255, 0, 1);//小
Color c2 = new Color(1, 240f / 255, 0, 1);
Color c3 = new Color(1, 168f / 255, 0, 1);
Color c4 = new Color(112f / 255, 240f / 255, 73f / 255, 1);// 大
for (int i = 0; i < Cabinets_go.Count; i++)
{
var D = Cabinets_go[i].GetComponent<DeviceQuery>().deviceList;
if (D.rackType == "2")
continue;
//var H = Cabinets_go[i].GetComponent<HighlightEffect>();
try
{
go = Cabinets_go[i].transform.Find(Cabinets_go[i].name).gameObject;
}
catch (Exception)
{
go = Cabinets_go[i];
}
//var M = go.GetComponent<Renderer>().materials[0];
//var M_old = Cabinets_go[i].GetComponent<TransparentGlow>().empty[0];
//var M_new = new Material(M_old);
var hight = Cabinets_go[i].transform.Find("高亮").gameObject;
if (string.IsNullOrEmpty(D.residueNum)) continue;
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.25f))
{
//M_new.SetColor(c1);
//ChangeMaterialColor(go, 0, c1);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/1Tou");
}
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.5f))
{
// M_new.color = c2;
//ChangeMaterialColor(go, 0, c2);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/2Tou");
}
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.75f))
{
//M_new.color = c3;
//ChangeMaterialColor(go, 0, c3);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
}
else if (Convert.ToSingle(D.residueNum) <= (42))
{
//M_new.color = c4;
//ChangeMaterialColor(go, 0, c4);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/4Tou");
}
}
}
/// <summary>
/// 关闭高亮
/// </summary>
[ContextMenu("关闭高亮")]
public void CloseHighlight()
{
//GameObject go;
for (int i = 0; i < Cabinets_go.Count; i++)
{
// try
// {
// go = Cabinets_go[i].transform.Find(Cabinets_go[i].name).gameObject;
// }
// catch (Exception)
// {
// go = Cabinets_go[i];
// }
// ChangeMaterialColor(go, 0, new Color(1, 1, 1, 1));
var hight = Cabinets_go[i].transform.Find("高亮").gameObject;
hight.SetActive(false);
}
}
/// <summary>
/// 显示柜门状态
/// </summary>
public void DoorCondition()
{
CloseHighlight();
//Color c = new Color(108f / 255, 221f / 255, 239f / 255, 1);
for (int i = 0; i < Cabinets_go.Count; i++)
{
var D = Cabinets_go[i].GetComponent<DeviceQuery>().deviceList;
var hight = Cabinets_go[i].transform.Find("高亮").gameObject;
//var H = Cabinets_go[i].GetComponent<HighlightEffect>();
//前门
if (!string.IsNullOrEmpty(D.openFlag))
{
if (D.openFlag == "0")
{
//关
power_close(Cabinets_go[i], "前门");
}
else if (D.openFlag == "1")
{
power_open(Cabinets_go[i], "前门");
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
continue;
//开
GameObject go = null;
try
{
go = Cabinets_go[i].transform.Find(Cabinets_go[i].name).gameObject;//有门的
}
catch (Exception)
{
go = Cabinets_go[i];//无门的
}
if (go)
{
//ChangeMaterialColor(go, 0, c);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
power_open(Cabinets_go[i], "前门");
}
//var door = Array.Find(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
//{
// return item.name.Contains("Object");
//});
//if (door)
// door.transform.localRotation = Quaternion.Euler(Vector3.forward * -90);
}
}
//后门
if (!string.IsNullOrEmpty(D.backDoorFlag))
{
if (D.backDoorFlag == "0")
{
power_close(Cabinets_go[i], "后门");
continue;
//模型原因微调
if (Cabinets_go[i].name == "R72") return;
//关
power_close(Cabinets_go[i], "后门");
}
else if (D.backDoorFlag == "1")
{
power_open(Cabinets_go[i], "后门");
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
continue;
//模型原因微调
if (Cabinets_go[i].name == "R72") return;
//开
GameObject go = null;
try
{
go = Cabinets_go[i].transform.Find(Cabinets_go[i].name).gameObject;//有门的
}
catch (Exception)
{
go = Cabinets_go[i];//无门的
}
if (go)
{
//ChangeMaterialColor(go, 0, c);
hight.SetActive(true);
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
power_open(Cabinets_go[i], "后门");
}
}
}
if (D.backDoorFlag == "0" && D.openFlag == "0")
hight.SetActive(false);
}
}
/// <summary>
/// 关门
/// </summary>
public void power_close()
{
#region old
//for (int i = 0; i < Cabinets_go.Count; i++)
//{
// //var door = Array.FindAll(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
// //{
// // return item.name.Contains("Object");
// //});
// if (/*door.Length == 4 && */Cabinets_go[i].name == "R71")
// {
// //Cabinets_go[i].transform.GetChild(0).localRotation = Quaternion.Euler(Vector3.zero);
// //Cabinets_go[i].transform.GetChild(1).localRotation = Quaternion.Euler(Vector3.zero);
// Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
// Cabinets_go[i].transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
// Cabinets_go[i].transform.GetChild(2).DOLocalRotate(Vector3.zero, 2);
// Cabinets_go[i].transform.GetChild(3).DOLocalRotate(Vector3.zero, 2);
// }
// //模型原因微调
// else if (Cabinets_go[i].name == "R72")
// {
// Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
// Cabinets_go[i].transform.GetChild(1).DOLocalRotate(Vector3.forward * -180, 2);
// }
// else /*if (door.Length == 2)*/
// {
// //door.transform.localRotation = Quaternion.Euler(Vector3.zero);
// Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
// Cabinets_go[i].transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
// }
//}
////CloseHighlight();
#endregion
for (int i = 0; i < roomDoors.Count; i++)
{
if (roomDoors[i].is_open)
roomDoors[i].DoorClose(true);
}
}
/// <summary>
/// 开门
/// </summary>
public void power_open()
{
#region old
//for (int i = 0; i < Cabinets_go.Count; i++)
//{
// //var door = Array.FindAll(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
// //{
// // return item.name.Contains("Object");
// //});
// if (/*door.Length == 4 && */Cabinets_go[i].name == "R71")
// {
// //Cabinets_go[i].transform.GetChild(0).localRotation = Quaternion.Euler(Vector3.forward * -90);
// //Cabinets_go[i].transform.GetChild(1).localRotation = Quaternion.Euler(Vector3.forward * 90);
// Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
// Cabinets_go[i].transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
// }
// //模型原因微调
// else if (Cabinets_go[i].name == "R72")
// {
// Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
// Cabinets_go[i].transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
// }
// else /*if (door.Length == 2)*/
// {
// //door.transform.localRotation = Quaternion.Euler(Vector3.forward * -90);
// //door.transform.DOLocalRotate(Vector3.forward * -90, 2f);
// Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
// }
//}
//CloseHighlight();
#endregion
for (int i = 0; i < roomDoors.Count; i++)
{
if (!roomDoors[i].is_open)
roomDoors[i].DoorOpen(true);
}
}
/// <summary>
/// 开门(单个)
/// </summary>
/// <param name="cabinet"></param>
public void power_open(GameObject cabinet, string type)
{
#region old
//if (type == "前门")
//{
// if (/*door.Length == 4 && */cabinet.name == "R71")
// {
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
// }
// else /*if (door.Length == 2)*/
// //door.transform.localRotation = Quaternion.Euler(Vector3.forward * -90);
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
//}
//else if (type == "后门")
//{
// if (/*door.Length == 4 && */cabinet.name == "R71")
// {
// cabinet.transform.GetChild(2).DOLocalRotate(Vector3.forward * -90, 2f);
// cabinet.transform.GetChild(3).DOLocalRotate(Vector3.forward * 90, 2f);
// }
// //模型原因微调
// else if (cabinet.name == "R72")
// {
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
// }
// else /*if (door.Length == 2)*/
// //door.transform.localRotation = Quaternion.Euler(Vector3.forward * -90);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * -90, 2f);
//}
//else if (type == "全开")
//{
// if (/*door.Length == 4 && */cabinet.name == "R71")
// {
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
// cabinet.transform.GetChild(2).DOLocalRotate(Vector3.forward * -90, 2f);
// cabinet.transform.GetChild(3).DOLocalRotate(Vector3.forward * 90, 2f);
// }
// //模型原因微调
// else if (cabinet.name == "R72")
// {
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
// }
// else /*if (door.Length == 2)*/
// {
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * -90, 2f);
// }
//}
#endregion
var doors = cabinet.GetComponentsInChildren<RoomDoor>(true);
if (doors.Length <= 0) return;
if (type == "前门")
{
if (doors.Length > 2)
{
cabinet.transform.GetChild(0).GetComponent<RoomDoor>().DoorOpen(true);
cabinet.transform.GetChild(1).GetComponent<RoomDoor>().DoorOpen(true);
}
else
{
cabinet.transform.GetChild(0).GetComponent<RoomDoor>().DoorOpen(true);
}
}
else if (type == "后门")
{
if (doors.Length > 2)
{
cabinet.transform.GetChild(2).GetComponent<RoomDoor>().DoorOpen(true);
cabinet.transform.GetChild(3).GetComponent<RoomDoor>().DoorOpen(true);
}
else
{
cabinet.transform.GetChild(1).GetComponent<RoomDoor>().DoorOpen(true);
}
}
else if (type == "全开")
{
for (int i = 0; i < doors.Length; i++)
{
doors[i].DoorOpen(true);
}
}
}
/// <summary>
/// 关门(单个)
/// </summary>
/// <param name="cabinet"></param>
public void power_close(GameObject cabinet, string type)
{
#region old
////var door = Array.FindAll(cabinet.GetComponentsInChildren<Renderer>(), item =>
////{
//// return item.name.Contains("Object");
////});
//if (type == "前门")
//{
// if (/*door.Length == 4 && */cabinet.name == "R71")
// {
// //cabinet.transform.GetChild(0).localRotation = Quaternion.Euler(Vector3.zero);
// //cabinet.transform.GetChild(1).localRotation = Quaternion.Euler(Vector3.zero);
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
// }
// else/* (door.Length == 2)*/
// //door.transform.localRotation = Quaternion.Euler(Vector3.zero);
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
//}
//else if (type == "后门")
//{
// if (/*door.Length == 4 && */cabinet.name == "R71")
// {
// cabinet.transform.GetChild(2).DOLocalRotate(Vector3.zero, 2);
// cabinet.transform.GetChild(3).DOLocalRotate(Vector3.zero, 2);
// }
// //模型原因微调
// else if (cabinet.name == "R72")
// {
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * -180, 2);
// }
// else /*if (door.Length == 2)*/
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
//}
//else if (type == "全关")
//{
// if (cabinet.name == "R71")
// {
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
// cabinet.transform.GetChild(2).DOLocalRotate(Vector3.zero, 2);
// cabinet.transform.GetChild(3).DOLocalRotate(Vector3.zero, 2);
// }
// //模型原因微调
// else if (cabinet.name == "R72")
// {
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * -180, 2);
// }
// else
// {
// cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
// cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
// }
//}
#endregion
var doors = cabinet.GetComponentsInChildren<RoomDoor>(true);
if (doors.Length <= 0) return;
if (type == "前门")
{
if (doors.Length > 2)
{
cabinet.transform.GetChild(0).GetComponent<RoomDoor>().DoorClose(true);
cabinet.transform.GetChild(1).GetComponent<RoomDoor>().DoorClose(true);
}
else
{
cabinet.transform.GetChild(0).GetComponent<RoomDoor>().DoorClose(true);
}
}
else if (type == "后门")
{
if (doors.Length > 2)
{
cabinet.transform.GetChild(2).GetComponent<RoomDoor>().DoorClose(true);
cabinet.transform.GetChild(3).GetComponent<RoomDoor>().DoorClose(true);
}
else
{
cabinet.transform.GetChild(1).GetComponent<RoomDoor>().DoorClose(true);
}
}
else if (type == " 全开")
{
for (int i = 0; i < doors.Length; i++)
{
doors[i].DoorClose(true);
}
}
}
/// <summary>
/// 变色
/// </summary>
/// <param name="go"></param>
/// <param name="materialIndex"></param>
/// <param name="newColor"></param>
public void ChangeMaterialColor(GameObject go, int materialIndex, Color newColor)
{
MeshRenderer renderer = go.GetComponent<MeshRenderer>();
// 获取当前材质球数组
Material[] materials = renderer.materials;
// 确保 materialIndex 在有效范围内
if (materialIndex >= 0 && materialIndex < materials.Length)
{
// 创建新的材质球数组
Material[] newMaterials = materials.Clone() as Material[];
// 更改特定索引位置的材质球颜色
newMaterials[materialIndex].color = newColor;
// 将新的材质球数组赋值给 MeshRenderer
renderer.materials = newMaterials;
}
}
/// <summary>
/// 变色
/// </summary>
/// <param name="go"></param>
/// <param name="materialIndex"></param>
/// <param name="newColor"></param>
public void ChangeMaterialColor(GameObject go, int index)
{
var hight = go.transform.Find("高亮").gameObject;
Material material = null;
switch (index)
{
case 1:
material = Resources.Load<Material>("Materials/1Tou");
break;
case 2:
material = Resources.Load<Material>("Materials/2Tou");
break;
case 3:
material = Resources.Load<Material>("Materials/3Tou");
break;
case 4:
material = Resources.Load<Material>("Materials/4Tou");
break;
default:
break;
}
hight.GetComponent<Renderer>().material = material;
hight.SetActive(true);
//Renderer renderer = hight.GetComponent<Renderer>();
//Material[] sharedMaterials = renderer.sharedMaterials;
////for (int i = 0; i < sharedMaterials.Length; i++)
////{
//// sharedMaterials[i] = newMaterial;
////}
//sharedMaterials[0] = material;
//renderer.sharedMaterials = sharedMaterials;
}
private void OnDisable()
{
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.End))
{
init();
}
}
public void init()
{
if (!nowCabine && nowCabine != null && !objectToShow_add)
{
var serarch1 = objectToShow_add.GetComponent<SearchName1>();
var drag = serarch1.dragController;
drag.uPosManger = nowCabine.transform.Find("U位").GetComponent<UPosManger>();
}
Array.ForEach(pop_ups.ToArray(), (itme) =>
{
itme.gameObject.SetActive(false);
});
StartCoroutine(LoadAddress((ct) =>
{
if (ct != null)
{
Jk_URL = new webURL(ct);
StartCoroutine(Initialize((x) =>
{
if (string.IsNullOrEmpty(x))
{
SecondConfirmPanel.DeleteConform(null, "进入场景失败");
Debug.Log("接口获取数据失败(手动-初始化失败)");
LoadScene();
}
}));
}
else
{
Debug.Log("获取地址错误!");
}
}));
}
/// <summary>
/// 递增寻找父物体
/// </summary>
/// <param name="gameObject"></param>
/// <param name="condition"></param>
/// <returns></returns>
public GameObject FindParent(GameObject gameObject, System.Predicate<GameObject> condition)
{
if (gameObject == null)
return null;
if (condition(gameObject))
return gameObject;
Transform parent = gameObject.transform.parent;
while (parent != null)
{
if (condition(parent.gameObject))
{
return parent.gameObject;
}
parent = parent.parent;
}
return null;
}
/// <summary>
/// 条件--机柜
/// </summary>
/// <param name="go"></param>
/// <returns></returns>
public bool IsDesiredParent(GameObject go)
{
DeviceQuery d = go.GetComponent<DeviceQuery>();
return (d != null && d.deviceList.type == "1");
}
public bool IsFindParent_UPosManger(GameObject go)
{
UPosManger d = go.GetComponent<UPosManger>();
return (d != null);
}
/// <summary>
/// 条件-机框
/// </summary>
/// <param name="go"></param>
/// <returns></returns>
public bool IsFindRacks_go(GameObject go)
{
DeviceQuery d = go.GetComponent<DeviceQuery>();
return (d != null && d.deviceList.type == "2" && d.deviceList.deviceType == "1");
}
/// <summary>
/// 条件--机框或机槽
/// </summary>
/// <param name="go"></param>
/// <returns></returns>
public bool IsFindRacks_goORTmsCards_go(GameObject go)
{
DeviceQuery d = go.GetComponent<DeviceQuery>();
return (d != null && d.deviceList.type == "2" && (d.deviceList.deviceType == "1" || d.deviceList.deviceType == "2"));
}
// 读取地址
public IEnumerator LoadAddress(Action<string> callback)
{
#region UnityWebRequest读取
string filePath = Application.streamingAssetsPath + "/dz.txt";
UnityWebRequest www = UnityWebRequest.Get(filePath);
DownloadHandlerBuffer dH = new DownloadHandlerBuffer();
www.downloadHandler = dH;
//www.timeout = 15;
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
{
// 等待一帧
yield return null;
// 检查请求是否已完成
while (!www.isDone)
{
yield return null;
}
string fileContent = www.downloadHandler.text;
if (string.IsNullOrEmpty(fileContent))
{
callback(null);
}
else
{
Debug.Log("获取穿透成功");
callback(fileContent);
}
}
else
{
Debug.LogError("获取穿透失败: " + www.error);
callback(null);
}
#endregion
//yield return 1;
//callback("http://192.168.41.106:8081/");
}
// 获取接口信息
public IEnumerator Initialize(Action<string> callback = null)
{
yield return null;
//Debug.Log("@@10");
isLoading = false;
//Debug.Log("@@11");
//TransparentGlowManage.Inst.addScript();
//Debug.Log("@@12");
/*yield return */
StartCoroutine(init_Device((x) =>
{
Debug.Log("@@1");
if (!string.IsNullOrEmpty(x))
{
Debug.Log("@@2");
StartCoroutine(init_Port((y) =>
{
Debug.Log("@@3");
if (!string.IsNullOrEmpty(y))
{
Debug.Log("@@4");
StartCoroutine(LineQuery.Inst.getJsonCoroutine((z) =>
{
if (z != null)
{
Debug.Log("@@5");
StartCoroutine(PatternChoose.Inst.xianlan.getByCode((v) =>
{
Debug.Log("@@5.1");
if (!string.IsNullOrEmpty(v))
{
LoadScene();
callback?.Invoke("1");
}
else
{
Debug.Log("查询线路类型错误 @@5.1");
callback.Invoke(null);
}
}));
}
else
{
Debug.Log("查询线缆组错误 @@4");
callback.Invoke(null);
}
}));
}
else
{
Debug.Log("查询端口错误 @@3");
callback.Invoke(null);
}
}));
}
else
{
Debug.Log("查询设备错误 @@1");
callback.Invoke(null);
//callback?.Invoke("1");
}
}));
//Debug.Log("@@13");//???
//yield return StartCoroutine(init_Port());
//Debug.Log("@@14");
//yield return StartCoroutine(init_TmsAlarm());
//yield return StartCoroutine(init_ENV());
//yield return StartCoroutine(LineQuery.Inst.getJsonCoroutine());
//Debug.Log("@@15");
//LoadScene();
}
// 加载场景
public void LoadScene()
{
Debug.Log("@@5.2");
Array.ForEach(GameManager.Inst.pop_ups.ToArray(), (itme) =>
{
itme.gameObject.SetActive(false);
});
Debug.Log("@@5.3");
// 加载场景
Load_Device();
Debug.Log("@@5.4");
Load_Port();
//Load_TmsAlarm();
//Load_ENV();
Debug.Log("@@6");
TransparentGlowManage.Inst.addScript();
Debug.Log("@@7");
LineGroupManager.Instance.addxianlan();
Debug.Log("@@8");
for (int i = 0; i < Cabinets_go.Count; i++)
{
Cabinets_go[i].GetComponent<TransparentGlow>().OnSceneReloaded();
}
Debug.Log("@@9");
//三维场景加载时显示地图
Application.ExternalCall("OnSceneLoaded", "三维加载完成");
Debug.Log("@@10 三维加载完成");
isLoading = true;
if (CabinetUIManager.Instance.current_menu == Menu.M_数字孪生_线缆连接_配置)
{
for (int i = 0; i < TmsPorts_go.Count; i++)
{
var g = FindParent(TmsPorts_go[i], IsDesiredParent);
if (g && g.activeSelf)
TmsPorts_go[i].GetComponent<PortQuery>().hight.SetActive(true);
}
}
if (magnifyState)
{
openCap();
}
//Debug.Log("@@16");
}
/// <summary>
/// 模型微调(打开前盖)
/// </summary>
/// <param name="isZoomin">是否为放大状态</param>
public void openCap()
{
for (int i = 0; i < GameManager.Inst.Racks_go.Count; i++)
{
if (!GameManager.Inst.Racks_go[i].activeSelf)
continue;
if (GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.modelNum == "6" ||
GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.modelNum == "7" ||
GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.modelNum == "20" ||
GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.modelNum == "21" ||
GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.modelNum == "91" ||
GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.modelNum == "92" ||
GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.modelNum == "93")
GameManager.Inst.Racks_go[i].transform.Find("前盖").gameObject.SetActive(false);
}
}
/// <summary>
/// 模型错误微调
/// </summary>
/// <param name="modelNum"></param>
/// <param name="go"></param>
public void Model_error(string modelNum, GameObject go)
{
if (modelNum == "1" || modelNum == "14" || modelNum == "15" || modelNum == "83")
{
MoveParentAndChildren(go.transform, new Vector3(-0.25f, 0, 0));
}
else if (modelNum == "4")
{
//MoveParentAndChildren(go.transform, new Vector3(-0.31f, 0, 0.1575f), false);
MoveParentAndChildren(go.transform, new Vector3(-0.244f, 0.1575f, 0), false);
}
else if (modelNum == "18")
{
MoveParentAndChildren(go.transform, new Vector3(-0.31f, 0, 0), false);
}
else if (modelNum == "19")
{
MoveParentAndChildren(go.transform, new Vector3(-0.27f, 0f, -0), false);
}
else if (modelNum == "24" || modelNum == "34")
{
MoveParentAndChildren(go.transform, new Vector3(-0.4f, 0f, -0), false);
}
else if (modelNum == "6" || modelNum == "7" || modelNum == "20" || modelNum == "21" || modelNum == "91" || modelNum == "92" || modelNum == "93")
{
MoveParentAndChildren(go.transform, new Vector3(-0.163f, 0, 0), false);
}
else if (modelNum == "36")
{
MoveParentAndChildren(go.transform, new Vector3(-0.248f, 0, 0), false);
}
else if (modelNum == "37" || modelNum == "41")
{
MoveParentAndChildren(go.transform, new Vector3(0, 0.0685f, 0), false);
}
else if (modelNum == "55")
{
MoveParentAndChildren(go.transform, new Vector3(-0.296f, 0f, 0f), false);
}
else if (modelNum == "77")
{
MoveParentAndChildren(go.transform, new Vector3(-0.208f, 0f, 0f), false);
}
else if (modelNum == "81")
{
MoveParentAndChildren(go.transform, new Vector3(-0.17f, 0f, 0f), false);
}
else if (modelNum == "86")
{
MoveParentAndChildren(go.transform, new Vector3(-0.212f, 0f, 0f), false);
}
else if (modelNum == "95" || modelNum == "96" || modelNum == "97")
{
MoveParentAndChildren(go.transform, new Vector3(-0.09f, 0, 0));
}
else if (modelNum == "98")
{
MoveParentAndChildren(go.transform, new Vector3(-0.258f, 0, 0), false);
}
}
/// <summary>
/// 微调模型移动
/// </summary>
public void MoveParentAndChildren(Transform parentTransform, Vector3 moveDistance, bool ismove_child = true)
{
// 移动父物体
parentTransform.position += moveDistance;
if (!ismove_child)
return;
// 移动所有子物体
foreach (Transform childTransform in parentTransform)
{
childTransform.position += moveDistance;
}
}
/// <summary>
/// 接口地址
/// </summary>
[System.Serializable]
public class webURL
{
/// <summary>
/// 设备-查询URL
/// </summary>
[Header("设备-查询URL")] public string sb_cx;
/// <summary>
/// 设备-新增URL
/// </summary>
[Header("设备-新增URL")] public string sb_xz;
/// <summary>
/// 设备-删除URL
/// </summary>
[Header("设备-删除URL")] public string sb_sc;
/// <summary>
/// 设备-编辑URL
/// </summary>
[Header("设备-编辑URL")] public string sb_bj;
/// <summary>
/// 端口-查询URL
/// </summary>
[Header("端口-查询URL")] public string dk_cx;
/// <summary>
/// 端口-新增URL
/// </summary>
[Header("端口-新增URL")] public string dk_xz;
/// <summary>
/// 端口-删除URL
/// </summary>
[Header("端口-删除URL")] public string dk_sc;
/// <summary>
/// 端口-编辑URL
/// </summary>
[Header("端口-编辑URL")] public string dk_bj;
/// <summary>
/// 环境-查询URL
/// </summary>
[Header("环境-查询URL")] public string hj_cx;
/// <summary>
/// 告警-查询URL
/// </summary>
[Header("告警-查询URL")] public string gj_cx;
/// <summary>
/// 工作票-查询URL
/// </summary>
[Header("工作票-查询URL")] public string gzp_cx;
/// <summary>
/// 检修票-查询URL
/// </summary>
[Header("检修票-查询URL")] public string jxp_cx;
/// <summary>
/// 线缆组-查询URL
/// </summary>
[Header("线缆组-查询URL")] public string xlz_cx;
/// <summary>
/// 线缆组-新增URL
/// </summary>
[Header("线缆组-查询URL")] public string xlz_xz;
/// <summary>
/// 线缆组-删除URL
/// </summary>
[Header("线缆组-查询URL")] public string xlz_sc;
/// <summary>
/// 线路类型-查询URL
/// </summary>
[Header("线路类型-查询URL")] public string xllx_cx;
/// <summary>
/// 菜单权限-查询URL
/// </summary>
[Header("菜单权限-查询URL")] public string cdqx_cx;
/// <summary>
/// 红外监测详情-查询URL
/// </summary>
[Header("红外监测详情-查询URL")] public string hwjc_cx;
/// <summary>
/// 机器人保存指令URL
/// </summary>
[Header("机器人保存指令URL")] public string jqr_bczl;
/// <summary>
/// 机器人保存坐标URL
/// </summary>
[Header("机器人保存坐标URL")] public string jqr_bczb;
/// <summary>
/// 机器人返回筛选-查询URL
/// </summary>
[Header("机器人返回筛选-查询URL")] public string jqr_xj_cx;
public webURL(string ct)
{
//string ct = "http://fpt9gx.natappfree.cc/";
sb_cx = ct + "device/queryList";
sb_xz = ct + "device/save";
sb_sc = ct + "device/delete";
sb_bj = ct + "device/updateById";
dk_cx = ct + "port/queryList";
dk_xz = ct + "port/save";
dk_sc = ct + "port/delete";
dk_bj = ct + "port/updateById";
hj_cx = ct + "tmsPoint/queryList";
gj_cx = ct + "tmsAlarm/queryList";
gzp_cx = ct + "tmsWorkTicket/queryList";
jxp_cx = ct + "tmsOverhaulTicket/queryList";
xlz_cx = ct + "deviceLine/queryList";
xlz_xz = ct + "deviceLine/save";
xlz_sc = ct + "deviceLine/delete";
xllx_cx = ct + "sysParam/getByCode?code=line";
cdqx_cx = ct + "menu/getMenus";
hwjc_cx = ct + "lora/getLatestAlarms";
jqr_bczl = ct + "robot/saveInstruct";
jqr_bczb = ct + "robot/saveCoordinate";
jqr_xj_cx = ct + "robot/queryInspection";
}
}
/// <summary>
/// 全局参数
/// </summary>
[System.Serializable]
public class GlobalParameter
{
/// <summary>
/// 登录后返回
/// </summary>
public string token;
/// <summary>
/// 温度最大阈值
/// </summary>
[Tooltip("温度最大阈值")] public string heatThresholdValueMax;
/// <summary>
/// 温度最小阈值
/// </summary>
[Tooltip("温度最小阈值")] public string heatThresholdValueMin;
/// <summary>
/// 湿度最大阈值
/// </summary>
[Tooltip("湿度最大阈值")] public string humidityThresholdValueMax;
/// <summary>
/// 湿度最小阈值
/// </summary>
[Tooltip("湿度最小阈值")] public string humidityThresholdValueMin;
}
}