LiveRTCRoomMain.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using Blue;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using static ScenesManager;
  7. public class LiveRTCRoomMain : MonoSingleton<LiveRTCRoomMain>,IController
  8. {
  9. public Button videoOpenBtn;
  10. public Button videoCloseBtn;
  11. public Button audioOpenBtn;
  12. public Button audioCloseBtn;
  13. public Button clearArrowBtn;
  14. public Button leaveRoomBtn;
  15. public GameObject defaultUI;
  16. public Button noBtn;
  17. public Button yesBtn;
  18. public RawImage rtcRawImage;
  19. private void Start()
  20. {
  21. OnInit();
  22. }
  23. private void OnInit()
  24. {
  25. videoOpenBtn.onClick.AddListener(()=> { SetVideo(false); });
  26. videoCloseBtn.onClick.AddListener(() => { SetVideo(true); });
  27. audioOpenBtn.onClick.AddListener(() => { SetAudio(false); });
  28. audioCloseBtn.onClick.AddListener(() => { SetAudio(true); });
  29. clearArrowBtn.onClick.AddListener(ClearAllArrow);
  30. leaveRoomBtn.onClick.AddListener(() => { SetDefaultUI(true); });
  31. noBtn.onClick.AddListener(() => { SetDefaultUI(false); });
  32. yesBtn.onClick.AddListener(LeaveRoom);
  33. }
  34. public void SetAudio(bool state)
  35. {
  36. this.GetService<IRTCService>().ActiveAudio(state);
  37. audioCloseBtn.gameObject.SetActive(state);
  38. audioOpenBtn.gameObject.SetActive(!state);
  39. }
  40. public void SetVideo(bool state)
  41. {
  42. this.GetService<IRTCService>().ActiveVideo(state);
  43. videoCloseBtn.gameObject.SetActive(state);
  44. videoOpenBtn.gameObject.SetActive(!state);
  45. }
  46. public void ClearAllArrow()
  47. {
  48. if (ArrowList.Instance)
  49. {
  50. ArrowList.Instance.DeleteAll();
  51. }
  52. }
  53. public void SetDefaultUI(bool state)
  54. {
  55. defaultUI.SetActive(state);
  56. }
  57. public void LeaveRoom()
  58. {
  59. this.GetService<IRTCService>().LeaveRoom();
  60. if (PopPeerView.Instance)
  61. {
  62. PopPeerView.Instance.list.SetParent(PopPublic.Instance.transform);
  63. PopPeerView.Instance.list.localPosition = new Vector3(0, 0, 0);
  64. PopPeerView.Instance.list.localEulerAngles = new Vector3(0, 0, 0);
  65. }
  66. if (PopUpInfo.Instance)
  67. {
  68. PopUpInfo.Instance.transform.SetParent(PopPublic.Instance.transform);
  69. PopUpInfo.Instance.transform.localPosition = new Vector3(0, 0, 0);
  70. PopUpInfo.Instance.transform.localEulerAngles = new Vector3(0, 0, 0);
  71. }
  72. ScenesManager.Instance.showWindow(SceneType.ShowChoose);
  73. if (InviteDlg.Instance)
  74. {
  75. InviteDlg.Instance.InvitingUnionIdList.Clear();
  76. }
  77. if (ArrowList.Instance)
  78. {
  79. ArrowList.Instance.DeleteAll();
  80. }
  81. if (RoomFile.Instance)
  82. {
  83. RoomFile.Instance.ClearAllFileItem();
  84. }
  85. if (PrintscreenList.Instance)
  86. {
  87. PrintscreenList.Instance.DeleteAll();
  88. }
  89. if (PopPeerView.Instance)
  90. {
  91. PopPeerView.Instance.DestoryAll();
  92. }
  93. if (PopCall.Instance)
  94. {
  95. PopCall.Instance.gameObject.SetActive(false);
  96. }
  97. if (ShowRoom.Instance)
  98. {
  99. ShowRoom.Instance.ShowMainScreen();
  100. ShowRoom.Instance.transform.localPosition = new Vector3(0, 0, 0);
  101. ShowRoom.Instance.transform.localEulerAngles = new Vector3(0, 0, 0);
  102. }
  103. API_GSXR_Slam.GSXR_Reset_Slam();
  104. // RemoteRtc.Instance.FiltrationCamera(true);
  105. }
  106. public void ExpertJonin( string identity)
  107. {
  108. rtcRawImage.gameObject.SetActive(true);
  109. RTCManager.Instance.ShowViewRawImage(identity, rtcRawImage);
  110. }
  111. }