Răsfoiți Sursa

1.修复mongo驱动在netcore3.0下的bug
2.ActorMessageHandlerAttribute不需要指定AppType

tanghai 6 ani în urmă
părinte
comite
8080a72256
24 a modificat fișierele cu 30 adăugiri și 56 ștergeri
  1. 1 9
      Config/StartConfig/127.0.0.1.txt
  2. 1 0
      Config/StartConfig/AllServer.txt
  3. 2 1
      Server/App/Program.cs
  4. 0 16
      Server/Hotfix/Handler/C2M_TestRequestHandler.cs
  5. 1 1
      Server/Hotfix/Module/ActorLocation/ObjectAddRequestHandler.cs
  6. 1 1
      Server/Hotfix/Module/ActorLocation/ObjectGetRequestHandler.cs
  7. 1 1
      Server/Hotfix/Module/ActorLocation/ObjectLockRequestHandler.cs
  8. 1 1
      Server/Hotfix/Module/ActorLocation/ObjectRemoveRequestHandler.cs
  9. 1 1
      Server/Hotfix/Module/ActorLocation/ObjectUnLockRequestHandler.cs
  10. 1 1
      Server/Hotfix/Module/Demo/Actor_TransferHandler.cs
  11. 0 1
      Server/Hotfix/Module/Demo/C2G_EnterMapHandler.cs
  12. 1 1
      Server/Hotfix/Module/Demo/C2M_TestActorRequestHandler.cs
  13. 1 1
      Server/Hotfix/Module/Demo/Frame_ClickMapHandler.cs
  14. 1 1
      Server/Hotfix/Module/Demo/G2M_CreateUnitHandler.cs
  15. 1 1
      Server/Hotfix/Module/Demo/G2M_SessionDisconnectHandler.cs
  16. 1 1
      Server/Hotfix/Module/Demo/M2M_TrasferUnitRequestHandler.cs
  17. 1 1
      Server/Hotfix/Module/Demo/R2G_GetLoginKeyHandler.cs
  18. 0 4
      Server/Hotfix/Module/Scene/SceneFactory.cs
  19. 0 6
      Server/Model/Module/Actor/ActorMessageHandlerAttribute.cs
  20. 1 1
      Server/ThirdParty/MongoDBDriver/MongoDB.Bson/Serialization/BsonClassMap.cs
  21. 2 2
      Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
  22. 10 1
      Unity/Assets/Model/Base/Helper/MongoHelper.cs
  23. 1 3
      Unity/Assets/Model/Entity/SceneType.cs
  24. BIN
      Unity/Assets/Res/Code/Hotfix.dll.bytes

+ 1 - 9
Config/StartConfig/127.0.0.1.txt

@@ -1,9 +1 @@
-{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20001" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10001", "Address2" : "127.0.0.1:10001" }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20002" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10002", "Address2" : "127.0.0.1:10002" }], "AppId" : 2, "AppType" : "Realm", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("98565862653976"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:10003" }], "AppId" : 3, "AppType" : "Location", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20004" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10004", "Address2" : "127.0.0.1:10004" }], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20005" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10005", "Address2" : "127.0.0.1:10005" }], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20006" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10006", "Address2" : "127.0.0.1:10006" }], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20007" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10007", "Address2" : "127.0.0.1:10007" }], "AppId" : 7, "AppType" : "Gate", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20008" }], "AppId" : 8, "AppType" : "Map", "ServerIP" : "*" }
-{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20009" }], "AppId" : 9, "AppType" : "Map", "ServerIP" : "*" }
+{ "_t" : "StartConfig", "_id" : NumberLong(1), "C" : [{ "_t" : "InnerConfig", "Address" : "127.0.0.1:20001" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10001", "Address2" : "127.0.0.1:10001" }], "List" : [{ "_id" : NumberLong(1), "C" : [{ "_t" : "SceneConfig", "_id" : NumberLong(1), "SceneType" : 2, "Name" : "Realm" }], "List" : [] }, { "_id" : NumberLong(2), "C" : [{ "_t" : "SceneConfig", "_id" : NumberLong(1), "SceneType" : 5, "Name" : "Location" }], "List" : [] }, { "_id" : NumberLong(3), "C" : [{ "_t" : "SceneConfig", "_id" : NumberLong(1), "SceneType" : 3, "Name" : "Gate" }], "List" : [] }] }

+ 1 - 0
Config/StartConfig/AllServer.txt

@@ -0,0 +1 @@
+{ "_t" : "StartConfig", "_id" : NumberLong(1), "List" : [{ "_id" : NumberLong(1), "C" : [{ "_t" : "ProcessConfig", "_id" : NumberLong(1), "ServerIP" : "" }, { "_t" : "InnerConfig", "_id" : NumberLong("102613898756108"), "Address" : "127.0.0.1:20000" }, { "_t" : "OuterConfig", "_id" : NumberLong("102613898887181"), "Address" : "127.0.0.1:10001", "Address2" : "127.0.0.1:10001" }, { "_t" : "SceneConfig", "_id" : NumberLong("410473928327214"), "SceneType" : 0, "Name" : "Process" }, { "_t" : "DBConfig", "ConnectionString" : "mongodb://127.0.0.1:27017/", "DBName" : "ET" }], "List" : [{ "_id" : NumberLong(1), "C" : [{ "_t" : "SceneConfig", "_id" : NumberLong(1), "SceneType" : 2, "Name" : "Realm" }], "List" : [] }, { "_id" : NumberLong(2), "C" : [{ "_t" : "SceneConfig", "_id" : NumberLong(2), "SceneType" : 3, "Name" : "Gate" }], "List" : [] }, { "_id" : NumberLong(3), "C" : [{ "_t" : "SceneConfig", "_id" : NumberLong(3), "SceneType" : 5, "Name" : "Location" }], "List" : [] }, { "_id" : NumberLong(4), "C" : [{ "_t" : "SceneConfig", "_id" : NumberLong(1), "SceneType" : 6, "Name" : "Map1" }], "List" : [] }] }] }

+ 2 - 1
Server/App/Program.cs

@@ -54,8 +54,9 @@ namespace ETModel
 				// 这两个组件是处理actor消息使用的
 				Game.Scene.AddComponent<MailboxDispatcherComponent>();
 				Game.Scene.AddComponent<ActorMessageDispatcherComponent>();
-				// manager server组件,用来管理其它进程使用
+				// 数值订阅组件
 				Game.Scene.AddComponent<NumericWatcherComponent>();
+				// 控制台组件
 				Game.Scene.AddComponent<ConsoleComponent>();
 
 

+ 0 - 16
Server/Hotfix/Handler/C2M_TestRequestHandler.cs

@@ -1,16 +0,0 @@
-using System;
-using ETModel;
-
-namespace ETHotfix
-{
-	[ActorMessageHandler(AppType.Map)]
-	public class C2M_TestRequestHandler : AMActorLocationRpcHandler<Unit, C2M_TestRequest, M2C_TestResponse>
-	{
-		protected override async ETTask Run(Unit unit, C2M_TestRequest message, M2C_TestResponse response, Action reply)
-		{
-			response.Response = "response actor rpc";
-			reply();
-			await ETTask.CompletedTask;
-		}
-	}
-}

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ObjectAddRequestHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class ObjectAddRequestHandler : AMActorRpcHandler<Scene, ObjectAddRequest, ObjectAddResponse>
 	{
 		protected override async ETTask Run(Scene scene, ObjectAddRequest request, ObjectAddResponse response, Action reply)

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ObjectGetRequestHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class ObjectGetRequestHandler : AMActorRpcHandler<Scene, ObjectGetRequest, ObjectGetResponse>
 	{
 		protected override async ETTask Run(Scene scene, ObjectGetRequest request, ObjectGetResponse response, Action reply)

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ObjectLockRequestHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class ObjectLockRequestHandler : AMActorRpcHandler<Scene, ObjectLockRequest, ObjectLockResponse>
 	{
 		protected override async ETTask Run(Scene scene, ObjectLockRequest request, ObjectLockResponse response, Action reply)

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ObjectRemoveRequestHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class ObjectRemoveRequestHandler : AMActorRpcHandler<Scene, ObjectRemoveRequest, ObjectRemoveResponse>
 	{
 		protected override async ETTask Run(Scene scene, ObjectRemoveRequest request, ObjectRemoveResponse response, Action reply)

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ObjectUnLockRequestHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class ObjectUnLockRequestHandler : AMActorRpcHandler<Scene, ObjectUnLockRequest, ObjectUnLockResponse>
 	{
 		protected override async ETTask Run(Scene scene, ObjectUnLockRequest request, ObjectUnLockResponse response, Action reply)

+ 1 - 1
Server/Hotfix/Module/Demo/Actor_TransferHandler.cs

@@ -4,7 +4,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[ActorMessageHandler(AppType.Map)]
+	[ActorMessageHandler]
 	public class Actor_TransferHandler : AMActorRpcHandler<Unit, Actor_TransferRequest, Actor_TransferResponse>
 	{
 		protected override async ETTask Run(Unit unit, Actor_TransferRequest request, Actor_TransferResponse response, Action reply)

+ 0 - 1
Server/Hotfix/Module/Demo/C2G_EnterMapHandler.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Net;
 using ETModel;
 
 namespace ETHotfix

+ 1 - 1
Server/Hotfix/Module/Demo/C2M_TestActorRequestHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[ActorMessageHandler(AppType.Map)]
+	[ActorMessageHandler]
 	public class C2M_TestActorRequestHandler : AMActorLocationRpcHandler<Unit, C2M_TestActorRequest, M2C_TestActorResponse>
 	{
 		protected override async ETTask Run(Unit unit, C2M_TestActorRequest message, M2C_TestActorResponse response, Action reply)

+ 1 - 1
Server/Hotfix/Module/Demo/Frame_ClickMapHandler.cs

@@ -4,7 +4,7 @@ using UnityEngine;
 
 namespace ETHotfix
 {
-	[ActorMessageHandler(AppType.Map)]
+	[ActorMessageHandler]
 	public class Frame_ClickMapHandler : AMActorLocationHandler<Unit, Frame_ClickMap>
 	{
 		protected override async ETTask Run(Unit unit, Frame_ClickMap message)

+ 1 - 1
Server/Hotfix/Module/Demo/G2M_CreateUnitHandler.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class G2M_CreateUnitHandler : AMActorRpcHandler<Scene, G2M_CreateUnit, M2G_CreateUnit>
 	{
 		protected override async ETTask Run(Scene scene, G2M_CreateUnit request, M2G_CreateUnit response, Action reply)

+ 1 - 1
Server/Hotfix/Module/Demo/G2M_SessionDisconnectHandler.cs

@@ -2,7 +2,7 @@
 
 namespace ETHotfix
 {
-	[ActorMessageHandler(AppType.Map)]
+	[ActorMessageHandler]
 	public class G2M_SessionDisconnectHandler : AMActorLocationHandler<Unit, G2M_SessionDisconnect>
 	{
 		protected override async ETTask Run(Unit unit, G2M_SessionDisconnect message)

+ 1 - 1
Server/Hotfix/Module/Demo/M2M_TrasferUnitRequest.cs → Server/Hotfix/Module/Demo/M2M_TrasferUnitRequestHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class M2M_TrasferUnitRequestHandler : AMActorRpcHandler<Scene, M2M_TrasferUnitRequest, M2M_TrasferUnitResponse>
 	{
 		protected override async ETTask Run(Scene scene, M2M_TrasferUnitRequest request, M2M_TrasferUnitResponse response, Action reply)

+ 1 - 1
Server/Hotfix/Module/Demo/R2G_GetLoginKeyHandler.cs

@@ -3,7 +3,7 @@ using ETModel;
 
 namespace ETHotfix
 {
-	[MessageHandler]
+	[ActorMessageHandler]
 	public class R2G_GetLoginKeyHandler : AMActorRpcHandler<Scene, R2G_GetLoginKey, G2R_GetLoginKey>
 	{
 		protected override async ETTask Run(Scene scene, R2G_GetLoginKey request, G2R_GetLoginKey response, Action reply)

+ 0 - 4
Server/Hotfix/Module/Scene/SceneFactory.cs

@@ -25,10 +25,6 @@ namespace ETHotfix
                     break;
                 case SceneType.Map:
                     scene.AddComponent<UnitComponent>();
-                    if (name == "GateMap")
-                    {
-                        return scene;
-                    }
                     break;
                 case SceneType.Location:
                     scene.AddComponent<LocationComponent>();

+ 0 - 6
Server/Model/Module/Actor/ActorMessageHandlerAttribute.cs

@@ -2,11 +2,5 @@
 {
 	public class ActorMessageHandlerAttribute : BaseAttribute
 	{
-		public AppType Type { get; }
-
-		public ActorMessageHandlerAttribute(AppType appType)
-		{
-			this.Type = appType;
-		}
 	}
 }

+ 1 - 1
Server/ThirdParty/MongoDBDriver/MongoDB.Bson/Serialization/BsonClassMap.cs

@@ -42,7 +42,7 @@ namespace MongoDB.Bson.Serialization
             .GetTypeInfo()
             .Assembly
             .GetType("System.Runtime.Serialization.FormatterServices")
-            .GetTypeInfo()
+            ?.GetTypeInfo()
             ?.GetMethod("GetUninitializedObject", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
 
         private static int __freezeNestingLevel = 0;

+ 2 - 2
Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs

@@ -251,14 +251,14 @@ namespace ETModel
 				if (GUILayout.Button("添加组件", GUILayout.Height(16)))
 				{
 					Assembly assembly = Assembly.GetAssembly(typeof(Init));
-					Type type = assembly.GetType($"ET.{this.st.ToString()}");
+					Type type = assembly.GetType($"ETModel.{this.st.ToString()}");
 					startConfig.AddComponent(type);
 				}
 				
 				if (GUILayout.Button("删除组件", GUILayout.Height(16)))
 				{
 					Assembly assembly = Assembly.GetAssembly(typeof(Init));
-					Type type = assembly.GetType($"ET.{this.st.ToString()}");
+					Type type = assembly.GetType($"ETModel.{this.st.ToString()}");
 					startConfig.RemoveComponent(type);
 				}
 				

+ 10 - 1
Unity/Assets/Model/Base/Helper/MongoHelper.cs

@@ -33,7 +33,16 @@ namespace ETModel
                 {
                     continue;
                 }
-                BsonClassMap.LookupClassMap(type);
+
+                try
+                {
+	                BsonClassMap.LookupClassMap(type);
+                }
+                catch (Exception e)
+                {
+	                Log.Error($"11111111111111111: {type.Name} {e}");
+                }
+                
             }
 #if SERVER
             BsonSerializer.RegisterSerializer(typeof(Vector3), new StructBsonSerialize<Vector3>());

+ 1 - 3
Unity/Assets/Model/Entity/SceneType.cs

@@ -1,6 +1,4 @@
-using System;
-
-namespace ETModel
+namespace ETModel
 {
 	public enum SceneType
 	{

BIN
Unity/Assets/Res/Code/Hotfix.dll.bytes