Parcourir la source

删除一个MongoHelp操作

tanghai il y a 8 ans
Parent
commit
3d8d5e5616

+ 5 - 0
Unity/Assets/Scripts/Base/Helper/ByteHelper.cs

@@ -45,6 +45,11 @@ namespace Model
 			return Encoding.Default.GetString(bytes);
 		}
 
+		public static string ToStr(this byte[] bytes, int index, int count)
+		{
+			return Encoding.Default.GetString(bytes, index, count);
+		}
+
 		public static string Utf8ToStr(this byte[] bytes)
 		{
 			return Encoding.UTF8.GetString(bytes);

+ 1 - 1
Unity/Hotfix/Entity/Session.cs

@@ -219,7 +219,7 @@ namespace Hotfix
 				rpcId = rpcId | 0x40000000;
 			}
 
-			byte[] messageBytes = message.ToBson();
+			byte[] messageBytes = JsonHelper.ToJson(message).ToByteArray();
 			if (messageBytes.Length > 100)
 			{
 				byte[] newMessageBytes = ZipHelper.Compress(messageBytes);

+ 2 - 2
Unity/Hotfix/Helper/JsonHelper.cs

@@ -23,13 +23,13 @@ namespace Hotfix
 
 		public static T FromJson<T>(byte[] bytes, int index, int count)
 		{
-			string str = bytes.Utf8ToStr(index, count);
+			string str = bytes.ToStr();
 			return JsonMapper.ToObject<T>(str);
 		}
 
 		public static object FromJson(Type type, byte[] bytes, int index, int count)
 		{
-			string str = bytes.Utf8ToStr(index, count);
+			string str = bytes.ToStr(index, count);
 			return JsonMapper.ToObject(type, str);
 		}
 	}

+ 0 - 1
Unity/Hotfix/UI/UILobby/Component/UILobbyComponent.cs

@@ -23,7 +23,6 @@ namespace Hotfix
 			try
 			{
 				session = Game.Scene.GetComponent<NetOuterComponent>().Create("127.0.0.1:10001");
-				
 				R2C_Login r2CLogin = await session.Call<C2R_Login, R2C_Login>(new C2R_Login() { Account = "abcdef", Password = "111111" });
 				Session gateSession = Game.Scene.GetComponent<NetOuterComponent>().Create(r2CLogin.Address);
 				G2C_LoginGate g2CLoginGate = await gateSession.Call<C2G_LoginGate, G2C_LoginGate>(new C2G_LoginGate(r2CLogin.Key));

+ 3 - 1
Unity/Unity.sln

@@ -1,6 +1,8 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2017
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.12
+MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"