Ver Fonte

IActorMessage变成所有消息的基类

tanghai há 2 anos atrás
pai
commit
d81b0ea52b
21 ficheiros alterados com 147 adições e 135 exclusões
  1. 2 2
      Unity/Assets/Config/Proto/LockStepOuter_C_11001.proto
  2. 14 14
      Unity/Assets/Config/Proto/OuterMessage_C_10001.proto
  3. 1 1
      Unity/Assets/Resources/GlobalConfig.asset
  4. 25 3
      Unity/Assets/Scripts/Core/Network/IActorMessage.cs
  5. 1 1
      Unity/Assets/Scripts/Core/Network/OpcodeType.cs
  6. 1 1
      Unity/Assets/Scripts/Core/Object/MessageObject.cs
  7. 0 36
      Unity/Assets/Scripts/Core/World/IMessage.cs
  8. 3 2
      Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs
  9. 9 5
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs
  10. 11 6
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs
  11. 3 3
      Unity/Assets/Scripts/Model/Client/Demo/NetClient/A2NetClient_Message.cs
  12. 2 2
      Unity/Assets/Scripts/Model/Generate/Client/Message/LockStepOuter_C_11001.cs
  13. 14 14
      Unity/Assets/Scripts/Model/Generate/Client/Message/OuterMessage_C_10001.cs
  14. 2 2
      Unity/Assets/Scripts/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs
  15. 14 14
      Unity/Assets/Scripts/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs
  16. 2 2
      Unity/Assets/Scripts/Model/Generate/Server/Message/LockStepOuter_C_11001.cs
  17. 14 14
      Unity/Assets/Scripts/Model/Generate/Server/Message/OuterMessage_C_10001.cs
  18. 1 1
      Unity/Assets/Scripts/Model/Server/Module/Message/MessageHandler.cs
  19. 16 0
      Unity/Assets/Scripts/Model/Share/Module/Message/ISessionMessage.cs
  20. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Message/ISessionMessage.cs.meta
  21. 11 11
      Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs

+ 2 - 2
Unity/Assets/Config/Proto/LockStepOuter_C_11001.proto

@@ -2,12 +2,12 @@ syntax = "proto3";
 package ET;
 
 //ResponseType G2C_Match
-message C2G_Match // IRequest
+message C2G_Match // ISessionRequest
 {
 	int32 RpcId = 1;
 }
 
-message G2C_Match // IResponse
+message G2C_Match // ISessionResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;

+ 14 - 14
Unity/Assets/Config/Proto/OuterMessage_C_10001.proto

@@ -43,12 +43,12 @@ message Actor_TransferResponse // IActorLocationResponse
 }
 
 //ResponseType G2C_EnterMap
-message C2G_EnterMap // IRequest
+message C2G_EnterMap // ISessionRequest
 {
 	int32 RpcId = 1;
 }
 
-message G2C_EnterMap // IResponse
+message G2C_EnterMap // ISessionResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;
@@ -123,12 +123,12 @@ message M2C_Stop // IActorMessage
 }
 
 //ResponseType G2C_Ping
-message C2G_Ping // IRequest
+message C2G_Ping // ISessionRequest
 {
 	int32 RpcId = 1;
 }
 
-message G2C_Ping // IResponse
+message G2C_Ping // ISessionResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;
@@ -137,19 +137,19 @@ message G2C_Ping // IResponse
 }
 
 
-message G2C_Test // IMessage
+message G2C_Test // ISessionMessage
 {
 }
 
 //ResponseType M2C_Reload
-message C2M_Reload // IRequest
+message C2M_Reload // ISessionRequest
 {
 	int32 RpcId = 1;
 	string Account = 2;
 	string Password = 3;
 }
 
-message M2C_Reload // IResponse
+message M2C_Reload // ISessionResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;
@@ -157,14 +157,14 @@ message M2C_Reload // IResponse
 }
 
 //ResponseType R2C_Login
-message C2R_Login // IRequest
+message C2R_Login // ISessionRequest
 {
 	int32 RpcId = 1;
 	string  Account = 2;  // 帐号
 	string  Password = 3;  // 密码
 }
 
-message R2C_Login // IResponse
+message R2C_Login // ISessionResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;
@@ -175,14 +175,14 @@ message R2C_Login // IResponse
 }
 
 //ResponseType G2C_LoginGate
-message C2G_LoginGate // IRequest
+message C2G_LoginGate // ISessionRequest
 {
 	int32 RpcId = 1;
 	int64 Key = 2;  // 帐号
 	int64 GateId = 3;
 }
 
-message G2C_LoginGate // IResponse
+message G2C_LoginGate // ISessionResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;
@@ -190,7 +190,7 @@ message G2C_LoginGate // IResponse
 	int64 PlayerId = 4;
 }
 
-message G2C_TestHotfixMessage // IMessage
+message G2C_TestHotfixMessage // ISessionMessage
 {
 	string Info = 1;
 }
@@ -236,12 +236,12 @@ message M2C_TransferMap // IActorLocationResponse
 }
 
 //ResponseType G2C_Benchmark
-message C2G_Benchmark // IRequest
+message C2G_Benchmark // ISessionRequest
 {
 	int32 RpcId = 1;
 }
 
-message G2C_Benchmark // IResponse
+message G2C_Benchmark // ISessionResponse
 {
 	int32 RpcId = 1;
 	int32 Error = 2;

+ 1 - 1
Unity/Assets/Resources/GlobalConfig.asset

@@ -12,6 +12,6 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 36527db572638af47b03c805671cba75, type: 3}
   m_Name: GlobalConfig
   m_EditorClassIdentifier: 
-  CodeMode: 1
+  CodeMode: 3
   BuildType: 1
   AppType: 7

+ 25 - 3
Unity/Assets/Scripts/Core/Network/IActorMessage.cs

@@ -1,15 +1,37 @@
 namespace ET
 {
     // 不需要返回消息
-    public interface IActorMessage: IMessage
+    public interface IActorMessage
     {
     }
 
-    public interface IActorRequest: IRequest, IActorMessage
+    public interface IActorRequest: IActorMessage
     {
+        int RpcId
+        {
+            get;
+            set;
+        }
     }
 
-    public interface IActorResponse: IResponse, IActorMessage
+    public interface IActorResponse: IActorMessage
     {
+        int Error
+        {
+            get;
+            set;
+        }
+
+        string Message
+        {
+            get;
+            set;
+        }
+
+        int RpcId
+        {
+            get;
+            set;
+        }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/Core/Network/OpcodeType.cs

@@ -34,7 +34,7 @@ namespace ET
                 }
 
                 // 检查request response
-                if (typeof (IRequest).IsAssignableFrom(type))
+                if (typeof (IActorRequest).IsAssignableFrom(type))
                 {
                     if (typeof (IActorLocationMessage).IsAssignableFrom(type))
                     {

+ 1 - 1
Unity/Assets/Scripts/Core/Object/MessageObject.cs

@@ -4,7 +4,7 @@ using MongoDB.Bson.Serialization.Attributes;
 
 namespace ET
 {
-    public abstract class MessageObject: ProtoObject, IMessage, IDisposable
+    public abstract class MessageObject: ProtoObject, IActorMessage, IDisposable
     {
         public virtual void Dispose()
         {

+ 0 - 36
Unity/Assets/Scripts/Core/World/IMessage.cs

@@ -1,36 +0,0 @@
-namespace ET
-{
-    public interface IMessage
-    {
-    }
-
-    public interface IRequest: IMessage
-    {
-        int RpcId
-        {
-            get;
-            set;
-        }
-    }
-
-    public interface IResponse: IMessage
-    {
-        int Error
-        {
-            get;
-            set;
-        }
-
-        string Message
-        {
-            get;
-            set;
-        }
-
-        int RpcId
-        {
-            get;
-            set;
-        }
-    }
-}

+ 3 - 2
Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs

@@ -21,6 +21,7 @@
 
         public static async ETTask<long> LoginAsync(this ClientSenderCompnent self, string account, string password)
         {
+            
             self.fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, 0, SceneType.NetClient, "");
             self.netClientActorId = new ActorId(self.Fiber().Process, self.fiberId);
 
@@ -28,14 +29,14 @@
             return response.PlayerId;
         }
 
-        public static void Send(this ClientSenderCompnent self, IMessage message)
+        public static void Send(this ClientSenderCompnent self, IActorMessage message)
         {
             A2NetClient_Message a2NetClientMessage = A2NetClient_Message.Create();
             a2NetClientMessage.MessageObject = message;
             self.Fiber().ActorInnerComponent.Send(self.netClientActorId, a2NetClientMessage);
         }
 
-        public static async ETTask<IResponse> Call(this ClientSenderCompnent self, IRequest request, bool needException = true)
+        public static async ETTask<IActorResponse> Call(this ClientSenderCompnent self, IActorRequest request, bool needException = true)
         {
             A2NetClient_Request a2NetClientRequest = A2NetClient_Request.Create();
             a2NetClientRequest.MessageObject = request;

+ 9 - 5
Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs

@@ -1,4 +1,5 @@
-using System.Net;
+using System;
+using System.Net;
 using System.Net.Sockets;
 using MongoDB.Bson;
 
@@ -40,11 +41,16 @@ namespace ET.Client
             
             switch (message)
             {
-                case IResponse response:
+                case IActorResponse response:
                 {
                     session.OnResponse(response);
                     break;
                 }
+                case ISessionMessage:
+                {
+                    MessageDispatcherComponent.Instance.Handle(session, message);
+                    break;
+                }
                 case IActorMessage iActorMessage:
                 {
                     // 扔到Main纤程队列中
@@ -53,9 +59,7 @@ namespace ET.Client
                 }
                 default:
                 {
-                    // 普通消息或者是Rpc请求消息
-                    MessageDispatcherComponent.Instance.Handle(session, message);
-                    break;
+                    throw new Exception($"not found handler: {message}");
                 }
             }
         }

+ 11 - 6
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs

@@ -1,4 +1,6 @@
-namespace ET.Server
+using System;
+
+namespace ET.Server
 {
     [Event(SceneType.Realm | SceneType.Gate | SceneType.BenchmarkServer)]
     public class NetServerComponentOnReadEvent: AEvent<Scene, NetServerComponentOnRead>
@@ -8,7 +10,7 @@
             Session session = args.Session;
             object message = args.Message;
             Scene root = scene.Root();
-            if (message is IResponse response)
+            if (message is IActorResponse response)
             {
                 session.OnResponse(response);
                 return;
@@ -16,6 +18,11 @@
             // 根据消息接口判断是不是Actor消息,不同的接口做不同的处理,比如需要转发给Chat Scene,可以做一个IChatMessage接口
             switch (message)
             {
+                case ISessionMessage:
+                {
+                    MessageDispatcherComponent.Instance.Handle(session, message);
+                    break;
+                }
                 case FrameMessage frameMessage:
                 {
                     Player player = session.GetComponent<SessionPlayerComponent>().Player;
@@ -43,7 +50,7 @@
                     long unitId = session.GetComponent<SessionPlayerComponent>().Player.Id;
                     int rpcId = actorLocationRequest.RpcId; // 这里要保存客户端的rpcId
                     long instanceId = session.InstanceId;
-                    IResponse iResponse = await root.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Call(unitId, actorLocationRequest);
+                    IActorResponse iResponse = await root.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Call(unitId, actorLocationRequest);
                     iResponse.RpcId = rpcId;
                     // session可能已经断开了,所以这里需要判断
                     if (session.InstanceId == instanceId)
@@ -63,9 +70,7 @@
 				
                 default:
                 {
-                    // 非Actor消息
-                    MessageDispatcherComponent.Instance.Handle(session, message);
-                    break;
+                    throw new Exception($"not found handler: {message}");
                 }
             }
         }

+ 3 - 3
Unity/Assets/Scripts/Model/Client/Demo/NetClient/A2NetClient_Message.cs

@@ -14,7 +14,7 @@
             ObjectPool.Instance.Recycle(this);
         }
         
-        public IMessage MessageObject;
+        public IActorMessage MessageObject;
     }
     
     [Message]
@@ -34,7 +34,7 @@
         }
      
         public int RpcId { get; set; }
-        public IRequest MessageObject;
+        public IActorRequest MessageObject;
     }
     
     [Message]
@@ -58,7 +58,7 @@
         public int Error { get; set; }
         public string Message { get; set; }
         
-        public IResponse MessageObject;
+        public IActorResponse MessageObject;
     }
     
     [Message]

+ 2 - 2
Unity/Assets/Scripts/Model/Generate/Client/Message/LockStepOuter_C_11001.cs

@@ -6,7 +6,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Match))]
 	[Message(LockStepOuter.C2G_Match)]
 	[MemoryPackable]
-	public partial class C2G_Match: MessageObject, IRequest
+	public partial class C2G_Match: MessageObject, ISessionRequest
 	{
 		public static C2G_Match Create(bool isFromPool = true) 
 		{ 
@@ -28,7 +28,7 @@ namespace ET
 
 	[Message(LockStepOuter.G2C_Match)]
 	[MemoryPackable]
-	public partial class G2C_Match: MessageObject, IResponse
+	public partial class G2C_Match: MessageObject, ISessionResponse
 	{
 		public static G2C_Match Create(bool isFromPool = true) 
 		{ 

+ 14 - 14
Unity/Assets/Scripts/Model/Generate/Client/Message/OuterMessage_C_10001.cs

@@ -176,7 +176,7 @@ namespace ET
 	[ResponseType(nameof(G2C_EnterMap))]
 	[Message(OuterMessage.C2G_EnterMap)]
 	[MemoryPackable]
-	public partial class C2G_EnterMap: MessageObject, IRequest
+	public partial class C2G_EnterMap: MessageObject, ISessionRequest
 	{
 		public static C2G_EnterMap Create(bool isFromPool = true) 
 		{ 
@@ -198,7 +198,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_EnterMap)]
 	[MemoryPackable]
-	public partial class G2C_EnterMap: MessageObject, IResponse
+	public partial class G2C_EnterMap: MessageObject, ISessionResponse
 	{
 		public static G2C_EnterMap Create(bool isFromPool = true) 
 		{ 
@@ -514,7 +514,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Ping))]
 	[Message(OuterMessage.C2G_Ping)]
 	[MemoryPackable]
-	public partial class C2G_Ping: MessageObject, IRequest
+	public partial class C2G_Ping: MessageObject, ISessionRequest
 	{
 		public static C2G_Ping Create(bool isFromPool = true) 
 		{ 
@@ -536,7 +536,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Ping)]
 	[MemoryPackable]
-	public partial class G2C_Ping: MessageObject, IResponse
+	public partial class G2C_Ping: MessageObject, ISessionResponse
 	{
 		public static G2C_Ping Create(bool isFromPool = true) 
 		{ 
@@ -570,7 +570,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Test)]
 	[MemoryPackable]
-	public partial class G2C_Test: MessageObject, IMessage
+	public partial class G2C_Test: MessageObject, ISessionMessage
 	{
 		public static G2C_Test Create(bool isFromPool = true) 
 		{ 
@@ -589,7 +589,7 @@ namespace ET
 	[ResponseType(nameof(M2C_Reload))]
 	[Message(OuterMessage.C2M_Reload)]
 	[MemoryPackable]
-	public partial class C2M_Reload: MessageObject, IRequest
+	public partial class C2M_Reload: MessageObject, ISessionRequest
 	{
 		public static C2M_Reload Create(bool isFromPool = true) 
 		{ 
@@ -619,7 +619,7 @@ namespace ET
 
 	[Message(OuterMessage.M2C_Reload)]
 	[MemoryPackable]
-	public partial class M2C_Reload: MessageObject, IResponse
+	public partial class M2C_Reload: MessageObject, ISessionResponse
 	{
 		public static M2C_Reload Create(bool isFromPool = true) 
 		{ 
@@ -650,7 +650,7 @@ namespace ET
 	[ResponseType(nameof(R2C_Login))]
 	[Message(OuterMessage.C2R_Login)]
 	[MemoryPackable]
-	public partial class C2R_Login: MessageObject, IRequest
+	public partial class C2R_Login: MessageObject, ISessionRequest
 	{
 		public static C2R_Login Create(bool isFromPool = true) 
 		{ 
@@ -680,7 +680,7 @@ namespace ET
 
 	[Message(OuterMessage.R2C_Login)]
 	[MemoryPackable]
-	public partial class R2C_Login: MessageObject, IResponse
+	public partial class R2C_Login: MessageObject, ISessionResponse
 	{
 		public static R2C_Login Create(bool isFromPool = true) 
 		{ 
@@ -723,7 +723,7 @@ namespace ET
 	[ResponseType(nameof(G2C_LoginGate))]
 	[Message(OuterMessage.C2G_LoginGate)]
 	[MemoryPackable]
-	public partial class C2G_LoginGate: MessageObject, IRequest
+	public partial class C2G_LoginGate: MessageObject, ISessionRequest
 	{
 		public static C2G_LoginGate Create(bool isFromPool = true) 
 		{ 
@@ -753,7 +753,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_LoginGate)]
 	[MemoryPackable]
-	public partial class G2C_LoginGate: MessageObject, IResponse
+	public partial class G2C_LoginGate: MessageObject, ISessionResponse
 	{
 		public static G2C_LoginGate Create(bool isFromPool = true) 
 		{ 
@@ -787,7 +787,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_TestHotfixMessage)]
 	[MemoryPackable]
-	public partial class G2C_TestHotfixMessage: MessageObject, IMessage
+	public partial class G2C_TestHotfixMessage: MessageObject, ISessionMessage
 	{
 		public static G2C_TestHotfixMessage Create(bool isFromPool = true) 
 		{ 
@@ -976,7 +976,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Benchmark))]
 	[Message(OuterMessage.C2G_Benchmark)]
 	[MemoryPackable]
-	public partial class C2G_Benchmark: MessageObject, IRequest
+	public partial class C2G_Benchmark: MessageObject, ISessionRequest
 	{
 		public static C2G_Benchmark Create(bool isFromPool = true) 
 		{ 
@@ -998,7 +998,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Benchmark)]
 	[MemoryPackable]
-	public partial class G2C_Benchmark: MessageObject, IResponse
+	public partial class G2C_Benchmark: MessageObject, ISessionResponse
 	{
 		public static G2C_Benchmark Create(bool isFromPool = true) 
 		{ 

+ 2 - 2
Unity/Assets/Scripts/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs

@@ -6,7 +6,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Match))]
 	[Message(LockStepOuter.C2G_Match)]
 	[MemoryPackable]
-	public partial class C2G_Match: MessageObject, IRequest
+	public partial class C2G_Match: MessageObject, ISessionRequest
 	{
 		public static C2G_Match Create(bool isFromPool = true) 
 		{ 
@@ -28,7 +28,7 @@ namespace ET
 
 	[Message(LockStepOuter.G2C_Match)]
 	[MemoryPackable]
-	public partial class G2C_Match: MessageObject, IResponse
+	public partial class G2C_Match: MessageObject, ISessionResponse
 	{
 		public static G2C_Match Create(bool isFromPool = true) 
 		{ 

+ 14 - 14
Unity/Assets/Scripts/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs

@@ -176,7 +176,7 @@ namespace ET
 	[ResponseType(nameof(G2C_EnterMap))]
 	[Message(OuterMessage.C2G_EnterMap)]
 	[MemoryPackable]
-	public partial class C2G_EnterMap: MessageObject, IRequest
+	public partial class C2G_EnterMap: MessageObject, ISessionRequest
 	{
 		public static C2G_EnterMap Create(bool isFromPool = true) 
 		{ 
@@ -198,7 +198,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_EnterMap)]
 	[MemoryPackable]
-	public partial class G2C_EnterMap: MessageObject, IResponse
+	public partial class G2C_EnterMap: MessageObject, ISessionResponse
 	{
 		public static G2C_EnterMap Create(bool isFromPool = true) 
 		{ 
@@ -514,7 +514,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Ping))]
 	[Message(OuterMessage.C2G_Ping)]
 	[MemoryPackable]
-	public partial class C2G_Ping: MessageObject, IRequest
+	public partial class C2G_Ping: MessageObject, ISessionRequest
 	{
 		public static C2G_Ping Create(bool isFromPool = true) 
 		{ 
@@ -536,7 +536,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Ping)]
 	[MemoryPackable]
-	public partial class G2C_Ping: MessageObject, IResponse
+	public partial class G2C_Ping: MessageObject, ISessionResponse
 	{
 		public static G2C_Ping Create(bool isFromPool = true) 
 		{ 
@@ -570,7 +570,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Test)]
 	[MemoryPackable]
-	public partial class G2C_Test: MessageObject, IMessage
+	public partial class G2C_Test: MessageObject, ISessionMessage
 	{
 		public static G2C_Test Create(bool isFromPool = true) 
 		{ 
@@ -589,7 +589,7 @@ namespace ET
 	[ResponseType(nameof(M2C_Reload))]
 	[Message(OuterMessage.C2M_Reload)]
 	[MemoryPackable]
-	public partial class C2M_Reload: MessageObject, IRequest
+	public partial class C2M_Reload: MessageObject, ISessionRequest
 	{
 		public static C2M_Reload Create(bool isFromPool = true) 
 		{ 
@@ -619,7 +619,7 @@ namespace ET
 
 	[Message(OuterMessage.M2C_Reload)]
 	[MemoryPackable]
-	public partial class M2C_Reload: MessageObject, IResponse
+	public partial class M2C_Reload: MessageObject, ISessionResponse
 	{
 		public static M2C_Reload Create(bool isFromPool = true) 
 		{ 
@@ -650,7 +650,7 @@ namespace ET
 	[ResponseType(nameof(R2C_Login))]
 	[Message(OuterMessage.C2R_Login)]
 	[MemoryPackable]
-	public partial class C2R_Login: MessageObject, IRequest
+	public partial class C2R_Login: MessageObject, ISessionRequest
 	{
 		public static C2R_Login Create(bool isFromPool = true) 
 		{ 
@@ -680,7 +680,7 @@ namespace ET
 
 	[Message(OuterMessage.R2C_Login)]
 	[MemoryPackable]
-	public partial class R2C_Login: MessageObject, IResponse
+	public partial class R2C_Login: MessageObject, ISessionResponse
 	{
 		public static R2C_Login Create(bool isFromPool = true) 
 		{ 
@@ -723,7 +723,7 @@ namespace ET
 	[ResponseType(nameof(G2C_LoginGate))]
 	[Message(OuterMessage.C2G_LoginGate)]
 	[MemoryPackable]
-	public partial class C2G_LoginGate: MessageObject, IRequest
+	public partial class C2G_LoginGate: MessageObject, ISessionRequest
 	{
 		public static C2G_LoginGate Create(bool isFromPool = true) 
 		{ 
@@ -753,7 +753,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_LoginGate)]
 	[MemoryPackable]
-	public partial class G2C_LoginGate: MessageObject, IResponse
+	public partial class G2C_LoginGate: MessageObject, ISessionResponse
 	{
 		public static G2C_LoginGate Create(bool isFromPool = true) 
 		{ 
@@ -787,7 +787,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_TestHotfixMessage)]
 	[MemoryPackable]
-	public partial class G2C_TestHotfixMessage: MessageObject, IMessage
+	public partial class G2C_TestHotfixMessage: MessageObject, ISessionMessage
 	{
 		public static G2C_TestHotfixMessage Create(bool isFromPool = true) 
 		{ 
@@ -976,7 +976,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Benchmark))]
 	[Message(OuterMessage.C2G_Benchmark)]
 	[MemoryPackable]
-	public partial class C2G_Benchmark: MessageObject, IRequest
+	public partial class C2G_Benchmark: MessageObject, ISessionRequest
 	{
 		public static C2G_Benchmark Create(bool isFromPool = true) 
 		{ 
@@ -998,7 +998,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Benchmark)]
 	[MemoryPackable]
-	public partial class G2C_Benchmark: MessageObject, IResponse
+	public partial class G2C_Benchmark: MessageObject, ISessionResponse
 	{
 		public static G2C_Benchmark Create(bool isFromPool = true) 
 		{ 

+ 2 - 2
Unity/Assets/Scripts/Model/Generate/Server/Message/LockStepOuter_C_11001.cs

@@ -6,7 +6,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Match))]
 	[Message(LockStepOuter.C2G_Match)]
 	[MemoryPackable]
-	public partial class C2G_Match: MessageObject, IRequest
+	public partial class C2G_Match: MessageObject, ISessionRequest
 	{
 		public static C2G_Match Create(bool isFromPool = true) 
 		{ 
@@ -28,7 +28,7 @@ namespace ET
 
 	[Message(LockStepOuter.G2C_Match)]
 	[MemoryPackable]
-	public partial class G2C_Match: MessageObject, IResponse
+	public partial class G2C_Match: MessageObject, ISessionResponse
 	{
 		public static G2C_Match Create(bool isFromPool = true) 
 		{ 

+ 14 - 14
Unity/Assets/Scripts/Model/Generate/Server/Message/OuterMessage_C_10001.cs

@@ -176,7 +176,7 @@ namespace ET
 	[ResponseType(nameof(G2C_EnterMap))]
 	[Message(OuterMessage.C2G_EnterMap)]
 	[MemoryPackable]
-	public partial class C2G_EnterMap: MessageObject, IRequest
+	public partial class C2G_EnterMap: MessageObject, ISessionRequest
 	{
 		public static C2G_EnterMap Create(bool isFromPool = true) 
 		{ 
@@ -198,7 +198,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_EnterMap)]
 	[MemoryPackable]
-	public partial class G2C_EnterMap: MessageObject, IResponse
+	public partial class G2C_EnterMap: MessageObject, ISessionResponse
 	{
 		public static G2C_EnterMap Create(bool isFromPool = true) 
 		{ 
@@ -514,7 +514,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Ping))]
 	[Message(OuterMessage.C2G_Ping)]
 	[MemoryPackable]
-	public partial class C2G_Ping: MessageObject, IRequest
+	public partial class C2G_Ping: MessageObject, ISessionRequest
 	{
 		public static C2G_Ping Create(bool isFromPool = true) 
 		{ 
@@ -536,7 +536,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Ping)]
 	[MemoryPackable]
-	public partial class G2C_Ping: MessageObject, IResponse
+	public partial class G2C_Ping: MessageObject, ISessionResponse
 	{
 		public static G2C_Ping Create(bool isFromPool = true) 
 		{ 
@@ -570,7 +570,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Test)]
 	[MemoryPackable]
-	public partial class G2C_Test: MessageObject, IMessage
+	public partial class G2C_Test: MessageObject, ISessionMessage
 	{
 		public static G2C_Test Create(bool isFromPool = true) 
 		{ 
@@ -589,7 +589,7 @@ namespace ET
 	[ResponseType(nameof(M2C_Reload))]
 	[Message(OuterMessage.C2M_Reload)]
 	[MemoryPackable]
-	public partial class C2M_Reload: MessageObject, IRequest
+	public partial class C2M_Reload: MessageObject, ISessionRequest
 	{
 		public static C2M_Reload Create(bool isFromPool = true) 
 		{ 
@@ -619,7 +619,7 @@ namespace ET
 
 	[Message(OuterMessage.M2C_Reload)]
 	[MemoryPackable]
-	public partial class M2C_Reload: MessageObject, IResponse
+	public partial class M2C_Reload: MessageObject, ISessionResponse
 	{
 		public static M2C_Reload Create(bool isFromPool = true) 
 		{ 
@@ -650,7 +650,7 @@ namespace ET
 	[ResponseType(nameof(R2C_Login))]
 	[Message(OuterMessage.C2R_Login)]
 	[MemoryPackable]
-	public partial class C2R_Login: MessageObject, IRequest
+	public partial class C2R_Login: MessageObject, ISessionRequest
 	{
 		public static C2R_Login Create(bool isFromPool = true) 
 		{ 
@@ -680,7 +680,7 @@ namespace ET
 
 	[Message(OuterMessage.R2C_Login)]
 	[MemoryPackable]
-	public partial class R2C_Login: MessageObject, IResponse
+	public partial class R2C_Login: MessageObject, ISessionResponse
 	{
 		public static R2C_Login Create(bool isFromPool = true) 
 		{ 
@@ -723,7 +723,7 @@ namespace ET
 	[ResponseType(nameof(G2C_LoginGate))]
 	[Message(OuterMessage.C2G_LoginGate)]
 	[MemoryPackable]
-	public partial class C2G_LoginGate: MessageObject, IRequest
+	public partial class C2G_LoginGate: MessageObject, ISessionRequest
 	{
 		public static C2G_LoginGate Create(bool isFromPool = true) 
 		{ 
@@ -753,7 +753,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_LoginGate)]
 	[MemoryPackable]
-	public partial class G2C_LoginGate: MessageObject, IResponse
+	public partial class G2C_LoginGate: MessageObject, ISessionResponse
 	{
 		public static G2C_LoginGate Create(bool isFromPool = true) 
 		{ 
@@ -787,7 +787,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_TestHotfixMessage)]
 	[MemoryPackable]
-	public partial class G2C_TestHotfixMessage: MessageObject, IMessage
+	public partial class G2C_TestHotfixMessage: MessageObject, ISessionMessage
 	{
 		public static G2C_TestHotfixMessage Create(bool isFromPool = true) 
 		{ 
@@ -976,7 +976,7 @@ namespace ET
 	[ResponseType(nameof(G2C_Benchmark))]
 	[Message(OuterMessage.C2G_Benchmark)]
 	[MemoryPackable]
-	public partial class C2G_Benchmark: MessageObject, IRequest
+	public partial class C2G_Benchmark: MessageObject, ISessionRequest
 	{
 		public static C2G_Benchmark Create(bool isFromPool = true) 
 		{ 
@@ -998,7 +998,7 @@ namespace ET
 
 	[Message(OuterMessage.G2C_Benchmark)]
 	[MemoryPackable]
-	public partial class G2C_Benchmark: MessageObject, IResponse
+	public partial class G2C_Benchmark: MessageObject, ISessionResponse
 	{
 		public static G2C_Benchmark Create(bool isFromPool = true) 
 		{ 

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/Message/MessageHandler.cs

@@ -2,7 +2,7 @@ using System;
 
 namespace ET.Server
 {
-    public abstract class MessageHandler<Request, Response>: IMHandler where Request : MessageObject, IRequest where Response : MessageObject, IResponse
+    public abstract class MessageHandler<Request, Response>: IMHandler where Request : MessageObject, IActorRequest where Response : MessageObject, IActorResponse
     {
         protected abstract ETTask Run(Session session, Request request, Response response);
 

+ 16 - 0
Unity/Assets/Scripts/Model/Share/Module/Message/ISessionMessage.cs

@@ -0,0 +1,16 @@
+namespace ET
+{
+
+    public interface ISessionMessage: IActorMessage
+    {
+    }
+    
+    public interface ISessionRequest: ISessionMessage, IActorRequest
+    {
+    }
+    
+    public interface ISessionResponse: ISessionMessage, IActorResponse
+    {
+
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Core/World/IMessage.cs.meta → Unity/Assets/Scripts/Model/Share/Module/Message/ISessionMessage.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 21e594d3ffbf71b45ad9577e4c586518
+guid: 0a9547428839e4f42be1f39cc57193b3
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 11 - 11
Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs

@@ -7,13 +7,13 @@ namespace ET
 {
     public readonly struct RpcInfo
     {
-        public readonly IRequest Request;
-        public readonly ETTask<IResponse> Tcs;
+        public readonly IActorRequest Request;
+        public readonly ETTask<IActorResponse> Tcs;
 
-        public RpcInfo(IRequest request)
+        public RpcInfo(IActorRequest request)
         {
             this.Request = request;
-            this.Tcs = ETTask<IResponse>.Create(true);
+            this.Tcs = ETTask<IActorResponse>.Create(true);
         }
     }
     
@@ -49,7 +49,7 @@ namespace ET
             self.requestCallbacks.Clear();
         }
         
-        public static void OnResponse(this Session self, IResponse response)
+        public static void OnResponse(this Session self, IActorResponse response)
         {
             if (!self.requestCallbacks.Remove(response.RpcId, out var action))
             {
@@ -64,7 +64,7 @@ namespace ET
             action.Tcs.SetResult(response);
         }
         
-        public static async ETTask<IResponse> Call(this Session self, IRequest request, ETCancellationToken cancellationToken)
+        public static async ETTask<IActorResponse> Call(this Session self, IActorRequest request, ETCancellationToken cancellationToken)
         {
             int rpcId = ++self.RpcId;
             RpcInfo rpcInfo = new RpcInfo(request);
@@ -82,12 +82,12 @@ namespace ET
 
                 self.requestCallbacks.Remove(rpcId);
                 Type responseType = OpcodeType.Instance.GetResponseType(action.Request.GetType());
-                IResponse response = (IResponse) Activator.CreateInstance(responseType);
+                IActorResponse response = (IActorResponse) Activator.CreateInstance(responseType);
                 response.Error = ErrorCore.ERR_Cancel;
                 action.Tcs.SetResult(response);
             }
 
-            IResponse ret;
+            IActorResponse ret;
             try
             {
                 cancellationToken?.Add(CancelAction);
@@ -100,7 +100,7 @@ namespace ET
             return ret;
         }
 
-        public static async ETTask<IResponse> Call(this Session self, IRequest request, int time = 0)
+        public static async ETTask<IActorResponse> Call(this Session self, IActorRequest request, int time = 0)
         {
             int rpcId = ++self.RpcId;
             RpcInfo rpcInfo = new(request);
@@ -132,12 +132,12 @@ namespace ET
             return await rpcInfo.Tcs;
         }
 
-        public static void Send(this Session self, IMessage message)
+        public static void Send(this Session self, IActorMessage message)
         {
             self.Send(default, message);
         }
         
-        public static void Send(this Session self, ActorId actorId, IMessage message)
+        public static void Send(this Session self, ActorId actorId, IActorMessage message)
         {
             self.LastSendTime = TimeInfo.Instance.ClientNow();
             LogMsg.Instance.Debug(message);