Просмотр исходного кода

获取Type的方式修改,增加getmonotype方法

tanghai 8 лет назад
Родитель
Сommit
79b4325e0b

+ 1 - 1
Unity/Assets/Scripts/Component/EventComponent.cs

@@ -18,7 +18,7 @@ namespace Model
 		{
 			this.allEvents = new Dictionary<int, List<object>>();
 
-			Type[] types = DllHelper.GetAllTypes();
+			Type[] types = DllHelper.GetMonoTypes();
 			foreach (Type type in types)
 			{
 				object[] attrs = type.GetCustomAttributes(typeof(EventAttribute), false);

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

@@ -24,7 +24,7 @@ namespace Model
 			this.handlers = new Dictionary<ushort, List<IInstanceMethod>>();
 			this.opcodeTypes = new DoubleMap<ushort, Type>();
 
-			Type[] monoTypes = DllHelper.GetAllTypes();
+			Type[] monoTypes = DllHelper.GetMonoTypes();
 			foreach (Type monoType in monoTypes)
 			{
 				object[] attrs = monoType.GetCustomAttributes(typeof(MessageAttribute), false);
@@ -42,7 +42,7 @@ namespace Model
 				this.opcodeTypes.Add(messageAttribute.Opcode, monoType);
 			}
 			
-			Type[] types = DllHelper.GetAllTypes();
+			Type[] types = DllHelper.GetMonoTypes();
 
 			foreach (Type type in types)
 			{

+ 6 - 1
Unity/Assets/Scripts/DllHelper.cs

@@ -20,7 +20,7 @@ namespace Model
 			return assembly;
 		}
 
-		public static Type[] GetAllTypes()
+		public static Type[] GetHotfixTypes()
 		{
 			ILRuntime.Runtime.Enviorment.AppDomain appDomain = Init.Instance.AppDomain;
 			if (appDomain == null)
@@ -36,6 +36,11 @@ namespace Model
 			return types.ToArray();
 		}
 
+		public static Type[] GetMonoTypes()
+		{
+			return typeof(Game).Assembly.GetTypes();
+		}
+
 		public static IMethod[] GetMethodInfo(string typeName)
 		{
 			ILRuntime.Runtime.Enviorment.AppDomain appDomain = Init.Instance.AppDomain;

+ 1 - 1
Unity/Hotfix/Component/ConfigComponent.cs

@@ -11,7 +11,7 @@ namespace Hotfix
 		private void Load()
 		{
 			this.allConfig = new Dictionary<Type, ICategory>();
-			Type[] types = DllHelper.GetAllTypes();
+			Type[] types = DllHelper.GetHotfixTypes();
 
 			foreach (Type type in types)
 			{

+ 1 - 1
Unity/Hotfix/Component/EventComponent.cs

@@ -18,7 +18,7 @@ namespace Hotfix
 		{
 			this.allEvents = new Dictionary<int, List<object>>();
 
-			Type[] types = DllHelper.GetAllTypes();
+			Type[] types = DllHelper.GetHotfixTypes();
 			foreach (Type type in types)
 			{
 				object[] attrs = type.GetCustomAttributes(typeof(EventAttribute), false);

+ 1 - 1
Unity/Hotfix/Component/UIComponent.cs

@@ -69,7 +69,7 @@ namespace Hotfix
 		{
 			this.UiTypes = new Dictionary<int, IUIFactory>();
 			
-			Type[] types = DllHelper.GetAllTypes();
+			Type[] types = DllHelper.GetHotfixTypes();
 
 			foreach (Type type in types)
 			{