Browse Source

上传代码,登录界面,修改版本号为1.0.0

蓝色星空 1 year ago
parent
commit
23735863b5

+ 15 - 1
Assets/Game/Blue/0.F/BlueRoot.prefab

@@ -44,6 +44,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 74b5b3bf8eadc3c488880a55afff4f9e, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  DeviceDetailsControl: {fileID: 0}
 --- !u!1 &8253213312023144010
 GameObject:
   m_ObjectHideFlags: 0
@@ -57,6 +58,7 @@ GameObject:
   - component: {fileID: 7409934566693514613}
   - component: {fileID: 6195766569180850275}
   - component: {fileID: 8415422319146954477}
+  - component: {fileID: 5365156477934369907}
   m_Layer: 0
   m_Name: BlueRoot
   m_TagString: Untagged
@@ -117,7 +119,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   ShowDevice: {fileID: 0}
-  Xunjian2: {fileID: 0}
+  Xunjian: {fileID: 0}
 --- !u!114 &8415422319146954477
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -131,3 +133,15 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   blueObject: {fileID: 0}
+--- !u!114 &5365156477934369907
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8253213312023144010}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: ec9e0c485643b2743ab57980fd4f21dd, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 

+ 0 - 15
Assets/Game/Blue/Command/LoginCommand.cs

@@ -1,15 +0,0 @@
-using Blue;
-
-namespace GHZLangChao
-{
-    /// <summary>
-    /// 登录命令
-    /// </summary>
-    public struct LoginCommand : ICommand
-    {
-        public void OnExcute()
-        {
-            this.GetService<ILoginService>().Login();
-        }
-    }
-}

+ 0 - 12
Assets/Game/Blue/Event/LoginSuccessEvent.cs

@@ -1,12 +0,0 @@
-using Blue;
-
-namespace GHZLangChao
-{
-    /// <summary>
-    /// 登录成功事件
-    /// </summary>
-    public struct LoginSuccessEvent : IEvent
-    {
-
-    }
-}

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

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

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

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

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

@@ -5,7 +5,7 @@ using Blue;
 /// </summary>
 public class RTCCreatRoomSuccessEvent : IEvent
 {
-    public RTCRoomInfo rtcRoomInfo;
+    public string rtcRoomInfo;
 }
 
 /// <summary>
@@ -28,7 +28,7 @@ public class RTCConnectFailEvent : IEvent
 /// </summary>
 public class JoinRoomSuccessEvent : IEvent
 {
-    public RTCRoomInfo rtcRoomInfo;
+    public string rtcRoomInfo;
 }
 
 /// <summary>

+ 1 - 1
Assets/Game/Blue/RTC/Event/SignallingEvent.cs

@@ -6,5 +6,5 @@ using Blue;
 /// </summary>
 public class GetContactsSuccessEvent : IEvent
 {
-    public List<ContactsInfo> ContactsInfoList;
+    public string jsonString;
 }

+ 8 - 0
Assets/Game/Blue/RTC/Info.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: cf05d9b8441ec2944b41ab79e986bf5e
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/Game/Blue/RTC/Info/LoginUserInfo.cs

@@ -0,0 +1,9 @@
+/// <summary>
+/// 用于登录
+/// https://yapi.ghz-tech.com:8843/project/60/interface/api/974
+/// </summary>
+public class EndustryLoginUserInfo
+{
+    public string account;
+    public string password;
+}

+ 1 - 1
Assets/Game/Blue/Command/LoginCommand.cs.meta → Assets/Game/Blue/RTC/Info/LoginUserInfo.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 5497061d51edbb34491da8c8a4d432d7
+guid: 2cef3b8015adb84439a2f9c580b1a3d6
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 4 - 0
Assets/Game/Blue/RTC/RTCRoomInfo.cs → Assets/Game/Blue/RTC/Info/RTCRoomInfo.cs

@@ -1,5 +1,9 @@
 using System;
 
+/// <summary>
+/// RTC模块 房间信息
+/// https://yapi.ghz-tech.com:8843/project/60/interface/api/1001
+/// </summary>
 [Serializable]
 public class RTCRoomInfo
 {

+ 0 - 0
Assets/Game/Blue/RTC/RTCRoomInfo.cs.meta → Assets/Game/Blue/RTC/Info/RTCRoomInfo.cs.meta


+ 3 - 0
Assets/Game/Blue/RTC/RTCUserInfo.cs → Assets/Game/Blue/RTC/Info/RTCUserInfo.cs

@@ -1,5 +1,8 @@
 using System;
 
+/// <summary>
+/// 自己测试的
+/// </summary>
 [Serializable]
 public class RTCUserInfo
 {

+ 0 - 0
Assets/Game/Blue/RTC/RTCUserInfo.cs.meta → Assets/Game/Blue/RTC/Info/RTCUserInfo.cs.meta


+ 7 - 146
Assets/Game/Blue/RTC/LangChaoRTC.unity

@@ -4506,38 +4506,6 @@ 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
@@ -6174,120 +6142,6 @@ 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
@@ -21083,6 +20937,13 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   global: 1
+  front: client/
+  id: 
+  username: u@unity3
+  password: 
+  rid: mqttx_b4c02ddc
+  account: 
+  roomId: 
 --- !u!1 &1504529037
 GameObject:
   m_ObjectHideFlags: 0

+ 4 - 9
Assets/Game/Blue/RTC/Service/IRTCService.cs

@@ -9,25 +9,20 @@ public interface IRTCService : IService
 {
     Dictionary<int, RTCUserInfo> mUserDic{ get; }
 
-    /// <summary>
-    /// 关闭RTC
-    /// </summary>
-    void CloseRTC();
-
     /// <summary>
     /// 根据Token创建房间
     /// </summary>
     void CreatRoom();
 
     /// <summary>
-    /// 根据url连接rtc
+    /// 加入房间
     /// </summary>
-    void ConnectByRTCUrl(string URL);
+    void JoinRoom(int roomId);
 
     /// <summary>
-    /// 加入房间
+    /// /// 根据url连接rtc
     /// </summary>
-    void JoinRoom(int roomId);
+    void ConnectByRTCUrl(string URL);
 
     /// <summary>
     /// 退出房间

+ 33 - 115
Assets/Game/Blue/RTC/Service/RTCService.cs

@@ -1,20 +1,15 @@
-using System.Collections;
 using System.Collections.Generic;
-using System.Text;
 using Blue;
-using GHZLangChao;
 using LitJson;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using UnityEngine;
-using UnityEngine.Networking;
 
 public class RTCService : IRTCService
 {
-    private string mToken;
     private RTCRoomInfo mRTCRoomInfo;
-    private List<RTCUserInfo> mUserList =new List<RTCUserInfo>(); // 房间用户列表
-    public Dictionary<int, RTCUserInfo> mUserDic{ get; private set; } = new Dictionary<int, RTCUserInfo>(); // 房间用户字典
+    public Dictionary<int, RTCUserInfo> mUserDic { get; private set; } = new Dictionary<int, RTCUserInfo>(); // 房间用户字典
+
     public void OnInit()
     {
         // 创建房间
@@ -30,31 +25,38 @@ public class RTCService : IRTCService
     }
 
     /// <summary>
-    /// 关闭RTC
+    /// 根据Token创建房间
     /// </summary>
-    public void CloseRTC()
+    public void CreatRoom()
     {
-
+        CoroutineSystem.Instance.StartCoroutine(
+            HttpTool.Instance.SendHttp(HttpActionLang.rtc_CreateRoom, "", message =>
+            {
+                JObject jobject = JObject.Parse(message);
+                if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString()))
+                {
+                    this.SendEvent(new RTCCreatRoomSuccessEvent() { rtcRoomInfo = jobject["data"].ToString() });
+                }
+            }, "application/x-www-form-urlencoded"));
     }
 
-    /// <summary>
-    /// 根据Token创建房间
+    /// <summary>s
+    /// 加入房间
     /// </summary>
-    public void CreatRoom()
+    public void JoinRoom(int roomId)
     {
-       //CoroutineSystem.Instance.StartCoroutine(RTCCreateRoom());
-        GameStart.Instance.StartCoroutine(HttpTool.Instance.SendHttp(HttpActionLang.rtc_CreateRoom, "", (string message) => {
-            JObject jobject = JObject.Parse(message);
-            if (jobject["code"].ToString() == "200")
+        JsonData data = new JsonData();
+        data["roomId"] = roomId;
+        CoroutineSystem.Instance.StartCoroutine(
+            HttpTool.Instance.SendHttp(HttpActionLang.rtc_JoinRoom, data.ToJson(), message =>
             {
-                message = jobject["data"].ToString();
-                if (!string.IsNullOrWhiteSpace(message))
+                JObject jobject = JObject.Parse(message);
+                if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString()))
                 {
-                    mRTCRoomInfo = JsonConvert.DeserializeObject<RTCRoomInfo>(message);
-                    this.SendEvent(new RTCCreatRoomSuccessEvent() { rtcRoomInfo = mRTCRoomInfo });
+                    this.SendEvent(new JoinRoomSuccessEvent() { rtcRoomInfo = jobject["data"].ToString() });
                 }
-            }
-        }, "application/x-www-form-urlencoded"));
+            }));
+
     }
 
     /// <summary>
@@ -66,33 +68,12 @@ public class RTCService : IRTCService
         //this.SendEvent<RTCConnectFailEvent>();
     }
 
-    /// <summary>s
-    /// 加入房间
-    /// </summary>
-    public void JoinRoom(int roomId)
-    {
-       // CoroutineSystem.Instance.StartCoroutine(RTCJoinRoom(roomId.ToString()));
-        JsonData data = new JsonData();
-        data["roomId"] = roomId;
-        GameStart.Instance.StartCoroutine(HttpTool.Instance.SendHttp(HttpActionLang.rtc_CreateRoom, data.ToJson(), (string message) => {
-
-            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 });
-            }
-        }));
-
-    }
 
     /// <summary>
     /// 退出房间
     /// </summary>
     public void LeaveRoom()
     {
-        mUserList.Clear();
         mUserDic.Clear();
         Debug.LogError($"离开房间");
     }
@@ -166,16 +147,18 @@ public class RTCService : IRTCService
     // 创建房间
     private void RTCCreatRoomSuccess(RTCCreatRoomSuccessEvent e)
     {
-        Debug.LogError($"创建房间成功,房间ID:{e.rtcRoomInfo.roomId}");
+        mRTCRoomInfo = JsonConvert.DeserializeObject<RTCRoomInfo>(e.rtcRoomInfo);
+        Debug.LogError($"创建房间成功,房间ID:{mRTCRoomInfo.roomId}");
         //ConnectByRTCUrl(e.rtcRoomInfo.host);
 
-        JoinRoom(e.rtcRoomInfo.roomId);
+        JoinRoom(mRTCRoomInfo.roomId);
     }
 
     // 加入房间
     private void JoinRoomSuccess(JoinRoomSuccessEvent e)
     {
-        Debug.LogError($"加入房间成功,房间号:{e.rtcRoomInfo.roomId}");
+        mRTCRoomInfo = JsonConvert.DeserializeObject<RTCRoomInfo>(e.rtcRoomInfo);
+        Debug.LogError($"加入房间成功,房间号:{mRTCRoomInfo.roomId}");
     }
 
     // 连接RTC
@@ -194,85 +177,20 @@ public class RTCService : IRTCService
     private void OtherUserJoinRoom(OtherUserJoinRoomEvent e)
     {
         RTCUserInfo RTCUserInfo = JsonConvert.DeserializeObject<RTCUserInfo>(e.rtcUserInfoJsonString);
-        if(!mUserDic.ContainsKey(RTCUserInfo.UserID))
+        if (!mUserDic.ContainsKey(RTCUserInfo.UserID))
         {
-            mUserDic.Add(RTCUserInfo.UserID,RTCUserInfo);
-            mUserList.Add(RTCUserInfo);
+            mUserDic.Add(RTCUserInfo.UserID, RTCUserInfo);
         }
         this.UnRegisterEvent<OtherUserJoinRoomEvent>(OtherUserJoinRoom);
     }
     private void OtherLeaveRoom(OtherLeaveRoomEvent e)
     {
         RTCUserInfo RTCUserInfo = JsonConvert.DeserializeObject<RTCUserInfo>(e.rtcUserInfoJsonString);
-        if(mUserDic.ContainsKey(RTCUserInfo.UserID))
+        if (mUserDic.ContainsKey(RTCUserInfo.UserID))
         {
             mUserDic.Remove(RTCUserInfo.UserID);
-            mUserList.Remove(RTCUserInfo);
         }
         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
 }

+ 10 - 43
Assets/Game/Blue/RTC/Service/SignallingService.cs

@@ -1,10 +1,8 @@
-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
 {
@@ -15,55 +13,24 @@ public class SignallingService : ISignallingService
 
     public void GetContacts()
     {
-        GameStart.Instance.StartCoroutine(HttpTool.Instance.SendHttp(HttpActionLang.signal_contact,"",(string message) => {
-
-            JObject jobject = JObject.Parse(message);
-            if (jobject["code"].ToString() == "200" && !string.IsNullOrEmpty(jobject["data"].ToString()) && !string.IsNullOrEmpty(jobject["data"]["list"].ToString()))
+        CoroutineSystem.Instance.StartCoroutine(
+            HttpTool.Instance.SendHttp(HttpActionLang.signal_contact, "", message =>
             {
-                message = jobject["data"]["list"].ToString();
-                List<ContactsInfo> mContactsInfoList = JsonConvert.DeserializeObject<List<ContactsInfo>>(message);
-                this.SendEvent(new GetContactsSuccessEvent() { ContactsInfoList = mContactsInfoList });
-            }
+                JObject jobject = JObject.Parse(message);
+                if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString()) && !string.IsNullOrEmpty(jobject["data"]["list"].ToString()))
+                {
+                    this.SendEvent(new GetContactsSuccessEvent() { jsonString = jobject["data"]["list"].ToString() });
+                }
 
-        }, "application/x-www-form-urlencoded"));
-       // CoroutineSystem.Instance.StartCoroutine(OnGetContacts());
+            }, "application/x-www-form-urlencoded"));
     }
 
     #region 事件
     private void GetContactsSuccess(GetContactsSuccessEvent e)
     {
-        string json = JsonConvert.SerializeObject(e.ContactsInfoList);
-        Debug.LogError($"获取联系人:{json}");
-    }
-    #endregion
+        List<ContactsInfo> mContactsInfoList = JsonConvert.DeserializeObject<List<ContactsInfo>>(e.jsonString);
 
-    #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 });
-            }
-        }
+        Debug.LogError($"获取联系人:{e.jsonString}");
     }
-}*/
     #endregion
 }

+ 0 - 34
Assets/Game/Blue/Service/ILoginService.cs

@@ -1,34 +0,0 @@
-using System.Collections;
-using Blue;
-using UnityEngine;
-
-namespace GHZLangChao
-{
-    /// <summary>
-    /// 登录成功事件
-    /// </summary>
-    public interface ILoginService : IService
-    {
-        void Login();
-    }
-
-    public class LoginService : ILoginService
-    {
-        public void OnInit()
-        {
-
-        }
-
-        public void Login()
-        {
-            CoroutineSystem.Instance.StartCoroutine(LoginImitate());
-        }
-
-        private IEnumerator LoginImitate()
-        {
-           // UICallManager.Instance.MachineRoomInit(""); // 初始化
-            yield return new WaitForSeconds(0.1f);
-            this.SendEvent<LoginSuccessEvent>();
-        }
-    }
-}

+ 24 - 0
Assets/Game/Blue/System/EventSystemPatch.cs

@@ -0,0 +1,24 @@
+using Blue;
+
+public class EventSystemPatch : SingletonMonobehaviour<EventSystemPatch>
+{
+    private EventCommad mEventCommad = new EventCommad();
+
+    /// <summary>
+    /// 发送命令
+    /// </summary>
+    public void SendEvent(IEvent mEvent)
+    {
+        mEventCommad.mEvent = mEvent;
+        this.SendEvent(mEvent);
+    }
+}
+
+public class EventCommad : ICommand
+{
+    public IEvent mEvent;
+    public void OnExcute()
+    {
+        this.SendEvent(mEvent);
+    }
+}

+ 1 - 1
Assets/Game/Blue/Service/ILoginService.cs.meta → Assets/Game/Blue/System/EventSystemPatch.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 4aad372645ee94d45ad978f76d4fec90
+guid: ec9e0c485643b2743ab57980fd4f21dd
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 70 - 9
Assets/Game/ShowLogin/LangChaoLogin.cs

@@ -1,28 +1,89 @@
-using Blue;
+using System.Collections;
+using Agora.Rtc.LitJson;
+using Newtonsoft.Json.Linq;
+using SC.XR.Unity;
+using UnityEngine;
+using UnityEngine.UI;
 
 namespace GHZLangChao
 {
     public class LangChaoLogin : AbstractController
     {
+        private SCInputField mAccount_Input;
+        private SCInputField mPassword_Input;
+        private Button mLogin_Btn;
+        private GameObject mLoginError_go;
+
+        private string mAccountStr;
+        private string mPasswordStr;
 
         private void Awake()
         {
-            this.RegisterEvent<LoginSuccessEvent>(LoginSuccess);
+            mAccount_Input = transform.Find("Account/SCInputField").GetComponent<SCInputField>();
+            mPassword_Input = transform.Find("Password/SCInputField").GetComponent<SCInputField>();
+            mLogin_Btn = transform.Find("LoginBtn").GetComponent<Button>();
+            mLoginError_go = transform.Find("LoginError").gameObject;
+
+            mAccount_Input.onEndEdit.AddListener(OnAccountEndEdit);
+            mPassword_Input.onEndEdit.AddListener(OnPasswordEndEdit);
+            mLogin_Btn.onClick.AddListener(OnClickLogin);
         }
 
+        /// <summary>
+        /// 账号输入完成
+        /// </summary>
+        private void OnAccountEndEdit(string str)
+        {
+            mAccountStr = str;
+        }
 
-        public void GotoChoose()
+        /// <summary>
+        /// 密码输入完成
+        /// </summary>
+        private void OnPasswordEndEdit(string str)
         {
-            this.SendCommand<LoginCommand>();
+            mPasswordStr = str;
         }
 
-        private void LoginSuccess(LoginSuccessEvent e)
+        /// <summary>
+        /// 登录
+        /// </summary>
+        private void OnClickLogin()
         {
-            
-          
+#if UNITY_EDITOR
+            mAccountStr = "cy1";
+            mPasswordStr = "1";
+            mAccount_Input.text = mAccountStr;
+            mPassword_Input.text = mPasswordStr;
+#endif
 
-            ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
+            if (string.IsNullOrWhiteSpace(mAccountStr) || string.IsNullOrWhiteSpace(mPasswordStr)) return;
+            EndustryLoginUserInfo sendLogin = new EndustryLoginUserInfo()
+            {
+                account = mAccountStr,
+                password = mPasswordStr
+            };
+            string jsonLogin = JsonMapper.ToJson(sendLogin);
+            HttpTool.Instance.PostLogin(HttpActionLang.login, jsonLogin, LoginCallBack);
         }
-    }
 
+        /// <summary>
+        /// 登录返回数据
+        /// </summary>
+        public void LoginCallBack(string mes)
+        {
+            JObject obj = JObject.Parse(mes);
+            if (obj["code"].ToString() != "200")
+                StartCoroutine(PopUp());
+            else
+                ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
+        }
+
+        private IEnumerator PopUp()
+        {
+            mLoginError_go.SetActive(true);
+            yield return new WaitForSeconds(1);
+            mLoginError_go.SetActive(false);
+        }
+    }
 }

File diff suppressed because it is too large
+ 676 - 394
Assets/Game/ShowLogin/LoginPanel.prefab


+ 7 - 6
Assets/HttpActionLang.cs

@@ -1,7 +1,3 @@
-using LitJson;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
 using XRTool.Util;
 
 public class HttpActionLang : Singleton<HttpActionLang>
@@ -9,8 +5,13 @@ public class HttpActionLang : Singleton<HttpActionLang>
 
     public const string signal_certification = "/signal/certification";
 
-    public const string signal_contact = "/signal/contact";
+    public const string signal_contact = "/mr-endustry/v1/signal/contact";
+
+    public const string rtc_CreateRoom = "/mr-endustry/v1/rtc/createRoom";
+
+    public const string rtc_JoinRoom = "/mr-endustry/v1/rtc/joinRoom";
+
+    public const string login = "/mr-endustry/v1/user/login";
 
-    public const string rtc_CreateRoom = "/rtc/createRoom";
     public string mqttSocket ="";
 }

+ 1 - 1
ProjectSettings/ProjectSettings.asset

@@ -145,7 +145,7 @@ PlayerSettings:
     16:10: 1
     16:9: 1
     Others: 1
-  bundleVersion: 0.1
+  bundleVersion: 1.0.0
   preloadedAssets: []
   metroInputSource: 0
   wsaTransparentSwapchain: 0

Some files were not shown because too many files changed in this diff