Skip to main content

Part 5: Count Received Calls

This chapter describes how to count the received calls and display them in the Main Menu Scene. To achieve this, the State Machine will send a relative value as event to the TextNode in Scene Main Menu.


Add TextNode to Main Menu Scene

Drag and drop a TextNode from the ToolBox into the Scene Tree.

drawing-7-1676624757.png

Open the TextBox's properties and configure its position and text. The text of a TextNode contains %d, which will be evaluated similar to the printf syntax.

drawing-7-1676624796.png

The Main Menu Scene will look like this now.

drawing-7-1676624822.png

Configure Active State

Open the IncomingCall_StateMachine in the State Machine Editor by double-clicking it in the Solution Explorer. Select the Call Active State and add another OnEntry Action by clicking on the '+' sign next to OnEntry.

Configure to execute action Send Value As Event when entering the Call Active State. The relative value 1 shall be sent to the TextNode in Scene MainMenu.

drawing-7-1676624852.png

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

drawing-7-1676624881.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-7-1676624937.png

Drag and drop a Format String behavior onto the Receivers of the Value Behavior.

drawing-7-1676624986.png

Select the Format String behavior in the right part of the Scene Tree panel and configure the text to Received Calls: %d The part with %d will be evaluated similar to the printf syntax.

drawing-7-1676625018.png

Test the Configuration - Start the Player

Save your solution and start the player.

drawing-7-1676625043.png

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

drawing-7-1676625060.png

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

drawing-7-1676625092.png

If you press the Key_Enter, the Incoming Calls Scene gets visible, the Media Scene is still displayed in the background and the number of received calls in the TextNode is increased by 1.

drawing-7-1676625119.png