ARobotCase.cs 777 B

12345678910111213141516171819202122
  1. namespace ET.Server
  2. {
  3. // 这里为什么能定义class呢?因为这里只有逻辑,热重载后新的handler替换旧的,仍然没有问题
  4. public abstract class ARobotCase: AInvokeHandler<RobotInvokeArgs, ETTask>
  5. {
  6. protected abstract ETTask Run(RobotCase robotCase);
  7. public override async ETTask Handle(RobotInvokeArgs a)
  8. {
  9. using RobotCase robotCase = await a.Fiber.Root.GetComponent<RobotCaseComponent>().New();
  10. try
  11. {
  12. await this.Run(robotCase);
  13. }
  14. catch (System.Exception e)
  15. {
  16. Log.Error($"{robotCase.Zone()} {e}");
  17. Log.Console($"RobotCase Error {this.GetType().FullName}:\n\t{e}");
  18. }
  19. }
  20. }
  21. }