UICallManager.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. using SC.XR.Unity.Module_InputSystem;
  2. using Blue;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class UICallManager : MonoSingleton<UICallManager>,IController
  6. {
  7. public delegate void TrackingFound(DataItem tagobj);
  8. public delegate void TrackingLast(DataItem tagobj);
  9. /// <summary>
  10. /// 物体识别到显示
  11. /// </summary>
  12. public TrackingFound OnTrackFound;
  13. /// <summary>
  14. /// 物体超出显示范围 隐藏
  15. /// </summary>
  16. public TrackingLast OnTrackLast;
  17. private void Start()
  18. {
  19. DispatcherBase.KeyDownDelegateRegister(AnyDown);
  20. DispatcherBase.KeyUpDelegateRegister(AnyUp);
  21. OnTrackFound += OnTrackfound;
  22. OnTrackLast += OnTracklast;
  23. // MachineRoomInit("");
  24. // MachineRoomInit();
  25. }
  26. public void OnTrackfound(DataItem item)
  27. {
  28. // ScenesManager.Instance.showWindow(ScenesManager.SceneType.Navigationing);
  29. if(HeadBtnManager.Instance.type == ScenesManager.SceneType.ShowDH)
  30. HeadBtnManager.Instance.uiFollow.Hide();
  31. }
  32. public void OnTracklast(DataItem item)
  33. {
  34. //ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  35. //ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
  36. }
  37. private void AnyUp(InputKeyCode keyCode, InputDevicePartBase part)
  38. {
  39. Debug.Log("DGJ ====> AnyUp " + keyCode.ToString());
  40. // UILogManager.Instance.SendLogText(3, part.PartType.ToString());
  41. if (part.PartType == InputDevicePartType.KSRight )
  42. {
  43. switch (keyCode)
  44. {
  45. case InputKeyCode.Enter:
  46. break;
  47. case InputKeyCode.Cancel:
  48. break;
  49. case InputKeyCode.Trigger:
  50. break;
  51. case InputKeyCode.Function:
  52. break;
  53. case InputKeyCode.Back:
  54. break;
  55. case InputKeyCode.Tp:
  56. break;
  57. case InputKeyCode.VolumeDown:
  58. break;
  59. case InputKeyCode.VolumeUp:
  60. break;
  61. case InputKeyCode.A:
  62. break;
  63. case InputKeyCode.B:
  64. break;
  65. case InputKeyCode.LjoystickKey:
  66. break;
  67. case InputKeyCode.LFunction:
  68. break;
  69. case InputKeyCode.LHallInside:
  70. break;
  71. case InputKeyCode.LHallForward:
  72. break;
  73. case InputKeyCode.LTrigger:
  74. break;
  75. case InputKeyCode.X:
  76. break;
  77. case InputKeyCode.Y:
  78. break;
  79. case InputKeyCode.RjoystickKey:
  80. break;
  81. case InputKeyCode.RFunction: // 返回主界面
  82. Debug.Log("DGJ ====> RFunction 按了 ");
  83. // ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
  84. break;
  85. case InputKeyCode.RHallInside:
  86. break;
  87. case InputKeyCode.RHallForward:
  88. break;
  89. case InputKeyCode.RTrigger:
  90. break;
  91. case InputKeyCode.UP:
  92. break;
  93. case InputKeyCode.DOWN:
  94. break;
  95. case InputKeyCode.RIGHT:
  96. break;
  97. case InputKeyCode.LEFT:
  98. break;
  99. case InputKeyCode.OTHER:
  100. break;
  101. case InputKeyCode.NULL:
  102. break;
  103. default:
  104. break;
  105. }
  106. }
  107. if (part.PartType == InputDevicePartType.KSLeft)
  108. {
  109. switch (keyCode)
  110. {
  111. case InputKeyCode.Enter:
  112. break;
  113. case InputKeyCode.Cancel:
  114. break;
  115. case InputKeyCode.Trigger:
  116. break;
  117. case InputKeyCode.Function:
  118. break;
  119. case InputKeyCode.Back:
  120. break;
  121. case InputKeyCode.Tp:
  122. break;
  123. case InputKeyCode.VolumeDown:
  124. break;
  125. case InputKeyCode.VolumeUp:
  126. break;
  127. case InputKeyCode.A:
  128. break;
  129. case InputKeyCode.B:
  130. break;
  131. case InputKeyCode.LjoystickKey:
  132. break;
  133. case InputKeyCode.LFunction:
  134. break;
  135. case InputKeyCode.LHallInside:
  136. break;
  137. case InputKeyCode.LHallForward:
  138. break;
  139. case InputKeyCode.LTrigger:
  140. break;
  141. case InputKeyCode.X:
  142. break;
  143. case InputKeyCode.Y:
  144. break;
  145. case InputKeyCode.RjoystickKey:
  146. break;
  147. case InputKeyCode.RFunction:
  148. break;
  149. case InputKeyCode.RHallInside:
  150. break;
  151. case InputKeyCode.RHallForward:
  152. break;
  153. case InputKeyCode.RTrigger:
  154. break;
  155. case InputKeyCode.UP:
  156. break;
  157. case InputKeyCode.DOWN:
  158. break;
  159. case InputKeyCode.RIGHT:
  160. break;
  161. case InputKeyCode.LEFT:
  162. break;
  163. case InputKeyCode.OTHER:
  164. break;
  165. case InputKeyCode.NULL:
  166. break;
  167. default:
  168. break;
  169. }
  170. }
  171. }
  172. private void AnyDown(InputKeyCode keyCode, InputDevicePartBase part)
  173. {
  174. Debug.Log("DGJ ====> AnyDown " + keyCode.ToString());
  175. // UILogManager.Instance.SendLogText(3, part.PartType.ToString());
  176. if (part.PartType == InputDevicePartType.KSRight)
  177. {
  178. switch (keyCode)
  179. {
  180. case InputKeyCode.Enter:
  181. break;
  182. case InputKeyCode.Cancel:
  183. break;
  184. case InputKeyCode.Trigger:
  185. break;
  186. case InputKeyCode.Function:
  187. break;
  188. case InputKeyCode.Back:
  189. break;
  190. case InputKeyCode.Tp:
  191. break;
  192. case InputKeyCode.VolumeDown:
  193. break;
  194. case InputKeyCode.VolumeUp:
  195. break;
  196. case InputKeyCode.A:
  197. break;
  198. case InputKeyCode.B:
  199. break;
  200. case InputKeyCode.LjoystickKey:
  201. break;
  202. case InputKeyCode.LFunction:
  203. break;
  204. case InputKeyCode.LHallInside:
  205. break;
  206. case InputKeyCode.LHallForward:
  207. break;
  208. case InputKeyCode.LTrigger:
  209. break;
  210. case InputKeyCode.X:
  211. break;
  212. case InputKeyCode.Y:
  213. break;
  214. case InputKeyCode.RjoystickKey:
  215. break;
  216. case InputKeyCode.RFunction:
  217. Debug.Log("DGJ ====> RFunction 按了 ");
  218. break;
  219. case InputKeyCode.RHallInside:
  220. break;
  221. case InputKeyCode.RHallForward:
  222. break;
  223. case InputKeyCode.RTrigger:
  224. break;
  225. case InputKeyCode.UP:
  226. break;
  227. case InputKeyCode.DOWN:
  228. break;
  229. case InputKeyCode.RIGHT:
  230. break;
  231. case InputKeyCode.LEFT:
  232. break;
  233. case InputKeyCode.OTHER:
  234. break;
  235. case InputKeyCode.NULL:
  236. break;
  237. default:
  238. break;
  239. }
  240. }
  241. if (part.PartType == InputDevicePartType.KSLeft)
  242. {
  243. switch (keyCode)
  244. {
  245. case InputKeyCode.Enter:
  246. break;
  247. case InputKeyCode.Cancel:
  248. break;
  249. case InputKeyCode.Trigger:
  250. break;
  251. case InputKeyCode.Function:
  252. break;
  253. case InputKeyCode.Back:
  254. break;
  255. case InputKeyCode.Tp:
  256. break;
  257. case InputKeyCode.VolumeDown:
  258. break;
  259. case InputKeyCode.VolumeUp:
  260. break;
  261. case InputKeyCode.A:
  262. break;
  263. case InputKeyCode.B:
  264. break;
  265. case InputKeyCode.LjoystickKey:
  266. break;
  267. case InputKeyCode.LFunction:
  268. break;
  269. case InputKeyCode.LHallInside:
  270. break;
  271. case InputKeyCode.LHallForward:
  272. break;
  273. case InputKeyCode.LTrigger:
  274. break;
  275. case InputKeyCode.X:
  276. break;
  277. case InputKeyCode.Y:
  278. break;
  279. case InputKeyCode.RjoystickKey:
  280. break;
  281. case InputKeyCode.RFunction:
  282. break;
  283. case InputKeyCode.RHallInside:
  284. break;
  285. case InputKeyCode.RHallForward:
  286. break;
  287. case InputKeyCode.RTrigger:
  288. break;
  289. case InputKeyCode.UP:
  290. break;
  291. case InputKeyCode.DOWN:
  292. break;
  293. case InputKeyCode.RIGHT:
  294. break;
  295. case InputKeyCode.LEFT:
  296. break;
  297. case InputKeyCode.OTHER:
  298. break;
  299. case InputKeyCode.NULL:
  300. break;
  301. default:
  302. break;
  303. }
  304. }
  305. }
  306. /// <summary>
  307. /// 机房场景的初始化
  308. /// </summary>
  309. /// <param name="msg"> 机房信息 </param>
  310. public void MachineRoomInit( string msg)
  311. {
  312. Debug.Log("DGJ ===> MachineRoomInit ");
  313. MachineRoomManager.Instance.Init();
  314. }
  315. /// <summary>
  316. /// 获取机房列表
  317. /// </summary>
  318. public List<string> GetMachineRoomList()
  319. {
  320. return MachineRoomManager.Instance.listRoomName;
  321. }
  322. /// <summary>
  323. /// 获取机房数据
  324. /// </summary>
  325. /// <returns></returns>
  326. public MachineRoomData GetMachineRoomData( string machineRoomName)
  327. {
  328. // 根据机房名称从后台获取机房信息
  329. return MachineRoomManager.Instance.data;
  330. }
  331. /// <summary>
  332. /// 场景物体初始化
  333. /// </summary>
  334. public void MachineRoomInit()
  335. {
  336. MachineRoomManager.Instance.SceneInit();
  337. }
  338. public MachineObj QueryMachineObj(string id)
  339. {
  340. for (int i = 0; i < MachineRoomManager.Instance.listObjes.Count; i++)
  341. {
  342. if(id == MachineRoomManager.Instance.listObjes[i].deviceParameters.deviceId)
  343. {
  344. return MachineRoomManager.Instance.listObjes[i];
  345. }
  346. }
  347. return null;
  348. }
  349. /// <summary>
  350. /// 获取ShowDevice位置
  351. /// </summary>
  352. /// <param name="showDeviceTransform"></param>
  353. public void ShowDeviceTransform(Transform showDeviceTransform)
  354. {
  355. this.SendCommand(new ShowDeviceCommand(showDeviceTransform));
  356. }
  357. /// <summary>
  358. /// 获取ShowDevice位置
  359. /// </summary>
  360. public void GetDeviceTransform()
  361. {
  362. this.SendCommand(new ShowDeviceCommand(MachineRoomManager.Instance.startShowDevice));
  363. }
  364. /// <summary>
  365. /// 导航
  366. /// </summary>
  367. /// <param name="item"></param>
  368. public void NavigatorServer(MachineObj item)
  369. {
  370. WayFindingManager.Instance.NavigatorServer(item);
  371. }
  372. /// <summary>
  373. /// 导航
  374. /// </summary>
  375. /// <param name="listItem"></param>
  376. public void NavigatorServer(List<MachineObj> listItem)
  377. {
  378. WayFindingManager.Instance.NavigatorServer(listItem);
  379. }
  380. /// <summary>
  381. /// 获取告警列表
  382. /// </summary>
  383. /// <returns></returns>
  384. public List<AlarmData> GetAlarmData()
  385. {
  386. // 缺少获取设备名称---备注
  387. if(MachineRoomManager.Instance.data.listAlarmData==null)
  388. SetData();
  389. return MachineRoomManager.Instance.data.listAlarmData;
  390. }
  391. private void SetData()
  392. {
  393. MachineRoomManager.Instance.data.listAlarmData = new List<AlarmData>();
  394. for (int i = 0; i < 5;i++)
  395. {
  396. AlarmData AlarmData = new AlarmData();
  397. AlarmData.deviceId = i.ToString();
  398. AlarmData.deviceName = "设备" + i;
  399. AlarmData.title = "问题" + i;
  400. AlarmData.carryingSystem = "承载系统" + i;
  401. AlarmData.level = "重大告警";
  402. AlarmData.equipmentAlarmTime = System.DateTime.Now.ToString();
  403. MachineRoomManager.Instance.data.listAlarmData.Add(AlarmData);
  404. }
  405. }
  406. }