123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532 |
- using SC.XR.Unity.Module_InputSystem;
- using Blue;
- using System.Collections.Generic;
- using UnityEngine;
- public class UICallManager : MonoSingleton<UICallManager>,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();
- /// <summary>
- /// 物体识别到显示
- /// </summary>
- private event TrackingFound OnTrackFound;
- /// <summary>
- /// 物体超出显示范围 隐藏
- /// </summary>
- private event TrackingLast OnTrackLast;
- /// <summary>
- /// 收到邀请
- /// </summary>
- private event Invite OnInvite;
- /// <summary>
- /// 超时
- /// </summary>
- private event TimeOut OnTimeOut;
- /// <summary>
- /// 无专家
- /// </summary>
- 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<IRTCService>().JoinRoom(roomId);
- this.GetService<IRTCService>().CreatRoom();
-
- }
- public void OntimeOut()
- {
- // 退出房间
- RTCRoomManager.Instance.LeaveChannel();
- // 改文字UI
- // AllotPanel.Instance.SetAllotText("");
- }
- public void OnnoExpert()
- {
- // 退出房间
- switch (RTCRoomManager.Instance.rtcState)
- {
- case RTCEnum.OFF:
- case RTCEnum.Online:
- RTCRoomManager.Instance.LeaveChannel();
- break;
- case RTCEnum.ExpertOnline:
- break;
- case RTCEnum.ConterlOnline:
- break;
- case RTCEnum.ALLOnline:
- break;
- default:
- break;
- }
- // RTCRoomManager.Instance.LeaveChannel();
- // 改文字UI
- // AllotPanel.Instance.SetAllotText("");
- }
- /// <summary>
- /// 设置MQTT房间ID
- /// </summary>
- 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;
- }
- }
- }
- /// <summary>
- /// 机房场景的初始化
- /// </summary>
- /// <param name="msg"> 机房信息 </param>
- public void MachineRoomInit( string msg)
- {
- Debug.Log("DGJ ===> MachineRoomInit ");
- MachineRoomManager.Instance.Init();
- }
- /// <summary>
- /// 获取机房列表
- /// </summary>
- public List<string> GetMachineRoomList()
- {
- return MachineRoomManager.Instance.listRoomName;
- }
- /// <summary>
- /// 获取机房数据
- /// </summary>
- /// <returns></returns>
- public MachineRoomData GetMachineRoomData( string machineRoomName)
- {
- // 根据机房名称从后台获取机房信息
- return MachineRoomManager.Instance.data;
- }
- /// <summary>
- /// 场景物体初始化
- /// </summary>
- 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;
- }
- /// <summary>
- /// 获取ShowDevice位置
- /// </summary>
- /// <param name="showDeviceTransform"></param>
- public void ShowDeviceTransform(Transform showDeviceTransform)
- {
- this.SendCommand(new ShowDeviceCommand(showDeviceTransform));
- }
- /// <summary>
- /// 获取ShowDevice位置
- /// </summary>
- public void GetDeviceTransform()
- {
- this.SendCommand(new ShowDeviceCommand(MachineRoomManager.Instance.startShowDevice));
-
- }
- /// <summary>
- /// 导航
- /// </summary>
- /// <param name="item"></param>
- public void NavigatorServer(MachineObj item)
- {
- WayFindingManager.Instance.NavigatorServer(item);
- }
- /// <summary>
- /// 导航
- /// </summary>
- /// <param name="listItem"></param>
- public void NavigatorServer(List<MachineObj> listItem)
- {
- WayFindingManager.Instance.NavigatorServer(listItem);
- }
- /// <summary>
- /// 获取告警列表
- /// </summary>
- /// <returns></returns>
- public List<AlarmData> GetAlarmData()
- {
- // 缺少获取设备名称---备注
- if(MachineRoomManager.Instance.data.listAlarmData==null)
- SetData();
- return MachineRoomManager.Instance.data.listAlarmData;
- }
- private void SetData()
- {
- MachineRoomManager.Instance.data.listAlarmData = new List<AlarmData>();
- 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);
- }
- }
- }
|