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