using System; using System.Reflection; namespace ET { public class GlobalMethodComponentAwakeSystem:AwakeSystem { public override void Awake(GlobalMethodComponent self) { foreach (MethodInfo methodInfo in typeof(GlobalMethod).GetMethods(BindingFlags.Public | BindingFlags.Static)) { DataTableMethodAttribute attribute= methodInfo.GetCustomAttribute(); if (attribute == null) continue; var action= methodInfo.CreateDelegate(typeof (Func>)) as Func>; self.methodDic.Add(methodInfo.Name,action); } } } public class GlobalMethodComponentLoadSystem:LoadSystem { public override void Load(GlobalMethodComponent self) { self.methodDic.Clear(); foreach (MethodInfo methodInfo in typeof(GlobalMethod).GetMethods(BindingFlags.Public | BindingFlags.Static)) { DataTableMethodAttribute attribute= methodInfo.GetCustomAttribute(); if (attribute == null) continue; var action= methodInfo.CreateDelegate(typeof (Func>)) as Func>; self.methodDic.Add(methodInfo.Name,action); } } } }