using Blue; using TMPro; using UnityEngine; using UnityEngine.UI; public class RTCRoomMain : AbstractController { [SerializeField] private TextMeshProUGUI mRoomName_Text; // 房间名 [SerializeField] private TextMeshProUGUI mRoomID_Text; // 房间ID [SerializeField] private TextMeshProUGUI mRoomPeopleCount_Text; // 房间人数 [SerializeField] private Button mVideoOpen_Btn; // 开启视频 [SerializeField] private Button mVideoClose_Btn; // 关闭视频 [SerializeField] private Button mAudioOpen_Btn; // 开启音频 [SerializeField] private Button mAudioClose_Btn; // 关闭音频 [SerializeField] private Button mInvite_Btn; // 邀请用户 [SerializeField] private Button mLeaveRoom; // 离开房间 [SerializeField] private MeshRenderer mBigView_Mesh; public Texture BigView_MeshTexture { set => mBigView_Mesh.material.mainTexture = value; } [SerializeField] private RawImage mRawImage_Raw; public Texture RawImageTexture { set => mRawImage_Raw.texture = value; } private IRTCService mRTCService; void Start() { mRTCService = this.GetService(); mVideoOpen_Btn.onClick.AddListener(VideoOpen); mVideoClose_Btn.onClick.AddListener(VideoClose); mAudioOpen_Btn.onClick.AddListener(AudioOpen); mAudioClose_Btn.onClick.AddListener(AudioClose); mInvite_Btn.onClick.AddListener(Invite); mLeaveRoom.onClick.AddListener(LeaveRoom); } #region UI事件 private void VideoOpen() { mRTCService.ActiveVideo(true); } private void VideoClose() { mRTCService.ActiveVideo(false); } private void AudioOpen() { mRTCService.ActiveAudio(true); } private void AudioClose() { mRTCService.ActiveAudio(false); } private void Invite() { ShowRoom.Instance.window[4].SetActive(true); if (InviteDlg.Instance) InviteDlg.Instance.ShowHistory(); Debug.LogError($"InviteUser:打开指定窗口"); } private void LeaveRoom() { mRTCService.LeaveRoom(); } #endregion private void Update() { if(Input.GetKeyDown(KeyCode.Q)) // 用户456加入房间 { mRTCService.JoinRoom(456); } else if(Input.GetKeyDown(KeyCode.Q)) { } else if(Input.GetKeyDown(KeyCode.E)) { } else if(Input.GetKeyDown(KeyCode.R)) { } } }