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

23 lines
677 B
C#
Raw Normal View History

2021-04-24 17:39:11 +08:00
namespace ET
{
public static class GlobalMethodHelper
{
2021-09-07 16:20:46 +08:00
public static async ETTask<string> Call(string methodName, object args)
2021-04-24 17:39:11 +08:00
{
var dic = Game.Scene.GetComponent<GlobalMethodComponent>().methodDic;
if (!dic.TryGetValue(methodName, out var action))
{
Log.Error($"don't has the mrthod : {methodName}");
2021-09-07 16:20:46 +08:00
return "系统错误001";
2021-04-24 17:39:11 +08:00
}
2021-05-01 11:27:41 +08:00
if (action == null)
{
Log.Error($"action == null where name = {methodName}");
2021-09-07 16:20:46 +08:00
return "系统错误002";
2021-05-01 11:27:41 +08:00
}
2021-09-07 16:20:46 +08:00
return await action.Invoke(args);
2021-04-24 17:39:11 +08:00
}
}
}