修改步骤列表跳步骤的时候 先等前面的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);
if (finishAction != null)
{
finishAction.Start(this);
}
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = i, status = StepStatus.Finished }); TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = i, status = StepStatus.Finished });
if (finishAction!=null)
{
seq.Append(finishAction);
}
} }
curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start); seq.Start(this,() =>
{
curAction = ActionHelper.GetActionAndSub(steps[targetIndex].Start);
RunCurAction(curAction, targetIndex);
});
} }
else if (this.index > targetIndex) else if (this.index > targetIndex)
{ {
@ -151,28 +155,35 @@ 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);
} }
if (curAction != null)
}
}
public void RunCurAction(IAction curAction,int targetIndex)
{
if (curAction != null)
{
this.index = targetIndex;
isStepRun = true;
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = targetIndex, status = StepStatus.Start });
curAction.Start(this, () =>
{ {
this.index = targetIndex; isStepRun = false;
isStepRun = true;
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = targetIndex, status = StepStatus.Start });
curAction.Start(this, () =>
{
isStepRun = false;
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = targetIndex, status = StepStatus.Finished });
});
}
else
{
this.index = targetIndex;
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = targetIndex, status = StepStatus.Finished }); TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = targetIndex, status = StepStatus.Finished });
Execute(this.index + 1); });
} }
else
{
this.index = targetIndex;
TypeEventSystem.Global.Send(new StepStatusOnChange() { curIndex = targetIndex, status = StepStatus.Finished });
Execute(this.index + 1);
} }
} }
} }