فهرست منبع

移动了Opcode跟Message文件的目录,修改proto2cs工具,生成message跟opcode

tanghai 8 سال پیش
والد
کامیت
469bf08e7d
26فایلهای تغییر یافته به همراه551 افزوده شده و 526 حذف شده
  1. 36 0
      Proto/HotfixMessage.proto
  2. 37 69
      Proto/InnerMessage.proto
  3. 14 42
      Proto/OuterMessage.proto
  4. 0 0
      Server/Hotfix/Module/Message/InnerMessageDispatcher.cs
  5. 0 0
      Server/Hotfix/Module/Message/NetInnerComponentSystem.cs
  6. 0 0
      Server/Hotfix/Module/Message/NetOuterComponentSystem.cs
  7. 2 2
      Server/Hotfix/Module/Message/OuterMessageDispatcher.cs
  8. 0 38
      Server/Model/Message/InnerOpcode.cs
  9. 66 86
      Server/Model/Module/Message/InnerMessage.cs
  10. 38 0
      Server/Model/Module/Message/InnerOpcode.cs
  11. 4 4
      Server/Model/Server.Model.csproj
  12. 72 27
      Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs
  13. 0 9
      Unity/Assets/Scripts/Message.meta
  14. 0 175
      Unity/Assets/Scripts/Message/OuterMessage.cs
  15. 0 22
      Unity/Assets/Scripts/Message/OuterOpcode.cs
  16. 14 1
      Unity/Assets/Scripts/Module/Message/IActorMessage.cs
  17. 1 0
      Unity/Assets/Scripts/Module/Message/Opcode.cs
  18. 190 0
      Unity/Assets/Scripts/Module/Message/OuterMessage.cs
  19. 2 2
      Unity/Assets/Scripts/Module/Message/OuterMessage.cs.meta
  20. 21 0
      Unity/Assets/Scripts/Module/Message/OuterOpcode.cs
  21. 2 2
      Unity/Assets/Scripts/Module/Message/OuterOpcode.cs.meta
  22. 33 33
      Unity/Hotfix/Module/Message/HotfixMessage.cs
  23. 9 9
      Unity/Hotfix/Module/Message/HotfixOpcode.cs
  24. 8 2
      Unity/Hotfix/Module/Message/IMessage.cs
  25. 0 1
      Unity/Hotfix/Module/Message/OpcodeTypeComponent.cs
  26. 2 2
      Unity/Unity.csproj

+ 36 - 0
Proto/HotfixMessage.proto

@@ -0,0 +1,36 @@
+message C2R_Login // IRequest
+{
+	required string	Account	 = 1;	// 帐号
+	required string	Password = 2;	// 密码
+}
+
+message R2C_Login // IResponse
+{
+	required string Address = 1;
+	required int64 	Key	    = 2;
+}
+
+message C2G_LoginGate // IRequest
+{
+	required int64 Key = 1;	// 帐号
+}
+
+message G2C_LoginGate // IResponse
+{
+	required int64 PlayerId = 1;
+}
+
+message G2C_TestHotfixMessage // IMessage
+{
+	required string Info = 1;
+}
+
+message C2M_TestActorRequest // IActorRequest
+{
+	required string Info = 1;
+}
+
+message M2C_TestActorResponse // IActorResponse
+{
+	required string Info = 1;
+}

+ 37 - 69
Proto/InnerMessage.proto

@@ -1,204 +1,172 @@
-	/// <summary>
-	/// 用来包装actor消息
-	/// </summary>
-	message ActorRequest // ARequest
-	{
-		required int64 Id = 1;
-		required AMessage AMessage = 2;
-	}
-
-	/// <summary>
-	/// actor RPC消息响应
-	/// </summary>
-	message ActorResponse // AResponse
-	{
-	}
-
-	/// <summary>
-	/// 用来包装actor消息
-	/// </summary>
-	message ActorRpcRequest // ActorRequest
-	{
-	}
-
-	/// <summary>
-	/// actor RPC消息响应带回应
-	/// </summary>
-	message ActorRpcResponse // ActorResponse
-	{
-		required AMessage AMessage = 1;
-	}
-
-
 	/// <summary>
 	/// 传送unit
 	/// </summary>
-	message M2M_TrasferUnitRequest // ARequest
+	message M2M_TrasferUnitRequest // IRequest
 	{
 		required Unit Unit = 1;
 	}
 	
-	message M2M_TrasferUnitResponse // AResponse
+	message M2M_TrasferUnitResponse // IResponse
 	{
 	}
 	
-	message M2A_Reload // ARequest
+	message M2A_Reload // IRequest
 	{
 	}
 
-	message A2M_Reload // AResponse
+	message A2M_Reload // IResponse
 	{
 	}
 
-	message G2G_LockRequest // ARequest
+	message G2G_LockRequest // IRequest
 	{
 		required int64 Id = 1;
 		required string Address = 2;
 	}
 
-	message G2G_LockResponse // AResponse
+	message G2G_LockResponse // IResponse
 	{
 	}
 
-	message G2G_LockReleaseRequest // ARequest
+	message G2G_LockReleaseRequest // IRequest
 	{
 		required int64 Id = 1;
 		required string Address = 2;
 	}
 
-	message G2G_LockReleaseResponse // AResponse
+	message G2G_LockReleaseResponse // IResponse
 	{
 	}
 
-	message DBSaveRequest // ARequest
+	message DBSaveRequest // IRequest
 	{
 		required bool NeedCache = 1;
 
 		required string CollectionName = 2;
 
-		required Disposer Disposer = 3;
+		required Component Disposer = 3;
 	}
 
 
-	message DBSaveBatchResponse // AResponse
+	message DBSaveBatchResponse // IResponse
 	{
 	}
 
-	message DBSaveBatchRequest // ARequest
+	message DBSaveBatchRequest // IRequest
 	{
 		required bool NeedCache = 1;
 		required string CollectionName = 2;
-		repeated Disposer Disposers = 3;
+		repeated Component Disposers = 3;
 	}
 
-	message DBSaveResponse // AResponse
+	message DBSaveResponse // IResponse
 	{
 	}
 
-	message DBQueryRequest // ARequest
+	message DBQueryRequest // IRequest
 	{
 		required int64 Id = 1;
 		required string CollectionName = 2;
 		required bool NeedCache = 3;
 	}
 
-	message DBQueryResponse // AResponse
+	message DBQueryResponse // IResponse
 	{
-		required Disposer Disposer = 1;
+		required Component Disposer = 1;
 	}
 
-	message DBQueryBatchRequest // ARequest
+	message DBQueryBatchRequest // IRequest
 	{
 		required string CollectionName = 1;
 		repeated int64 IdList = 2;
 		required bool NeedCache = 3;
 	}
 
-	message DBQueryBatchResponse // AResponse
+	message DBQueryBatchResponse // IResponse
 	{
-		repeated Disposer Disposers = 1;
+		repeated Component Disposers = 1;
 	}
 
-	message DBQueryJsonRequest // ARequest
+	message DBQueryJsonRequest // IRequest
 	{
 		required string CollectionName = 1;
 		required string Json = 2;
 		required bool NeedCache = 3;
 	}
 
-	message DBQueryJsonResponse // AResponse
+	message DBQueryJsonResponse // IResponse
 	{
-		repeated Disposer Disposers = 1;
+		repeated Component Disposers = 1;
 	}
 
-	message ObjectAddRequest // ARequest
+	message ObjectAddRequest // IRequest
 	{
 		required int64 Key = 1;
 		required int AppId = 2;
 	}
 
-	message ObjectAddResponse // AResponse
+	message ObjectAddResponse // IResponse
 	{
 	}
 
-	message ObjectRemoveRequest // ARequest
+	message ObjectRemoveRequest // IRequest
 	{
 		required int64 Key = 1;
 	}
 
-	message ObjectRemoveResponse // AResponse
+	message ObjectRemoveResponse // IResponse
 	{
 	}
 
-	message ObjectLockRequest // ARequest
+	message ObjectLockRequest // IRequest
 	{
 		required int64 Key = 1;
 		required int LockAppId = 2;
 		required int Time = 3;
 	}
 
-	message ObjectLockResponse // AResponse
+	message ObjectLockResponse // IResponse
 	{
 	}
 
-	message ObjectUnLockRequest // ARequest
+	message ObjectUnLockRequest // IRequest
 	{
 		required int64 Key = 1;
 		required int UnLockAppId = 2;
 		required int AppId = 3;
 	}
 
-	message ObjectUnLockResponse // AResponse
+	message ObjectUnLockResponse // IResponse
 	{
 	}
 
-	message ObjectGetRequest // ARequest
+	message ObjectGetRequest // IRequest
 	{
 		required int64 Key = 1;
 	}
 
-	message ObjectGetResponse // AResponse
+	message ObjectGetResponse // IResponse
 	{
 		required int AppId = 1;
 	}
 
-	message R2G_GetLoginKey // ARequest
+	message R2G_GetLoginKey // IRequest
 	{
 		required string Account = 1;
 	}
 
-	message G2R_GetLoginKey // AResponse
+	message G2R_GetLoginKey // IResponse
 	{
 		required int64 Key = 1;
 	}
 
-	message G2M_CreateUnit // ARequest
+	message G2M_CreateUnit // IRequest
 	{
 		required int64 PlayerId = 1;
 		required int64 GateSessionId = 2;
 	}
 
-	message M2G_CreateUnit // AResponse
+	message M2G_CreateUnit // IResponse
 	{
 		required int64 UnitId = 1;
 		required int Count = 2;

+ 14 - 42
Proto/OuterMessage.proto

@@ -1,54 +1,32 @@
-message C2R_Login // ARequest
-{
-	required string	Account	 = 1;	// 帐号
-	required string	Password = 2;	// 密码
-}
-
-message R2C_Login // AResponse
-{
-	required string Address = 1;
-	required int64 	Key	    = 2;
-}
-
-message C2G_LoginGate // ARequest
-{
-	required int64 Key = 1;	// 帐号
-}
-
-message G2C_LoginGate // AResponse
-{
-	required int64 PlayerId = 1;
-}
-
-message Actor_Test // AActorMessage
+message Actor_Test // IActorMessage
 {
 	required string Info = 1;
 }
 
-message Actor_TestRequest // AActorRequest
+message Actor_TestRequest // IActorRequest
 {
 	required string request = 1;
 }
 
-message Actor_TestResponse // AActorResponse
+message Actor_TestResponse // IActorResponse
 {
 	required string response = 1;
 }
 
-message Actor_TransferRequest // AActorRequest
+message Actor_TransferRequest // IActorRequest
 {
 	required int32 MapIndex = 1;
 }
 
-message Actor_TransferResponse // AActorResponse
+message Actor_TransferResponse // IActorResponse
 {
 }
 
-message C2G_EnterMap // ARequest
+message C2G_EnterMap // IRequest
 {
 }
 
-message G2C_EnterMap // AResponse
+message G2C_EnterMap // IResponse
 {
 	required int64 UnitId = 1;
 	required int32 Count  = 2;
@@ -61,7 +39,7 @@ message UnitInfo
 	required int32 Z       = 3;
 }
 
-message Actor_CreateUnits // AActorMessage
+message Actor_CreateUnits // IActorMessage
 {
     repeated UnitInfo Units = 1;
 }
@@ -69,34 +47,28 @@ message Actor_CreateUnits // AActorMessage
 message FrameMessageInfo
 {
 	required int64 Id = 1;
-	required AMessage Message = 2;
-}
-
-message FrameMessage // AActorMessage
-{
-	required int32 Frame = 1;
-	repeated AFrameMessage Messages = 2;
+	required MessageObject Message = 2;
 }
 
-message Frame_ClickMap // AFrameMessage
+message Frame_ClickMap // IFrameMessage
 {
 	required int32 X = 1;
 	required int32 Z = 2;
 }
 
-message C2M_Reload // ARequest
+message C2M_Reload // IRequest
 {
 	required AppType AppType = 1;
 }
 
-message M2C_Reload // AResponse
+message M2C_Reload // IResponse
 {
 }
 
-message C2R_Ping // ARequest
+message C2R_Ping // IRequest
 {
 }
 
-message R2C_Ping // AResponse
+message R2C_Ping // IResponse
 {
 }

+ 0 - 0
Server/Hotfix/Module/Network/InnerMessageDispatcher.cs → Server/Hotfix/Module/Message/InnerMessageDispatcher.cs


+ 0 - 0
Server/Hotfix/Module/Network/NetInnerComponentSystem.cs → Server/Hotfix/Module/Message/NetInnerComponentSystem.cs


+ 0 - 0
Server/Hotfix/Module/Network/NetOuterComponentSystem.cs → Server/Hotfix/Module/Message/NetOuterComponentSystem.cs


+ 2 - 2
Server/Hotfix/Module/Network/OuterMessageDispatcher.cs → Server/Hotfix/Module/Message/OuterMessageDispatcher.cs

@@ -8,14 +8,14 @@ namespace Hotfix
 		public async void Dispatch(Session session, PacketInfo packetInfo)
 		{
 			Type messageType = Game.Scene.GetComponent<OpcodeTypeComponent>().GetType(packetInfo.Opcode);
-			IMessage message = (IMessage)session.Network.MessagePacker.DeserializeFrom(messageType, packetInfo.Bytes, packetInfo.Index, packetInfo.Length);
+			object message = session.Network.MessagePacker.DeserializeFrom(messageType, packetInfo.Bytes, packetInfo.Index, packetInfo.Length);
 
 			// gate session收到actor消息直接转发给actor自己去处理
 			if (message is IActorMessage)
 			{
 				long unitId = session.GetComponent<SessionPlayerComponent>().Player.UnitId;
 				ActorProxy actorProxy = Game.Scene.GetComponent<ActorProxyComponent>().Get(unitId);
-				actorProxy.Send(message);
+				actorProxy.Send((IMessage)message);
 				return;
 			}
 

+ 0 - 38
Server/Model/Message/InnerOpcode.cs

@@ -1,38 +0,0 @@
-namespace Model
-{
-	public static partial class Opcode
-	{
-	    public const ushort M2M_TrasferUnitRequest = 2005;
-	    public const ushort M2M_TrasferUnitResponse = 2006;
-	    public const ushort M2A_Reload = 2007;
-	    public const ushort A2M_Reload = 2008;
-	    public const ushort G2G_LockRequest = 2009;
-	    public const ushort G2G_LockResponse = 2010;
-	    public const ushort G2G_LockReleaseRequest = 2011;
-	    public const ushort G2G_LockReleaseResponse = 2012;
-	    public const ushort DBSaveRequest = 2013;
-	    public const ushort DBSaveBatchResponse = 2014;
-	    public const ushort DBSaveBatchRequest = 2015;
-	    public const ushort DBSaveResponse = 2016;
-	    public const ushort DBQueryRequest = 2017;
-	    public const ushort DBQueryResponse = 2018;
-	    public const ushort DBQueryBatchRequest = 2019;
-	    public const ushort DBQueryBatchResponse = 2020;
-	    public const ushort DBQueryJsonRequest = 2021;
-	    public const ushort DBQueryJsonResponse = 2022;
-	    public const ushort ObjectAddRequest = 2023;
-	    public const ushort ObjectAddResponse = 2024;
-	    public const ushort ObjectRemoveRequest = 2025;
-	    public const ushort ObjectRemoveResponse = 2026;
-	    public const ushort ObjectLockRequest = 2027;
-	    public const ushort ObjectLockResponse = 2028;
-	    public const ushort ObjectUnLockRequest = 2029;
-	    public const ushort ObjectUnLockResponse = 2030;
-	    public const ushort ObjectGetRequest = 2031;
-	    public const ushort ObjectGetResponse = 2032;
-	    public const ushort R2G_GetLoginKey = 2033;
-	    public const ushort G2R_GetLoginKey = 2034;
-	    public const ushort G2M_CreateUnit = 2035;
-	    public const ushort M2G_CreateUnit = 2036;
-	}
-}

+ 66 - 86
Server/Model/Message/InnerMessage.cs → Server/Model/Module/Message/InnerMessage.cs

@@ -1,51 +1,48 @@
 using ProtoBuf;
-using System.Collections.Generic;
 using Model;
+using System.Collections.Generic;
 using MongoDB.Bson.Serialization.Attributes;
-
 namespace Model
 {
-	/// <summary>
-	/// 传送unit
-	/// </summary>
-	[Message(Opcode.M2M_TrasferUnitRequest)]
+/// <summary>
+/// 传送unit
+/// </summary>
+	[Message(InnerOpcode.M2M_TrasferUnitRequest)]
 	[ProtoContract]
-	public partial class M2M_TrasferUnitRequest: MessageObject, IRequest
+	public partial class M2M_TrasferUnitRequest: IRequest
 	{
 		[ProtoMember(1, IsRequired = true)]
 		public Unit Unit;
 
 	}
 
-	[Message(Opcode.M2M_TrasferUnitResponse)]
+	[Message(InnerOpcode.M2M_TrasferUnitResponse)]
 	[ProtoContract]
-	public partial class M2M_TrasferUnitResponse: MessageObject, IResponse
+	public partial class M2M_TrasferUnitResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.M2A_Reload)]
+	[Message(InnerOpcode.M2A_Reload)]
 	[ProtoContract]
 	public partial class M2A_Reload: IRequest
 	{
 	}
 
-	[Message(Opcode.A2M_Reload)]
+	[Message(InnerOpcode.A2M_Reload)]
 	[ProtoContract]
 	public partial class A2M_Reload: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.G2G_LockRequest)]
+	[Message(InnerOpcode.G2G_LockRequest)]
 	[ProtoContract]
 	public partial class G2G_LockRequest: IRequest
 	{
@@ -57,18 +54,17 @@ namespace Model
 
 	}
 
-	[Message(Opcode.G2G_LockResponse)]
+	[Message(InnerOpcode.G2G_LockResponse)]
 	[ProtoContract]
 	public partial class G2G_LockResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.G2G_LockReleaseRequest)]
+	[Message(InnerOpcode.G2G_LockReleaseRequest)]
 	[ProtoContract]
 	public partial class G2G_LockReleaseRequest: IRequest
 	{
@@ -80,18 +76,17 @@ namespace Model
 
 	}
 
-	[Message(Opcode.G2G_LockReleaseResponse)]
+	[Message(InnerOpcode.G2G_LockReleaseResponse)]
 	[ProtoContract]
 	public partial class G2G_LockReleaseResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.DBSaveRequest)]
+	[Message(InnerOpcode.DBSaveRequest)]
 	[ProtoContract]
 	public partial class DBSaveRequest: IRequest
 	{
@@ -106,18 +101,17 @@ namespace Model
 
 	}
 
-	[Message(Opcode.DBSaveBatchResponse)]
+	[Message(InnerOpcode.DBSaveBatchResponse)]
 	[ProtoContract]
 	public partial class DBSaveBatchResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.DBSaveBatchRequest)]
+	[Message(InnerOpcode.DBSaveBatchRequest)]
 	[ProtoContract]
 	public partial class DBSaveBatchRequest: IRequest
 	{
@@ -132,18 +126,17 @@ namespace Model
 
 	}
 
-	[Message(Opcode.DBSaveResponse)]
+	[Message(InnerOpcode.DBSaveResponse)]
 	[ProtoContract]
 	public partial class DBSaveResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.DBQueryRequest)]
+	[Message(InnerOpcode.DBQueryRequest)]
 	[ProtoContract]
 	public partial class DBQueryRequest: IRequest
 	{
@@ -158,21 +151,20 @@ namespace Model
 
 	}
 
-	[Message(Opcode.DBQueryResponse)]
+	[Message(InnerOpcode.DBQueryResponse)]
 	[ProtoContract]
 	public partial class DBQueryResponse: IResponse
 	{
-		[ProtoMember(1, IsRequired = true)]
-		public Component Disposer;
-
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public Component Disposer;
+
 	}
 
-	[Message(Opcode.DBQueryBatchRequest)]
+	[Message(InnerOpcode.DBQueryBatchRequest)]
 	[ProtoContract]
 	public partial class DBQueryBatchRequest: IRequest
 	{
@@ -187,21 +179,20 @@ namespace Model
 
 	}
 
-	[Message(Opcode.DBQueryBatchResponse)]
+	[Message(InnerOpcode.DBQueryBatchResponse)]
 	[ProtoContract]
 	public partial class DBQueryBatchResponse: IResponse
 	{
-		[ProtoMember(1)]
-		public List<Component> Disposers = new List<Component>();
-
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
+		[ProtoMember(1)]
+		public List<Component> Disposers = new List<Component>();
+
 	}
 
-	[Message(Opcode.DBQueryJsonRequest)]
+	[Message(InnerOpcode.DBQueryJsonRequest)]
 	[ProtoContract]
 	public partial class DBQueryJsonRequest: IRequest
 	{
@@ -216,21 +207,20 @@ namespace Model
 
 	}
 
-	[Message(Opcode.DBQueryJsonResponse)]
+	[Message(InnerOpcode.DBQueryJsonResponse)]
 	[ProtoContract]
 	public partial class DBQueryJsonResponse: IResponse
 	{
-		[ProtoMember(1)]
-		public List<Component> Disposers = new List<Component>();
-
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
+		[ProtoMember(1)]
+		public List<Component> Disposers = new List<Component>();
+
 	}
 
-	[Message(Opcode.ObjectAddRequest)]
+	[Message(InnerOpcode.ObjectAddRequest)]
 	[ProtoContract]
 	public partial class ObjectAddRequest: IRequest
 	{
@@ -242,18 +232,17 @@ namespace Model
 
 	}
 
-	[Message(Opcode.ObjectAddResponse)]
+	[Message(InnerOpcode.ObjectAddResponse)]
 	[ProtoContract]
 	public partial class ObjectAddResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.ObjectRemoveRequest)]
+	[Message(InnerOpcode.ObjectRemoveRequest)]
 	[ProtoContract]
 	public partial class ObjectRemoveRequest: IRequest
 	{
@@ -262,18 +251,17 @@ namespace Model
 
 	}
 
-	[Message(Opcode.ObjectRemoveResponse)]
+	[Message(InnerOpcode.ObjectRemoveResponse)]
 	[ProtoContract]
 	public partial class ObjectRemoveResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.ObjectLockRequest)]
+	[Message(InnerOpcode.ObjectLockRequest)]
 	[ProtoContract]
 	public partial class ObjectLockRequest: IRequest
 	{
@@ -288,18 +276,17 @@ namespace Model
 
 	}
 
-	[Message(Opcode.ObjectLockResponse)]
+	[Message(InnerOpcode.ObjectLockResponse)]
 	[ProtoContract]
 	public partial class ObjectLockResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.ObjectUnLockRequest)]
+	[Message(InnerOpcode.ObjectUnLockRequest)]
 	[ProtoContract]
 	public partial class ObjectUnLockRequest: IRequest
 	{
@@ -314,46 +301,39 @@ namespace Model
 
 	}
 
-	[Message(Opcode.ObjectUnLockResponse)]
+	[Message(InnerOpcode.ObjectUnLockResponse)]
 	[ProtoContract]
 	public partial class ObjectUnLockResponse: IResponse
 	{
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
 	}
 
-	[Message(Opcode.ObjectGetRequest)]
+	[Message(InnerOpcode.ObjectGetRequest)]
 	[ProtoContract]
 	public partial class ObjectGetRequest: IRequest
 	{
 		[ProtoMember(1, IsRequired = true)]
 		public long Key;
 
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
 	}
 
-	[Message(Opcode.ObjectGetResponse)]
+	[Message(InnerOpcode.ObjectGetResponse)]
 	[ProtoContract]
 	public partial class ObjectGetResponse: IResponse
 	{
-		[ProtoMember(1, IsRequired = true)]
-		public int AppId;
-
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public int AppId;
+
 	}
 
-	[Message(Opcode.R2G_GetLoginKey)]
+	[Message(InnerOpcode.R2G_GetLoginKey)]
 	[ProtoContract]
 	public partial class R2G_GetLoginKey: IRequest
 	{
@@ -362,21 +342,20 @@ namespace Model
 
 	}
 
-	[Message(Opcode.G2R_GetLoginKey)]
+	[Message(InnerOpcode.G2R_GetLoginKey)]
 	[ProtoContract]
 	public partial class G2R_GetLoginKey: IResponse
 	{
-		[ProtoMember(1, IsRequired = true)]
-		public long Key;
-
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public long Key;
+
 	}
 
-	[Message(Opcode.G2M_CreateUnit)]
+	[Message(InnerOpcode.G2M_CreateUnit)]
 	[ProtoContract]
 	public partial class G2M_CreateUnit: IRequest
 	{
@@ -388,27 +367,28 @@ namespace Model
 
 	}
 
-	[Message(Opcode.M2G_CreateUnit)]
+	[Message(InnerOpcode.M2G_CreateUnit)]
 	[ProtoContract]
 	public partial class M2G_CreateUnit: IResponse
 	{
+		[ProtoMember(90, IsRequired = true)]
+		public int Error { get; set; }
+		[ProtoMember(91, IsRequired = true)]
+		public string Message { get; set; }
 		[ProtoMember(1, IsRequired = true)]
 		public long UnitId;
 
 		[ProtoMember(2, IsRequired = true)]
 		public int Count;
 
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
 	}
 
-	[BsonKnownTypes(typeof(FrameMessage))]
-	[BsonKnownTypes(typeof(Actor_CreateUnits))]
-	[BsonKnownTypes(typeof(Actor_TransferRequest))]
-	public partial class MessageObject
-	{
-	}
-}
+}
+#if SERVER
+namespace Model
+{
+}
+#endif
+namespace Model
+{
+}

+ 38 - 0
Server/Model/Module/Message/InnerOpcode.cs

@@ -0,0 +1,38 @@
+namespace Model
+{
+	public static partial class InnerOpcode
+	{
+		 public const ushort M2M_TrasferUnitRequest = 1001;
+		 public const ushort M2M_TrasferUnitResponse = 1002;
+		 public const ushort M2A_Reload = 1003;
+		 public const ushort A2M_Reload = 1004;
+		 public const ushort G2G_LockRequest = 1005;
+		 public const ushort G2G_LockResponse = 1006;
+		 public const ushort G2G_LockReleaseRequest = 1007;
+		 public const ushort G2G_LockReleaseResponse = 1008;
+		 public const ushort DBSaveRequest = 1009;
+		 public const ushort DBSaveBatchResponse = 1010;
+		 public const ushort DBSaveBatchRequest = 1011;
+		 public const ushort DBSaveResponse = 1012;
+		 public const ushort DBQueryRequest = 1013;
+		 public const ushort DBQueryResponse = 1014;
+		 public const ushort DBQueryBatchRequest = 1015;
+		 public const ushort DBQueryBatchResponse = 1016;
+		 public const ushort DBQueryJsonRequest = 1017;
+		 public const ushort DBQueryJsonResponse = 1018;
+		 public const ushort ObjectAddRequest = 1019;
+		 public const ushort ObjectAddResponse = 1020;
+		 public const ushort ObjectRemoveRequest = 1021;
+		 public const ushort ObjectRemoveResponse = 1022;
+		 public const ushort ObjectLockRequest = 1023;
+		 public const ushort ObjectLockResponse = 1024;
+		 public const ushort ObjectUnLockRequest = 1025;
+		 public const ushort ObjectUnLockResponse = 1026;
+		 public const ushort ObjectGetRequest = 1027;
+		 public const ushort ObjectGetResponse = 1028;
+		 public const ushort R2G_GetLoginKey = 1029;
+		 public const ushort G2R_GetLoginKey = 1030;
+		 public const ushort G2M_CreateUnit = 1031;
+		 public const ushort M2G_CreateUnit = 1032;
+	}
+}

+ 4 - 4
Server/Model/Server.Model.csproj

@@ -66,8 +66,6 @@
     <Compile Include="..\..\Unity\Assets\Scripts\Component\Config\OuterConfig.cs" Link="Module\Message\OuterConfig.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Component\TimerComponent.cs" Link="Component\TimerComponent.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Entity\Session.cs" Link="Module\Message\Session.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Message\OuterMessage.cs" Link="Message\OuterMessage.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Message\OuterOpcode.cs" Link="Message\OuterOpcode.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Config\ACategory.cs" Link="Module\Config\ACategory.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Config\AConfig.cs" Link="Module\Config\AConfig.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Config\ConfigAttribute.cs" Link="Module\Config\ConfigAttribute.cs" />
@@ -98,6 +96,8 @@
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Message\Network\TCP\TService.cs" Link="Module\Message\Network\TCP\TService.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Message\Opcode.cs" Link="Module\Message\Opcode.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Message\OpcodeTypeComponent.cs" Link="Module\Message\OpcodeTypeComponent.cs" />
+    <Compile Include="..\..\Unity\Assets\Scripts\Module\Message\OuterMessage.cs" Link="Module\Message\OuterMessage.cs" />
+    <Compile Include="..\..\Unity\Assets\Scripts\Module\Message\OuterOpcode.cs" Link="Module\Message\OuterOpcode.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Message\ProtobufPacker.cs" Link="Module\Message\ProtobufPacker.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Message\RpcException.cs" Link="Module\Message\RpcException.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Numeric\INumericWatcher.cs" Link="Module\Numeric\INumericWatcher.cs" />
@@ -107,8 +107,8 @@
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Numeric\NumericWatcherAttribute.cs" Link="Module\Numeric\NumericWatcherAttribute.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Module\Numeric\NumericWatcherComponent.cs" Link="Module\Numeric\NumericWatcherComponent.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Other\AppType.cs" Link="Other\AppType.cs" />
-    <Compile Include="..\..\Unity\Hotfix\Module\Message\HotfixMessage.cs" Link="Message\HotfixMessage.cs" />
-    <Compile Include="..\..\Unity\Hotfix\Module\Message\HotfixOpcode.cs" Link="Message\HotfixOpcode.cs" />
+    <Compile Include="..\..\Unity\Hotfix\Module\Message\HotfixMessage.cs" Link="Module\Message\HotfixMessage.cs" />
+    <Compile Include="..\..\Unity\Hotfix\Module\Message\HotfixOpcode.cs" Link="Module\Message\HotfixOpcode.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 72 - 27
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs

@@ -23,28 +23,34 @@ namespace MyEditor
 	public class Proto2CSEditor : EditorWindow
 	{
 		private const string protoPath = @"..\Proto\";
-		private const string innerOutPath = @"..\Server\Model\Entity\Message\";
-		private const string outerOutPath = @"Assets\Scripts\Entity\Message\";
-		private const string opcodePath = @"Assets\Scripts\Entity\Message\Opcode.cs";
+		private const string innerOutPath = @"..\Server\Model\Module\Message\";
+		private const string outerOutPath = @"Assets\Scripts\Module\Message\";
+		private const string hotfixOutPath = @"Hotfix\Module\Message\";
 		private static readonly char[] splitChars = { ' ', '\t' };
-		private static List<OpcodeInfo> msgOpcode = new List<OpcodeInfo>();
+		private static readonly List<OpcodeInfo> msgOpcode = new List<OpcodeInfo>();
 		private static MultiMap<string, string> parentMsg = new MultiMap<string, string>();
 		
 		[MenuItem("Tools/Proto2CS")]
 		public static void AllProto2CS()
 		{
 			msgOpcode.Clear();
+			Proto2CS("Model", "OuterMessage.proto", outerOutPath, "OuterOpcode", 100, HeadFlag.Proto | HeadFlag.Bson);
+			GenerateOpcode("OuterOpcode", outerOutPath);
 
-			Proto2CS("OuterMessage.proto", outerOutPath, 100, HeadFlag.Proto | HeadFlag.Bson);
-			Proto2CS("InnerMessage.proto", innerOutPath, 1000, HeadFlag.Bson);
-			
-			GenerateOpcode();
+			msgOpcode.Clear();
+			Proto2CS("Model", "InnerMessage.proto", innerOutPath, "InnerOpcode", 1000, HeadFlag.Bson);
+			GenerateOpcode("InnerOpcode", innerOutPath);
+
+			msgOpcode.Clear();
+			Proto2CS("Hotfix", "HotfixMessage.proto", hotfixOutPath, "HotfixOpcode", 10000, HeadFlag.Bson);
+			GenerateOpcode("HotfixOpcode", hotfixOutPath);
 			
 			AssetDatabase.Refresh();
 		}
 		
-		public static void Proto2CS(string protoName, string outputPath, int startOpcode, HeadFlag flag)
+		public static void Proto2CS(string ns, string protoName, string outputPath, string opcodeClassName, int startOpcode, HeadFlag flag)
 		{
+			msgOpcode.Clear();
 			parentMsg = new MultiMap<string, string>();
 			string proto = Path.Combine(protoPath, protoName);
 			string csPath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(proto) + ".cs");
@@ -53,12 +59,19 @@ namespace MyEditor
 
 			StringBuilder sb = new StringBuilder();
 			sb.Append("using ProtoBuf;\n");
+			sb.Append("using Model;\n");
+			if (ns == "Hotfix")
+			{
+				sb.Append("using Hotfix;\n");
+			}
+
 			sb.Append("using System.Collections.Generic;\n");
 			sb.Append("using MongoDB.Bson.Serialization.Attributes;\n");
-			sb.Append("namespace Model\n");
+			sb.Append($"namespace {ns}\n");
 			sb.Append("{\n");
 
 			bool isMsgStart = false;
+			string parentClass = "";
 			foreach (string line in s.Split('\n'))
 			{
 				string newline = line.Trim();
@@ -75,22 +88,27 @@ namespace MyEditor
 
 				if (newline.StartsWith("message"))
 				{
+					parentClass = "";
 					isMsgStart = true;
 					string msgName = newline.Split(splitChars, StringSplitOptions.RemoveEmptyEntries)[1];
 					string[] ss = newline.Split(new []{"//"}, StringSplitOptions.RemoveEmptyEntries);
-					string parentClass = "";
+					
 					if (ss.Length == 2)
 					{
-						parentClass = ss[1];
-						parentMsg.Add(parentClass, msgName);
+						parentClass = ss[1].Trim();
 					}
 
 					msgOpcode.Add(new OpcodeInfo() { Name = msgName, Opcode = ++startOpcode});
 					
-					sb.Append($"\t[Message(Opcode.{msgName})]\n");
+					sb.Append($"\t[Message({opcodeClassName}.{msgName})]\n");
 					sb.Append($"\t[ProtoContract]\n");
 					sb.Append($"\tpublic partial class {msgName}");
-					if (parentClass != "")
+					if (parentClass == "IActorMessage" || parentClass == "IActorRequest" || parentClass == "IActorResponse" || parentClass == "IFrameMessage")
+					{
+						sb.Append($": MessageObject, {parentClass}\n");
+						parentMsg.Add("MessageObject", msgName);
+					}
+					else if (parentClass != "")
 					{
 						sb.Append($": {parentClass}\n");
 					}
@@ -103,6 +121,20 @@ namespace MyEditor
 				if (isMsgStart && newline == "{")
 				{
 					sb.Append("\t{\n");
+
+					if (parentClass == "IResponse" || parentClass == "IActorResponse")
+					{
+						sb.AppendLine("\t\t[ProtoMember(90, IsRequired = true)]");
+						sb.AppendLine("\t\tpublic int Error { get; set; }");
+						sb.AppendLine("\t\t[ProtoMember(91, IsRequired = true)]");
+						sb.AppendLine("\t\tpublic string Message { get; set; }");
+					}
+
+					if (parentClass == "IFrameMessage")
+					{
+						sb.AppendLine("\t\t[ProtoMember(92, IsRequired = true)]");
+						sb.AppendLine("\t\tpublic long Id { get; set; }");
+					}
 				}
 
 				// 成员
@@ -127,43 +159,55 @@ namespace MyEditor
 					sb.Append("\t}\n\n");
 				}
 			}
-			GenerateHead(sb, flag);
 			sb.Append("}\n");
-			
+
+			GenerateHead(sb, flag, opcodeClassName);
+
 			File.WriteAllText(csPath, sb.ToString());
 		}
 
-		private static void GenerateHead(StringBuilder sb, HeadFlag flag)
+		private static void GenerateHead(StringBuilder sb, HeadFlag flag, string opcodeClassName)
 		{
+			sb.AppendLine("#if SERVER");
+			sb.AppendLine("namespace Model\n{");
 			foreach (string parentClass in parentMsg.GetDictionary().Keys)
 			{
-				if ((flag & HeadFlag.Proto) != 0)
+				if ((flag & HeadFlag.Bson) != 0)
 				{
 					foreach (string s in parentMsg.GetAll(parentClass))
 					{
-						sb.Append($"\t[ProtoInclude((int)Opcode.{s}, typeof({s}))]\n");
+						sb.Append($"\t[BsonKnownTypes(typeof({s}))]\n");
 					}
 				}
 
-				if ((flag & HeadFlag.Bson) != 0)
+
+				sb.Append($"\tpublic partial class {parentClass} {{}}\n\n");
+			}
+			sb.AppendLine("}");
+			sb.AppendLine("#endif");
+
+			sb.AppendLine("namespace Model\n{");
+			foreach (string parentClass in parentMsg.GetDictionary().Keys)
+			{
+				if ((flag & HeadFlag.Proto) != 0)
 				{
 					foreach (string s in parentMsg.GetAll(parentClass))
 					{
-						sb.Append($"\t[BsonKnownTypes(typeof({s}))]\n");
+						sb.Append($"\t[ProtoInclude({opcodeClassName}.{s}, typeof({s}))]\n");
 					}
 				}
 
-
 				sb.Append($"\tpublic partial class {parentClass} {{}}\n\n");
 			}
+			sb.AppendLine("}");
 		}
 		
-		private static void GenerateOpcode()
+		private static void GenerateOpcode(string outputFileName, string outputPath)
 		{
 			StringBuilder sb = new StringBuilder();
 			sb.AppendLine("namespace Model");
 			sb.AppendLine("{");
-			sb.AppendLine("\tpublic static partial class Opcode");
+			sb.AppendLine($"\tpublic static partial class {outputFileName}");
 			sb.AppendLine("\t{");
 			foreach (OpcodeInfo info in msgOpcode)
 			{
@@ -171,8 +215,9 @@ namespace MyEditor
 			}
 			sb.AppendLine("\t}");
 			sb.AppendLine("}");
-
-			File.WriteAllText(opcodePath, sb.ToString());
+			
+			string csPath = Path.Combine(outputPath, outputFileName + ".cs");
+			File.WriteAllText(csPath, sb.ToString());
 		}
 
 		private static void Repeated(StringBuilder sb, string newline)

+ 0 - 9
Unity/Assets/Scripts/Message.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: e9766182470b7474a9ac9f1cccc8edcc
-folderAsset: yes
-timeCreated: 1498120811
-licenseType: Free
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 175
Unity/Assets/Scripts/Message/OuterMessage.cs

@@ -1,175 +0,0 @@
-using ProtoBuf;
-using System.Collections.Generic;
-using MongoDB.Bson.Serialization.Attributes;
-namespace Model
-{
-	[Message(Opcode.Actor_Test)]
-	[ProtoContract]
-	public partial class Actor_Test : MessageObject, IActorMessage
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public string Info;
-
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
-	}
-
-	[Message(Opcode.Actor_TestRequest)]
-	[ProtoContract]
-	public partial class Actor_TestRequest : MessageObject, IActorRequest
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public string request;
-	}
-
-	[Message(Opcode.Actor_TestResponse)]
-	[ProtoContract]
-	public partial class Actor_TestResponse : MessageObject, IActorResponse
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public string response;
-
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
-	}
-
-	[Message(Opcode.Actor_TransferRequest)]
-	[ProtoContract]
-	public partial class Actor_TransferRequest : MessageObject, IActorRequest
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public int MapIndex;
-	}
-
-	[Message(Opcode.Actor_TransferResponse)]
-	[ProtoContract]
-	public partial class Actor_TransferResponse : MessageObject, IActorResponse
-	{
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
-	}
-
-	[Message(Opcode.C2G_EnterMap)]
-	[ProtoContract]
-	public partial class C2G_EnterMap : MessageObject, IRequest
-	{
-	}
-
-	[Message(Opcode.G2C_EnterMap)]
-	[ProtoContract]
-	public partial class G2C_EnterMap : MessageObject, IResponse
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public long UnitId;
-
-		[ProtoMember(2, IsRequired = true)]
-		public int Count;
-
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
-	}
-
-	[Message(Opcode.UnitInfo)]
-	[ProtoContract]
-	public partial class UnitInfo
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public long UnitId;
-
-		[ProtoMember(2, IsRequired = true)]
-		public int X;
-
-		[ProtoMember(3, IsRequired = true)]
-		public int Z;
-
-	}
-
-	[Message(Opcode.Actor_CreateUnits)]
-	[ProtoContract]
-	public partial class Actor_CreateUnits : MessageObject, IActorMessage
-	{
-		[ProtoMember(1)]
-		public List<UnitInfo> Units = new List<UnitInfo>();
-
-	}
-	
-	[Message(Opcode.FrameMessage)]
-	[ProtoContract]
-	public partial class FrameMessage : MessageObject, IActorMessage
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public int Frame;
-
-		[ProtoMember(2)]
-		public List<MessageObject> Messages = new List<MessageObject>();
-	}
-
-	[Message(Opcode.Frame_ClickMap)]
-	[ProtoContract]
-	public partial class Frame_ClickMap : MessageObject, IFrameMessage
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public int X;
-
-		[ProtoMember(2, IsRequired = true)]
-		public int Z;
-
-		[ProtoMember(90)]
-		public long Id { get; set; }
-	}
-
-	[Message(Opcode.C2M_Reload)]
-	[ProtoContract]
-	public partial class C2M_Reload : MessageObject, IRequest
-	{
-		[ProtoMember(1, IsRequired = true)]
-		public AppType AppType;
-
-	}
-
-	[Message(Opcode.M2C_Reload)]
-	[ProtoContract]
-	public partial class M2C_Reload : MessageObject, IResponse
-	{
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
-	}
-
-	[Message(Opcode.C2R_Ping)]
-	[ProtoContract]
-	public partial class C2R_Ping : MessageObject, IRequest
-	{
-	}
-
-	[Message(Opcode.R2C_Ping)]
-	[ProtoContract]
-	public partial class R2C_Ping : MessageObject, IResponse
-	{
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
-	}
-	
-	[ProtoInclude(Opcode.Frame_ClickMap, typeof(Frame_ClickMap))]
-	[BsonKnownTypes(typeof(Frame_ClickMap))]
-	public partial class MessageObject
-	{
-	}
-}

+ 0 - 22
Unity/Assets/Scripts/Message/OuterOpcode.cs

@@ -1,22 +0,0 @@
-namespace Model
-{
-	public static partial class Opcode
-	{
-		 public const ushort Actor_Test = 1105;
-		 public const ushort Actor_TestRequest = 1106;
-		 public const ushort Actor_TestResponse = 1107;
-		 public const ushort Actor_TransferRequest = 1108;
-		 public const ushort Actor_TransferResponse = 1109;
-		 public const ushort C2G_EnterMap = 1110;
-		 public const ushort G2C_EnterMap = 1111;
-		 public const ushort UnitInfo = 1112;
-		 public const ushort Actor_CreateUnits = 1113;
-		 public const ushort FrameMessageInfo = 1114;
-		 public const ushort FrameMessage = 1115;
-		 public const ushort Frame_ClickMap = 1116;
-		 public const ushort C2M_Reload = 1117;
-		 public const ushort M2C_Reload = 1118;
-		 public const ushort C2R_Ping = 1119;
-		 public const ushort R2C_Ping = 1120;
-	}
-}

+ 14 - 1
Unity/Assets/Scripts/Module/Message/IActorMessage.cs

@@ -1,4 +1,5 @@
-using MongoDB.Bson.Serialization.Attributes;
+using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
 using ProtoBuf;
 
 // 不要在这个文件加[ProtoInclude]跟[BsonKnowType]标签,加到InnerMessage.cs或者OuterMessage.cs里面去
@@ -23,4 +24,16 @@ namespace Model
 	{
 		long Id { get; set; }
 	}
+
+	[Message(Opcode.FrameMessage)]
+	[ProtoContract]
+	public partial class FrameMessage : MessageObject, IActorMessage
+	{
+		[ProtoMember(1, IsRequired = true)]
+		public int Frame;
+
+		[ProtoMember(2)]
+		public List<MessageObject> Messages = new List<MessageObject>();
+
+	}
 }

+ 1 - 0
Unity/Assets/Scripts/Module/Message/Opcode.cs

@@ -4,5 +4,6 @@ namespace Model
 	{
 		public const ushort ActorRequest = 1;
 		public const ushort ActorResponse = 2;
+		public const ushort FrameMessage = 3;
 	}
 }

+ 190 - 0
Unity/Assets/Scripts/Module/Message/OuterMessage.cs

@@ -0,0 +1,190 @@
+using ProtoBuf;
+using Model;
+using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
+namespace Model
+{
+	[Message(OuterOpcode.Actor_Test)]
+	[ProtoContract]
+	public partial class Actor_Test: MessageObject, IActorMessage
+	{
+		[ProtoMember(1, IsRequired = true)]
+		public string Info;
+
+	}
+
+	[Message(OuterOpcode.Actor_TestRequest)]
+	[ProtoContract]
+	public partial class Actor_TestRequest: MessageObject, IActorRequest
+	{
+		[ProtoMember(1, IsRequired = true)]
+		public string request;
+
+	}
+
+	[Message(OuterOpcode.Actor_TestResponse)]
+	[ProtoContract]
+	public partial class Actor_TestResponse: MessageObject, IActorResponse
+	{
+		[ProtoMember(90, IsRequired = true)]
+		public int Error { get; set; }
+		[ProtoMember(91, IsRequired = true)]
+		public string Message { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public string response;
+
+	}
+
+	[Message(OuterOpcode.Actor_TransferRequest)]
+	[ProtoContract]
+	public partial class Actor_TransferRequest: MessageObject, IActorRequest
+	{
+		[ProtoMember(1, IsRequired = true)]
+		public int MapIndex;
+
+	}
+
+	[Message(OuterOpcode.Actor_TransferResponse)]
+	[ProtoContract]
+	public partial class Actor_TransferResponse: MessageObject, IActorResponse
+	{
+		[ProtoMember(90, IsRequired = true)]
+		public int Error { get; set; }
+		[ProtoMember(91, IsRequired = true)]
+		public string Message { get; set; }
+	}
+
+	[Message(OuterOpcode.C2G_EnterMap)]
+	[ProtoContract]
+	public partial class C2G_EnterMap: IRequest
+	{
+	}
+
+	[Message(OuterOpcode.G2C_EnterMap)]
+	[ProtoContract]
+	public partial class G2C_EnterMap: IResponse
+	{
+		[ProtoMember(90, IsRequired = true)]
+		public int Error { get; set; }
+		[ProtoMember(91, IsRequired = true)]
+		public string Message { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public long UnitId;
+
+		[ProtoMember(2, IsRequired = true)]
+		public int Count;
+
+	}
+
+	[Message(OuterOpcode.UnitInfo)]
+	[ProtoContract]
+	public partial class UnitInfo
+	{
+		[ProtoMember(1, IsRequired = true)]
+		public long UnitId;
+
+		[ProtoMember(2, IsRequired = true)]
+		public int X;
+
+		[ProtoMember(3, IsRequired = true)]
+		public int Z;
+
+	}
+
+	[Message(OuterOpcode.Actor_CreateUnits)]
+	[ProtoContract]
+	public partial class Actor_CreateUnits: MessageObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public List<UnitInfo> Units = new List<UnitInfo>();
+
+	}
+
+	[Message(OuterOpcode.FrameMessageInfo)]
+	[ProtoContract]
+	public partial class FrameMessageInfo
+	{
+		[ProtoMember(1, IsRequired = true)]
+		public long Id;
+
+		[ProtoMember(2, IsRequired = true)]
+		public MessageObject Message;
+
+	}
+
+	[Message(OuterOpcode.Frame_ClickMap)]
+	[ProtoContract]
+	public partial class Frame_ClickMap: MessageObject, IFrameMessage
+	{
+		[ProtoMember(92, IsRequired = true)]
+		public long Id { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public int X;
+
+		[ProtoMember(2, IsRequired = true)]
+		public int Z;
+
+	}
+
+	[Message(OuterOpcode.C2M_Reload)]
+	[ProtoContract]
+	public partial class C2M_Reload: IRequest
+	{
+		[ProtoMember(1, IsRequired = true)]
+		public AppType AppType;
+
+	}
+
+	[Message(OuterOpcode.M2C_Reload)]
+	[ProtoContract]
+	public partial class M2C_Reload: IResponse
+	{
+		[ProtoMember(90, IsRequired = true)]
+		public int Error { get; set; }
+		[ProtoMember(91, IsRequired = true)]
+		public string Message { get; set; }
+	}
+
+	[Message(OuterOpcode.C2R_Ping)]
+	[ProtoContract]
+	public partial class C2R_Ping: IRequest
+	{
+	}
+
+	[Message(OuterOpcode.R2C_Ping)]
+	[ProtoContract]
+	public partial class R2C_Ping: IResponse
+	{
+		[ProtoMember(90, IsRequired = true)]
+		public int Error { get; set; }
+		[ProtoMember(91, IsRequired = true)]
+		public string Message { get; set; }
+	}
+
+}
+#if SERVER
+namespace Model
+{
+	[BsonKnownTypes(typeof(Actor_Test))]
+	[BsonKnownTypes(typeof(Actor_TestRequest))]
+	[BsonKnownTypes(typeof(Actor_TestResponse))]
+	[BsonKnownTypes(typeof(Actor_TransferRequest))]
+	[BsonKnownTypes(typeof(Actor_TransferResponse))]
+	[BsonKnownTypes(typeof(Actor_CreateUnits))]
+	[BsonKnownTypes(typeof(Frame_ClickMap))]
+	public partial class MessageObject {}
+
+}
+#endif
+namespace Model
+{
+	[ProtoInclude(OuterOpcode.Actor_Test, typeof(Actor_Test))]
+	[ProtoInclude(OuterOpcode.Actor_TestRequest, typeof(Actor_TestRequest))]
+	[ProtoInclude(OuterOpcode.Actor_TestResponse, typeof(Actor_TestResponse))]
+	[ProtoInclude(OuterOpcode.Actor_TransferRequest, typeof(Actor_TransferRequest))]
+	[ProtoInclude(OuterOpcode.Actor_TransferResponse, typeof(Actor_TransferResponse))]
+	[ProtoInclude(OuterOpcode.Actor_CreateUnits, typeof(Actor_CreateUnits))]
+	[ProtoInclude(OuterOpcode.Frame_ClickMap, typeof(Frame_ClickMap))]
+	public partial class MessageObject {}
+
+}

+ 2 - 2
Unity/Assets/Scripts/Message/OuterMessage.cs.meta → Unity/Assets/Scripts/Module/Message/OuterMessage.cs.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: a3ea7647c46dedb4186a28908a86005a
-timeCreated: 1498120812
+guid: 9009bea774938f34da3e876647989e07
+timeCreated: 1519802912
 licenseType: Free
 MonoImporter:
   serializedVersion: 2

+ 21 - 0
Unity/Assets/Scripts/Module/Message/OuterOpcode.cs

@@ -0,0 +1,21 @@
+namespace Model
+{
+	public static partial class OuterOpcode
+	{
+		 public const ushort Actor_Test = 101;
+		 public const ushort Actor_TestRequest = 102;
+		 public const ushort Actor_TestResponse = 103;
+		 public const ushort Actor_TransferRequest = 104;
+		 public const ushort Actor_TransferResponse = 105;
+		 public const ushort C2G_EnterMap = 106;
+		 public const ushort G2C_EnterMap = 107;
+		 public const ushort UnitInfo = 108;
+		 public const ushort Actor_CreateUnits = 109;
+		 public const ushort FrameMessageInfo = 110;
+		 public const ushort Frame_ClickMap = 111;
+		 public const ushort C2M_Reload = 112;
+		 public const ushort M2C_Reload = 113;
+		 public const ushort C2R_Ping = 114;
+		 public const ushort R2C_Ping = 115;
+	}
+}

+ 2 - 2
Unity/Assets/Scripts/Message/OuterOpcode.cs.meta → Unity/Assets/Scripts/Module/Message/OuterOpcode.cs.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: 744bed14ed54ae24b86904852fc00a5c
-timeCreated: 1498120812
+guid: 21a1091059a20734d9bdec1fe498d484
+timeCreated: 1519802912
 licenseType: Free
 MonoImporter:
   serializedVersion: 2

+ 33 - 33
Unity/Hotfix/Module/Message/HotfixMessage.cs

@@ -1,41 +1,41 @@
-using Hotfix;
+using ProtoBuf;
 using Model;
+using Hotfix;
+using System.Collections.Generic;
 using MongoDB.Bson.Serialization.Attributes;
-using ProtoBuf;
-
 namespace Hotfix
 {
 	[Message(HotfixOpcode.C2R_Login)]
 	[ProtoContract]
-	public class C2R_Login : MessageObject, IRequest
+	public partial class C2R_Login: IRequest
 	{
 		[ProtoMember(1, IsRequired = true)]
 		public string Account;
 
 		[ProtoMember(2, IsRequired = true)]
 		public string Password;
+
 	}
 
 	[Message(HotfixOpcode.R2C_Login)]
 	[ProtoContract]
-	public class R2C_Login : MessageObject, IResponse
+	public partial class R2C_Login: IResponse
 	{
+		[ProtoMember(90, IsRequired = true)]
+		public int Error { get; set; }
+		[ProtoMember(91, IsRequired = true)]
+		public string Message { get; set; }
 		[ProtoMember(1, IsRequired = true)]
 		public string Address;
 
 		[ProtoMember(2, IsRequired = true)]
 		public long Key;
 
-		[ProtoMember(90, IsRequired = true)]
-		public int Error { get; set; }
-
-		[ProtoMember(91, IsRequired = true)]
-		public string Message { get; set; }
 	}
 
 	[Message(HotfixOpcode.C2G_LoginGate)]
 	[ProtoContract]
-	public class C2G_LoginGate : MessageObject, IRequest
+	public partial class C2G_LoginGate: IRequest
 	{
 		[ProtoMember(1, IsRequired = true)]
 		public long Key;
@@ -44,60 +44,60 @@ namespace Hotfix
 
 	[Message(HotfixOpcode.G2C_LoginGate)]
 	[ProtoContract]
-	public class G2C_LoginGate : MessageObject, IResponse
+	public partial class G2C_LoginGate: IResponse
 	{
-		[ProtoMember(1, IsRequired = true)]
-		public long PlayerId;
-
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public long PlayerId;
+
 	}
 
 	[Message(HotfixOpcode.G2C_TestHotfixMessage)]
 	[ProtoContract]
-	public class G2C_TestHotfixMessage : MessageObject, IMessage
+	public partial class G2C_TestHotfixMessage: IMessage
 	{
 		[ProtoMember(1, IsRequired = true)]
 		public string Info;
+
 	}
 
 	[Message(HotfixOpcode.C2M_TestActorRequest)]
 	[ProtoContract]
-	public class C2M_TestActorRequest : MessageObject, IActorRequest
+	public partial class C2M_TestActorRequest: MessageObject, IActorRequest
 	{
 		[ProtoMember(1, IsRequired = true)]
 		public string Info;
+
 	}
 
 	[Message(HotfixOpcode.M2C_TestActorResponse)]
 	[ProtoContract]
-	public class M2C_TestActorResponse : MessageObject, IActorResponse
+	public partial class M2C_TestActorResponse: MessageObject, IActorResponse
 	{
-		[ProtoMember(1, IsRequired = true)]
-		public string Info;
-
 		[ProtoMember(90, IsRequired = true)]
 		public int Error { get; set; }
-
 		[ProtoMember(91, IsRequired = true)]
 		public string Message { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public string Info;
+
 	}
-}
 
+}
 #if SERVER
 namespace Model
 {
-	[BsonKnownTypes(typeof(M2C_TestActorResponse))]
 	[BsonKnownTypes(typeof(C2M_TestActorRequest))]
-	public partial class MessageObject
-	{
-	}
+	[BsonKnownTypes(typeof(M2C_TestActorResponse))]
+	public partial class MessageObject {}
+
+}
+#endif
+namespace Model
+{
+	public partial class MessageObject {}
+
 }
-#else
-	public partial class MessageObject
-	{
-	}
-#endif

+ 9 - 9
Unity/Hotfix/Module/Message/HotfixOpcode.cs

@@ -1,13 +1,13 @@
-namespace Hotfix
+namespace Model
 {
-	public static class HotfixOpcode
+	public static partial class HotfixOpcode
 	{
-		public const ushort C2R_Login = 10001;
-		public const ushort R2C_Login = 10002;
-		public const ushort C2G_LoginGate = 10003;
-		public const ushort G2C_LoginGate = 10004;
-		public const ushort G2C_TestHotfixMessage = 10005;
-		public const ushort C2M_TestActorRequest = 10006;
-		public const ushort M2C_TestActorResponse = 10007;
+		 public const ushort C2R_Login = 10001;
+		 public const ushort R2C_Login = 10002;
+		 public const ushort C2G_LoginGate = 10003;
+		 public const ushort G2C_LoginGate = 10004;
+		 public const ushort G2C_TestHotfixMessage = 10005;
+		 public const ushort C2M_TestActorRequest = 10006;
+		 public const ushort M2C_TestActorResponse = 10007;
 	}
 }

+ 8 - 2
Unity/Hotfix/Module/Message/IMessage.cs

@@ -2,6 +2,10 @@
 
 namespace Hotfix
 {
+	public partial class MessageObject
+	{
+	}
+
 	public interface IMessage
 	{
 	}
@@ -9,8 +13,10 @@ namespace Hotfix
 	public interface IRequest
 	{
 	}
-	
-	public interface IResponse
+
+	public interface IResponse : IMessage
 	{
+		int Error { get; set; }
+		string Message { get; set; }
 	}
 }

+ 0 - 1
Unity/Hotfix/Module/Message/OpcodeTypeComponent.cs

@@ -32,7 +32,6 @@ namespace Hotfix
 				{
 					continue;
 				}
-
 				this.opcodeTypes.Add(messageAttribute.Opcode, type);
 
 				ProtoBuf.PType.RegisterType(type.FullName, type);

+ 2 - 2
Unity/Unity.csproj

@@ -230,8 +230,6 @@
     <Compile Include="Assets\Scripts\Helper\ResourceHelper.cs" />
     <Compile Include="Assets\Scripts\Helper\ResourcesHelper.cs" />
     <Compile Include="Assets\Scripts\Init.cs" />
-    <Compile Include="Assets\Scripts\Message\OuterMessage.cs" />
-    <Compile Include="Assets\Scripts\Message\OuterOpcode.cs" />
     <Compile Include="Assets\Scripts\Module\BehaviorTree\BehaviorNodeConfig.cs" />
     <Compile Include="Assets\Scripts\Module\BehaviorTree\BehaviorTree.cs" />
     <Compile Include="Assets\Scripts\Module\BehaviorTree\BehaviorTreeArgsDict.cs" />
@@ -318,6 +316,8 @@
     <Compile Include="Assets\Scripts\Module\Message\Opcode.cs" />
     <Compile Include="Assets\Scripts\Module\Message\OpcodeHelper.cs" />
     <Compile Include="Assets\Scripts\Module\Message\OpcodeTypeComponent.cs" />
+    <Compile Include="Assets\Scripts\Module\Message\OuterMessage.cs" />
+    <Compile Include="Assets\Scripts\Module\Message\OuterOpcode.cs" />
     <Compile Include="Assets\Scripts\Module\Message\ProtobufPacker.cs" />
     <Compile Include="Assets\Scripts\Module\Message\RpcException.cs" />
     <Compile Include="Assets\Scripts\Module\Numeric\INumericWatcher.cs" />