Skip to main content

Part 4: Add an Incoming Call

If CGI Studio Scene Composer supports multiple global StateMachines,State Machines, you can add an incoming call scene that will poppops up onwhen ayou pressingtype e.g.Enter key_enteror other key and vanishesdisappears again when pressingyou e.g.type key_escape.Escape or other key.

Creatig

the
IncomingCall scene

Configure the IncomingCall Scene

The IncomingCall scene is created by duplicating the Phone scene.

    In [Solution Explorer], select [Scenes > Phone], then choose [Clone] from the context menu.

    Create IncomingCall State Machine Add States for Active and Inactive Call Configure the States - OnEntry and OnExit Actions Insert Transitions Configure State Transitions Test the Configuration - Start the Player

    Prepare an Incoming Call Scene

    In the Solution[Clone Explorer,Item] copydialog, select [Single Clone], rename [Name] to "IncomingCall", then click [OK].

      The IncomingCall scene will be created.

      The scene tree will display the alreadynewly existingcreated PhoneIncomingCall scene.

       

      Select the text node in the IncomingCall scene tree, then update [Text] in the [Properties] panel under [2D Text Node] to "Incoming Call".

        The text displayed in the Scene Editor will change to "Incoming Call".

        To change the position of the text node on the Scene Editor, change the [Transform] setting in the text node's properties panel to the following.

        Position X 28 Position Y 220

         

        Drag and pastedrop a [Solid Color Node] from [Node 2D] in the [Toolbox] panel onto the TextNode in the [IncomingCall] scene tree.
          The SolidColorNode will be placed on the scene tree. By placing it intoabove the ScenesTextNode folderon usingthe CTRL+Cscene tree, the added SolidColorNode can be used as the background for the TextNode. If you are unable to place it below the TextNode, you can adjust its position by dragging and Ctrl+V.dropping Renameit after placing it on the scene tree. The node added to the scene tree by this operation will have its [Position] set to X=0, Y=0 automatically in the [Transform] section of the Properties panel.

          To change the position of the SolidColorNode on the scene editor, change the [Transform] setting in the SolidColorNode's property panel to the following.
          Position X 5 Position Y 200 After selecting the SolidColorNode on the scene tree, select the SolidColorBrushBlend that appears in the extra scene tree.
            The properties of the SolidColorBrushBlend effect will be displayed in the Properties panel.

            To change the color and size of the SolidColorNode, set the following items in the Properties panel as shown in the table below.

            Effect

            FillColor

            Red

            1.0

            Green

            0.0

            Blue

            0.0

            Alpha

            1.0

            Size X 380 Y 90

            The settings for the Incoming Call scene are now complete.

             

            Sequence Number Configuration

            Set the rendering order for the new scene tocreated "Phone IncomingCall".

            drawing-5-1729230618.png

            Openin the sceneprevious "Phonesection. IncomingCall",In this case, we will set it to 4, so we will also change the rendering order of the Swap Scene Camera, which was originally set to 4.

              In the Render Target panel, select IncomingCall/Camera.
                The properties of the TextNodeIncomingCall andcamera changewill itsbe text to "Phone – Incoming Call"displayed in the Properties Panel.panel.

                Add a line-break intoIn the TextProperties propertypanel, by keeping Key_Shift pressed while hitting Key_Enter. Adjustchange the TextNode'svalue Positionof [Sequence Number] in the Transformation[Camera] properties.category
                to
                4.

                drawing-5-1729230974.png

                ToNext, makeselect thisSwap\Camera Incoming Call more noticeable, add a SolidColorNode intoin the backgroundRender Target panel. 

                  The properties of the TextNode.Swap Tocamera dowill this,be dragdisplayed in the Properties panel.

                  In the Properties panel, change the value of [Sequence Number] in the [Camera] category to 5.

                  drawing-4-1742280096.png


                  Creating an IncomingCall State Machine

                  We will create and dropconfigure a SolidColorNodenew State Machine for the IncomingCall scene.

                  Creating a new State Machine

                    Select [ State Machines > New State Machine ] from the ToolBoxmenu intobar.
                      The [ New State Machine ] dialog will appear. Click [ Browse ] at the Scenetop Editor.

                      Make sure thatof the SolidColorNodedialog.

                        The [ Select Location ] dialog will appear.
                        Select StateMachines and click [ OK ].
                          The location “/State Machines” is placedselected as the save location for the new State Machine. Set [ Name ] in the backgrounddialog to "IncomingCall_StateMachine" and click the [ OK ] button.
                            The IncomingCall_StateMachine is newly created in the [ State Machines ] folder in the Solution Explorer.
                            drawing-4-1742280069.png

                            Setting the Global State Machine

                              Select the IncomingCall_StateMachine in the [ State Machines ] folder in the Solution Explorer.
                                The IncomingCall_StateMachine properties will be displayed in the Properties panel. Enable the [ Is Global ] checkbox in the [ General ] category of the TextNode.properties. You
                                mightThe wantIncomingCall_StateMachine towill changebe set as a Global State Machine.

                                Adding a State

                                  Double-click on IncomingCall_StateMachine in the front[ State Machines ] folder in the Solution Explorer.
                                    The State Machine Editor will appear. There is already one Initial State and backone orderState.

                                    Select a State on the State Machine Editor. 

                                      The properties of the TextNodeselected and the SolidColorNode in the Scene Tree by dragging the TextNode onto the "Phone IncomingCall" item. ThisState will bringbe the TextNode into the foreground. You can see the correct order of this scene's nodes in the picture on the right below.

                                      drawing-5-1732876507.png

                                      The next step is to change the SolidColorNode's position.

                                      drawing-5-1729234509.png

                                      To adjust the SolidColorNode's size and color select the SolidColorNode in the Scene Tree Panel. This makes its behaviors and effects visible just a few centimeters to the right in the same panel. Select the SolidColorBrushBlend effect to see its propertiesdisplayed in the Properties Panel.

                                       

                                      drawing-5-1732876573.png

                                      Change the FillColor by clicking on the rectangle or use the input fields for Red, Green and Blue. Change the size so that the SolidColorNode works as a background.

                                      drawing-5-1729234627.png
                                      Adjust the Scene's Camera

                                      The Phone IncomingCall scene should be rendered above any other content scene. Therefore we have to correct render order[Name] in the Render[General] Targetscategory Panel. Our Phone IncomingCall Camera needs to have Sequence Number 4, the Swap Camera's Sequence number has to be increased as well (5).

                                      drawing-5-1729234936.png

                                      Create IncomingCall State Machine

                                      Create a new State Machine to handle the Phone IncomingCall scene using the menu and change the name to IncomingCall_StateMachine.

                                      drawing-5-1729235051.png

                                      You can see the newly created StateMachine in the Solution Explorer. Double click the IncomingCall StateMachine in the Solution Explorer to edit it in the StateMachine Editor. Inof the Properties Panel changeto CallInactive. 

                                        The State name on the State Machine Editor will change to global.CallInactive.

                                        drawing-5-1729236613.png

                                        Add States for Active and Inactive Call

                                        DragNext, andplace Drop an Initiala State andfrom twothe normaltoolbar Statesat intothe top right of the State Machine Editor.

                                        And

                                         change

                                        Change the statesnames namesof the added States to somethingCallInActive.

                                        more meaningful like Call InactiveDrag and Calldrop Active.[Transition] from the toolbar at the top of the panel to the Initial State in IncomingCall_State. 
                                          Transition will be connected to the Initial State and become ready to be placed.

                                          While Transition is ready to be placed, click on CallInactive State.
                                          drawing-4-1742280026.png

                                           

                                           

                                          You can

                                          rename

                                          OnEntry/OnExit asettings

                                          state

                                          When bytransitioning selectingto each State (entering and exiting States), it is necessary to activate and deactivate the corresponding scenes. 

                                          Scene display settings
                                            With the CallActive State selected, click [ Fusion ] in the list on thelower left of the State Machine Editor andpanel. change
                                              The Fusion panel for the nameNavigation 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 category.
                                                Select “Action > Transition > Transition Request” from the list and connect it to the top node.
                                                  You can also narrow down the list of behaviors in the Propertiesdialog Panel.by Orentering select“Transition the stateRequest” in the list,search right-clickfield and useat the shortcut menu.
                                                  drawing-5-1729236735.png


                                                  Configure the States - OnEntry and OnExit Actions

                                                  Select the CallActive State and add an OnEntry as well as an OnExit Action in the Properties Panel. Do this by clicking on the + sign.

                                                    For the OnEntry Action configure a Transition Requesttop of type Activate. Choose the Phone IncomingCall Scene as Identifier. To choose the identifier, click on the magnifying glass icon and select the Scene in the Select Item dialog. ForThe the OnExit Action configure a Transition Request ofis typeconnected Deactivateto [CallActive > On Exit Actions]. Choose the Phone IncomingCall Scene as Identifier.
                                                    drawing-5-1729237166.png
                                                    Repeat
                                                    the
                                                    same
                                                    process
                                                    for

                                                    Insertthe Transitions

                                                    [On Exit Actions] of the CallActive Fusion node to connect the Transition Request Fusion node.

                                                    Make the following settings for the two Transition Requests that you have connected.
                                                    On Entry Actions RequestType Activate Identifier IncomingCall scene On Exit Actions RequestType Deactivate Identifier IncomingCall scene
                                                    Transition settings between each State

                                                    ConnectNext, thesewe Stateswill withset transitions:up the transitions between each State (CallInactive and CallActive).

                                                      1. From the initialtoolbar stateat tothe statetop Callright Inactive.
                                                    From state Call Inactive to state Call Active. From state Call Active to state Call Inactive.
                                                    drawing-5-1729241061.png

                                                    Configure State Transitions

                                                    Configureof the State TransitionsMachine Editor, drag the Transition and drop it onto the CallInactive State (the starting side of the transition).

                                                      The Transition (arrow) will appear on the State Machine Editor and be ready to definebe whichdragged.

                                                      keypress Extend the Transition (arrow) to the CallActive State (end of transition) and click.
                                                        The two states, CallInactive and CallActive, will triggerbe connected by an incomingarrow.

                                                        call and whichWith keypressthe added Transition selected, click [ Fusion... ] at the bottom left of the State Machine Editor panel.
                                                          The Fusion panel will end the incoming call. In our example we will configure that the Key_Enter will initiate the incoming callopen, and the Key_EscapeFusion willdiagram end the incoming call.
                                                            Selectfor the Transition thatwill goesbe fromdisplayed.
                                                            theThe CallCheck InactiveClick stateFusion node is connected to the Callconnector Active(Condition) state. Inat the Propertiestop panelright changeof the nameTransition toFusion somethingnode.

                                                            more meaningful like Activate Call. Define the Key Event and the KeyCode as in the picture below. Select the TransitionCheck Click Fusion node that goesis fromconnected by default, and press the CallDelete Activekey. state
                                                              The Check Click Fusion node will be deleted.

                                                              Drag the connector (Condition) at the upper right of the Transition Fusion node, move the mouse, and release the left mouse button at the any location.
                                                                The [Select Behavior] dialog will open.

                                                                Enter “Check Key Input” in the search field at the top of the dialog. 
                                                                  The list of behaviors in the dialog will be narrowed down, and Condition > Input > Check Key Input will be displayed.

                                                                  Double-click Check Key Input.
                                                                    The Check Key Input Fusion node will be linked to the CallCondition Inactiveconnector state.of Changethe itsTransition nameFusion node.

                                                                    Make the following settings for the Check Key Input Fusion node.
                                                                      Clicking the upward-pointing arrow icon in the upper right of the Fusion panel will switch the display to Deactivatethe CallState.
                                                                      Check Key Input KeyCode Key_Enter

                                                                      Repeat the above operations 1 to 8, this time connecting the Transition from CallActive State to CallInactive State, and defineset the Check Key EventInput andFusion as shown in the table below. 
                                                                      Check Key Input KeyCode asKey_ESC




                                                                      When all settings are complete, the screen will look like the one below. 
                                                                      drawing-4-1742279942.png

                                                                       

                                                                       

                                                                       

                                                                      Checking the transition state

                                                                      Use the Player to check the transition between the states set in the previous section.

                                                                      Checking the screen transition

                                                                      Use the Player to check the screen transition.

                                                                        Click the [ Play selected scenario ] icon on the toolbar to start the Player.
                                                                          Three windows will open, and you can see below.
                                                                          drawing-5-1729241370.png

                                                                          Testthat the Configurationsimulation -display, Startone of the Player

                                                                          windows,

                                                                          Savedisplays yourthe solution“Navi Title” and start“Navigation” text, and that the player.

                                                                          drawing-5-1729241447.png

                                                                          After the Player is opened, you can see the Navigation Scene. When Pressing the Key_RightArrow, theinitial transition has occurred to the MediaMain scene is performedMenu and theNavigation selectedscenes.

                                                                          device is By pressing the defaultEnter devicekey "Radio". If you presson the Key_Enter,keyboard, the text “Incoming CallsCall” Scenewill getsappear visible,on the Mediascreen. Scene
                                                                          isUsing stillthe left and right directional keys in this state will move the scene, but the “Incoming Call” text will remain displayed.

                                                                          Pressing the ESC key on the keyboard hides the “Incoming Call” text displayed inon the background.screen.

                                                                          drawing-5-1694776617.png

                                                                          You can navigate through

                                                                          Close the scenesCGI usingPanel and exit the Key_RightArrowPlayer. to
                                                                          arriveAll atthree thewindows Phonethat Scenewere whileopen thewill Incomingclose. Call is visible. To end the incoming call, press Key_Escape and the Phone IncomingCall Scene is inactive again, only the Phone Scene is active.
                                                                          drawing-5-1694776717.png