Browse Source

修改上传代码,信令+RTC

蓝色星空 1 year ago
parent
commit
4462ac5e3c

+ 1 - 1
Assets/Game/Blue/0.F/SceneIOCContainer.cs

@@ -1,7 +1,7 @@
 using System.Collections.Generic;
 using Blue;
 
-namespace GHZLangChao
+namespace Blue
 {
     /// <summary>
     /// 场景IOC容器,用于存储对象、物体

+ 1 - 1
Assets/Game/Blue/Action/ResetTransform.cs

@@ -1,4 +1,4 @@
-using GHZLangChao;
+using Blue;
 using UnityEngine;
 
 /// <summary>

+ 1 - 0
Assets/Game/Blue/GHZLangChao.cs

@@ -20,6 +20,7 @@ namespace GHZLangChao
             this.RegisterService<ILoginService>(new LoginService());
             this.RegisterService<IQueueSystem>(new QueueSystem());
             this.RegisterService<IRTCService>(new RTCService());
+            this.RegisterService<ISignallingService>(new SignallingService());
         }
 
         private void RegisterUtility()

+ 9 - 0
Assets/Game/Blue/RTC/ContactsInfo.cs

@@ -0,0 +1,9 @@
+using System;
+
+[Serializable]
+public class ContactsInfo
+{
+    public int email;
+    public string name;
+    public bool online;
+}

+ 11 - 0
Assets/Game/Blue/RTC/ContactsInfo.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: dbac058190e52bb48b39c517dfd82a3f
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 31
Assets/Game/Blue/RTC/Event/RTCEvent.cs

@@ -1,34 +1,11 @@
 using Blue;
 
-/// <summary>
-/// RTC登录后获取Token成功事件
-/// </summary>
-public class RTCGetTokenSuccessEvent : IEvent
-{
-    public string token;
-}
-/// <summary>
-/// RTC登录后获取Token失败事件
-/// </summary>
-public class RTCGetTokenFailEvent : IEvent
-{
-
-}
-
 /// <summary>
 /// 创建房间成功事件
 /// </summary>
 public class RTCCreatRoomSuccessEvent : IEvent
 {
-    public string RTCUrl;
-    public string roomInfo;
-}
-/// <summary>
-/// RTC创建房间失败事件
-/// </summary>
-public class RTCCreatRoomFailEvent : IEvent
-{
-
+    public RTCRoomInfo rtcRoomInfo;
 }
 
 /// <summary>
@@ -51,15 +28,9 @@ public class RTCConnectFailEvent : IEvent
 /// </summary>
 public class JoinRoomSuccessEvent : IEvent
 {
-    public string roomInfo;
+    public RTCRoomInfo rtcRoomInfo;
 }
-/// <summary>
-/// 加入房间失败事件
-/// </summary>
-public class JoinRoomFailEvent : IEvent
-{
 
-}
 /// <summary>
 /// 其他用户加入房间事件
 /// </summary>

+ 10 - 0
Assets/Game/Blue/RTC/Event/SignallingEvent.cs

@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using Blue;
+
+/// <summary>
+/// 获取联系人成功事件
+/// </summary>
+public class GetContactsSuccessEvent : IEvent
+{
+    public List<ContactsInfo> ContactsInfoList;
+}

+ 11 - 0
Assets/Game/Blue/RTC/Event/SignallingEvent.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: beb1fde176d0eaa4abcade8999f05064
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 160 - 0
Assets/Game/Blue/RTC/LangChaoRTC.unity

@@ -4506,6 +4506,38 @@ Transform:
   m_CorrespondingSourceObject: {fileID: 4944353772951783779, guid: 7cd0ceba7525bdc42a36be841a8aad16, type: 3}
   m_PrefabInstance: {fileID: 332018100}
   m_PrefabAsset: {fileID: 0}
+--- !u!1 &333531399
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 333531400}
+  m_Layer: 0
+  m_Name: GameObject
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &333531400
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 333531399}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 1000000}
+  m_LocalScale: {x: 1, y: 2, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 474832631}
+  m_Father: {fileID: 0}
+  m_RootOrder: 53
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &334138221
 GameObject:
   m_ObjectHideFlags: 0
@@ -6142,6 +6174,120 @@ CanvasRenderer:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 469901233}
   m_CullTransparentMesh: 1
+--- !u!1001 &474832630
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    m_TransformParent: {fileID: 333531400}
+    m_Modifications:
+    - target: {fileID: 6791783665993114108, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_Name
+      value: LoginPanel
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_Pivot.x
+      value: 0.5
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_Pivot.y
+      value: 0.5
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_RootOrder
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_AnchorMax.x
+      value: 0.5
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_AnchorMax.y
+      value: 0.5
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_AnchorMin.x
+      value: 0.5
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_AnchorMin.y
+      value: 0.5
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_SizeDelta.x
+      value: 780
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_SizeDelta.y
+      value: 748
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalScale.x
+      value: 0.001
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalScale.y
+      value: 0.0005
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalScale.z
+      value: 0.001
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: -999998
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: -0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: -0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: -0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_AnchoredPosition.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_AnchoredPosition.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    m_RemovedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+--- !u!224 &474832631 stripped
+RectTransform:
+  m_CorrespondingSourceObject: {fileID: 6791783665993114135, guid: f8911898ec087ee4b8a94b2cf3353631, type: 3}
+  m_PrefabInstance: {fileID: 474832630}
+  m_PrefabAsset: {fileID: 0}
 --- !u!1 &480063032
 GameObject:
   m_ObjectHideFlags: 0
@@ -20856,6 +21002,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1485402483}
+  - component: {fileID: 1485402484}
   m_Layer: 0
   m_Name: HttpTool
   m_TagString: Untagged
@@ -20878,6 +21025,19 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 12
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &1485402484
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1485402481}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 55d86a86da9b1674489340987e1f67f2, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  global: 1
 --- !u!1 &1496039440
 GameObject:
   m_ObjectHideFlags: 0

+ 3 - 4
Assets/Game/Blue/RTC/RTCRoomInfo.cs

@@ -1,10 +1,9 @@
 using System;
-using System.Collections.Generic;
 
 [Serializable]
 public class RTCRoomInfo
 {
-    public int RoomID;
-    public string RoomName;
-    public List<RTCUserInfo> UserList ;
+    public int roomId;
+    public string token;
+    public string host;
 }

+ 1 - 6
Assets/Game/Blue/RTC/Service/IRTCService.cs

@@ -2,7 +2,7 @@ using System.Collections.Generic;
 using Blue;
 
 /// <summary>
-/// 登录获取账号token---根据token创建房间---创建房间后获得url,根据url连接rtc
+/// 根据token创建房间---创建房间后获得url,根据url连接rtc
 /// 开关音视频,加入离开房间
 /// </summary>
 public interface IRTCService : IService
@@ -14,11 +14,6 @@ public interface IRTCService : IService
     /// </summary>
     void CloseRTC();
 
-    /// <summary>
-    /// 登录后获取账号Token
-    /// </summary>
-    void GetToken();
-
     /// <summary>
     /// 根据Token创建房间
     /// </summary>

+ 12 - 0
Assets/Game/Blue/RTC/Service/ISignallingService.cs

@@ -0,0 +1,12 @@
+using Blue;
+
+/// <summary>
+/// 信令模块
+/// </summary>
+public interface ISignallingService : IService
+{
+    /// <summary>
+    /// 获取联系人
+    /// </summary>
+    void GetContacts();
+}

+ 11 - 0
Assets/Game/Blue/RTC/Service/ISignallingService.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2d3fe64e99bf6cd4c8c71cfa2438a1fd
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 78 - 71
Assets/Game/Blue/RTC/Service/RTCService.cs

@@ -1,7 +1,12 @@
+using System.Collections;
 using System.Collections.Generic;
+using System.Text;
 using Blue;
+using GHZLangChao;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using UnityEngine;
+using UnityEngine.Networking;
 
 public class RTCService : IRTCService
 {
@@ -11,18 +16,13 @@ public class RTCService : IRTCService
     public Dictionary<int, RTCUserInfo> mUserDic{ get; private set; } = new Dictionary<int, RTCUserInfo>(); // 房间用户字典
     public void OnInit()
     {
-        // 获取 token
-        this.RegisterEvent<RTCGetTokenSuccessEvent>(RTCGetTokenSuccess);
-        this.RegisterEvent<RTCGetTokenFailEvent>(RTCGetTokenFail);
         // 创建房间
         this.RegisterEvent<RTCCreatRoomSuccessEvent>(RTCCreatRoomSuccess);
-        this.RegisterEvent<RTCCreatRoomFailEvent>(RTCCreatRoomFail);
         // 连接RTC
         this.RegisterEvent<RTCConnectSuccessEvent>(RTCConnectSuccess);
         this.RegisterEvent<RTCConnectFailEvent>(RTCConnectFail);
         // 加入房间
         this.RegisterEvent<JoinRoomSuccessEvent>(JoinRoomSuccess);
-        this.RegisterEvent<JoinRoomFailEvent>(JoinRoomFail);
         // 其他用户加入房间
         this.RegisterEvent<OtherUserJoinRoomEvent>(OtherUserJoinRoom);
         this.RegisterEvent<OtherLeaveRoomEvent>(OtherLeaveRoom);
@@ -36,38 +36,12 @@ public class RTCService : IRTCService
 
     }
 
-    /// <summary>
-    /// 登录后获取账号Token
-    /// </summary>
-    public void GetToken()
-    {
-        mToken = "...token...";
-
-        this.SendEvent(new RTCGetTokenSuccessEvent() { token = mToken });
-        //this.SendEvent<RTCGetTokenFailEvent>();
-    }
-
     /// <summary>
     /// 根据Token创建房间
     /// </summary>
     public void CreatRoom()
     {
-        var mRTCUrl = "...RTCURL...";
-
-        RTCUserInfo RTCUserInfo = new RTCUserInfo()
-        {
-            UserID = 123,UserName="我是123",Head=321,Audio = false,Video = false
-        };
-        mUserDic.Add(RTCUserInfo.UserID,RTCUserInfo);
-        mUserList.Add(RTCUserInfo);
-        mRTCRoomInfo = new RTCRoomInfo()
-        {
-            RoomID=111111,RoomName="我是111111",UserList = mUserList
-        };
-        string currentRoomInfo = JsonConvert.SerializeObject(mRTCRoomInfo);
-
-        this.SendEvent(new RTCCreatRoomSuccessEvent() { RTCUrl = mRTCUrl, roomInfo = currentRoomInfo });
-        //this.SendEvent<RTCCreatRoomFailEvent>();
+        CoroutineSystem.Instance.StartCoroutine(RTCCreateRoom());
     }
 
     /// <summary>
@@ -84,9 +58,7 @@ public class RTCService : IRTCService
     /// </summary>
     public void JoinRoom(int roomId)
     {
-        // ToDo:
-        this.SendEvent<JoinRoomSuccessEvent>();
-        //this.SendEvent<JoinRoomFailEvent>();
+        CoroutineSystem.Instance.StartCoroutine(RTCJoinRoom(roomId.ToString()));
     }
 
     /// <summary>
@@ -165,32 +137,19 @@ public class RTCService : IRTCService
 
     #region  事件
 
-    // 获取 token
-    private void RTCGetTokenSuccess(RTCGetTokenSuccessEvent e)
-    {
-        Debug.LogError($"获取token成功:{e.token}");
-
-        this.UnRegisterEvent<RTCGetTokenSuccessEvent>(RTCGetTokenSuccess);
-    }
-    private void RTCGetTokenFail(RTCGetTokenFailEvent e)
-    {
-        Debug.LogError($"RTC:RTCGetTokenFail");
-
-        this.UnRegisterEvent<RTCGetTokenFailEvent>(RTCGetTokenFail);
-    }
-
     // 创建房间
     private void RTCCreatRoomSuccess(RTCCreatRoomSuccessEvent e)
     {
-        Debug.LogError($"创建房间成功:{e.roomInfo}");
-        ConnectByRTCUrl(e.RTCUrl);
-        this.UnRegisterEvent<RTCCreatRoomSuccessEvent>(RTCCreatRoomSuccess);
+        Debug.LogError($"创建房间成功,房间ID:{e.rtcRoomInfo.roomId}");
+        //ConnectByRTCUrl(e.rtcRoomInfo.host);
+
+        JoinRoom(e.rtcRoomInfo.roomId);
     }
-    private void RTCCreatRoomFail(RTCCreatRoomFailEvent e)
-    {
-        Debug.LogError($"RTC:RTCGetTokenFail");
 
-        this.UnRegisterEvent<RTCCreatRoomFailEvent>(RTCCreatRoomFail);
+    // 加入房间
+    private void JoinRoomSuccess(JoinRoomSuccessEvent e)
+    {
+        Debug.LogError($"加入房间成功,房间号:{e.rtcRoomInfo.roomId}");
     }
 
     // 连接RTC
@@ -205,21 +164,6 @@ public class RTCService : IRTCService
         this.UnRegisterEvent<RTCConnectFailEvent>(RTCConnectFail);
     }
 
-    // 加入房间
-    private void JoinRoomSuccess(JoinRoomSuccessEvent e)
-    {
-        mUserList = JsonConvert.DeserializeObject<List<RTCUserInfo>>(e.roomInfo);
-        foreach(RTCUserInfo user in mUserList) mUserDic.Add(user.UserID,user);
-
-        Debug.LogError($"RTC:JoinRoomSuccess");
-        this.UnRegisterEvent<JoinRoomSuccessEvent>(JoinRoomSuccess);
-    }
-    private void JoinRoomFail(JoinRoomFailEvent e)
-    {
-        Debug.LogError($"RTC:JoinRoomFail");
-        this.UnRegisterEvent<JoinRoomFailEvent>(JoinRoomFail);
-    }
-
     // 其他用户
     private void OtherUserJoinRoom(OtherUserJoinRoomEvent e)
     {
@@ -242,4 +186,67 @@ public class RTCService : IRTCService
         this.UnRegisterEvent<OtherLeaveRoomEvent>(OtherLeaveRoom);
     }
     #endregion
+
+    #region 协程
+
+    private string message;
+    public IEnumerator RTCCreateRoom()
+    {
+        UnityWebRequest webRequest = new UnityWebRequest(HttpAction.mEndustryURL+HttpAction.rtc_CreateRoom,"POST");
+        //foreach( var head in HttpTool.Instance.RequestHeader) webRequest.SetRequestHeader(head.Key,head.Value); 暂时使用直接写的方式,等后续确定使用此行代码
+        webRequest.SetRequestHeader("Content-Type","application/x-www-form-urlencoded");
+        webRequest.SetRequestHeader("Authorization",login.UserInfo.Instance.Token);
+        webRequest.downloadHandler = new DownloadHandlerBuffer();
+        yield return webRequest.SendWebRequest();
+        if (webRequest.result== UnityWebRequest.Result.ProtocolError || webRequest.result == UnityWebRequest.Result.ConnectionError)
+            Debug.LogError($"Error:{webRequest.error},DownloadHandler:{webRequest.downloadHandler.text}");
+        else
+        {
+            if (!string.IsNullOrWhiteSpace(webRequest.downloadHandler.text))
+            {
+                message = webRequest.downloadHandler.text;
+                JObject jobject = JObject.Parse(message);
+                if (jobject["code"].ToString() == "200")
+                {
+                    message = jobject["data"].ToString();
+                    if (!string.IsNullOrWhiteSpace(message))
+                    {
+                        mRTCRoomInfo =  JsonConvert.DeserializeObject<RTCRoomInfo>(message);
+                        this.SendEvent(new RTCCreatRoomSuccessEvent() { rtcRoomInfo =  mRTCRoomInfo});
+                    }
+                }
+            }
+        }
+    }
+
+    public IEnumerator RTCJoinRoom(string roomID)
+    {
+        UnityWebRequest webRequest = new UnityWebRequest(HttpAction.mEndustryURL+HttpAction.rtc_CreateRoom,"POST");
+        //foreach( var head in HttpTool.Instance.RequestHeader) webRequest.SetRequestHeader(head.Key,head.Value); 暂时使用直接写的方式,等后续确定使用此行代码
+        webRequest.SetRequestHeader("Content-Type","application/x-www-form-urlencoded");
+        webRequest.SetRequestHeader("Authorization",login.UserInfo.Instance.Token);
+        byte[] bodyRaw = Encoding.UTF8.GetBytes(roomID);
+        webRequest.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
+        webRequest.downloadHandler = new DownloadHandlerBuffer();
+        yield return webRequest.SendWebRequest();
+        if (webRequest.result== UnityWebRequest.Result.ProtocolError || webRequest.result == UnityWebRequest.Result.ConnectionError)
+        {
+            Debug.LogError($"Error:{webRequest.error},DownloadHandler:{webRequest.downloadHandler.text}");
+        }
+        else
+        {
+            if (!string.IsNullOrWhiteSpace(webRequest.downloadHandler.text))
+            {
+                message = webRequest.downloadHandler.text;
+                JObject jobject = JObject.Parse(message);
+                if (jobject["code"].ToString() == "200" && !string.IsNullOrEmpty(jobject["data"].ToString()))
+                {
+                    message = jobject["data"].ToString();
+                    mRTCRoomInfo =  JsonConvert.DeserializeObject<RTCRoomInfo>(message);
+                    this.SendEvent(new JoinRoomSuccessEvent() { rtcRoomInfo =  mRTCRoomInfo});
+                }
+            }
+        }
+    }
+    #endregion
 }

+ 57 - 0
Assets/Game/Blue/RTC/Service/SignallingService.cs

@@ -0,0 +1,57 @@
+using System.Collections;
+using System.Collections.Generic;
+using Blue;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using UnityEngine;
+using UnityEngine.Networking;
+
+public class SignallingService : ISignallingService
+{
+    public void OnInit()
+    {
+        this.RegisterEvent<GetContactsSuccessEvent>(GetContactsSuccess);
+    }
+
+    public void GetContacts()
+    {
+        CoroutineSystem.Instance.StartCoroutine(OnGetContacts());
+    }
+
+    #region 事件
+    private void GetContactsSuccess(GetContactsSuccessEvent e)
+    {
+        string json = JsonConvert.SerializeObject(e.ContactsInfoList);
+        Debug.LogError($"获取联系人:{json}");
+    }
+    #endregion
+
+    #region  协程
+    private string message;
+    private IEnumerator OnGetContacts()
+    {
+        UnityWebRequest webRequest = new UnityWebRequest(HttpAction.mEndustryURL + HttpAction.signal_contact, "POST");
+        //foreach( var head in HttpTool.Instance.RequestHeader) webRequest.SetRequestHeader(head.Key,head.Value); 暂时使用直接写的方式,等后续确定使用此行代码
+        webRequest.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+        webRequest.SetRequestHeader("Authorization", login.UserInfo.Instance.Token);
+        webRequest.downloadHandler = new DownloadHandlerBuffer();
+        yield return webRequest.SendWebRequest();
+        if (webRequest.result == UnityWebRequest.Result.ProtocolError || webRequest.result == UnityWebRequest.Result.ConnectionError)
+            Debug.LogError($"Error:{webRequest.error},DownloadHandler:{webRequest.downloadHandler.text}");
+        else
+        {
+            if (!string.IsNullOrWhiteSpace(webRequest.downloadHandler.text))
+            {
+                message = webRequest.downloadHandler.text;
+                JObject jobject = JObject.Parse(message);
+                if (jobject["code"].ToString() == "200" && !string.IsNullOrEmpty(jobject["data"].ToString()) && !string.IsNullOrEmpty(jobject["data"]["list"].ToString()))
+                {
+                    message = jobject["data"]["list"].ToString();
+                    List<ContactsInfo> mContactsInfoList = JsonConvert.DeserializeObject<List<ContactsInfo>>(message);
+                    this.SendEvent(new GetContactsSuccessEvent() { ContactsInfoList = mContactsInfoList });
+                }
+            }
+        }
+    }
+    #endregion
+}

+ 11 - 0
Assets/Game/Blue/RTC/Service/SignallingService.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9e0fe50b42e7a0b4bb53034fb18d9b68
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Assets/Game/Blue/Service/ILoginService.cs

@@ -21,7 +21,7 @@ namespace GHZLangChao
 
         public void Login()
         {
-            CoroutineSystem.Instance.Start_Coroutine(LoginImitate());
+            CoroutineSystem.Instance.StartCoroutine(LoginImitate());
         }
 
         private IEnumerator LoginImitate()

+ 3 - 0
Assets/Game/Blue/Service/IQueueSystem.cs

@@ -2,6 +2,9 @@ using System.Collections.Generic;
 using Blue;
 using UnityEngine;
 
+/// <summary>
+/// 服务于三级菜单,用于统一开关
+/// </summary>
 public interface IQueueSystem : IService
 {
     BindableProperty<int> Level3QueueCount { get; }

+ 1 - 3
Assets/Game/Blue/System/CommandSystem.cs

@@ -1,6 +1,4 @@
-using Blue;
-
-namespace GHZLangChao
+namespace Blue
 {
     public class CommandSystem : SingletonMonobehaviour<CommandSystem>
     {

+ 1 - 19
Assets/Game/Blue/System/CoroutineSystem.cs

@@ -1,25 +1,7 @@
-using System.Collections;
-using UnityEngine;
-using Blue;
-
-namespace GHZLangChao
+namespace Blue
 {
     public class CoroutineSystem : SingletonMonobehaviour<CoroutineSystem>
     {
-        /// <summary>
-        /// 启动一个协程
-        /// </summary>
-        public Coroutine Start_Coroutine(IEnumerator coroutine)
-        {
-            return StartCoroutine(coroutine);
-        }
 
-        /// <summary>
-        /// 停止一个协程序
-        /// </summary>
-        public void Stop_Coroutine(Coroutine routine)
-        {
-            StopCoroutine(routine);
-        }
     }
 }

+ 1 - 2
Assets/Game/Blue/System/GetObjectSystem.cs

@@ -1,8 +1,7 @@
-using Blue;
 using UnityEngine;
 using UnityEngine.UI;
 
-namespace GHZLangChao
+namespace Blue
 {
     public class GetObjectSystem : SingletonMonobehaviour<GetObjectSystem>
     {

+ 1 - 2
Assets/Game/Blue/System/InstantiateSystem.cs

@@ -1,7 +1,6 @@
-using Blue;
 using UnityEngine;
 
-namespace GHZLangChao
+namespace Blue
 {
     public class InstantiateSystem : SingletonMonobehaviour<InstantiateSystem>
     {

+ 1 - 0
Assets/Game/ShowChoose/ShowChoosePanelSelect.cs

@@ -1,3 +1,4 @@
+using Blue;
 using UnityEngine;
 using UnityEngine.UI;
 

+ 0 - 2
Assets/Game/ShowLogin/LangChaoLogin.cs

@@ -14,8 +14,6 @@ namespace GHZLangChao
         public void GotoChoose()
         {
             this.SendCommand<LoginCommand>();
-
-            this.GetService<IRTCService>().GetToken();
         }
 
         private void LoginSuccess(LoginSuccessEvent e)

+ 1 - 0
Assets/Game/ShowSupport/SupportControl.cs

@@ -55,6 +55,7 @@ public class SupportControl : AbstractController
     public void showRTC()
     {
         this.GetService<IRTCService>().CreatRoom();
+        this.GetService<ISignallingService>().GetContacts();
         ShowRTC.Instance.gotoWindow(ScenesManager.SceneType.ShowRTCRoomMain);
     }
     public void Home()