RobotCase_FirstCase.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. namespace ET.Server
  3. {
  4. [Invoke(RobotCaseType.FirstCase)]
  5. public class RobotCase_FirstCase: ARobotCase
  6. {
  7. protected override async ETTask Run(RobotCase robotCase)
  8. {
  9. await ETTask.CompletedTask;
  10. // using ListComponent<Scene> robots = ListComponent<Scene>.Create();
  11. //
  12. // // 创建了两个机器人,生命周期是RobotCase,RobotCase_FirstCase.Run执行结束,机器人就会删除
  13. // await robotCase.NewRobot(2, robots);
  14. //
  15. // using ListComponent<ETTask> robotsTasks = ListComponent<ETTask>.Create();
  16. // for (int i = 0; i < 50; ++i)
  17. // {
  18. // robotsTasks.Add(robotCase.NewRobot(i, robots));
  19. // }
  20. //
  21. // await ETTaskHelper.WaitAll(robotsTasks);
  22. //
  23. // foreach (Scene robotScene in robots)
  24. // {
  25. // M2C_TestRobotCase response = await robotScene.GetComponent<Client.SessionComponent>().Session.Call(new C2M_TestRobotCase() {N = robotScene.Zone}) as M2C_TestRobotCase;
  26. // if (response.N != robotScene.Zone)
  27. // {
  28. // // 跟预期不一致就抛异常,外层会catch住在控制台上打印
  29. // throw new Exception($"robot case: {RobotCaseType.FirstCase} run fail!");
  30. // }
  31. // }
  32. }
  33. }
  34. }