Time for action – using the UI Emulator to test the FreeSDK demo menus

Follow the given steps:

  1. Open the UI Emulator and enable the Flow Graph updates (the play button in the top menu bar). Clear the state by pressing the little trash icon.
  2. Now click on the Sys->UI button in the Objects panel. If you select the System UIEventSytem, you will find a list of all the system events. If you double-click on one of the events in the event list, it gets attached to the Emulation panel on the right.
  3. For now, we want to see what happens if the game starts, if a level loads, and if the gameplay starts. So let's add the following events to the Emulation panel:
    • OnSystemStart
    • OnLoadingStart
    • OnGameplayStated
  4. If you call OnSystemStart, the main menu should appear. You can also look into the Flow Graph and enable Flow Graph debugging to see which nodes are triggered to fill the main menu. The flow starts in the sys_statecontrol UI Action (there should be the UI:Events:System:OnSystemStart node that then starts another UI Action).
  5. You can always reset the state by pressing the trash icon. If you enable UI Action logging (in the Settings tab on the left-hand side of the UI Emulator, or with the gfx_uiaction_log 1 CVAR), you will see what happens in the EventLog window.
    Time for action – using the UI Emulator to test the FreeSDK demo menus

    Note

    With the big X button in the top button bar, you can clear the log.

  6. Repeat the steps with the OnLoadingStart and OnGameplayStarted events.

What just happened?

By using the UI Emulator, you can easily see how the UI Action flow handles the different system events. This is a great tool that helps a lot in setting up your menus without the need of starting the launcher and restarting it every time you changed something. You can also change your UI Actions and see the result directly, without the need of using Sandbox to create/change your UI Actions and then starting the launcher to see the results.

Have a go Hero – creating a new menu page

Try to create a new menu page for the main menu. Look into the MM_Main UI Action Flow Graph and add a new button for your new menu page. Look into MM_SoundSettings, on how this page is set up and how the button in the MM_Main UI Action is set up to go to the Sound Settings menu.

Note

Look in the UI:Functions:MainMenu:AddButton node of the mm_main UI Action that creates the button with the @ui_SoundSettings caption. Look for it's id. Isn't it the same name as the MM_SoundSettings UI Action?

Pop quiz – UI Actions

  1. Where are the Flash element XML definition files located?
    1. LibsUI
    2. LibsUIUIElements
    3. LibsUIUIActions
  2. When using a textfield to display some info, such as the current health, what type of textfield do you have to use?
    1. Input Text
    2. Static Text
    3. Dynamic Text
  3. If you want to raise an event from Flash, what ActionScript function do you need to call?
    1. sendEvent
    2. fsCommand
    3. onEnterFrame
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.161.116