修改步骤列表跳步骤的时候 先等前面的finished执行完毕

This commit is contained in:
shenjianxing 2024-12-27 19:54:54 +08:00
parent aff0e81e67
commit d6f069c408

View File

@ -124,18 +124,22 @@ public class OperationController : MonoSingleton<OperationController>
{ {
if (this.index < targetIndex) if (this.index < targetIndex)
{ {
var seq = ActionKit.Sequence();
for (int i = this.index + 1; i < targetIndex; i++) for (int i = this.index + 1; i < targetIndex; i++)
{ {
// Íê³É¶¯×÷ Ö±½ÓÖ´ÐÐ // Íê³É¶¯×÷ Ö±½ÓÖ´ÐÐ
IAction finishAction = ActionHelper.GetActionAndSub(steps[i].Finished); IAction finishAction = ActionHelper.GetActionAndSub(steps[i].Finished);
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = i, status = StepStatus.Finished });
if (finishAction!=null) if (finishAction!=null)
{ {
finishAction.Start(this); seq.Append(finishAction);
} }
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = i, status = StepStatus.Finished });
} }
seq.Start(this,() =>
{
curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start); curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start);
RunCurAction(curAction, targetIndex);
});
} }
else if (this.index > targetIndex) else if (this.index > targetIndex)
{ {
@ -151,11 +155,19 @@ public class OperationController : MonoSingleton<OperationController>
} }
curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start); curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start);
RunCurAction(curAction, targetIndex);
} }
else else
{ {
curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start); curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start);
RunCurAction(curAction, targetIndex);
} }
}
}
public void RunCurAction(IAction curAction,int targetIndex)
{
if (curAction != null) if (curAction != null)
{ {
this.index = targetIndex; this.index = targetIndex;
@ -175,4 +187,3 @@ public class OperationController : MonoSingleton<OperationController>
} }
} }
} }
}