This commit is contained in:
高国正 2024-05-09 09:18:48 +08:00
parent 7e9a7cd47b
commit ddb16c2c53
20 changed files with 2441 additions and 309 deletions

View File

@ -672,6 +672,12 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 8003116978871882199}
m_Modifications:
- target: {fileID: 656055431512136447, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_FontData.m_Font
value:
objectReference: {fileID: 12800000, guid: f945cd23a57e99b46ac65684d5bb3be8,
type: 3}
- target: {fileID: 5563585228302549198, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_AnchorMax.x
@ -702,10 +708,40 @@ PrefabInstance:
propertyPath: m_Size
value: 0.9999998
objectReference: {fileID: 0}
- target: {fileID: 5726857653261026372, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5726857653261026372, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5726857653261026372, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5726857653261026372, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5726857653261026372, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_SizeDelta.x
value: 304.5813
objectReference: {fileID: 0}
- target: {fileID: 5726857653261026372, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_SizeDelta.y
value: 363.69
objectReference: {fileID: 0}
- target: {fileID: 5726857653261026372, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 5.100896
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5726857653602639248, guid: dbdb920525eb2e24e83426e575435d16,
type: 3}

View File

@ -276,7 +276,7 @@ MonoBehaviour:
m_ChildAlignment: 0
m_StartCorner: 0
m_StartAxis: 0
m_CellSize: {x: 315, y: 33.4}
m_CellSize: {x: 295, y: 33.4}
m_Spacing: {x: 0, y: 0}
m_Constraint: 1
m_ConstraintCount: 1

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
using BestHTTP.WebSocket;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@ -9,10 +8,8 @@ using System.Linq;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using Unity.VisualScripting;
using UnityEngine;
using static InterfaceManager;
using UnityEngine.Networking;
public class RobotDataManager : MonoBehaviour
@ -113,6 +110,11 @@ public class RobotDataManager : MonoBehaviour
bool restart_WS;
public WebSocketT socketT = new WebSocketT();
/// <summary>
/// 机器人ID与机器人任务ID
/// </summary>
public Dictionary<string, string> id_insId = new Dictionary<string, string>();
private void Awake()
{
Inst = this;
@ -144,9 +146,10 @@ public class RobotDataManager : MonoBehaviour
{
if (string.IsNullOrEmpty(_base64) || string.IsNullOrEmpty(_id))
return;
Debug.Log("准备上传热成像至数据库!");
BASE64_INTERFACE bASE64_ = new BASE64_INTERFACE
{
instructId = int.Parse(_id),
instructId = _id,
inspectionResult = _base64,
};
_base64 = JsonConvert.SerializeObject(bASE64_);
@ -154,9 +157,10 @@ public class RobotDataManager : MonoBehaviour
{
if (x != null)
{
if (GameManager.Inst.Jk_URL != null)
RobotReturnData.Inst.init();
Debug.Log("上传热成像至数据库成功!");
}
else
Debug.Log("上传热成像至数据库失败!");
}));
}
@ -548,66 +552,93 @@ public class RobotDataManager : MonoBehaviour
{
if (_error != null)
{
Debug.Log(_error);
Debug.Log("查询任务失败:" + _error);
return;
}
Debug.Log("巡检任务完成,开始获取查询巡检报表数据!");
//任务结束后执行第四步查看【查询巡检报表数据】将“pic“字段的值从” thermal “开始拆分把thermal后的截取出来发送到后台进行保存
GetInsReport((_error, _success) =>
Debug.Log("巡检任务完成,开始获取查询巡检报表数据!" + System.DateTime.Now.ToString());
StartCoroutine(DelayedAction(20.0f, () =>
{
if (_error != null)
Debug.Log("等待20秒后执行【查询巡检报表数据】" + System.DateTime.Now.ToString());
// 继续执行后续操作
//任务结束后执行第四步查看【查询巡检报表数据】将“pic“字段的值从” thermal “开始拆分把thermal后的截取出来发送到后台进行保存
GetInsReport((_error, _success) =>
{
Debug.Log("巡检报表数据错误:" + _error);
return;
}
Dictionary<string, List<string>> _pics = new Dictionary<string, List<string>>();
string head_url = http_ip_address + "/jk";
for (int i = 0; i < InsReport.thermal.Count; i++)
{
var _ps = new List<string>();
var pic1 = InsReport.thermal[i].pic1.Split("images")[1];
var pic2 = InsReport.thermal[i].pic2.Split("images")[1];
var pic3 = InsReport.thermal[i].pic3.Split("images")[1];
var pic4 = InsReport.thermal[i].pic4.Split("images")[1];
var pic5 = InsReport.thermal[i].pic5.Split("images")[1];
var pic6 = InsReport.thermal[i].pic6.Split("images")[1];
var pic7 = InsReport.thermal[i].pic7.Split("images")[1];
_ps.Add(head_url + pic1);
_ps.Add(head_url + pic2);
_ps.Add(head_url + pic3);
_ps.Add(head_url + pic4);
_ps.Add(head_url + pic5);
_ps.Add(head_url + pic6);
_ps.Add(head_url + pic7);
_pics.Add(InsReport.thermal[i].id, _ps);
}
//ToDo
//将处理好的数据发送给后台
//...
/*foreach (var pair in _pics)
{
string key = pair.Key;
List<string> valueList = pair.Value;
for (int i = 0; i < valueList.Count; i++)
if (_error != null)
{
StartCoroutine(CombineJSON.SaveImageAsBase64(valueList[i], pair.Key, action_Base64));
Debug.Log("巡检报表数据错误:" + _error);
return;
}
}
Debug.Log("图片路径处理完成!");*/
StartCoroutine(ProcessImages(_pics, () =>
{
Debug.Log("图片路径处理完成!");
}));
});
Dictionary<string, List<string>> _pics = new Dictionary<string, List<string>>();
string head_url = http_ip_address + "/jk";
for (int i = 0; i < InsReport.thermal.Count; i++)
{
var _ps = new List<string>();
var pic1 = InsReport.thermal[i].pic1.Split("images")[1];
var pic2 = InsReport.thermal[i].pic2.Split("images")[1];
var pic3 = InsReport.thermal[i].pic3.Split("images")[1];
var pic4 = InsReport.thermal[i].pic4.Split("images")[1];
var pic5 = InsReport.thermal[i].pic5.Split("images")[1];
var pic6 = InsReport.thermal[i].pic6.Split("images")[1];
var pic7 = InsReport.thermal[i].pic7.Split("images")[1];
_ps.Add(head_url + pic1);
_ps.Add(head_url + pic2);
_ps.Add(head_url + pic3);
_ps.Add(head_url + pic4);
_ps.Add(head_url + pic5);
_ps.Add(head_url + pic6);
_ps.Add(head_url + pic7);
_pics.Add(InsReport.thermal[i].id, _ps);
}
//ToDo
//将处理好的数据发送给后台
//...
/*foreach (var pair in _pics)
{
string key = pair.Key;
List<string> valueList = pair.Value;
for (int i = 0; i < valueList.Count; i++)
{
StartCoroutine(CombineJSON.SaveImageAsBase64(valueList[i], pair.Key, action_Base64));
}
}
Debug.Log("图片路径处理完成!");*/
StartCoroutine(ProcessImages(_pics, () =>
{
Debug.Log("等待2秒后开始更新巡检历史数据" + System.DateTime.Now.ToString());
StartCoroutine(DelayedAction(2.0f, () =>
{
if (GameManager.Inst.Jk_URL != null)
{
RobotReturnData.Inst.init((x) =>
{
Debug.Log("图片路径处理完成!" + System.DateTime.Now.ToString());
});
}
}));
}));
});
}));
}));
});
});
}
public IEnumerator DelayedAction(float delayTime, Action action)
{
yield return new WaitForSeconds(delayTime);
action?.Invoke();
}
/// <summary>
/// 处理图片
/// </summary>
/// <param name="_pics"></param>
/// <param name="_callback"></param>
/// <returns></returns>
IEnumerator ProcessImages(Dictionary<string, List<string>> _pics, Action _callback = null)
{
foreach (var pair in _pics)
@ -660,6 +691,19 @@ public class RobotDataManager : MonoBehaviour
{
if (!string.IsNullOrEmpty(RobotTask.data[i].Task_type))
{
// 添加机器人ID与任务ID键对值
if (!string.IsNullOrEmpty(RobotTask.data[i].Ins_Id))
{
if (id_insId.ContainsKey(RobotTask.robotId))
{
id_insId[RobotTask.robotId] = RobotTask.data[i].Ins_Id;
}
else
{
id_insId.Add(RobotTask.robotId, RobotTask.data[i].Ins_Id);
}
}
Debug.Log($"获取到任务字典robotId{RobotTask.robotId}任务ID{RobotTask.data[i].Ins_Id}");
is_fixed = true;
break;
}
@ -681,27 +725,44 @@ public class RobotDataManager : MonoBehaviour
/// </summary>
public void PostRobotTask(List<string> _point_no, Action<string, bool> _callback = null)
{
//var p = new PointList();
//for (int i = 0; i < _point_no.Count; i++)
//{
// if (i != _point_no.Count - 1)
// p.pointList.Add(new PointNo(_point_no[i] + ","));
// else
// p.pointList.Add(new PointNo(_point_no[i]));
//}
//var _pointList = JsonConvert.SerializeObject(p.pointList);
var p = new RootObjectPoin();
p.robotIp = RobotObject.robotClass.ipAddr;
List<PointData> pl = new List<PointData>(); ;
/*var p = new PointList();
for (int i = 0; i < _point_no.Count; i++)
pl.Add(new PointData { pointNo = _point_no[i] });
p.pointList = pl;
{
if (i != _point_no.Count - 1)
p.pointList.Add(new PointNo(_point_no[i] + ","));
else
p.pointList.Add(new PointNo(_point_no[i]));
}
var _pointList = JsonConvert.SerializeObject(p);
string _json_data = "{\r\n \"robotIp\": \"" + RobotObject.robotClass.ipAddr + "\",\r\n \"pointList\": [" + _pointList + " ]\r\n}";
var _pointList = JsonConvert.SerializeObject(p.pointList);*/
//var p = new RootObjectPoin();
//p.robotIp = RobotObject.robotClass.ipAddr;
//List<PointData> pl = new List<PointData>(); ;
//for (int i = 0; i < _point_no.Count; i++)
// pl.Add(new PointData { pointNo = _point_no[i] });
//p.pointList = pl;
//var _pointList = JsonConvert.SerializeObject(p);
List<string> _pointList = new List<string>();
for (int i = 0; i < _point_no.Count; i++)
{
_pointList.Add(new PointData().BackToString(_point_no[i]));
}
string pointList = string.Empty;
if (_pointList.Count > 1)
{
pointList = string.Join(",", _pointList);
}
else
pointList = _pointList[0];
var _json_data = string.Format("{{\"robotIp\":\"{0}\",\"pointList\":[{1}]}}", RobotObject.robotClass.ipAddr, pointList);
//string _json_data = "{\r\n \"robotIp\": \"" + RobotObject.robotClass.ipAddr + "\",\r\n \"pointList\": [" + _pointList + " ]\r\n}";
//string _json_data = "{\r\n \"robotIp\": \"192.168.8.198\",\r\n \"pointList\": [\r\n {\r\n \"pointNo\": \"" + _point_no + "\",\r\n \"04\": \"0\",\r\n \"06\": \"0\",\r\n \"01\": \"1\",\r\n \"cabinType\": \"1\",\r\n \"03\": \"0\",\r\n \"05\": \"0\"\r\n }\r\n ]\r\n}";
StartCoroutine(PostRequest(http_ip_address + post_robot_fixed_point, _json_data, request_header, (_error, _data) =>
@ -743,22 +804,22 @@ public class RobotDataManager : MonoBehaviour
if (_finish) break;
//循环查询异常次数超过一定值,结束查询并跳出循环,避免过多不必要的开销
if (_error_time > 40)
if (_error_time > 120)
{
_callback?.Invoke("查询异常!");
break;
}
yield return new WaitForSeconds(3);
yield return new WaitForSeconds(5);
if (_call_time != _response_time) continue;
#region
if (_response_time == 40)
if (_response_time == 120)
{
Debug.Log("测试:等待次数过多");
_callback?.Invoke(null);
//Debug.Log("测试:等待次数过多");
_callback?.Invoke("等待次数过多!");
break;
}
@ -798,8 +859,15 @@ public class RobotDataManager : MonoBehaviour
/// </summary>
public void GetInsReport(Action<string, bool> _callback)
{
if (!id_insId.ContainsKey(RobotObject.robotClass.robot_id))
{
_callback?.Invoke("未获取到机器人任务ID", false);
}
else
Debug.Log($"获取巡检报表数据机器人ID{RobotObject.robotClass.robot_id}任务ID{id_insId[RobotObject.robotClass.robot_id]}");
//需补充请求参数机器人任务队列中的Ins_Id,根据业务筛选具体数据
StartCoroutine(GetRequest(http_ip_address + get_record_ins_report, request_header, new Dictionary<string, string>() { { "insId", RobotTask.data[0].Ins_Id } }, (_error, _data) =>
//StartCoroutine(GetRequest(http_ip_address + get_record_ins_report, request_header, new Dictionary<string, string>() { { "insId", RobotTask.data[0].Ins_Id } }, (_error, _data) =>
StartCoroutine(GetRequest(http_ip_address + get_record_ins_report, request_header, new Dictionary<string, string>() { { "insId", id_insId[RobotObject.robotClass.robot_id] } }, (_error, _data) =>
{
if (_error != null)
{

View File

@ -31,6 +31,7 @@ public class RobotObject : MonoBehaviour
/// <summary>
/// 当前执行的机器人位置信息
/// 【map_xmap_y】
/// </summary>
private RobotPos current_robot_pos = null;
@ -83,15 +84,27 @@ public class RobotObject : MonoBehaviour
current_robot_pos = RobotPosQueue.Peek();
//Debug.Log(Newtonsoft.Json.JsonConvert.SerializeObject(current_robot_pos));
display_x = (current_robot_pos.current_pose.x - origin_x) / resolution;
/*display_x = (current_robot_pos.current_pose.x - origin_x) / resolution;
display_y = (current_robot_pos.current_pose.x - origin_y) / resolution;
display_x *= (rect_transform.sizeDelta.x / pixel_width);
display_y *= (rect_transform.sizeDelta.y / pixel_height);
display_y *= (rect_transform.sizeDelta.y / pixel_height);*/
rect_transform.DOAnchorPos(new Vector2((float)display_x, (float)display_y), 0.5f).OnComplete(() =>
// display_x = - bmp_x + map_x/resolution
display_x = -origin_x + current_robot_pos.current_pose.x / resolution;
// display _y= -bmp_h - bmp_y + map_y/resolution
display_y = -(pixel_height - origin_y + current_robot_pos.current_pose.y / resolution);
var _display_y = (display_x / pixel_width) * (296) + 50;
//var _display_x = MathF.Abs(((float)display_y / (float)pixel_height) * 750) - 790;
var _display_x = MathF.Abs(790 - MathF.Abs(((float)display_y / (float)pixel_height) * 785));
//rect_transform.DOAnchorPos(new Vector2((float)display_x, (float)display_y), 0.5f).OnComplete(() =>
rect_transform.DOAnchorPos(new Vector2((float)_display_x + 24, (float)_display_y + 24), 0.5f).OnComplete(() =>
{
Debug.Log($"robotλÖù켣£º{new Vector2((float)display_x, (float)display_y)}");
//Debug.Log($"robot位置轨迹{new Vector2((float)display_x, (float)display_y)}");
Debug.Log($"robot位置轨迹{new Vector2((float)_display_x + 24, (float)_display_y + 24)}");
RobotPosQueue.Dequeue();
current_robot_pos = null;
});

View File

@ -395,6 +395,7 @@ public class UIToCabinet : MonoBehaviour
if (clickEventLens[i].coroutine == null)
StartCoroutine(clickEventLens[i].TwinkleLens(0.25f));
}
LocalVideo.Inst.AlarmFlashing();
LocalVideo.Inst.RecoveryUI();
LocalVideo.Inst.AssignDataToUI();
isContinue_menu = true;

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using Unity.VisualScripting;
using UnityEngine;
using static UnityEngine.Rendering.DebugUI;
@ -1097,6 +1098,16 @@ public class PointData
public string cabinType = "1";
public string _03 = "0";
public string _05 = "0";
public string BackToString(string pointNo)
{
//
//{\"robotIp\":\"10.145.133.140\",\"pointList\":[{\"pointNo\":\"xj45\",\"04\":\"0\",\"06\":\"0\",\"01\":\"1\",\"cabinType\":\"1\",\"03\":\"0\",\"05\":\"0\"}]}
//string temp = $"{"{\"pointNo\":\"{pointNo}\",\"04\":\"0\",\"06\":\"0\",\"01\":\"1\",\"cabinType\":\"1\",\"03\":\"0\",\"05\":\"0\"}"}";
string temp = string.Format("{{\"pointNo\":\"{0}\",\"04\":\"0\",\"06\":\"0\",\"01\":\"1\",\"cabinType\":\"1\",\"03\":\"0\",\"05\":\"0\"}}", pointNo);
return temp;
}
}
/// <summary>
@ -1134,6 +1145,6 @@ public class RootCabinDictionary
public class BASE64_INTERFACE
{
public int? instructId;
public string instructId;
public string inspectionResult;
}

View File

@ -512,7 +512,7 @@ public static class CombineJSON
Texture2D texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
byte[] imageBytes = texture.EncodeToJPG(); // 根据实际需要选择其他格式进行编码
string base64String = System.Convert.ToBase64String(imageBytes);
Debug.Log(base64String);
Debug.Log($"base64String{base64String}热成像数据记录id{id}");
_callback?.Invoke(base64String, id);
}
}

View File

@ -108,6 +108,14 @@ public class LocalVideo : MonoBehaviour
AssignDataToUI();
if (clickEventLens != null)
{
var localVideoAlarm_list = GameObject.FindObjectsOfType<LocalVideoAlarm>(true).ToList();
for (int i = 0; i < localVideoAlarm_list.Count; i++)
{
localVideoAlarm_list[i].EnterTheCameraModule();
}
}
}
catch (Exception e)
{
@ -200,7 +208,7 @@ public class LocalVideo : MonoBehaviour
{
var _item = AlarmObjectPool.instance.GetItemFromPool<LocalVideoAlarmItem>(localVideoAlarmUI.preform);
_item.gameObject.SetActive(true);
_item.transform.parent = localVideoAlarmUI.Content.transform;
_item.transform.SetParent(localVideoAlarmUI.Content.transform);
_item.textMeshPro_object.text = list_Confs[j].sourceName + "¼à²âÒì³£";
_item.textMeshPro_time.text = GetTime(long.Parse(list_Confs[j].timeStamp)).ToString();
var t = CombineJSON.Base64StringToTexture(list_Confs[j].alarmPicture);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0429bb659211915418326611277658a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -76,6 +76,7 @@ public class RobotReturnData : MonoBehaviour
public void init(Action<string> _callback = null)
{
Debug.Log("准备更新巡检历史数据!");
gameObject.SetActive(true);
dropdown.value = -1;
CalendarDetails.Inst.close();
@ -94,7 +95,7 @@ public class RobotReturnData : MonoBehaviour
inspectionDictionary.Clear();
/// 校验 instructId createTime
Dictionary<int, string> check = new Dictionary<int, string>();
Dictionary<string, string> check = new Dictionary<string, string>();
for (int i = 0; i < myroot.data.Count; i++)
{
@ -118,6 +119,7 @@ public class RobotReturnData : MonoBehaviour
//dropdown.options.Add(new Dropdown.OptionData(myroot.data[i].createTime));
}
//CalendarDetails.Inst.delContent();
Debug.Log("更新巡检历史数据完成!");
_callback?.Invoke("1");
}
else
@ -127,7 +129,7 @@ public class RobotReturnData : MonoBehaviour
}
catch (Exception e)
{
Debug.LogError(e.StackTrace);
Debug.LogError("机器人返回图片序列化错误:" + e.StackTrace);
SecondConfirmPanel.DeleteConform(null, "机器人返回图片序列化错误");
}
}
@ -148,7 +150,7 @@ public class RobotReturnData : MonoBehaviour
/// <summary>
///
/// </summary>
public int instructId;
public string instructId;
/// <summary>
///
/// </summary>

View File

@ -19,11 +19,11 @@ public class SaveCoordinateRobot : MonoBehaviour
/// <summary>
/// X输入范围最小
/// </summary>
[SerializeField] float inputMin_x;
[SerializeField] float inputMin_x => 0;
/// <summary>
/// X输入范围最大
/// </summary>
[SerializeField] float inputMax_x;
[SerializeField] float inputMax_x => 320;
/// <summary>
/// X输出范围最小
/// </summary>
@ -36,11 +36,11 @@ public class SaveCoordinateRobot : MonoBehaviour
/// <summary>
/// Y输入范围最小
/// </summary>
[SerializeField] float inputMin_y;
[SerializeField] float inputMin_y => 0;
/// <summary>
/// Y输入范围最大
/// </summary>
[SerializeField] float inputMax_y;
[SerializeField] float inputMax_y => 800;
/// <summary>
/// Y输出范围最小
/// </summary>

View File

@ -153,14 +153,14 @@ public class ClickEventLens : MonoBehaviour
{
while (true)
{
for (int i = 0; i < 3; i++)
{
ChangeMaterialColor(gameObject, 1);
yield return new WaitForSeconds(looptime);
ChangeMaterialColor(gameObject, 99);
yield return new WaitForSeconds(looptime);
}
yield return null;
//for (int i = 0; i < 3; i++)
//{
ChangeMaterialColor(gameObject, 1);
yield return new WaitForSeconds(looptime);
ChangeMaterialColor(gameObject, 99);
yield return new WaitForSeconds(looptime);
//}
}
//yield return null;
}
}

View File

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 本地视频告警UI
@ -30,9 +31,24 @@ public class LocalVideoAlarm : CabinetUIBase
void Update()
{
transform.eulerAngles = Camera.eulerAngles;
if (localVideoAlarmUI.Content && localVideoAlarmUI.Content.gameObject.activeSelf)
{
// Grid 的高 = 图高 * 行 + 行间距 * (行 - 1)
var content = localVideoAlarmUI.Content;
var grid = content.GetComponent<GridLayoutGroup>();
var x = content.sizeDelta.x;
var y = grid.cellSize.y * content.childCount;
content.sizeDelta = new Vector2(x, y);
}
}
public override void OnMenuChanged(Menu menu)
{
EnterTheCameraModule(menu);
}
public void EnterTheCameraModule(Menu menu = Menu.M_全景监控_摄像头)
{
base.OnMenuChanged(menu);
if (menu == Menu.M_全景监控_摄像头 && baseConf.conf1.alarmEntities.Count > 0)

View File

@ -24,7 +24,7 @@ public class LocalVideoAlarmItem : MonoBehaviour
var l = (LocalVideo.Inst.clickEventLens).SelectMany(x => x.GetComponentsInChildren<LocalVideoAlarmUI>(true)).ToList();
for (int i = 0; i < l.Count; i++)
{
l[i].canvas.transform.GetChild(0).gameObject.SetActive(false);
l[i].canvas./*transform.GetChild(0).*/gameObject.SetActive(false);
}
});
}

View File

@ -5,6 +5,9 @@ using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
using static IRPopup;
using System.Linq;
using Newtonsoft.Json.Linq;
/// <summary>
/// ºìÍâ
@ -12,6 +15,11 @@ using UnityEngine.UI;
public class IRPopup : MonoBehaviour
{
public Root myroot = new Root();
//public Msg msg = new Msg();
public JObject msg;
public Root_Data root_Data = new Root_Data();
public List<Data> data = new List<Data>();
public static IRPopup Inst;
public Transform content;
public RectTransform content_ret;
@ -57,46 +65,152 @@ public class IRPopup : MonoBehaviour
/// </summary>
public void LoadmoreDetails()
{
StartCoroutine(CombineJSON.GetJson_GET(GameManager.Inst.Jk_URL.hwjc_cx, GameManager.Inst.arguments.token, (jsonResult) =>
//StartCoroutine(CombineJSON.GetJson_GET(GameManager.Inst.Jk_URL.hwjc_cx, GameManager.Inst.arguments.token, (jsonResult) =>
//{
var jsonResult = "{\"code\":\"000000\",\"message\":\"操作成功\",\"data\":{\"personFlag\":\"1\",\"data\":\"{\\\"result\\\":0,\\\"remark\\\":\\\"\\\",\\\"data\\\":[{\\\"alarmid\\\":\\\"A6304521252331213883\\\",\\\"alarmcode\\\":\\\"1\\\",\\\"typeflag\\\":1,\\\"title\\\":\\\"someone intrusion!\\\",\\\"deveui\\\":\\\"1@004a770062c0042f\\\",\\\"devtype\\\":\\\"sensor_infrared_intrusion\\\",\\\"alarmlevel\\\":1,\\\"alarmtime\\\":\\\"2024-04-28 16:15:07\\\",\\\"descp\\\":\\\"\\\",\\\"cleartime\\\":null,\\\"confirmstate\\\":0,\\\"confirmtime\\\":null,\\\"confirmer\\\":null,\\\"remark\\\":null,\\\"devname\\\":\\\"人体红外传感器-3\\\",\\\"addr\\\":\\\"\\\",\\\"relaobjid\\\":null,\\\"relaobjtype\\\":0,\\\"relaobjname\\\":null},{\\\"alarmid\\\":\\\"A4800272191298919822\\\",\\\"alarmcode\\\":\\\"1\\\",\\\"typeflag\\\":1,\\\"title\\\":\\\"someone intrusion!\\\",\\\"deveui\\\":\\\"1@004a770062c004e7\\\",\\\"devtype\\\":\\\"sensor_infrared_intrusion\\\",\\\"alarmlevel\\\":1,\\\"alarmtime\\\":\\\"2024-04-28 16:14:01\\\",\\\"descp\\\":\\\"\\\",\\\"cleartime\\\":null,\\\"confirmstate\\\":0,\\\"confirmtime\\\":null,\\\"confirmer\\\":null,\\\"remark\\\":null,\\\"devname\\\":\\\"人体红外传感器-2\\\",\\\"addr\\\":\\\"\\\",\\\"relaobjid\\\":null,\\\"relaobjtype\\\":0,\\\"relaobjname\\\":null},{\\\"alarmid\\\":\\\"A8060430184138534773\\\",\\\"alarmcode\\\":\\\"1\\\",\\\"typeflag\\\":1,\\\"title\\\":\\\"someone intrusion!\\\",\\\"deveui\\\":\\\"1@004a770062c001a2\\\",\\\"devtype\\\":\\\"sensor_infrared_intrusion\\\",\\\"alarmlevel\\\":1,\\\"alarmtime\\\":\\\"2024-04-28 16:12:24\\\",\\\"descp\\\":\\\"\\\",\\\"cleartime\\\":null,\\\"confirmstate\\\":0,\\\"confirmtime\\\":null,\\\"confirmer\\\":null,\\\"remark\\\":null,\\\"devname\\\":\\\"人体红外传感器-1\\\",\\\"addr\\\":\\\"\\\",\\\"relaobjid\\\":null,\\\"relaobjtype\\\":0,\\\"relaobjname\\\":null}]}\"},\"serverTime\":\"1714291536526\"}";
if (jsonResult != null)
{
if (jsonResult != null)
try
{
try
myroot = JsonConvert.DeserializeObject<Root>(jsonResult);
if (myroot.message == "操作成功")
{
myroot = JsonConvert.DeserializeObject<Root>(jsonResult);
if (myroot.message == "操作成功")
Debug.Log("获取红外数据成功!");
//for (int i = 0; i < myroot.data.Count; i++)
{
//for (int i = 0; i < myroot.data.Count; i++)
{
var go = GameObject.Instantiate(prefab, content);
var t = go.GetComponent<calendarIcon>();
var txt = myroot.data.personFlag;
if (txt == "1") t.text1.text = "有异物";
else if (txt == "0") t.text1.text = "无异物";
//t.text1.text = myroot.data[i].personFlag;
//t.text2.text = myroot.data[i].particulars;
}
}
else
{
SecondConfirmPanel.DeleteConform(null, myroot.message);
//var go = GameObject.Instantiate(prefab, content);
//var t = go.GetComponent<calendarIcon>();
msg = JObject.Parse(myroot.data.ToString());
//var txt = myroot.data.personFlag;
//var txt = msg["personFlag"].ToString();
root_Data = JsonConvert.DeserializeObject<Root_Data>(msg["data"].ToString().Trim());
data = root_Data.data;
//if (txt == "1") t.text1.text = "有异物";
//else if (txt == "0") t.text1.text = "无异物";
//t.text1.text = myroot.data[i].personFlag;
//t.text2.text = myroot.data[i].particulars;
}
}
catch (Exception e)
else
{
SecondConfirmPanel.DeleteConform(null, "红外检测序列化错误");
SecondConfirmPanel.DeleteConform(null, myroot.message);
}
}
}));
catch (Exception e)
{
SecondConfirmPanel.DeleteConform(null, "红外检测序列化错误:" + e.Message + "" + e.StackTrace);
}
}
//}));
}
[System.Serializable]
public class Msg
{
/// <summary>
/// 1-有人0-无人
/// </summary>
public string personFlag;
public Root_Data data;
}
[System.Serializable]
public class Root_Data
{
/// <summary>
///
/// </summary>
public int result;
/// <summary>
/// 告警备注信息
/// </summary>
public string remark;
/// <summary>
///
/// </summary>
public List<Data> data;
}
[System.Serializable]
public class Data
{
/// <summary>
/// 1-有人0-无人
/// 告警流水号
/// </summary>
public string personFlag;
public string alarmid;
/// <summary>
/// 告警码
/// </summary>
public string alarmcode;
/// <summary>
/// 类型标记: 0: 告警恢复1: 告警发生2: 通知消息;
/// </summary>
public int typeflag;
/// <summary>
/// 告警标题
/// </summary>
public string title;
/// <summary>
/// 告警设备标识
/// </summary>
public string deveui;
/// <summary>
/// 告警设备类型
/// </summary>
public string devtype;
/// <summary>
/// 告警级别
/// </summary>
public int alarmlevel;
/// <summary>
/// 告警发生时间
/// </summary>
public DateTime alarmtime;
/// <summary>
/// 告警详细描述
/// </summary>
public string descp;
/// <summary>
/// 告警恢复时间
/// </summary>
public string cleartime;
/// <summary>
/// 告警确认状态: 0-未确认1-已确认
/// </summary>
public int confirmstate;
/// <summary>
/// 告警确认时间, 若有值,为 yyyy-MM-dd HH:mm:ss 格式
/// </summary>
public string confirmtime;
/// <summary>
/// 告警确认人
/// </summary>
public string confirmer;
/// <summary>
///
/// </summary>
public string remark;
/// <summary>
/// 传感器名字
/// </summary>
public string devname;
/// <summary>
///
/// </summary>
public string addr;
/// <summary>
///
/// </summary>
public string relaobjid;
/// <summary>
///
/// </summary>
public int relaobjtype;
/// <summary>
///
/// </summary>
public string relaobjname;
}
[System.Serializable]
@ -113,7 +227,7 @@ public class IRPopup : MonoBehaviour
/// <summary>
///
/// </summary>
public Data data;
public object data;
/// <summary>
///
/// </summary>

View File

@ -5,6 +5,10 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using Newtonsoft.Json.Linq;
using static IRPopup;
using Newtonsoft.Json;
using System;
public class Infraredsensor : MonoBehaviour, IPointerDownHandler
{
@ -37,7 +41,33 @@ public class Infraredsensor : MonoBehaviour, IPointerDownHandler
{
//if (text)
// WebInteraction.Inst.Infraredsensor_open(text.text.Replace("ºìÍâ", ""));
IRPopup.Inst.popup.SetActive(true);
try
{
IRPopup.Inst.msg = JObject.Parse(IRPopup.Inst.myroot.data.ToString());
// 0无异物 1有异物
if (IRPopup.Inst && IRPopup.Inst.msg["personFlag"].ToString() == "1")
{
var data = IRPopup.Inst.data.Where(x => x.devname.Contains(text.text.Split('-')[1])).ToList();
for (int i = IRPopup.Inst.content.childCount - 1; i >= 0; i--)
DestroyImmediate(IRPopup.Inst.content.GetChild(i).gameObject);
for (int i = 0; i < data.Count; i++)
{
var go = GameObject.Instantiate(IRPopup.Inst.prefab, IRPopup.Inst.content);
var t = go.GetComponent<calendarIcon>();
t.text1.text = data[i].alarmtime.ToString();
t.text2.text = "有异物";
}
IRPopup.Inst.popup.SetActive(true);
}
}
catch (System.Exception e)
{
Debug.Log("红外赋值错误:" + e.Message + ",行次:" + e.StackTrace);
}
}
//public static void ChangeMenu(Menu menu)

View File

@ -2305,6 +2305,9 @@
<Reference Include="UnityEditor.WebGL.Extensions">
<HintPath>D:\unity\2021.3.2f1c1\Editor\Data\PlaybackEngines\WebGLSupport\UnityEditor.WebGL.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>D:\unity\2021.3.2f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>D:\unity\2021.3.2f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@ -2392,6 +2395,12 @@
<Reference Include="unityplastic">
<HintPath>Library\PackageCache\com.unity.collab-proxy@1.15.16\Lib\Editor\PlasticSCM\unityplastic.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Types">
<HintPath>D:\unity\2021.3.2f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Gradle">
<HintPath>D:\unity\2021.3.2f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll</HintPath>
</Reference>
<Reference Include="netstandard">
<HintPath>D:\unity\2021.3.2f1c1\Editor\Data\NetStandard\ref\2.1.0\netstandard.dll</HintPath>
</Reference>

23
GQ_URP/GQ/app.config Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="netstandard" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>