tanghai 8 лет назад
Родитель
Сommit
4bd92a60cf

+ 206 - 0
Proto/InnerMessage.proto

@@ -0,0 +1,206 @@
+	/// <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
+	{
+		required Unit Unit = 1;
+	}
+	
+	message M2M_TrasferUnitResponse // AResponse
+	{
+	}
+	
+	message M2A_Reload // ARequest
+	{
+	}
+
+	message A2M_Reload // AResponse
+	{
+	}
+
+	message G2G_LockRequest // ARequest
+	{
+		required int64 Id = 1;
+		required string Address = 2;
+	}
+
+	message G2G_LockResponse // AResponse
+	{
+	}
+
+	message G2G_LockReleaseRequest // ARequest
+	{
+		required int64 Id = 1;
+		required string Address = 2;
+	}
+
+	message G2G_LockReleaseResponse // AResponse
+	{
+	}
+
+	message DBSaveRequest // ARequest
+	{
+		required bool NeedCache = 1;
+
+		required string CollectionName = 2;
+
+		required Disposer Disposer = 3;
+	}
+
+
+	message DBSaveBatchResponse // AResponse
+	{
+	}
+
+	message DBSaveBatchRequest // ARequest
+	{
+		required bool NeedCache = 1;
+		required string CollectionName = 2;
+		repeated Disposer Disposers = 3;
+	}
+
+	message DBSaveResponse // AResponse
+	{
+	}
+
+	message DBQueryRequest // ARequest
+	{
+		required int64 Id = 1;
+		required string CollectionName = 2;
+		required bool NeedCache = 3;
+	}
+
+	message DBQueryResponse // AResponse
+	{
+		required Disposer Disposer = 1;
+	}
+
+	message DBQueryBatchRequest // ARequest
+	{
+		required string CollectionName = 1;
+		repeated int64 IdList = 2;
+		required bool NeedCache = 3;
+	}
+
+	message DBQueryBatchResponse // AResponse
+	{
+		repeated Disposer Disposers = 1;
+	}
+
+	message DBQueryJsonRequest // ARequest
+	{
+		required string CollectionName = 1;
+		required string Json = 2;
+		required bool NeedCache = 3;
+	}
+
+	message DBQueryJsonResponse // AResponse
+	{
+		repeated Disposer Disposers = 1;
+	}
+
+	message ObjectAddRequest // ARequest
+	{
+		required int64 Key = 1;
+		required int AppId = 2;
+	}
+
+	message ObjectAddResponse // AResponse
+	{
+	}
+
+	message ObjectRemoveRequest // ARequest
+	{
+		required int64 Key = 1;
+	}
+
+	message ObjectRemoveResponse // AResponse
+	{
+	}
+
+	message ObjectLockRequest // ARequest
+	{
+		required int64 Key = 1;
+		required int LockAppId = 2;
+		required int Time = 3;
+	}
+
+	message ObjectLockResponse // AResponse
+	{
+	}
+
+	message ObjectUnLockRequest // ARequest
+	{
+		required int64 Key = 1;
+		required int UnLockAppId = 2;
+		required int AppId = 3;
+	}
+
+	message ObjectUnLockResponse // AResponse
+	{
+	}
+
+	message ObjectGetRequest // ARequest
+	{
+		required int64 Key = 1;
+	}
+
+	message ObjectGetResponse // AResponse
+	{
+		required int AppId = 1;
+	}
+
+	message R2G_GetLoginKey // ARequest
+	{
+		required string Account = 1;
+	}
+
+	message G2R_GetLoginKey // AResponse
+	{
+		required int64 Key = 1;
+	}
+
+	message G2M_CreateUnit // ARequest
+	{
+		required int64 PlayerId = 1;
+		required int64 GateSessionId = 2;
+	}
+
+	message M2G_CreateUnit // AResponse
+	{
+		required int64 UnitId = 1;
+		required int Count = 2;
+	}
+}

+ 102 - 0
Proto/OuterMessage.proto

@@ -0,0 +1,102 @@
+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
+{
+	required string Info = 1;
+}
+
+message Actor_TestRequest // AActorRequest
+{
+	required string request = 1;
+}
+
+message Actor_TestResponse // AActorResponse
+{
+	required string response = 1;
+}
+
+message Actor_TransferRequest // AActorRequest
+{
+	required int32 MapIndex = 1;
+}
+
+message Actor_TransferResponse // AActorResponse
+{
+}
+
+message C2G_EnterMap // ARequest
+{
+}
+
+message G2C_EnterMap // AResponse
+{
+	required int64 UnitId = 1;
+	required int32 Count  = 2;
+}
+
+message UnitInfo
+{
+	required int64 UnitId  = 1;
+	required int32 X       = 2;
+	required int32 Z       = 3;
+}
+
+message Actor_CreateUnits // AActorMessage
+{
+    repeated UnitInfo Units = 1;
+}
+
+message FrameMessageInfo
+{
+	required int64 Id = 1;
+	required AMessage Message = 2;
+}
+
+message FrameMessage // AActorMessage
+{
+	required int32 Frame = 1;
+	repeated AFrameMessage Messages = 2;
+}
+
+message Frame_ClickMap // AFrameMessage
+{
+	required int32 X = 1;
+	required int32 Z = 2;
+}
+
+message C2M_Reload // ARequest
+{
+	required AppType AppType = 1;
+}
+
+message M2C_Reload // AResponse
+{
+}
+
+message C2R_Ping // ARequest
+{
+}
+
+message R2C_Ping // AResponse
+{
+}

+ 1 - 4
Server/Model/Base/Message/AMActorHandler.cs

@@ -29,10 +29,7 @@ namespace Model
 			{
 				return;
 			}
-			ActorResponse response = new ActorResponse
-			{
-				RpcId = message.RpcId
-			};
+			ActorResponse response = new ActorResponse { RpcId = message.RpcId };
 			session.Reply(response);
 		}
 

Разница между файлами не показана из-за своего большого размера
+ 0 - 3
Server/Model/Entity/Message/InnerMessage.cs


+ 9 - 0
Unity/Assets/Editor/Proto2CsEditor.meta

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

+ 251 - 0
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs

@@ -0,0 +1,251 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using Model;
+using UnityEditor;
+
+namespace MyEditor
+{
+	class OpcodeInfo
+	{
+		public string Name;
+		public int Opcode;
+	}
+
+	[Flags]
+	public enum HeadFlag
+	{
+		Bson = 1,
+		Proto = 2,
+	}
+	
+	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 static readonly char[] splitChars = { ' ', '\t' };
+		private static 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("OuterMessage.proto", outerOutPath, 100, HeadFlag.Proto | HeadFlag.Bson);
+			Proto2CS("InnerMessage.proto", innerOutPath, 1000, HeadFlag.Bson);
+			
+			GenerateOpcode();
+			
+			AssetDatabase.Refresh();
+		}
+		
+		public static void Proto2CS(string protoName, string outputPath, int startOpcode, HeadFlag flag)
+		{
+			parentMsg = new MultiMap<string, string>();
+			string proto = Path.Combine(protoPath, protoName);
+			string csPath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(proto) + ".cs");
+
+			string s = File.ReadAllText(proto);
+
+			StringBuilder sb = new StringBuilder();
+			sb.Append("using ProtoBuf;\n");
+			sb.Append("using System.Collections.Generic;\n");
+			sb.Append("using MongoDB.Bson.Serialization.Attributes;\n");
+			sb.Append("namespace Model\n");
+			sb.Append("{\n");
+
+			bool isMsgStart = false;
+			foreach (string line in s.Split('\n'))
+			{
+				string newline = line.Trim();
+
+				if (newline == "")
+				{
+					continue;
+				}
+
+				if (newline.StartsWith("//"))
+				{
+					sb.Append($"{newline}\n");
+				}
+
+				if (newline.StartsWith("message"))
+				{
+					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);
+					}
+
+					msgOpcode.Add(new OpcodeInfo() { Name = msgName, Opcode = ++startOpcode});
+					
+					sb.Append($"\t[Message(Opcode.{msgName})]\n");
+					sb.Append($"\t[ProtoContract]\n");
+					sb.Append($"\tpublic partial class {msgName}");
+					if (parentClass != "")
+					{
+						sb.Append($": {parentClass}\n");
+					}
+					else
+					{
+						sb.Append("\n");
+					}
+				}
+
+				if (isMsgStart && newline == "{")
+				{
+					sb.Append("\t{\n");
+				}
+
+				// 成员
+				if (newline.StartsWith("required"))
+				{
+					Members(sb, newline, true);
+				}
+
+				if (newline.StartsWith("optional"))
+				{
+					Members(sb, newline, false);
+				}
+
+				if (newline.StartsWith("repeated"))
+				{
+					Repeated(sb, newline);
+				}
+
+				if (isMsgStart && newline == "}")
+				{
+					isMsgStart = false;
+					sb.Append("\t}\n\n");
+				}
+			}
+			GenerateHead(sb, flag);
+			sb.Append("}\n");
+			
+			File.WriteAllText(csPath, sb.ToString());
+		}
+
+		private static void GenerateHead(StringBuilder sb, HeadFlag flag)
+		{
+			foreach (string parentClass in parentMsg.GetDictionary().Keys)
+			{
+				if ((flag & HeadFlag.Proto) != 0)
+				{
+					foreach (string s in parentMsg.GetAll(parentClass))
+					{
+						sb.Append($"\t[ProtoInclude((int)Opcode.{s}, typeof({s}))]\n");
+					}
+				}
+
+				if ((flag & HeadFlag.Bson) != 0)
+				{
+					foreach (string s in parentMsg.GetAll(parentClass))
+					{
+						sb.Append($"\t[BsonKnownTypes(typeof({s}))]\n");
+					}
+				}
+
+
+				sb.Append($"\tpublic partial class {parentClass} {{}}\n\n");
+			}
+		}
+		
+		private static void GenerateOpcode()
+		{
+			StringBuilder sb = new StringBuilder();
+			sb.AppendLine("namespace Model");
+			sb.AppendLine("{");
+			sb.AppendLine("\tpublic enum Opcode: ushort");
+			sb.AppendLine("\t{");
+			foreach (OpcodeInfo info in msgOpcode)
+			{
+				sb.AppendLine($"\t\t{info.Name} = {info.Opcode},");
+			}
+			sb.AppendLine("\t}");
+			sb.AppendLine("}");
+
+			File.WriteAllText(opcodePath, sb.ToString());
+		}
+
+		private static void Repeated(StringBuilder sb, string newline)
+		{
+			try
+			{
+				int index = newline.IndexOf(";");
+				newline = newline.Remove(index);
+				string[] ss = newline.Split(splitChars, StringSplitOptions.RemoveEmptyEntries);
+				string type = ss[1];
+				type = ConvertType(type);
+				string name = ss[2];
+				int order = int.Parse(ss[4]);
+				sb.Append($"\t\t[ProtoMember({order})]\n");
+				sb.Append($"\t\tpublic List<{type}> {name} = new List<{type}>();\n\n");
+			}
+			catch (Exception e)
+			{
+				Log.Error($"{newline}\n {e}");
+			}
+
+		}
+
+		private static string ConvertType(string type)
+		{
+			string typeCs = "";
+			switch (type)
+			{
+				case "int32":
+					typeCs = "int";
+					break;
+				case "bytes":
+					typeCs = "byte[]";
+					break;
+				case "uint32":
+					typeCs = "uint";
+					break;
+				case "long":
+					typeCs = "long";
+					break;
+				case "int64":
+					typeCs = "long";
+					break;
+				case "uint64":
+					typeCs = "ulong";
+					break;
+				default:
+					typeCs = type;
+					break;
+			}
+			return typeCs;
+		}
+
+		private static void Members(StringBuilder sb, string newline, bool isRequired)
+		{
+			try
+			{
+				int index = newline.IndexOf(";");
+				newline = newline.Remove(index);
+				string[] ss = newline.Split(splitChars, StringSplitOptions.RemoveEmptyEntries);
+				string type = ss[1];
+				string name = ss[2];
+				int order = int.Parse(ss[4]);
+				sb.Append($"\t\t[ProtoMember({order}, IsRequired = {isRequired.ToString().ToLower()})]\n");
+				string typeCs = ConvertType(type);
+
+				sb.Append($"\t\tpublic {typeCs} {name};\n\n");
+			}
+			catch (Exception e)
+			{
+				Log.Error($"{newline}\n {e}");
+			}
+
+		}
+	}
+}

+ 12 - 0
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4eb91415eb00caf45ac2d0c0a6be283f
+timeCreated: 1514895524
+licenseType: Free
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 5 - 2
Unity/Assets/Scripts/Base/Message/AActorMessage.cs

@@ -1,9 +1,12 @@
-using ProtoBuf;
+using MongoDB.Bson.Serialization.Attributes;
+using ProtoBuf;
 
 // 不要在这个文件加[ProtoInclude]跟[BsonKnowType]标签,加到InnerMessage.cs或者OuterMessage.cs里面去
 namespace Model
 {
 	[ProtoContract]
+	[BsonKnownTypes(typeof(AFrameMessage))]
+	[BsonKnownTypes(typeof(FrameMessage))]
 	public abstract partial class AActorMessage : AMessage
 	{
 	}
@@ -21,7 +24,7 @@ namespace Model
 	[ProtoContract]
 	public abstract partial class AFrameMessage : AActorMessage
 	{
-		[ProtoMember(1)]
+		[ProtoMember(90)]
 		public long Id;
 	}
 }

+ 9 - 4
Unity/Assets/Scripts/Base/Message/AMessage.cs

@@ -5,6 +5,9 @@ using ProtoBuf;
 namespace Model
 {
 	[ProtoContract]
+	[BsonKnownTypes(typeof(AActorMessage))]
+	[BsonKnownTypes(typeof(ARequest))]
+	[BsonKnownTypes(typeof(AActorResponse))]
 	public abstract partial class AMessage
 	{
 		public override string ToString()
@@ -14,9 +17,10 @@ namespace Model
 	}
 
 	[ProtoContract]
+	[BsonKnownTypes(typeof(AActorRequest))]
 	public abstract partial class ARequest : AMessage
 	{
-		[ProtoMember(1000)]
+		[ProtoMember(90)]
 		[BsonIgnoreIfDefault]
 		public uint RpcId;
 	}
@@ -25,15 +29,16 @@ namespace Model
 	/// 服务端回的RPC消息需要继承这个抽象类
 	/// </summary>
 	[ProtoContract]
+	[BsonKnownTypes(typeof(AActorResponse))]
 	public abstract partial class AResponse : AMessage
 	{
-		[ProtoMember(1000)]
+		[ProtoMember(90)]
 		public uint RpcId;
 
-		[ProtoMember(1001)]
+		[ProtoMember(91)]
 		public int Error = 0;
 
-		[ProtoMember(1002)]
+		[ProtoMember(92)]
 		public string Message = "";
 	}
 }

+ 57 - 73
Unity/Assets/Scripts/Entity/Message/Opcode.cs

@@ -1,78 +1,62 @@
-namespace Model
+namespace Model
 {
-	// 客户端 100 - 999, 服务端内部1000以上
 	public enum Opcode: ushort
 	{
-		ARequest = 1,
-		AResponse = 2,
-		AActorMessage = 3,
-		AActorRequest = 4,
-		AActorResponse = 5,
-		ActorRequest = 6,
-		ActorResponse = 7,
-		ActorRpcRequest = 8,
-		ActorRpcResponse = 9,
-		AFrameMessage = 10,
-
-		FrameMessage = 100,
-		C2R_Login,
-		R2C_Login,
-		R2C_ServerLog,
-		C2G_LoginGate,
-		G2C_LoginGate,
-		C2G_EnterMap,
-		G2C_EnterMap,
-		C2M_Reload,
-		M2C_Reload,
-		C2R_Ping,
-		R2C_Ping,
-
-		Actor_Test,
-		Actor_TestRequest,
-		Actor_TestResponse,
-		Actor_TransferRequest,
-		Actor_TransferResponse,
-		Frame_ClickMap,
-		Actor_CreateUnits,
-
-		// 服务端Opcode, 从1000开始
-		G2G_LockRequest = 1000,
-		G2G_LockResponse,
-		G2G_LockReleaseRequest,
-		G2G_LockReleaseResponse,
-
-		M2A_Reload,
-		A2M_Reload,
-
-		DBSaveRequest,
-		DBSaveResponse,
-		DBQueryRequest,
-		DBQueryResponse,
-		DBSaveBatchResponse,
-		DBSaveBatchRequest,
-		DBQueryBatchRequest,
-		DBQueryBatchResponse,
-		DBQueryJsonRequest,
-		DBQueryJsonResponse,
-
-		ObjectAddRequest,
-		ObjectAddResponse,
-		ObjectRemoveRequest,
-		ObjectRemoveResponse,
-		ObjectLockRequest,
-		ObjectLockResponse,
-		ObjectUnLockRequest,
-		ObjectUnLockResponse,
-		ObjectGetRequest,
-		ObjectGetResponse,
-
-		R2G_GetLoginKey,
-		G2R_GetLoginKey,
-
-		G2M_CreateUnit,
-		M2G_CreateUnit,
-
-		M2M_TrasferUnitRequest,
-		M2M_TrasferUnitResponse,
+		C2R_Login = 101,
+		R2C_Login = 102,
+		C2G_LoginGate = 103,
+		G2C_LoginGate = 104,
+		Actor_Test = 105,
+		Actor_TestRequest = 106,
+		Actor_TestResponse = 107,
+		Actor_TransferRequest = 108,
+		Actor_TransferResponse = 109,
+		C2G_EnterMap = 110,
+		G2C_EnterMap = 111,
+		UnitInfo = 112,
+		Actor_CreateUnits = 113,
+		FrameMessageInfo = 114,
+		FrameMessage = 115,
+		Frame_ClickMap = 116,
+		C2M_Reload = 117,
+		M2C_Reload = 118,
+		C2R_Ping = 119,
+		R2C_Ping = 120,
+		ActorRequest = 1001,
+		ActorResponse = 1002,
+		ActorRpcRequest = 1003,
+		ActorRpcResponse = 1004,
+		M2M_TrasferUnitRequest = 1005,
+		M2M_TrasferUnitResponse = 1006,
+		M2A_Reload = 1007,
+		A2M_Reload = 1008,
+		G2G_LockRequest = 1009,
+		G2G_LockResponse = 1010,
+		G2G_LockReleaseRequest = 1011,
+		G2G_LockReleaseResponse = 1012,
+		DBSaveRequest = 1013,
+		DBSaveBatchResponse = 1014,
+		DBSaveBatchRequest = 1015,
+		DBSaveResponse = 1016,
+		DBQueryRequest = 1017,
+		DBQueryResponse = 1018,
+		DBQueryBatchRequest = 1019,
+		DBQueryBatchResponse = 1020,
+		DBQueryJsonRequest = 1021,
+		DBQueryJsonResponse = 1022,
+		ObjectAddRequest = 1023,
+		ObjectAddResponse = 1024,
+		ObjectRemoveRequest = 1025,
+		ObjectRemoveResponse = 1026,
+		ObjectLockRequest = 1027,
+		ObjectLockResponse = 1028,
+		ObjectUnLockRequest = 1029,
+		ObjectUnLockResponse = 1030,
+		ObjectGetRequest = 1031,
+		ObjectGetResponse = 1032,
+		R2G_GetLoginKey = 1033,
+		G2R_GetLoginKey = 1034,
+		G2M_CreateUnit = 1035,
+		M2G_CreateUnit = 1036,
 	}
 }

+ 136 - 107
Unity/Assets/Scripts/Entity/Message/OuterMessage.cs

@@ -1,214 +1,243 @@
+using ProtoBuf;
 using System.Collections.Generic;
 using MongoDB.Bson.Serialization.Attributes;
-using ProtoBuf;
-
 namespace Model
 {
-	[BsonKnownTypes(typeof(AActorMessage))]
-	public abstract partial class AMessage
-	{
-	}
-
-	[BsonKnownTypes(typeof(AActorRequest))]
-	[ProtoInclude((int)Opcode.C2R_Login, typeof(C2R_Login))]
-	[ProtoInclude((int)Opcode.C2G_LoginGate, typeof(C2G_LoginGate))]
-	[ProtoInclude((int)Opcode.C2G_EnterMap, typeof(C2G_EnterMap))]
-	[ProtoInclude((int)Opcode.C2R_Ping, typeof(C2R_Ping))]
-	public abstract partial class ARequest : AMessage
-	{
-	}
-
-	[BsonKnownTypes(typeof(AActorResponse))]
-	[ProtoInclude((int)Opcode.R2C_Login, typeof(R2C_Login))]
-	[ProtoInclude((int)Opcode.G2C_LoginGate, typeof(G2C_LoginGate))]
-	[ProtoInclude((int)Opcode.G2C_EnterMap, typeof(G2C_EnterMap))]
-	[ProtoInclude((int)Opcode.R2C_Ping, typeof(R2C_Ping))]
-	public abstract partial class AResponse : AMessage
-	{
-	}
-
-	[BsonKnownTypes(typeof(Actor_Test))]
-	[BsonKnownTypes(typeof(AFrameMessage))]
-	[BsonKnownTypes(typeof(Actor_CreateUnits))]
-	[BsonKnownTypes(typeof(FrameMessage))]
-	[ProtoInclude((int)Opcode.FrameMessage, typeof(FrameMessage))]
-	[ProtoInclude((int)Opcode.AFrameMessage, typeof(AFrameMessage))]
-	[ProtoInclude((int)Opcode.Actor_CreateUnits, typeof(Actor_CreateUnits))]
-	public abstract partial class AActorMessage : AMessage
-	{
-	}
-
-	[BsonKnownTypes(typeof(Actor_TestRequest))]
-	[BsonKnownTypes(typeof(Actor_TransferRequest))]
-	public abstract partial class AActorRequest : ARequest
-	{
-	}
-
-	[BsonKnownTypes(typeof(Actor_TestResponse))]
-	[BsonKnownTypes(typeof(Actor_TransferResponse))]
-	public abstract partial class AActorResponse : AResponse
-	{
-	}
-
-	/// <summary>
-	/// 帧消息,继承这个类的消息会经过服务端转发
-	/// </summary>
-	[ProtoInclude((int)Opcode.Frame_ClickMap, typeof(Frame_ClickMap))]
-	[BsonKnownTypes(typeof(Frame_ClickMap))]
-	public abstract partial class AFrameMessage : AActorMessage
-	{
-	}
-
-	[ProtoContract]
 	[Message(Opcode.C2R_Login)]
-	public class C2R_Login: ARequest
+	[ProtoContract]
+	public partial class C2R_Login:  ARequest
 	{
-		[ProtoMember(1)]
+		[ProtoMember(1, IsRequired = true)]
 		public string Account;
 
-		[ProtoMember(2)]
+		[ProtoMember(2, IsRequired = true)]
 		public string Password;
+
 	}
 
-	[ProtoContract]
 	[Message(Opcode.R2C_Login)]
-	public class R2C_Login: AResponse
+	[ProtoContract]
+	public partial class R2C_Login:  AResponse
 	{
-		[ProtoMember(1)]
-		public string Address { get; set; }
+		[ProtoMember(1, IsRequired = true)]
+		public string Address;
+
+		[ProtoMember(2, IsRequired = true)]
+		public long Key;
 
-		[ProtoMember(2)]
-		public long Key { get; set; }
 	}
 
-	[ProtoContract]
 	[Message(Opcode.C2G_LoginGate)]
-	public class C2G_LoginGate: ARequest
+	[ProtoContract]
+	public partial class C2G_LoginGate:  ARequest
 	{
-		[ProtoMember(1)]
+		[ProtoMember(1, IsRequired = true)]
 		public long Key;
+
 	}
 
-	[ProtoContract]
 	[Message(Opcode.G2C_LoginGate)]
-	public class G2C_LoginGate: AResponse
+	[ProtoContract]
+	public partial class G2C_LoginGate:  AResponse
 	{
-		[ProtoMember(1)]
+		[ProtoMember(1, IsRequired = true)]
 		public long PlayerId;
-	}
 
+	}
 
 	[Message(Opcode.Actor_Test)]
-	public class Actor_Test : AActorMessage
+	[ProtoContract]
+	public partial class Actor_Test:  AActorMessage
 	{
+		[ProtoMember(1, IsRequired = true)]
 		public string Info;
+
 	}
 
 	[Message(Opcode.Actor_TestRequest)]
-	public class Actor_TestRequest : AActorRequest
+	[ProtoContract]
+	public partial class Actor_TestRequest:  AActorRequest
 	{
+		[ProtoMember(1, IsRequired = true)]
 		public string request;
+
 	}
 
 	[Message(Opcode.Actor_TestResponse)]
-	public class Actor_TestResponse : AActorResponse
+	[ProtoContract]
+	public partial class Actor_TestResponse:  AActorResponse
 	{
+		[ProtoMember(1, IsRequired = true)]
 		public string response;
-	}
 
+	}
 
 	[Message(Opcode.Actor_TransferRequest)]
-	public class Actor_TransferRequest : AActorRequest
+	[ProtoContract]
+	public partial class Actor_TransferRequest:  AActorRequest
 	{
+		[ProtoMember(1, IsRequired = true)]
 		public int MapIndex;
+
 	}
 
 	[Message(Opcode.Actor_TransferResponse)]
-	public class Actor_TransferResponse : AActorResponse
+	[ProtoContract]
+	public partial class Actor_TransferResponse:  AActorResponse
 	{
 	}
 
-	[ProtoContract]
 	[Message(Opcode.C2G_EnterMap)]
-	public class C2G_EnterMap: ARequest
+	[ProtoContract]
+	public partial class C2G_EnterMap:  ARequest
 	{
 	}
 
-	[ProtoContract]
 	[Message(Opcode.G2C_EnterMap)]
-	public class G2C_EnterMap: AResponse
+	[ProtoContract]
+	public partial class G2C_EnterMap:  AResponse
 	{
-		[ProtoMember(1)]
+		[ProtoMember(1, IsRequired = true)]
 		public long UnitId;
-		[ProtoMember(2)]
+
+		[ProtoMember(2, IsRequired = true)]
 		public int Count;
+
 	}
 
+	[Message(Opcode.UnitInfo)]
 	[ProtoContract]
-	public class UnitInfo
+	public partial class UnitInfo
 	{
-		[ProtoMember(1)]
+		[ProtoMember(1, IsRequired = true)]
 		public long UnitId;
-		[ProtoMember(2)]
+
+		[ProtoMember(2, IsRequired = true)]
 		public int X;
-		[ProtoMember(3)]
+
+		[ProtoMember(3, IsRequired = true)]
 		public int Z;
+
 	}
 
-	[ProtoContract]
 	[Message(Opcode.Actor_CreateUnits)]
-	public class Actor_CreateUnits : AActorMessage
+	[ProtoContract]
+	public partial class Actor_CreateUnits:  AActorMessage
 	{
 		[ProtoMember(1)]
 		public List<UnitInfo> Units = new List<UnitInfo>();
+
 	}
 
-	public struct FrameMessageInfo
+	[Message(Opcode.FrameMessageInfo)]
+	[ProtoContract]
+	public partial class FrameMessageInfo
 	{
+		[ProtoMember(1, IsRequired = true)]
 		public long Id;
+
+		[ProtoMember(2, IsRequired = true)]
 		public AMessage Message;
+
 	}
 
-	[ProtoContract]
 	[Message(Opcode.FrameMessage)]
-	public class FrameMessage : AActorMessage
+	[ProtoContract]
+	public partial class FrameMessage:  AActorMessage
 	{
-		[ProtoMember(1)]
+		[ProtoMember(1, IsRequired = true)]
 		public int Frame;
+
 		[ProtoMember(2)]
 		public List<AFrameMessage> Messages = new List<AFrameMessage>();
+
 	}
 
-	[ProtoContract]
 	[Message(Opcode.Frame_ClickMap)]
-	public class Frame_ClickMap: AFrameMessage
+	[ProtoContract]
+	public partial class Frame_ClickMap:  AFrameMessage
 	{
-		[ProtoMember(1)]
+		[ProtoMember(1, IsRequired = true)]
 		public int X;
-		[ProtoMember(2)]
+
+		[ProtoMember(2, IsRequired = true)]
 		public int Z;
+
 	}
 
 	[Message(Opcode.C2M_Reload)]
-	public class C2M_Reload: ARequest
+	[ProtoContract]
+	public partial class C2M_Reload:  ARequest
 	{
+		[ProtoMember(1, IsRequired = true)]
 		public AppType AppType;
+
 	}
 
 	[Message(Opcode.M2C_Reload)]
-	public class M2C_Reload: AResponse
+	[ProtoContract]
+	public partial class M2C_Reload:  AResponse
 	{
 	}
 
-	[ProtoContract]
 	[Message(Opcode.C2R_Ping)]
-	public class C2R_Ping: ARequest
+	[ProtoContract]
+	public partial class C2R_Ping:  ARequest
 	{
 	}
 
-	[ProtoContract]
 	[Message(Opcode.R2C_Ping)]
-	public class R2C_Ping: AResponse
+	[ProtoContract]
+	public partial class R2C_Ping:  AResponse
 	{
 	}
-}
+
+	[ProtoInclude((int)Opcode.Actor_Test, typeof(Actor_Test))]
+	[ProtoInclude((int)Opcode.Actor_CreateUnits, typeof(Actor_CreateUnits))]
+	[ProtoInclude((int)Opcode.FrameMessage, typeof(FrameMessage))]
+	[BsonKnownTypes(typeof(Actor_Test))]
+	[BsonKnownTypes(typeof(Actor_CreateUnits))]
+	[BsonKnownTypes(typeof(FrameMessage))]
+	public partial class  AActorMessage {}
+
+	[ProtoInclude((int)Opcode.Actor_TestRequest, typeof(Actor_TestRequest))]
+	[ProtoInclude((int)Opcode.Actor_TransferRequest, typeof(Actor_TransferRequest))]
+	[BsonKnownTypes(typeof(Actor_TestRequest))]
+	[BsonKnownTypes(typeof(Actor_TransferRequest))]
+	public partial class  AActorRequest {}
+
+	[ProtoInclude((int)Opcode.Actor_TestResponse, typeof(Actor_TestResponse))]
+	[ProtoInclude((int)Opcode.Actor_TransferResponse, typeof(Actor_TransferResponse))]
+	[BsonKnownTypes(typeof(Actor_TestResponse))]
+	[BsonKnownTypes(typeof(Actor_TransferResponse))]
+	public partial class  AActorResponse {}
+
+	[ProtoInclude((int)Opcode.Frame_ClickMap, typeof(Frame_ClickMap))]
+	[BsonKnownTypes(typeof(Frame_ClickMap))]
+	public partial class  AFrameMessage {}
+
+	[ProtoInclude((int)Opcode.C2R_Login, typeof(C2R_Login))]
+	[ProtoInclude((int)Opcode.C2G_LoginGate, typeof(C2G_LoginGate))]
+	[ProtoInclude((int)Opcode.C2G_EnterMap, typeof(C2G_EnterMap))]
+	[ProtoInclude((int)Opcode.C2M_Reload, typeof(C2M_Reload))]
+	[ProtoInclude((int)Opcode.C2R_Ping, typeof(C2R_Ping))]
+	[BsonKnownTypes(typeof(C2R_Login))]
+	[BsonKnownTypes(typeof(C2G_LoginGate))]
+	[BsonKnownTypes(typeof(C2G_EnterMap))]
+	[BsonKnownTypes(typeof(C2M_Reload))]
+	[BsonKnownTypes(typeof(C2R_Ping))]
+	public partial class  ARequest {}
+
+	[ProtoInclude((int)Opcode.R2C_Login, typeof(R2C_Login))]
+	[ProtoInclude((int)Opcode.G2C_LoginGate, typeof(G2C_LoginGate))]
+	[ProtoInclude((int)Opcode.G2C_EnterMap, typeof(G2C_EnterMap))]
+	[ProtoInclude((int)Opcode.M2C_Reload, typeof(M2C_Reload))]
+	[ProtoInclude((int)Opcode.R2C_Ping, typeof(R2C_Ping))]
+	[BsonKnownTypes(typeof(R2C_Login))]
+	[BsonKnownTypes(typeof(G2C_LoginGate))]
+	[BsonKnownTypes(typeof(G2C_EnterMap))]
+	[BsonKnownTypes(typeof(M2C_Reload))]
+	[BsonKnownTypes(typeof(R2C_Ping))]
+	public partial class  AResponse {}
+
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов