diff --git a/.vsconfig b/.vsconfig new file mode 100644 index 0000000..1586a48 --- /dev/null +++ b/.vsconfig @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedGame" + ] +} diff --git a/Assets/Scripts/ANet/DeviceInfo.cs b/Assets/Scripts/ANet/DeviceInfo.cs index feb28dc..504c560 100644 --- a/Assets/Scripts/ANet/DeviceInfo.cs +++ b/Assets/Scripts/ANet/DeviceInfo.cs @@ -34,60 +34,112 @@ public class DeviceInfo : MonoBehaviour Destroy(item.gameObject); } } + Debug.Log("数据:" + info.timelyData); + /* + 设备类型code (136-用户信息传输装置, 258-消防水泵状态, + 401-消防水箱水位, 302-消防主管网压力, 305-消火栓末端压力, + 256-喷淋泵, 301-喷淋主管网压力, 304-喷淋末端压力, + 451-正压送风机, 452-防火排烟风机, 453-补风机) + */ + InfoBase infobase = JsonConvert.DeserializeObject(info.timelyData.ToString()); + { + GameObject go = Instantiate(infoItem, infoParent); + go.GetComponent().Bind("名称 : " + infobase.deviceName); + } + { + GameObject go = Instantiate(infoItem, infoParent); + go.GetComponent().Bind("类型 : " + infobase.deviceTypeName); + } if (info.deviceType == 256 || info.deviceType == 258) { + PLInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); { - PLInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); + GameObject go = Instantiate(infoItem, infoParent); - go.GetComponent().Bind("名称:" + pinfo.deviceName); + go.GetComponent().Bind("手自动状态 : " + (pinfo.manualAutomaticState == "0" ? "自动" : "手动")); } { - PLInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); GameObject go = Instantiate(infoItem, infoParent); - go.GetComponent().Bind("状态:" + pinfo.startStopStatus); + go.GetComponent().Bind("电源状态 : " + (pinfo.powerState == "0" ? "已上电" : "未上电")); } { - PLInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); GameObject go = Instantiate(infoItem, infoParent); - go.GetComponent().Bind("状态:" + pinfo.faultStatus); + go.GetComponent().Bind("故障信息 : " + (pinfo.faultStatus == "0" ? "正常" : "故障")); } { - PLInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); GameObject go = Instantiate(infoItem, infoParent); - go.GetComponent().Bind("电源状态:" + pinfo.powerState); + go.GetComponent().Bind("启停状态 : " + (pinfo.startStopStatus == "0" ? "停止" : "启动")); } + } + else if (info.deviceType == 401) + { + SXInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); { - PLInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); GameObject go = Instantiate(infoItem, infoParent); - go.GetComponent().Bind("描述:" + pinfo.descript); + go.GetComponent().Bind("水位 : " + pinfo.level); } { - PLInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); GameObject go = Instantiate(infoItem, infoParent); - go.GetComponent().Bind("楼层:" + pinfo.floor); + go.GetComponent().Bind("预警状态 : " + (pinfo.alarmStatus == "0" ? "正常" : "告警")); } } - + else if (info.deviceType == 305) + { + XHSInfo pinfo = JsonConvert.DeserializeObject(info.timelyData.ToString()); + { + GameObject go = Instantiate(infoItem, infoParent); + go.GetComponent().Bind("压力 : " + pinfo.pressure); + } + { + GameObject go = Instantiate(infoItem, infoParent); + go.GetComponent().Bind("预警状态 : " + (pinfo.alarmStatus == "0" ? "正常" : "告警")); + } + } + { + GameObject go = Instantiate(infoItem, infoParent); + go.GetComponent().Bind("楼层 : " + infobase.floor); + } + { + GameObject go = Instantiate(infoItem, infoParent); + go.GetComponent().Bind("描述 : " + infobase.descript); + } gameObject.SetActive(true); } } -public class PLInfo +public class InfoBase +{ + public string deviceType;//类型例如"256" + public string devInterface;//"spraypump" + public string openProjectId;//"1150" + public string deviceTypeName;//"喷淋泵" + public string ulogtime;// "1712793073050" + public int isOnline;//1 在线状态 + public string deviceNo;//"2020000006461" + public string deviceName; //"水泵控制柜6461" + public string logTime;//"2024-04-11 07:51:12" + public string devSystem;// "sprinkler" + public string appKey;// "849248896159842305" + public string descript;//描述 + public string floor;//楼层 +} +//manualAutomaticState 手自动状态(0 自动,1 手动) TRUE string +//powerState 电源状态(0 已上电,1 未上电) TRUE string +//faultStatus 故障信息(0 正常,1 故障) TRUE string +//startStopStatus 启停状态(0 停止,1 启动) TRUE string +public class PLInfo : InfoBase { - public string deviceType; - public string devInterface; public string startStopStatus; - public string openProjectId; - public string deviceTypeName; public string faultStatus; - public string ulogtime; - public int isOnline; - public string deviceNo; - public string deviceName; - public string logTime; public string powerState; public string manualAutomaticState; - public string devSystem; - public string appKey; - public string descript; - public string floor; +} +public class XHSInfo : InfoBase +{ + public string pressure; + public string alarmStatus; +} +public class SXInfo : InfoBase +{ + public string level; + public string alarmStatus; } \ No newline at end of file diff --git a/Assets/Scripts/ANet/DeviceObj.cs b/Assets/Scripts/ANet/DeviceObj.cs index b9ee96a..64b89fb 100644 --- a/Assets/Scripts/ANet/DeviceObj.cs +++ b/Assets/Scripts/ANet/DeviceObj.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.EventSystems; public class DeviceObj : MonoBehaviour { @@ -13,6 +14,10 @@ public class DeviceObj : MonoBehaviour } private void OnMouseDown() { + if (EventSystem.current.IsPointerOverGameObject()) + { + return; + } DevicePanelManager.Instance.ShowBindList(BindType, this); } } diff --git a/Assets/StreamingAssets/DeviceObj.json b/Assets/StreamingAssets/DeviceObj.json deleted file mode 100644 index af1fb36..0000000 --- a/Assets/StreamingAssets/DeviceObj.json +++ /dev/null @@ -1 +0,0 @@ -[{"ObjName":"Cube (1)","DeviceId":"2020000006464"},{"ObjName":"BF_Beng0","DeviceId":"2020000006463"}] \ No newline at end of file diff --git a/Assets/StreamingAssets/DeviceObj.json.meta b/Assets/StreamingAssets/DeviceObj.json.meta deleted file mode 100644 index 74e4c5a..0000000 --- a/Assets/StreamingAssets/DeviceObj.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b58d3f38dd601a94f9d59128c283d571 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: