CTT/Server/Hotfix/Game/Helper/GlobalMethodHelper.cs

23 lines
626 B
C#
Executable File

namespace ET
{
public static class GlobalMethodHelper
{
public static async ETTask Call(string methodName, object args)
{
var dic = Game.Scene.GetComponent<GlobalMethodComponent>().methodDic;
if (!dic.TryGetValue(methodName, out var action))
{
Log.Error($"don't has the mrthod : {methodName}");
return;
}
if (action == null)
{
Log.Error($"action == null where name = {methodName}");
return;
}
await action.Invoke(args);
}
}
}