Răsfoiți Sursa

C2M_Reload消息不需要发送一个AppType的数组了

tanghai 9 ani în urmă
părinte
comite
dd6b13657b

+ 1 - 1
Server/Controller/Message/C2M_ReloadHandler.cs

@@ -16,7 +16,7 @@ namespace Controller
 				NetInnerComponent netInnerComponent = Game.Scene.GetComponent<NetInnerComponent>();
 				foreach (StartConfig startConfig in startConfigComponent.GetAll())
 				{
-					if (!message.AppType.Contains(startConfig.AppType))
+					if (!message.AppType.Is(startConfig.AppType))
 					{
 						continue;
 					}

+ 0 - 9
Unity/Assets/Editor/ServerCommandLineEditor/Component.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: 24f0b40b39c2f954d9e5e63bbb17f3d6
-folderAsset: yes
-timeCreated: 1476673759
-licenseType: Pro
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 4 - 4
Unity/Assets/Editor/ServerManagerEditor/ServerManagerEditor.cs

@@ -34,8 +34,8 @@ namespace MyEditor
 				return;
 			}
 
-			
-			List<AppType> selected = new List<AppType>();
+
+			AppType reloadType = AppType.None;
 			this.isAll = GUILayout.Toggle(this.isAll, "All");
 			if (this.isAll)
 			{
@@ -62,14 +62,14 @@ namespace MyEditor
 				{
 					if (this.isCheck[i])
 					{
-						selected.Add(this.serverTypes[i]);
+						reloadType = reloadType | this.serverTypes[i];
 					}
 				}
 				NetworkComponent networkComponent = Game.Scene.GetComponent<NetOuterComponent>();
 				Session session = networkComponent.Get($"{this.managerAddress}");
 				try
 				{
-					session.Call<C2M_Reload, M2C_Reload>(new C2M_Reload { AppType = selected });
+					session.Call<C2M_Reload, M2C_Reload>(new C2M_Reload { AppType = reloadType });
 				}
 				catch (RpcException e)
 				{

+ 2 - 2
Unity/Assets/Scripts/Component/MessageDispatherComponent.cs

@@ -28,7 +28,7 @@ namespace Model
 	{
 		private AppType AppType;
 		private Dictionary<ushort, List<IMHandler>> handlers;
-		private Dictionary<Type, MessageAttribute> messageOpcode { get; set; } = new Dictionary<Type, MessageAttribute>();
+		private Dictionary<Type, MessageAttribute> messageOpcode { get; set; }
 		
 		public void Awake(AppType appType)
 		{
@@ -71,7 +71,7 @@ namespace Model
 					}
 
 					MessageHandlerAttribute messageHandlerAttribute = (MessageHandlerAttribute)attrs[0];
-					if (!messageHandlerAttribute.Contains(this.AppType))
+					if (!messageHandlerAttribute.Type.Is(this.AppType))
 					{
 						continue;
 					}

+ 1 - 5
Unity/Assets/Scripts/Message/AppType.cs

@@ -3,14 +3,10 @@ using System.Collections.Generic;
 
 namespace Model
 {
-	public class ServerType: Attribute
-	{
-		
-	}
-	
 	[Flags]
 	public enum AppType
 	{
+		None = 0,
 		Manager = 1,
 		Realm = 2,
 		Gate = 4,

+ 1 - 1
Unity/Assets/Scripts/Message/Message.cs

@@ -91,7 +91,7 @@ namespace Model
 	[BsonIgnoreExtraElements]
 	public class C2M_Reload : ARequest
 	{
-		public List<AppType> AppType = new List<AppType>();
+		public AppType AppType;
 	}
 
 	[Message(11)]

+ 2 - 8
Unity/Assets/Scripts/Message/MessageHandlerAttribute.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 
 namespace Model
 {
@@ -8,16 +7,11 @@ namespace Model
 	/// </summary>
 	public class MessageHandlerAttribute : Attribute
 	{
-		private readonly AppType type;
+		public AppType Type { get; }
 
 		public MessageHandlerAttribute(AppType appType)
 		{
-			this.type = appType;
-		}
-
-		public bool Contains(AppType appType)
-		{
-			return this.type.Is(appType);
+			this.Type = appType;
 		}
 	}
 }

+ 1 - 3
Unity/Unity.sln

@@ -1,8 +1,6 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 10.0.40219.1
+# Visual Studio 2015
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.CSharp.Plugins", "Unity.CSharp.Plugins.csproj", "{1AA60596-6964-87F6-2427-6CA85BBAF27D}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.CSharp", "Unity.CSharp.csproj", "{4123F183-8F61-27AE-EA27-294DDE0CC7EB}"