|
@@ -13,7 +13,6 @@ namespace ET
|
|
|
switch (content)
|
|
switch (content)
|
|
|
{
|
|
{
|
|
|
case ConsoleMode.CreateRobot:
|
|
case ConsoleMode.CreateRobot:
|
|
|
- contex.Parent.RemoveComponent<ModeContex>();
|
|
|
|
|
Log.Console("CreateRobot args error!");
|
|
Log.Console("CreateRobot args error!");
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
@@ -23,19 +22,33 @@ namespace ET
|
|
|
.WithParsed(o => { options = o; });
|
|
.WithParsed(o => { options = o; });
|
|
|
|
|
|
|
|
// 获取当前进程的RobotScene
|
|
// 获取当前进程的RobotScene
|
|
|
- List<StartSceneConfig> robotSceneConfigs = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
|
|
|
|
|
- // 创建机器人
|
|
|
|
|
- for (int i = 0; i < options.Num; ++i)
|
|
|
|
|
|
|
+ using (ListComponent<StartSceneConfig> thisProcessRobotScenes = ListComponent<StartSceneConfig>.Create())
|
|
|
{
|
|
{
|
|
|
- int index = i % robotSceneConfigs.Count;
|
|
|
|
|
- StartSceneConfig robotSceneConfig = robotSceneConfigs[index];
|
|
|
|
|
- Scene robotScene = Game.Scene.Get(robotSceneConfig.Id);
|
|
|
|
|
- RobotManagerComponent robotManagerComponent = robotScene.GetComponent<RobotManagerComponent>();
|
|
|
|
|
- await robotManagerComponent.NewRobot(Game.Options.Process * 10000 + i);
|
|
|
|
|
|
|
+ List<StartSceneConfig> robotSceneConfigs = StartSceneConfigCategory.Instance.Robots;
|
|
|
|
|
+ foreach (StartSceneConfig robotSceneConfig in robotSceneConfigs)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (robotSceneConfig.Process != Game.Options.Process)
|
|
|
|
|
+ {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ thisProcessRobotScenes.List.Add(robotSceneConfig);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 创建机器人
|
|
|
|
|
+ for (int i = 0; i < options.Num; ++i)
|
|
|
|
|
+ {
|
|
|
|
|
+ int index = i % thisProcessRobotScenes.List.Count;
|
|
|
|
|
+ StartSceneConfig robotSceneConfig = thisProcessRobotScenes.List[index];
|
|
|
|
|
+ Scene robotScene = Game.Scene.Get(robotSceneConfig.Id);
|
|
|
|
|
+ RobotManagerComponent robotManagerComponent = robotScene.GetComponent<RobotManagerComponent>();
|
|
|
|
|
+ Scene robot = await robotManagerComponent.NewRobot(Game.Options.Process * 10000 + i);
|
|
|
|
|
+ Log.Console($"create robot {robot.Zone}");
|
|
|
|
|
+ await TimerComponent.Instance.WaitAsync(2000);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ contex.Parent.RemoveComponent<ModeContex>();
|
|
|
await ETTask.CompletedTask;
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|