Skip to main content

Part 5: Count Received Calls

ThisPart chapter5 describesexplains how to count the receivedincoming calls and display them in the Main Menu Scene.scene. ToThe achievenumber this,of incoming calls is the Statenumber Machineof willtimes sendthe text “Incoming Call” set in Part 4 is displayed. The result is sent to the TextNode of the Main Menu scene as an event with a relative value as event tovia the TextNodeState in Scene Main Menu.Machine.


Add TextNode to

The Main Menu scene will be displayed in the Scene Tree panel.

Drag and drop athe TextNodeText Node from the ToolBox[Node into2D] in the Toolbox panel onto the Main Menu scene in the Scene Tree. 

drawing-5-1732876656.png

Open the TextBox's properties and configure its position. The textText of the TextNodeNode will be set via a Behavior, which is explaineddisplayed in sectionthe ConfigureScene BehaviorsEditor as "Text".

Set the following properties for TextNode.the added Text Node in the Properties panel.

drawing-5-1729253173.png
Transformations>Position X 325
Y 0 2D Text Node>Text Received Calls: %d

OnEntry Settings

    Double-click IncomingCall_StateMachine in the [ State Machines ] folder in the Solution Explorer. 

      The MainState MenuMachine SceneEditor will lookbe like this now.displayed.

      drawing-5-1729253210.png

      Configure Active State

      OpenWith the IncomingCall_StateMachineCallActive inState selected, click [ Fusion ] at the bottom left of the State Machine Editor panel. 

        The Fusion panel for the CallActive State will be displayed.

         

        Drag the [ On Entry Actions ] connector on the right of the CallActive Fusion node and move the mouse.

         

        A link will appear as you move the mouse, so release the left mouse button at the any location.
          The [ Select Behavior ] dialog will be displayed. The selectable behaviors will be displayed by double-clickingcategory.

          Select “Action > Property > Send Value As Event” from the list and connect it to the top node. 

            You can also narrow down the list of behaviors in the dialog by entering “Send Value As Event” in the search field at the top of the dialog. Send Value As Event is connected to [ CallActive > On Exit Actions ].

             

            The settings in the table below are made for the connected Send Value As Event. 

              When the CallActive State is entered, a relative value (Relative) 1 is sent to the TextNode that was just added.

              TargetNode Scenes>Main Menu>TextNode Value Ulnt32, 1 ChangeValue Relative
              drawing-4-1742279518.png

               

              Adding a TextNode

                Double-click IncomingCall_StateMachine in the [ State Machines ] folder in the Solution Explorer. Select

                the
                Call Active

                The State andMachine addEditor anotherwill OnEntrybe Actiondisplayed.

                by clicking After selecting a TextNode on the '+'scene signtree, nextclick [Fusion] displayed in the Extra Scene Tree on the left side of the scene tree.
                  The Fusion panel will open, and the Fusion diagram for TextNode Fusion will open.

                  Drag the [ Behaviors ] connector on the right of the TextNode Fusion node and move the mouse.

                   

                  A link will appear as you move the mouse, so release the left mouse button at the any location.
                    The [ Select Behavior ] dialog will be displayed. The selectable behaviors will be displayed by category.

                    Select “Value Processing > Value” from the list and connect it to OnEntry.the top node. 

                    Configure

                    toYou executecan actionalso narrow down the list of behaviors in the dialog by entering “Value” in the search field at the top of the dialog. Send Value As Event whenis enteringconnected to [ TextNode > Behaviors ].

                     

                    Drag the Call[ ActiveReceivers State.] The relative value 1 shall be sent to the TextNode in Scene MainMenu.

                    drawing-5-1729247786.png

                    To select the TargetNode clickconnector on the magnifying glass icon and select the TextNode of Scene MainMenu in the Choose Item dialog.

                    drawing-5-1729247865.png

                    We have now configured the State to send a value. The next step is to configure the TextNode to receive the value.


                    Configure Behaviors for TextNode

                    Select the TextNode in the Scene Tree Panel. Drag and drop a Value Behavior from the ToolBox Controls into the right side of the Scene Tree Panel below Behaviors. This Behavior is the Behavior to receive the values from the received calls.

                    drawing-5-1732876741.png

                    Drag and drop a Format String behavior onto the Receivers of the Value Behavior.Behavior Fusion node and move the mouse.

                     

                    drawing-5-1732876802.png
                    A
                    link will appear as you move the mouse, so release the left mouse button at the any location.

                    Select “Value Processing > Format String” from the Formatlist Stringand behaviorconnect it to the top node. 

                      You can also narrow down the list of behaviors in the rightdialog partby entering “Format String” in the search field at the top of the Scenedialog. TreeSend panelValue As Event is connected to [ Value > Receivers ].

                       

                      Enter “Received Calls: %d” in the [ Text ] of the Format String Behavior Fusion node.
                      drawing-4-1742279571.png

                       

                      Verifying Action

                      Use the Player to check the operation of the configuration you have set in the previous section.

                      Checking the incoming call count operation

                        Click the [ Play selected scenario ] icon on the toolbar to start the Player.
                          Three windows will open, and configurein one of them, the simulation display, in addition to “Navi Title” and “Navigation”, “Received Call: 0” will be displayed to the right of “Navi Title”.
                          By pressing the Enter key on the keyboard, the text to“Incoming Received Calls: %d The part with %dCall” will beappear evaluatedon similarthe screen.
                            As a result, “Received Call: 0” changes to the“Received printfCall: syntax.1”.
                            drawing-5-1729252878.png

                            Test

                            Pressing the ConfigurationESC -key Starton the Playerkeyboard

                            Savehides yourthe solution“Incoming Call” text displayed on the screen.

                            Press the Enter key on the keyboard again to make “Incoming Call” reappear, and startit thewill player.change
                            to
                            “Received
                            Call:
                            drawing-5-1729252939.png
                            2”.
                            As
                            a

                            After the Player is opened,result, you can seeconfirm the Navigation Scene, on the right side you can see the new "Received Calls" TextNode.

                            drawing-5-1694778838.png

                            When Pressing the Key_RightArrow, the transition to the Media scene is performed and the selected device is the default device "Radio".

                            drawing-5-1694778903.png

                            If you press the Key_Enter, the Incoming Calls Scene gets visible, the Media Scene is still displayed in the background andthat the number of receivedincoming calls inis being counted correctly.

                            Close the TextNodeCGI isPanel increasedand byexit 1.the
                            Player.
                            All
                            drawing-5-1694778966.png
                            three
                            windows that were open will close.