This commit is contained in:
高国正 2023-08-17 16:21:33 +08:00
parent b5e7fe02e4
commit 0a36492147
5 changed files with 2799 additions and 14756 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,9 @@ using static DeviceQuery;
using static PortQuery;
using UnityEngine.Timeline;
using AutoMapper;
using HighlightPlus;
using UnityEngine.UI;
using static ENVQuery;
public class GameManager : MonoBehaviour
{
@ -30,6 +33,8 @@ public class GameManager : MonoBehaviour
[Header("机柜区域集合")]
public List<Transform> Cabinet_quYu;
[Header("当前设备ID")] public string nowDeviceID;
[Header("设备-查询接口")] public DeviceQuery.Root root_AllDevice;
///// <summary>
@ -73,7 +78,7 @@ public class GameManager : MonoBehaviour
/// </summary>
public List<DeviceList> TmsCards;
[Header(""), Header("端口-查询接口")] public PortQuery.Root root_AllPort;
[Header("端口-查询接口")] public PortQuery.Root root_AllPort;
/// <summary>
/// 场景所有端口
@ -84,9 +89,10 @@ public class GameManager : MonoBehaviour
/// </summary>
public List<PortList> TmsPorts;
[HideInInspector]public int nowLayerMask = 6;
[HideInInspector] public int nowLayerMask = 6;
[Header("当前设备ID")] public string nowDeviceID;
[Header("环境-查询接口")] public ENVQuery.Root root_AllENV;
public List<ENVList> ENVs;
private void Awake()
{
@ -119,7 +125,7 @@ public class GameManager : MonoBehaviour
if (root_AllDevice.data == null) return;
#region
//设备信息分类-保存
//信息分类-保存
foreach (var item in root_AllDevice.data)
{
//(机柜)
@ -144,6 +150,11 @@ public class GameManager : MonoBehaviour
}
}
for (int i = 0; i < root_AllENV.data.Count; i++)
{
ENVs.Add(root_AllENV.data[i]);
}
//读取机柜配置
#region
//if (Cabinets_POS != null)
@ -179,8 +190,6 @@ public class GameManager : MonoBehaviour
#endregion
//读取机柜配置
if (Cabinets_go != null)
{
for (int i = 0; i < Cabinets_go.Count; i++)
{
var n = Cabinets_go[i].GetComponent<DeviceQuery>().deviceList;
@ -195,7 +204,38 @@ public class GameManager : MonoBehaviour
}
}
}
//读取机柜环境配置
for (int j = 0; j < ENVs.Count;)
{
for (int i = 0; i < Cabinets_go.Count; i++)
{
var n = Cabinets_go[i].GetComponent<DeviceQuery>().deviceList;
var e = Cabinets_go[i].GetComponent<ENVQuery>();
if (ENVs[j].pointDeviceId == n.id)
{
if (ENVs[j].pointType == "1")
{
e.eNVList_W = ENVs[j];
break;
}
else if (ENVs[j].pointType == "2")
{
e.eNVList_S = ENVs[j];
break;
}
else if (ENVs[j].pointType == "3")
{
}
else if (ENVs[j].pointType == "4")
{
}
}
}
}
//动态加载设备(机框)
for (int i = 0; i < Racks.Count; i++)
@ -600,6 +640,10 @@ public class GameManager : MonoBehaviour
var jsonResult1 = await CombineJSON.GetJson_POST(Jk_URL.dk_cx, token);
root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
var jsonResult2 = await CombineJSON.GetJson_POST(Jk_URL.hj_cx, token);
root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
//return root;
}
@ -692,13 +736,95 @@ public class GameManager : MonoBehaviour
}
}
/// <summary>
/// 显示机柜容量
/// </summary>
[ContextMenu("显示机柜容量")]
public void DisplayCapacity(Toggle t)
{
if (!t.isOn) 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>();
H.overlay = 0.8f;
if (string.IsNullOrEmpty(D.residueNum)) continue;
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.25f))
{
H.overlayColor = c1;
H.highlighted = true;
}
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.5f))
{
H.overlayColor = c2;
H.highlighted = true;
}
else if (Convert.ToSingle(D.residueNum) <= (42 * 0.75f))
{
H.overlayColor = c3;
H.highlighted = true;
}
else if (Convert.ToSingle(D.residueNum) <= (42))
{
H.overlayColor = c4;
H.highlighted = true;
}
}
}
/// <summary>
/// 关闭高亮
/// </summary>
[ContextMenu("关闭高亮")]
public void CloseHighlight()
{
Array.ForEach(GameObject.FindObjectsOfType<HighlightEffect>(), item =>
{
item.outline = 0;
item.glow = 0;
item.innerGlow = 0;
item.overlayMinIntensity = 0f;
item.overlay = 0;
item.highlighted = false;
});
}
/// <summary>
/// 显示柜门状态
/// </summary>
[ContextMenu("显示柜门状态")]
public void DoorCondition(Toggle t)
{
if (!t.isOn) return;
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 H = Cabinets_go[i].GetComponent<HighlightEffect>();
if (string.IsNullOrEmpty(D.openFlag)) continue;
else if (D.openFlag == "0")
{
//关
}
else if (D.openFlag == "1")
{
//开
H.outlineColor = c;
H.outline = 1;
H.glowHQColor = c;
H.glow = 0.31f;
H.highlighted = true;
}
}
}
@ -781,7 +907,7 @@ public class GameManager : MonoBehaviour
public webURL()
{
string ct = "http://988ze4.natappfree.cc/";
string ct = " http://fpt9gx.natappfree.cc/";
sb_cx = ct + "machineRoom/device/queryList";
sb_xz = ct + "machineRoom/device/save";
sb_sc = ct + "machineRoom/device/delete";

View File

@ -50,7 +50,7 @@ public class PatternChoose : MonoBehaviour
}
void F1(bool isheatMap)
public void F1(bool isheatMap)
{
heatMap.SetActive(isheatMap);
ExtendedFlycam.Inst.init_mainCamera_rot();

View File

@ -9,27 +9,28 @@ using UnityEngine;
[AddComponentMenu("环境查询")]
public class ENVQuery : MonoBehaviour
{
public ENVList eNVList = new ENVList();
public ENVList eNVList_W;//温度
public ENVList eNVList_S;//湿度
private async void Start()
private void Start()
{
//await initAsync("");
}
public async Task initAsync()
{
var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.hj_cx, GameManager.Inst.token);
//var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.hj_cx, GameManager.Inst.token);
Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
//Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
foreach (var item in root.data)
{
if (item.pointId == eNVList.pointId)
{
eNVList = item;
break;
}
}
//foreach (var item in root.data)
//{
// if (item.pointId == eNVList.pointId)
// {
// eNVList = item;
// break;
// }
//}
}
void Update()
@ -38,16 +39,17 @@ public class ENVQuery : MonoBehaviour
}
#region JSON
[System.Serializable]
public class ENVList
{
/// <summary>
/// 点位ID
/// </summary>
[Tooltip("µãλID")] public int pointId;
[Tooltip("点位ID")] public string pointId;
/// <summary>
/// 点位设备ID
/// </summary>
[Tooltip("µãλÉ豸ID")] public int pointDeviceId;
[Tooltip("点位设备ID")] public string pointDeviceId;
/// <summary>
/// 点位名称
/// </summary>
@ -63,13 +65,14 @@ public class ENVQuery : MonoBehaviour
/// <summary>
/// 采集时间
/// </summary>
[Tooltip("²É¼¯Ê±¼ä")] public int collectDate;
[Tooltip("采集时间")] public string collectDate;
/// <summary>
/// 当前状态(采集结果)
/// </summary>
[Tooltip("当前状态(采集结果)")] public string collectResult;
}
[System.Serializable]
public class Root
{
/// <summary>

View File

@ -109,7 +109,7 @@ public class ExtendedFlycam : MonoBehaviour
//Debug.Log(rotationX + "\n" + rotationX);
// 从initialRotationEulerAngles开始旋转然后添加旋转增量。
Vector3 rotation = initialRotationEulerAngles + new Vector3(-rotationY, rotationX, 0);
Vector3 rotation = initialRotationEulerAngles + new Vector3(rotationY, rotationX, 0);
transform.localRotation = Quaternion.Euler(rotation);
//transform.localEulerAngles = rotation;
}