浏览代码

修改 画面播放逻辑

DGJ 1 年之前
父节点
当前提交
52e7ea5fab
共有 2 个文件被更改,包括 30 次插入8 次删除
  1. 20 8
      Assets/Game/ShowSupport/SupportControl.cs
  2. 10 0
      Assets/Scripts/RTC/LiveRTCRoomMain.cs

+ 20 - 8
Assets/Game/ShowSupport/SupportControl.cs

@@ -30,6 +30,8 @@ public class SupportControl : AbstractController
     ///  选择的问题类型
     /// </summary>
     public QuestionEnum Question;
+
+    private RTCRoomInfo mRTCRoomInfo;
     void Awake()
     {
 #if UNITY_EDITOR
@@ -61,28 +63,38 @@ public class SupportControl : AbstractController
 
         this.RegisterEvent<RTCCreatRoomSuccessEvent>(CreatRoomSuccess).UnRegisterWhenGameObjectDestroyed(gameObject);
         Question = QuestionEnum.NetWork;
+
+        RTCManager.OnUserJoined += OnUserJoined;
     }
 
-    private void CreatRoomSuccess(RTCCreatRoomSuccessEvent e)
+    private void OnUserJoined(string uid)
     {
-
-        Debug.Log("DGJ   =====>  JoinRoomSuccess");
-        RTCRoomInfo mRTCRoomInfo = JsonConvert.DeserializeObject<RTCRoomInfo>(e.rtcRoomInfo);
-
         JsonData data = new JsonData();
         data["roomId"] = mRTCRoomInfo.roomId.ToString();
         data["questionCategory"] = (int)Question;
 
-        Debug.Log("DGJ   =====>  "+ mRTCRoomInfo.roomId );
-      StartCoroutine(  HttpTool.Instance.SendHttp(HttpActionLang.apply, data.ToJson(), message =>
+        Debug.Log("DGJ   =====>  " + mRTCRoomInfo.roomId);
+
+        StartCoroutine(HttpTool.Instance.SendHttp(HttpActionLang.apply, data.ToJson(), message =>
         {
-            Debug.Log("DGJ ===>  HttpActionLang.apply   " + HttpActionLang.apply+"   "+ message);
+            Debug.Log("DGJ ===>  HttpActionLang.apply   " + HttpActionLang.apply + "   " + message);
             JObject jobject = JObject.Parse(message);
             if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString()))
             {
                 Debug.Log("DGJ ===>   ");
+                RTCManager.OnUserJoined -= OnUserJoined;
             }
         }));
+    }
+
+    private void CreatRoomSuccess(RTCCreatRoomSuccessEvent e)
+    {
+
+        Debug.Log("DGJ   =====>  JoinRoomSuccess");
+        mRTCRoomInfo = JsonConvert.DeserializeObject<RTCRoomInfo>(e.rtcRoomInfo);
+
+     
+     
 
         UILogManager.Instance.text2.text = mRTCRoomInfo.roomId.ToString();
         UICallManager.Instance.SetMQTTRoomId(mRTCRoomInfo.roomId.ToString());

+ 10 - 0
Assets/Scripts/RTC/LiveRTCRoomMain.cs

@@ -20,10 +20,17 @@ public class LiveRTCRoomMain : MonoSingleton<LiveRTCRoomMain>,IController
 
     public RawImage rtcRawImage;
 
+    public ParticipantView expertView;
     private void Start()
     {
         OnInit();
     }
+
+    private void Update()
+    {
+        if (expertView != null)
+            rtcRawImage.texture = expertView.VideoView;
+    }
     private void OnInit()
     {
         videoOpenBtn.onClick.AddListener(()=> { SetVideo(false); });
@@ -63,6 +70,9 @@ public class LiveRTCRoomMain : MonoSingleton<LiveRTCRoomMain>,IController
         }
     }
 
+    
+
+
     public void SetDefaultUI(bool state)
     {
         defaultUI.SetActive(state);