“hujiajun” 4 mesiacov pred
rodič
commit
f646faedc0

+ 6 - 5
Assets/HotUpdate/Scripts/Scripts/Project/RTC/RTCDemoManager.cs

@@ -30,7 +30,8 @@ public class RTCDemoManager : MonoSingleton<RTCDemoManager>
                 RTCDemoManager.Instance.ConnectByRTCUrl(host);
                 
                 rtcpostCount = 0;
-                // 创建成功
+                // 锟斤拷锟斤拷锟缴癸拷
+                RTCRoomManager.Instance.OnLocalUserJoined();
             }
             else
             {
@@ -38,7 +39,7 @@ public class RTCDemoManager : MonoSingleton<RTCDemoManager>
                 if (rtcpostCount > 5)
                 {
                     //ErrorPopup.Instance.UpdateRTCState(NetState.DisConnect);
-                    //ErrorPopup.Instance.ShowRTCError("创建房间失败 " + message, -1);
+                    //ErrorPopup.Instance.ShowRTCError("锟斤拷锟斤拷锟斤拷锟斤拷失锟斤拷 " + message, -1);
 
                 }
                 else
@@ -51,8 +52,8 @@ public class RTCDemoManager : MonoSingleton<RTCDemoManager>
                 //{
                 //    RTCRoomManager.Instance.isRTCreate = true;
                 //}
-                // RTC 创建房间失败
-                // RTC 创建房间失败
+                // RTC 锟斤拷锟斤拷锟斤拷锟斤拷失锟斤拷
+                // RTC 锟斤拷锟斤拷锟斤拷锟斤拷失锟斤拷
             }
 
 
@@ -63,7 +64,7 @@ public class RTCDemoManager : MonoSingleton<RTCDemoManager>
     }
 
     /// <summary>
-    /// 根据url连接rtc
+    /// 锟斤拷锟斤拷url锟斤拷锟斤拷rtc
     /// </summary>
     public void ConnectByRTCUrl(string URL)
     {

+ 24 - 8
Assets/Scripts/MQTT/MQTTClient.cs

@@ -84,16 +84,12 @@ public class MQTTClient : MonoSingleton<MQTTClient>
         Subscribe(MQTTManager.Instance.front + "sensor/VOICE"); //噪声
         Subscribe(MQTTManager.Instance.front + "sensor/TEMPERATURE_HUMIDITY"); //温湿度传感器
         Subscribe(MQTTManager.Instance.front + "sensor/VIBRATE"); //振动传感器
-        //if (!string.IsNullOrEmpty( MQTTManager.Instance.topiceNavigation))
-        //{
-        //    Subscribe(MQTTManager.Instance.topiceNavigation);
-        //    Subscribe(MQTTManager.Instance.topiceSync);
-        //    Subscribe(MQTTManager.Instance.topiceClose);
-        //}
+        Subscribe(MQTTManager.Instance.front + "room/RTC"); //RTC
+                                                                  
 
         // Subscribe((MQTTManager.Instance.front + "younuo"));
-     //   MQTTManager.Instance.isCreateRoom = true;
-       
+        //   MQTTManager.Instance.isCreateRoom = true;
+
     }
 
 
@@ -129,6 +125,26 @@ public class MQTTClient : MonoSingleton<MQTTClient>
       //  MQTTManager.Instance.Received(msg);
         MQTTManager.Instance.Received(obj);
 
+        JsonData data = JsonMapper.ToObject(msg);
+        if(data["device"].ToString()=="ROOM2")
+        {
+            if (RTCDemoManager.Instance&&RTCDemoManager.Instance.roomId!="")
+            {
+                JsonData obj2 = new JsonData();
+                obj2["device"] = new JsonData();
+                obj2["device"]["deviceCode"] = "ROOM";
+                obj2["roomId"] = RTCDemoManager.Instance.roomId;
+                // 用MQTT 向中考发送邀请
+                MQTTManager.Instance.PushMsg(MQTTManager.Instance.front + "room/RTC", obj2.ToJson());
+            }else
+            {
+                Debug.Log("创建房间");
+                RTCDemoManager.Instance.CreatRoom();
+
+            }
+
+        }
+
         if (ProjectALLStateManager.Instance.isAIDevice)
             AIDeviceManager.Instance.Received(msg);
     }

+ 7 - 4
Assets/Scripts/RTC/RTCRoomManager.cs

@@ -108,8 +108,8 @@ public class RTCRoomManager : MonoSingleton<RTCRoomManager>
     public void OnLocalUserJoined()
     {
         // UserJoined(UserEnum.Player);
-        Debug.Log("DGJ  ===>OnLocalUserJoined  " + isInvite + isApply);
-        if(isInvite) // 邀请中控
+        Debug.Log("DGJ  ===>OnLocalUserJoined  " + MQTTManager.Instance.front + "online/" + controlId);
+        if(true) // 邀请中控
         {
             isInvite = false;
             JsonData obj = new JsonData();
@@ -123,12 +123,15 @@ public class RTCRoomManager : MonoSingleton<RTCRoomManager>
             obj["personnel"]["resourcePoolId"] = MQTTManager.Instance.resourcePoolId;
             obj["personnel"]["room"] = MQTTManager.Instance.room;
             obj["personnel"]["phone"] = MQTTManager.Instance.phone;
+            obj["device"] = new JsonData();
+            obj["device"]["deviceCode"] = "ROOM";
+            obj["roomId"] = roomId;
             // 用MQTT 向中考发送邀请
-            MQTTManager.Instance.PushMsg(MQTTManager.Instance.front + "online/" + controlId, obj.ToJson());
+            MQTTManager.Instance.PushMsg(MQTTManager.Instance.front + "room/RTC" , obj.ToJson());
 
         }
       
-        if (isApply) // 当前在RTC 频道内
+        if (false) // 当前在RTC 频道内
         {
             isApply = false;
             JsonData data = new JsonData();