Skip to main content

Controlling Transitions with Conditions and Action Chains

ThisdaIn pagethis walkspage, you through implementingimplement a conditional automatic transition for the DetailView, combining a timer with a checkbox value. The central concept heretheme is the division of roles: the Action Chain Editor is wherethe youplace to build the processing flow, andwhile the Condition Editor is wherethe youplace independentlyto define the condition expressions.expression independently. You will create abuild behavior that returns to the MainView after a certain amount of time haselapses elapsed sinceafter entering the DetailView, while stopping thatthe automatic auto-transition only when the KeepDetailOpenCheckBoxKeep Detail Open CheckBox is checked.on. This lets you understand inthe practicecoordination howof Triggers,triggers, Conditions,conditions, and Actionsactions workin together.practice. In particular, in this page, setting the OperationMode of Check Processed Value to CompareExternalValueWithConditionValue is the key to correct operation on this page.behavior.

Configuring the CheckBox Control

First, you convert the state of the CheckBox control placed in the DetailContent scene into a form thatreadable by the Condition Editor can read.Editor. If you skip this step, you cannot use the current checkchecked state withinin a condition expression.

  1. Double-click the DetailContent scene to open the Scene Editor.

  2. Select KeepDetailOpenCheckBox inIn the Scene Tree.Tree, select KeepDetailOpenCheckBox.

  3. Drag and drop a Forward Value behavior onto the Extra Scene Tree.

  4. Select the added Forward Value behavior you just added and configure the following properties in the Properties panel:
    Property Category Item Value
     Asset EventDispatchStrategy DedicatedBehavior

  5. Add a Value behavior under the DedicatedBehavior node of the Forward Value behavior.

  6. Drag and drop the added Value behavior you just added onto the DetailContent scene in the Scene Tree to associate it.

ThisWith configurationthis causesconfiguration, the current value of the CheckBox control'scontrol current value to beis held on the scene nodenode, side, making it available toand the Condition Editor can reference it as an external value. The Valuetarget that you created here is the target you will specify as the ValueBehavior in the next step.step is the Value you created here.

Configuring the ConditionBlock

Here, you define the condition logic that determines whether the automatic transition is allowed, separately from the Action Chain. By isolatingSeparating the condition,condition youmakes canit easier to understand the processing flow and the evaluation logic independently.

In this task, you createbuild a condition that evaluates tobecomes true only when both the timer has fired and the KeepDetailOpenCheckBoxKeep Detail Open CheckBox is unchecked.off. This is the heart of the conditional transition.

  1. SelectIn theSolution SolutionExplorer, folder inselect the Solution Explorer,folder thenand select Add > New Item from the context menu.

  2. Select ConditionBlock fromIn the New Item dialogdialog, select ConditionBlock and name it ReturnToMainOnTimeoutCondition.ReturnToMainOnTimeoutCondition.
    • The Condition Editor panel appears,appears displayingand displays the diagram forof the newly created ReturnToMainOnTimeoutCondition > Condition.

  3. Right-clickOn the diagramdiagram, use the context menu and select Add Check > Condition > Control > Check Timer to add it to the diagram.

  4. Similarly,In the same way, from the context menu, select Add Check > Condition > Control > Check Processed Value from the context menu to add it to the diagram.

  5. Select the added Check Processed Value you just added and configure the following properties in the Properties panel:
    Property Category Item Value
    Asset OperationMode CompareExternalValueWithConditionValue
      ConditionOperator Equal
      ConditionValue type Bool
      ConditionValue False
      ValueBehavior DetailContent scene > Value

  6. Next, from the context menu, select Add AND from the context menu to add an AND node.

  7. Connect Check Timer and Check Processed Value to the AND node.AND.

  8. Connect the output of the AND node to ConditionOutput.the ConditionOutput.
    drawing-4-1779261704.png

The meaning of the condition createdbuilt here means:is: allow the automatic transition only when the timer has fired and the checkbox is unchecked.off. The OperationMode setting is particularlyespecially important. If you set thisit to aan processed-in-process event-dependent mode such as CompareProcessedValueWithConditionValue, no value event to compare against exists for comparison at the time of the Timer event, and the condition cannotis benot evaluated correctly. The correct choice here is CompareExternalValueWithConditionValue, which references the external value held on the scene node.

Configuring the DetailView On Entry Settingfor DetailView

Next, you configure athe settingaction that starts athe timer at the moment youof enter theentering DetailView. NoAt this point, no transition occurs atyet this— point; this stepyou only establishesset up the reference time for the subsequent condition evaluation.

You can edit a View's OnEntry action in the OnEntry / OnExit Editing Mode of the Action Chain Editor. This tutorial uses this method.

  1. Double-click MainViewTree to open the View Tree panel.

  2. Double-click DetailView to open the Action Chain Editor.
In the left pane of the Action Chain Editor, double-click State > OnEntry.
    The OnEntry pseudo-block appears in the right pane.

    On the right side of the pseudo-block, select Add Action > Action > Control > Start Timer from the context menu to add a Start Timer action.

    Select DetailViewthe added Start Timer and configure the following properties in the Properties panel:
    Property Category Item Value
    StateAsset OnEntry > ActionDelay Start Timer
      OnEntry > Delay 3000

    This settingconfiguration meansmeans: thatuse 3the moment three seconds after entering the DetailView is used as the timing for the automatic transition evaluation.decision. Note that starting the timer and performing the transition itself are separate configurations. The content added to OnEntry in the Action Chain Editor is automatically synchronized with the OnEntry property of DetailView.

    Configuring the Action Chain

    Finally, you build thea processing flow that receives the timer firing,event, evaluates the ConditionOutput, and returns to the MainView only when the result is true. This is wherethe first point at which the Action Chain Editor and the Condition Editor work together for the first time.together.

    1. Double-click MainViewTree to open the View Tree panel.

    2. Double-click DetailView to open the Action Chain Editor.

    3. Double-click ActionChain1 inIn the left panepane, double-click ActionChain1 to open the diagram.

    4. Right-clickOn the diagramdiagram, andfrom the context menu Add Condition, select the Condition of the previouslyReturnToMainOnTimeoutCondition you created CloseMenuOnTimeoutCondition from Add Conditionearlier to add it.

    5. SelectFrom the context menu, select Add Action > Action > Views > Jump To View from the context menu and place it on the diagram.

    6. Select the Jump To View and configure the following properties in the Properties panel:
      Property Category Item Value
      General Name JumpToMainViewAfterTimeout
      Asset View MainView

    7. From

      Selectthe context menu, select Add Trigger > Condition > Control > Check Timer from the context menu and place it on the diagram.

    8. On

      Connectthe diagram, connect Check Timer andto Condition on the diagram.

      Condition.


      drawing-4-1779261731.png

    9. Finally, snap the **Jump To View**View action to the **Condition**Condition to connect them.
      drawing-4-1779261757.png

    This configuration means: when the Check Timer fires, the system evaluatesevaluate the ConditionOutput of ReturnToMainOnTimeoutCondition, and ifreturn to MainView only when the result is true, returns to the MainView.true. If you connect Check Timer anddirectly to Jump To View directly,View, the system always returns after the timer elapses,elapses and cannot reflect the checkbox state. By placing thea ConditionOutput in between, the transition becomes a conditional for the first time.one.

    Verifying the Behavior in the Player

    ThisIn verificationthis confirmsverification, you confirm not onlyjust the automatic transition triggered by the timer,timer itself, but also that the behavior changes depending on the checkbox state. This is the final check to ensureverify that the division of roles between the Action Chain and the Condition is functioning correctly.

    1. Save the solution and startlaunch the Player.
      • Verify that the MainView appearsis displayed immediately after startup.launch.

    2. Click the Open Detail. button.
      • Verify that the displayscreen switches to the DetailView.

    3. Leave the Keep Detail Open checkbox uncheckedoff and wait 3for three seconds.
      • Verify that the display automaticallyscreen returns to theMainView MainView.automatically.

    4. Click the Open Detail button again.

    5. This time, checkturn the Keep Detail Open checkbox.checkbox on.
      • Verify that the displayscreen does not return automatically return even after approximatelywaiting 3about three seconds.

    6. Verify that you can return to the MainView by clicking the Back. button.

    OnIn this page, you used the Action Chain Editor and the Condition Editor together to implementimplemented a conditional automatic transition whose behavior changes dependingaccording onto the UI state.state, by coordinating the Action Chain Editor with the Condition Editor. With this, you have practiced all four basic functionsfeatures of the View Editor: creating screen-level Views within the View Definition Editor, structuringconfiguring their relationships within the View Tree, building processing flows within the Action Chain Editor, and isolatingseparating condition expressions within the Condition Editor. ThisThe completescomplete flow of the entire tutorial series.is now finished.