using SC.XR.Unity.Module_InputSystem; using Blue; using System.Collections.Generic; using UnityEngine; public class UICallManager : MonoSingleton,IController { private delegate void TrackingFound(DataItem tagobj); private delegate void TrackingLast(DataItem tagobj); private delegate void Invite(string control, string roomid); private delegate void TimeOut(); private delegate void NoExpert(); /// /// 物体识别到显示 /// private event TrackingFound OnTrackFound; /// /// 物体超出显示范围 隐藏 /// private event TrackingLast OnTrackLast; /// /// 收到邀请 /// private event Invite OnInvite; /// /// 超时 /// private event TimeOut OnTimeOut; /// /// 无专家 /// private event NoExpert OnNoExpert; private void Start() { DispatcherBase.KeyDownDelegateRegister(AnyDown); DispatcherBase.KeyUpDelegateRegister(AnyUp); OnTrackFound += OnTrackfound; OnTrackLast += OnTracklast; OnInvite += Oninvite; OnTimeOut += OntimeOut; OnNoExpert += OnnoExpert; // MachineRoomInit(""); // MachineRoomInit(); } public void OnTrackfound(DataItem item) { // ScenesManager.Instance.showWindow(ScenesManager.SceneType.Navigationing); if(HeadBtnManager.Instance.type == ScenesManager.SceneType.ShowDH) HeadBtnManager.Instance.uiFollow.Hide(); } public void OnTracklast(DataItem item) { //ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian); //ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH); } public void EventInvite(string control, string roomId) { OnInvite?.Invoke(control, roomId); } public void EventTimeOut() { OnTimeOut?.Invoke(); } public void EventNoExpert() { OnNoExpert?.Invoke(); } public void Oninvite(string control ,string roomId) { // this.GetService().JoinRoom(roomId); this.GetService().CreatRoom(); } public void OntimeOut() { // 退出房间 RTCRoomManager.Instance.LeaveChannel(); // 改文字UI // AllotPanel.Instance.SetAllotText(""); } public void OnnoExpert() { // 退出房间 RTCRoomManager.Instance.LeaveChannel(); // 改文字UI // AllotPanel.Instance.SetAllotText(""); } /// /// 设置MQTT房间ID /// public void SetMQTTRoomId(string roomId) { MQTTManager.Instance.SetRoomId(roomId); } private void AnyUp(InputKeyCode keyCode, InputDevicePartBase part) { // Debug.Log("DGJ ====> AnyUp " + keyCode.ToString()); // UILogManager.Instance.SendLogText(3, part.PartType.ToString()); if (part.PartType == InputDevicePartType.KSRight ) { switch (keyCode) { case InputKeyCode.Enter: break; case InputKeyCode.Cancel: break; case InputKeyCode.Trigger: break; case InputKeyCode.Function: break; case InputKeyCode.Back: break; case InputKeyCode.Tp: break; case InputKeyCode.VolumeDown: break; case InputKeyCode.VolumeUp: break; case InputKeyCode.A: break; case InputKeyCode.B: break; case InputKeyCode.LjoystickKey: break; case InputKeyCode.LFunction: break; case InputKeyCode.LHallInside: break; case InputKeyCode.LHallForward: break; case InputKeyCode.LTrigger: break; case InputKeyCode.X: break; case InputKeyCode.Y: break; case InputKeyCode.RjoystickKey: break; case InputKeyCode.RFunction: // 返回主界面 Debug.Log("DGJ ====> RFunction 按了 "); // ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose); break; case InputKeyCode.RHallInside: break; case InputKeyCode.RHallForward: break; case InputKeyCode.RTrigger: break; case InputKeyCode.UP: break; case InputKeyCode.DOWN: break; case InputKeyCode.RIGHT: break; case InputKeyCode.LEFT: break; case InputKeyCode.OTHER: break; case InputKeyCode.NULL: break; default: break; } } if (part.PartType == InputDevicePartType.KSLeft) { switch (keyCode) { case InputKeyCode.Enter: break; case InputKeyCode.Cancel: break; case InputKeyCode.Trigger: break; case InputKeyCode.Function: break; case InputKeyCode.Back: break; case InputKeyCode.Tp: break; case InputKeyCode.VolumeDown: break; case InputKeyCode.VolumeUp: break; case InputKeyCode.A: break; case InputKeyCode.B: break; case InputKeyCode.LjoystickKey: break; case InputKeyCode.LFunction: break; case InputKeyCode.LHallInside: break; case InputKeyCode.LHallForward: break; case InputKeyCode.LTrigger: break; case InputKeyCode.X: break; case InputKeyCode.Y: break; case InputKeyCode.RjoystickKey: break; case InputKeyCode.RFunction: break; case InputKeyCode.RHallInside: break; case InputKeyCode.RHallForward: break; case InputKeyCode.RTrigger: break; case InputKeyCode.UP: break; case InputKeyCode.DOWN: break; case InputKeyCode.RIGHT: break; case InputKeyCode.LEFT: break; case InputKeyCode.OTHER: break; case InputKeyCode.NULL: break; default: break; } } } private void AnyDown(InputKeyCode keyCode, InputDevicePartBase part) { // Debug.Log("DGJ ====> AnyDown " + keyCode.ToString()); // UILogManager.Instance.SendLogText(3, part.PartType.ToString()); if (part.PartType == InputDevicePartType.KSRight) { switch (keyCode) { case InputKeyCode.Enter: break; case InputKeyCode.Cancel: break; case InputKeyCode.Trigger: break; case InputKeyCode.Function: break; case InputKeyCode.Back: break; case InputKeyCode.Tp: break; case InputKeyCode.VolumeDown: break; case InputKeyCode.VolumeUp: break; case InputKeyCode.A: break; case InputKeyCode.B: break; case InputKeyCode.LjoystickKey: break; case InputKeyCode.LFunction: break; case InputKeyCode.LHallInside: break; case InputKeyCode.LHallForward: break; case InputKeyCode.LTrigger: break; case InputKeyCode.X: break; case InputKeyCode.Y: break; case InputKeyCode.RjoystickKey: break; case InputKeyCode.RFunction: Debug.Log("DGJ ====> RFunction 按了 "); break; case InputKeyCode.RHallInside: break; case InputKeyCode.RHallForward: break; case InputKeyCode.RTrigger: break; case InputKeyCode.UP: break; case InputKeyCode.DOWN: break; case InputKeyCode.RIGHT: break; case InputKeyCode.LEFT: break; case InputKeyCode.OTHER: break; case InputKeyCode.NULL: break; default: break; } } if (part.PartType == InputDevicePartType.KSLeft) { switch (keyCode) { case InputKeyCode.Enter: break; case InputKeyCode.Cancel: break; case InputKeyCode.Trigger: break; case InputKeyCode.Function: break; case InputKeyCode.Back: break; case InputKeyCode.Tp: break; case InputKeyCode.VolumeDown: break; case InputKeyCode.VolumeUp: break; case InputKeyCode.A: break; case InputKeyCode.B: break; case InputKeyCode.LjoystickKey: break; case InputKeyCode.LFunction: break; case InputKeyCode.LHallInside: break; case InputKeyCode.LHallForward: break; case InputKeyCode.LTrigger: break; case InputKeyCode.X: break; case InputKeyCode.Y: break; case InputKeyCode.RjoystickKey: break; case InputKeyCode.RFunction: break; case InputKeyCode.RHallInside: break; case InputKeyCode.RHallForward: break; case InputKeyCode.RTrigger: break; case InputKeyCode.UP: break; case InputKeyCode.DOWN: break; case InputKeyCode.RIGHT: break; case InputKeyCode.LEFT: break; case InputKeyCode.OTHER: break; case InputKeyCode.NULL: break; default: break; } } } /// /// 机房场景的初始化 /// /// 机房信息 public void MachineRoomInit( string msg) { Debug.Log("DGJ ===> MachineRoomInit "); MachineRoomManager.Instance.Init(); } /// /// 获取机房列表 /// public List GetMachineRoomList() { return MachineRoomManager.Instance.listRoomName; } /// /// 获取机房数据 /// /// public MachineRoomData GetMachineRoomData( string machineRoomName) { // 根据机房名称从后台获取机房信息 return MachineRoomManager.Instance.data; } /// /// 场景物体初始化 /// public void MachineRoomInit() { MachineRoomManager.Instance.SceneInit(); } public MachineObj QueryMachineObj(string id) { for (int i = 0; i < MachineRoomManager.Instance.listObjes.Count; i++) { if(id == MachineRoomManager.Instance.listObjes[i].deviceParameters.deviceId) { return MachineRoomManager.Instance.listObjes[i]; } } return null; } /// /// 获取ShowDevice位置 /// /// public void ShowDeviceTransform(Transform showDeviceTransform) { this.SendCommand(new ShowDeviceCommand(showDeviceTransform)); } /// /// 获取ShowDevice位置 /// public void GetDeviceTransform() { this.SendCommand(new ShowDeviceCommand(MachineRoomManager.Instance.startShowDevice)); } /// /// 导航 /// /// public void NavigatorServer(MachineObj item) { WayFindingManager.Instance.NavigatorServer(item); } /// /// 导航 /// /// public void NavigatorServer(List listItem) { WayFindingManager.Instance.NavigatorServer(listItem); } /// /// 获取告警列表 /// /// public List GetAlarmData() { // 缺少获取设备名称---备注 if(MachineRoomManager.Instance.data.listAlarmData==null) SetData(); return MachineRoomManager.Instance.data.listAlarmData; } private void SetData() { MachineRoomManager.Instance.data.listAlarmData = new List(); for (int i = 0; i < 5;i++) { AlarmData AlarmData = new AlarmData(); AlarmData.deviceId = i.ToString(); AlarmData.deviceName = "设备" + i; AlarmData.title = "问题" + i; AlarmData.carryingSystem = "承载系统" + i; AlarmData.level = "重大告警"; AlarmData.equipmentAlarmTime = System.DateTime.Now.ToString(); MachineRoomManager.Instance.data.listAlarmData.Add(AlarmData); } } }