using Blue; using SC.XR.Unity.Module_InputSystem; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using static ScenesManager; public class LiveRTCRoomMain : MonoSingleton,IController { public Button videoOpenBtn; public Button videoCloseBtn; public Button audioOpenBtn; public Button audioCloseBtn; public Button clearArrowBtn; public Button leaveRoomBtn; public GameObject defaultUI; public Button noBtn; public Button yesBtn; public RawImage rtcRawImage; public ManipulationHandler dragBtn; private void Start() { OnInit(); dragBtn.Target = transform.parent; } private void Update() { if (RTCRoomManager.Instance.expertView != null) { if (!rtcRawImage.gameObject.activeSelf) rtcRawImage.gameObject.SetActive(true); rtcRawImage.texture = RTCRoomManager.Instance.expertView.VideoView; } else { if (rtcRawImage.gameObject.activeSelf) rtcRawImage.gameObject.SetActive(false); } } private void OnInit() { videoOpenBtn.onClick.AddListener(()=> { SetVideo(true); }); videoCloseBtn.onClick.AddListener(() => { SetVideo(false); }); audioOpenBtn.onClick.AddListener(() => { SetAudio(true); }); audioCloseBtn.onClick.AddListener(() => { SetAudio(false); }); clearArrowBtn.onClick.AddListener(ClearAllArrow); leaveRoomBtn.onClick.AddListener(() => { SetDefaultUI(true); }); noBtn.onClick.AddListener(() => { SetDefaultUI(false); }); yesBtn.onClick.AddListener(LeaveRoom); } public void SetAudio(bool state) { GHZRtcManager.Instance.OnMicrophone(state); audioCloseBtn.gameObject.SetActive(state); audioOpenBtn.gameObject.SetActive(!state); } public void SetVideo(bool state) { GHZRtcManager.Instance.OnWebCam(state); videoCloseBtn.gameObject.SetActive(state); videoOpenBtn.gameObject.SetActive(!state); } public void ClearAllArrow() { if (ArrowList.Instance) { ArrowList.Instance.DeleteAll(); } } public void SetDefaultUI(bool state) { defaultUI.SetActive(state); } public void LeaveRoom() { RTCRoomManager.Instance.LeaveChannel(); if (PopPeerView.Instance) { PopPeerView.Instance.list.SetParent(PopPublic.Instance.transform); PopPeerView.Instance.list.localPosition = new Vector3(0, 0, 0); PopPeerView.Instance.list.localEulerAngles = new Vector3(0, 0, 0); } if (PopUpInfo.Instance) { PopUpInfo.Instance.transform.SetParent(PopPublic.Instance.transform); PopUpInfo.Instance.transform.localPosition = new Vector3(0, 0, 0); PopUpInfo.Instance.transform.localEulerAngles = new Vector3(0, 0, 0); } ScenesManager.Instance.showWindow(SceneType.ShowChoose); if (InviteDlg.Instance) { InviteDlg.Instance.InvitingUnionIdList.Clear(); } if (ArrowList.Instance) { ArrowList.Instance.DeleteAll(); } if (RoomFile.Instance) { RoomFile.Instance.ClearAllFileItem(); } if (PrintscreenList.Instance) { PrintscreenList.Instance.DeleteAll(); } if (PopPeerView.Instance) { PopPeerView.Instance.DestoryAll(); } if (PopCall.Instance) { // PopCall.Instance.gameObject.SetActive(false); } if (ShowRoom.Instance) { ShowRoom.Instance.ShowMainScreen(); ShowRoom.Instance.transform.localPosition = new Vector3(0, 0, 0); ShowRoom.Instance.transform.localEulerAngles = new Vector3(0, 0, 0); } API_GSXR_Slam.GSXR_Reset_Slam(); // RemoteRtc.Instance.FiltrationCamera(true); } private void OnEnable() { audioCloseBtn.gameObject.SetActive(true); audioOpenBtn.gameObject.SetActive(false); videoCloseBtn.gameObject.SetActive(true); videoOpenBtn.gameObject.SetActive(false); } }