Create A New Multi-Denom-Select-Modal Scene

The select-denom-modal.scene.ts file is a custom scene file and must be created for each game using a multiple denomination select modal dialog.

To create and use this custom scene:

  1. Create a scene file.
  2. Register the new scene.

Create the Scene File

IMPORTANT
When creating this custom scene, keep in mind that the Mercury asset names in the sceneries must match the paths and node names in the actual Mercury files containing those assets.

NOTE
for more information about creating scenes, see the Scenes article.

  1. Create the file with the structure and initial content as shown in the following example:

select-denom-modal.scene.ts

import { GDK, Local, SceneConfig } from "../config";

export const scene: SceneConfig = {
    id: "SelectDenomModalScene",
    cascadeUserInput: false,
    type: "StandardScene",
    wires: [
        {
            handler: "enable",
            event: "GlobalScene.BetManagerScenery.RequestSelectDenomination"
        },
        {
            handler: "disable",
            event: "SelectDenomModalScene.Complete.Enter",
            priority: 2
        }
    ],
    states: [ ],

    sceneries: [ ],

    performers: [ ]
};
  1. Add the following states instances of the GDK.States.SimpleDisplayState type to the states[] array following the example below for each state:

  2. Active

  3. ExitModal
  4. Complete
  5. EnterModal

select-denom-modal.scene.ts > states[]


{
id: "EnterModal",
type: GDK.States.SimpleDisplayState,
transitions: {
	standard: "Active"
},
...
}
							
  1. Add the following sceneries to the sceneries[] array:

  2. SelectDenomModalScene.TimelineScenery

  3. SelectDenomModalScene.DenomButton_nn
  4. SelectDenomModalScene.DenomText_nn
  5. SelectDenomModalScene.PickBoardScenery
  6. SelectDenomModalScene.SelectGridLayoutScenery

Note
There are ten DenomButton sceneries, numbered 01 through 10. There are also ten DenomText sceneries, numbered 01 through 10.

  1. Add the following performers to the performers[] array.

  2. SelectDenomModalScene.ExitSemaphorePerformer

  3. SelectDenomModalScene.SceneryEnablerPerformer
  4. SelectDenomModalScene.DenomSelectPerformer
  5. DenomDisplayScene.TextColorPerformer
  6. SelectDenomModalScene.ButtonDeckModalButtonDisabler
  7. SelectDenomModalScene.ModalButtonDeckAutoPlayButtonEnabler
  8. SelectDenomModalScene.ModalInputPerformer
  9. SelectDenomModalScene.SelectDenomSoundPlayerPerformer

Note
There are ten TextColorPerformer performers, corresponding to the ten buttons in the select denomination modal.

States

The states[] array contains four states from the GDK.States.SimpleDisplayState type. All the states have standard transisitons.

State Description
Active The modal is active up and the user is able to interact with it.
ExitModal An option is selected and is in the process of hiding itself and setting the new denom.
Complete The modal is hidden. It remains hidden until it is popped up again.
EnterModal The modal is loading.

states: [
		{
id: "EnterModal",
type: GDK.States.SimpleDisplayState,
transitions: {
standard: "Active"

		},
		....
	]
							

Sceneries

Time Line Scenery

Time Line Scenery

The timeline scenery brings in the Mercury assets.

Property Type Description
id string A unique name for the scenery object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Scenery.TimelineScenery Add this in the type property to instantiate a TimelineScenery object.
updateOrder integer This sets the priority for updating the scenery. 0 is the highest priority and will update before a higher number.
enabled boolean Determins whether or not the scenery is enabled when it loaded.
fileName string The path to the Mercury file to be loaded into the timeline scenery.
data configuration objects Contains references to all the objects having resources consumed by the scenery

Time Line Scenery Configuration Objects

Object Description
start (Optional)
string:
 • The name of the starting marker to which this timeline is set when it is loaded.
number:
 • The frame number of the starting marker to which this timeline is set when it is loaded.
end (Optional)
string:
 • The name of the ending marker to which this timeline is set when it is loaded.
number:
 • The frame number of the ending marker to which this timeline is set when it is loaded.
{
id: "SelectDenomModalScene.TimelineScenery",
type: GDK.Scenery.TimelineScenery,
updateOrder: 1,
enabled: false,
data: {
fileName: "resources/{platform}/select_denom.mercury"
	}
}

Denom Buttons

The button sceneries reference the Mercury assets for each button, specifically the button node and the HotSpot node within the button node.

Property Type Description
id string A unique name for the scenery object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Scenery.ButtonScenery Add this in the type property to instantiate a ButtonScenery object.
data configuration object Contains references to all the objects having resources consumed by the scenery.

Button Scenery Configuration Objects

Object Description
timelineSceneryId The identifier of the modal timeline scenery that contains the Mercury button assets.
buttonName (Optional) A string containing the path to the root of the button in the Mercury file.
hotSpotName (Optional) A string containing the path to the hot spot node in the Mercury file.
disabledMarker (Optional) A marker in the Mercury timeline indicating that the button is disabled.
normalMarker (Optional) A marker in the Mercury timeline indicating that the button is in a normal state.
pressedMarker (Optional) A marker in the Mercury timeline indicating that the button is pressed.
highlightedMarker (Optional) A marker in the Mercury timeline indicating that the button is highlighted.
externalRender (Optional) A boolean value indicating whether or not the button is external,
{
	id: "SelectDenomModalScene.DenomButton_01",
	type: GDK.Scenery.ButtonScenery,
	data: {
		timelineSceneryId: "SelectDenomModalScene.TimelineScenery",
		buttonName: "DialogBox/DenomButton01",
		hotSpotName: "DialogBox/DenomButton01/HotSpot"
	}
}

Denom Button Text

Note
Typically in most games, the button text is baked into the button itself, not so in this implementation. The text shown on top of the button is its own text node in the Mercury file. Because local jurstictional requirements vary, the button text must be generated dymanically.

Note
There are ten buttons and each button has a corresponding Mercury text node that must be associated with the button. In this example implementation, each denom text scenery is numbered 01 through 10.

Property Type Description
id string A unique name for the scenery object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Scenery.TextScenery Enter this in the type property to instantiate a TextScenery object.
name string The path to the text for the button.
data configuration object Contains references to all the objects having resources consumed by the scenery.

Text Scenery Configuration Objects

Object Description
color (Optional) A color object consisting of four values for: r, g, b, a defining the color of the text.
scaleToFit (Optional) Specifies whether or not the text scales to fit. True scales to fit.
value (Optional) The text string to display.
name The node path associated with the timelineScenery with the text to display.
timelineSceneryID (Optional) The ID of the timelineScenery.
fixedWidth (Optional) Determines whether or not to use the font's default width. Undefined uses the default width, 0 means it does not use fixed width.
externalRender (Optional) A boolean value indicating that the source of the text is external.
{
	id: "SelectDenomModalScene.DenomText_01",
	type: GDK.Scenery.TextScenery,
	data: {
		timelineSceneryId: "SelectDenomModalScene.TimelineScenery",
		name: "DenomText01/DenomText01",
	}
}

Pick Board Scenery

The pick board scenery stores the index of the last item clicked.

Property Type Description
id string A unique name for the scenery object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Scenery.PickBoardScenery Enter this in the type property to instantiate a PickBoardScenery object.
data configuration object Contains references to all the objects having resources consumed by the scenery.

Pick Board Scenery Configuration Objects

Object Description
clickableSceneryIds A string array containing a list of clickable scenery IDs corresponding to the predefined button sceneries for each button in the modal.
{
	id: "SelectDenomModalScene.PickBoardScenery",
	type: GDK.Scenery.PickBoardScenery,
	data: {
		clickableSceneryIds: [
			"SelectDenomModalScene.DenomButton_01",
			"SelectDenomModalScene.DenomButton_02",
			"SelectDenomModalScene.DenomButton_03",
			"SelectDenomModalScene.DenomButton_04",
			"SelectDenomModalScene.DenomButton_05",
			"SelectDenomModalScene.DenomButton_06",
			"SelectDenomModalScene.DenomButton_07",
			"SelectDenomModalScene.DenomButton_08",
			"SelectDenomModalScene.DenomButton_09",
			"SelectDenomModalScene.DenomButton_10",
		]
	}
}

Select Grid Layout Scenery

The grid layout scenery centers the buttons in evenly distributed rows and creates the grid layout. The DenomSelectPerformer sets the visibility of the buttons referenced in the selectGridSceneryIds object.

Property Type Description
id string A unique name for the scenery object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Scenery.SelectGridLayoutScenery Enter this in the type property to instantiate a SelectGridLayoutScenery object.
selectGridSceneryIds string An array of button sceneries specifying the buttons to be displayed in the modal.
rowSize non-negative integer Specifies the maximum number of buttons in a row.
specialRowArrangements array[] An array of button objects from the selectDenomModalScene and pecifies the arrangement of buttons in rows depending on the number of buttons.
visibleCount non-negative integer The number of visible buttons in the modal.
rowArrangement array[] The first value specifies the number of buttons appearing in the first (top) row. The second value specifies the number of buttons appearing in the second (botton) row. The default values are [5, 5].
data configuration object Contains references to all the objects having resources consumed by the scenery.

Select Grid Layout Scenery Configuration Objects

Object Description
specialRowArrangements An array of button objects from a scene and specifies the arrangement of buttons in rows depending on the number of buttons.
visibleCount The number of visible buttons in the modal.
rowArrangements A sparse array of arrays that define special arrangements when a given number of items is visible. For this example: { visibleCount: 5, rowArrangement: [3, 2] }, five items are visible with the first row of three items and a second row of two items.
rowSize An integer value specifying the maximum number of items per row.
{
	id: "SelectDenomModalScene.SelectGridLayoutScenery",
	type: GDK.Scenery.SelectGridLayoutScenery,
	data: {
		selectGridSceneryIds: [
			"SelectDenomModalScene.DenomButton_01",
			"SelectDenomModalScene.DenomButton_02",
			"SelectDenomModalScene.DenomButton_03",
			"SelectDenomModalScene.DenomButton_04",
			"SelectDenomModalScene.DenomButton_05",
			"SelectDenomModalScene.DenomButton_06",
			"SelectDenomModalScene.DenomButton_07",
			"SelectDenomModalScene.DenomButton_08",
			"SelectDenomModalScene.DenomButton_09",
			"SelectDenomModalScene.DenomButton_10",
		],
		rowSize: 5,
		specialRowArrangements: [
			{ visibleCount: 5, rowArrangement: [3, 2] },
			{ visibleCount: 6, rowArrangement: [3, 3] },
			{ visibleCount: 7, rowArrangement: [4, 3] },
			{ visibleCount: 8, rowArrangement: [4, 4] }
		]
	}
}

Performers

This implementation contains a total of 17 performers, 10 of which are variations of the same performer for each button text element.

Exit Semaphore Performer

The semaphore performer is responsible for assuring that a scene pauses until some action is completed. In this example, when the scene is enters the active state, it is paused. When a bet denomination is selected, the scene resumes playing.

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.SemaphorePerformer Enter this in the type property to instantiate a SemaphorePerformer object.
wires array[{}] An array of objects specifying specific events and their handlers.
data configuration object Contains references to all the objects having resources consumed by the performer.

Semaphore Performer Configuration Objects

Note
The semaphorePeformer has no configuration objects.

Handlers

Handler Description
hold Holds the current state of the scene when the denomination modal is loaded.
clear Releases the state hold when a player selects a bet denomination.
{
id: "SelectDenomModalScene.ExitSemaphorePerformer",
type: GDK.Performer.SemaphorePerformer,
data: {},
wires: [
		{
handler: "hold",
event: "SelectDenomModalScene.Active.Enter"
		},
		{
handler: "clear",
event: "GlobalScene.BetManagerScenery.PlayerSelectedBetDenomination"
		},
	]
}

Scenery Enabler Performer

The scenery enabler performer enables the modal scenery after is is loaded.

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.SceneryEnablerPerformer Enter this in the type property to instantiate a SceneryEnablerPerformer object.
sceneryIds array[] An array of scenery ids for timelines to be enabled.
data configuration object Contains references to all the objects having resources consumed by the performer.
wires array[{}] An array of objects specifying specific events and their handlers.

Scenery Enabler Performer Configuration Objects

Object Description
sceneryIds An array of scenery IDs for sceneries that may be enabled or disabled.

Handlers

Handler Description
enableScenery Instructs the scenery to enable after it loads.
diaableScenery Disables the scenery by setting the enabled flag to false. The scene no longer updates this scenery. It will neither render or accept mouse events.
{
id: "SelectDenomModalScene.SceneryEnablerPerformer",
type: GDK.Performer.SceneryEnablerPerformer,
data: {
sceneryIds: [
			"SelectDenomModalScene.TimelineScenery"
		]
	},
wires: [
		{
handler: "enableScenery",
event: "SelectDenomModalScene.Active.Enter"
		}
	]
}

Denom Select Performer

The denom select performer:

  • fills out the grid with available denominations.
  • assures that the current denomination button is highlighted (sets highlight state to true).
  • sets the denomination when the button is clicked.
Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.DenomSelectPerformer Enter this in the type property to instantiate a DenomSelectPerformer object.
data configuration object Contains references to all the objects having resources consumed by the performer.
wires array[{}] An array of objects specifying specific events and their handlers.

Denom Select Performer Configuration Objects

Object Description
betManagerSceneryId The ID of the bet manager scenery. The bet manager scenery supplies the denomination information.
currencyConfigurationSceneryId The ID of the currency configuration scenery that handles changing the denominations into readable text from millicents.
buttonSceneryIds A string array of the IDs of the button sceneries that reference the buttons in the Mercury assets.
textSceneryIds A string array of the IDs of the text sceneries that reference the text nodes in the Mercury assets.
pickIndexSceneryId string The ID of the pick index scenery that contains the index of the the selection.
selectGridLayoutSceneryId (Optional) The ID of the select grid layout scenery that defines how the grid is laid out.

Handlers

Handler Description
refreshDenominations Refreshes the button text with the available denomination selections when the modal is loaded.
selectDenomination Sets a global notification that the player selected a bet denomination and fires selection event causing the bet denomination to be displayed.
notifyDenomSelectionActive Notifies the lobby that the denomination selection dialog is loaded.
notifyDenomSelectionDismissed Notifies the lobby that the denomination selection dialog has closed.
notifyDenomSelectionMade Notifies the lobby that the player selected a denomination and returns the denomination in millicents.
{
	id: "SelectDenomModalScene.DenomSelectPerformer",
	type: GDK.Performer.DenomSelectPerformer,
	data: {
		betManagerSceneryId: "GlobalScene.BetManagerScenery",
		currencyConfigurationSceneryId: "GlobalScene.CurrencyConfigurationScenery",
		buttonSceneryIds: [
			"SelectDenomModalScene.DenomButton_01",
			"SelectDenomModalScene.DenomButton_02",
			"SelectDenomModalScene.DenomButton_03",
			"SelectDenomModalScene.DenomButton_04",
			"SelectDenomModalScene.DenomButton_05",
			"SelectDenomModalScene.DenomButton_06",
			"SelectDenomModalScene.DenomButton_07",
			"SelectDenomModalScene.DenomButton_08",
			"SelectDenomModalScene.DenomButton_09",
			"SelectDenomModalScene.DenomButton_10"
		],
		textSceneryIds: [
			"SelectDenomModalScene.DenomText_01",
			"SelectDenomModalScene.DenomText_02",
			"SelectDenomModalScene.DenomText_03",
			"SelectDenomModalScene.DenomText_04",
			"SelectDenomModalScene.DenomText_05",
			"SelectDenomModalScene.DenomText_06",
			"SelectDenomModalScene.DenomText_07",
			"SelectDenomModalScene.DenomText_08",
			"SelectDenomModalScene.DenomText_09",
			"SelectDenomModalScene.DenomText_10"
		],
		pickIndexSceneryId: "SelectDenomModalScene.PickBoardScenery",
		selectGridLayoutSceneryId: "SelectDenomModalScene.SelectGridLayoutScenery"
	},
	wires: [
		{
			handler: "refreshDenominations",
			event: "SelectDenomModalScene.Active.Enter",
			priority: 2
		},

		{
			handler: "selectDenomination",
			event: "SelectDenomModalScene.DenomButton_*.Clicked"
		},

		{
			handler: "notifyDenomSelectionActive",
			event: "SelectDenomModalScene.Active.Enter"
		},
		{
			handler: "notifyDenomSelectionDismissed",
			event: "SelectDenomModalScene.Complete.Enter"
		},
		{
			handler: "notifyDenomSelectionMade",
			event: "GlobalScene.BetManagerScenery.PlayerSelectedBetDenomination"
		}
	]

}

Text Color Performer

The text color performer listens for an event signaling that the button was placed in the highlighted mode (HighlightEnabled) and then changes the color of the text. The performer changes the color back to its initial state (index 0) when button enters the active state. There is one text color performer specified for each button text scenery.

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.TextColorPerformer Enter this in the type property to instantiate a TextColorPerformer object.

| data| configuration object | Contains references to all the objects having resources consumed by the performer.| | wires | array[{}] | An array of objects specifying specific events and their handlers. |

Denom Select Performer Configuration Objects

Object Description
textSceneryId The ID of the text scenery for the corresponding button text.
colors An array[{}] of RGBA color objects. The colors[] array may contain a maximum of three color objects.

Handlers

Handler Description
assignTextColor0 Assigns the color from the 0-index of the colors[] array to the DenomText object specified in the textSceneryId.
assignTextColor1 Assigns the color from the 1-index of the colors[] array to the DenomText object specified in the textSceneryId.
assignTextColor1 Assigns the color from the 2-index of the colors[] array to the DenomText object specified in the textSceneryId.
{
	id: "DenomDisplayScene.TextColorPerformer01",
	type: GDK.Performer.TextColorPerformer,
	data: {
		textSceneryId: "SelectDenomModalScene.DenomText_01",
		colors: [
			{ r: 0.0, g: 0.0, b: 0.0, a: 1.0 },
			{ r: 1.0, g: 1.0, b: 1.0, a: 1.0 }
		]
	},
	wires: [
		{
			handler: "assignTextColor0",
			event: "SelectDenomModalScene.Active.Enter"
		},
		{
			handler: "assignTextColor1",
			event: "SelectDenomModalScene.DenomButton_01.HighlightEnabled"
		}
	]
}

Button Deck Modal Button Disabler

The ButtonDeckModalButtonDisabler instance of ButtonEnablePerformer is used to disable all the buttons outside of the modal to avoid inadvertently clicking a button that lays underneath the modal.

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.ButtonEnablePerformer Enter this in the type property to instantiate a ButtonEnablePerformer object.
featureRestriction string[] An optional list of of feature switches that enable or disable the performer. Only the autoplay-active choice is available.
buttonSceneryIds array[] The IDs of the sceneries in the ButtonDeckScene that are disabled by the performer.
data configuration object Contains references to all the objects having resources consumed by the performer.
wires array[{}] An array of objects specifying specific events and their handlers.

Button Deck Modal Button Disabler Performer Configuration Objects

Object Description
buttonSceneryIds An array[] The IDs of the sceneries in the ButtonDeckScene that are enabled or disabled by the performer.
hideWhenDisabled (Optional) True to disable when the buttons are disabled, false to do nothing. _what does this actually mean?
stackButtonDisables (Optional) When set to true (boolean), an equal number of enable calls must be made before the button can be enabled.

Handlers

Handler Description
enableButtons Sets the button to an (active) state.
disableButtons Sets the button to an inactive (disabled) state.
disableClick Disables click handling and the disabled state on button.
resetButtonToDisabled Immediately sets the button to a disabled state and resets any internal disable stack counts to 1.
resetButtonToEnabled Immediately sets the button to an enabled state and resets any internal disable stack counts to 0.

{
	id: "SelectDenomModalScene.ButtonDeckModalButtonDisabler",
	type: GDK.Performer.ButtonEnablePerformer,
	data: {
		buttonSceneryIds: [
			"IncrementBetButton",
			"ButtonDeckScene.DecrementBetButton",
			"ButtonDeckScene.MaxBetButton",
			"ButtonDeckScene.SpinButton",
			"ButtonDeckScene.ChangeDenomButton",
			"UPIScene.GameRulesButton",
		],
	},
	wires: [
		{
			handler: "disableButtons",
			event: "SelectDenomModalScene.EnterModal.Enter"
		}
	]
}

Modal Button Deck Autoplay Button Enabler

The ModalButtonDeckAutoPlayButtonEnabler instance of ButtonEnablePerformer in this example is used to disable the autoplay button when autoplay is also active during an active modal.

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.ButtonEnablePerformer Enter this in the type property to instantiate a ButtonEnablePerformer object.
featureRestriction string[] An optional list of of feature switches that enable or disable the performer. Only the autoplay-active choice is available.
buttonSceneryIds string[] The IDs of the sceneries in the ButtonDeckScene that will be disabled by the performer if the modal is active and the autoplay feature is active.
data configuration object Contains references to all the objects having resources consumed by the performer.
wires array[{}] An array of objects specifying specific events and their handlers.
Object Description
buttonSceneryIds An array[] The IDs of the sceneries in the ButtonDeckScene that are enabled or disabled by the performer.
hideWhenDisabled (Optional) True to disable when the buttons are disabled, false to do nothing. _what does this actually mean?
stackButtonDisables (Optional) When set to true (boolean), an equal number of enable calls must be made before the button can be enabled.

Handlers

Handler Description
enableButtons Sets the button to an (active) state.
disableButtons Sets the button to an inactive (disabled) state.
disableClick Disables click handling and the disabled state on button.
resetButtonToDisabled Immediately sets the button to a disabled state and resets any internal disable stack counts to 1.
resetButtonToEnabled Immediately sets the button to an enabled state and resets any internal disable stack counts to 0.
{
id: "SelectDenomModalScene.ModalButtonDeckAutoPlayButtonEnabler",
type: GDK.Performer.ButtonEnablePerformer,
featureRestriction: ["autoplay-active"],
data: {
buttonSceneryIds: [
			"ButtonDeckScene.AutoPlayButton",
		],
	},
wires: [
		{
handler: "disableButtons",
event: "SelectDenomModalScene.EnterModal.Enter"
		}
	]
}

Modal Input Performer

This implementation of a ModalInputPerformer prevents user input from outside the modal by setting the allowed scenesAllowedInput property to SelectDenomModalScene. In this implementation the SelectDenomModalScene is the id of the scene you are creating.

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.ModalInputPerformer Enter this in the type property to instantiate a ModalInputPerformer object.
data configuration object Contains references to all the objects having resources consumed by the performer.
wires array[{}] An array of objects specifying specific events and their handlers.
Object Description
sceneInputManagerSceneryId The ID for the sceneInputManagerScenery object.
scenesAllowedInput A string[] list of IDs for scenes that are allowed input events to the modal.

Handlers

Handler Description
enterModal The handler restricts input to only those scenes specified in the scenesAllowedInput[] list.
exitModal Causes the modal to close.
{
id: "SelectDenomModalScene.ModalInputPerformer",
type: GDK.ModalInputPerformer,
data: {
sceneInputManagerSceneryId: "GlobalScene.SceneInputManagerScenery",
scenesAllowedInput: [
			"SelectDenomModalScene"
		]
	},
wires: [
		{
handler: "enterModal",
event: "SelectDenomModalScene.EnterModal.Enter"
		},
		{
handler: "exitModal",
event: "SelectDenomModalScene.Complete.Enter"
		}
	]
}

Select Denom Sound Player Performer

This implementation of the SoundPlayerPerformer plays the sound specified in the soundName property when one of the denomination buttons in the modal is clicked.

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.SoundPlayerPerformer Enter this in the type property to instantiate a SoundPlayerPerformer object.
data configuration object Contains references to all the objects having resources consumed by the performer.
wires array[{}] An array of objects specifying specific events and their handlers.

Select Denom Sound Player Performer Configuration Objects

Object Description
timelineSceneryId The ID of the time line scenery containing the sound to be played.
soundName The node path of the sound in the Mercury asset configured in the TimeLineScenery.
blocking (Optional) Specifies whether or not the play handler completes before the sound finishes playing. Default is false.
timerSceneryId The ID of the timer scenery. The timer scenery assures that the sound does not loop.
loopCount (Optional) An integer value that determines how many times a sound repeats when played. -1 fill loop forever, 0 will inhibit looping. The default value is 0.

Handlers

Handler Description
play Plays the sound.
stop Stops playing the sound without waiting for the sound to complete.

Important
The SoundPlayerPerformer is deprecated and should be replaced by the SoundPerformer in the GDK.

{
id: "SelectDenomModalScene.SelectDenomSoundPlayerPerformer",
type: GDK.Performer.SoundPlayerPerformer,
data: {
timelineSceneryId: "GlobalScene.TimelineScenery",
soundName: "betbeep2.wav",
timerSceneryId: "GlobalScene.TimerScenery"
	},
wires: [
		{
handler: "play",
event: "SelectDenomModalScene.DenomButton_*.Clicked"
		}
	]
}

Replace the Sound Player Performer

The SoundPlayerPerformer is deprecated and should be replaced with the SoundPerformer.

The replacement required the addition of a SoundScenery in the select-denom-modal.scene.ts file. The timelineSceneryId and the soundName properties in the sound scenery are the same as in the sound player performer. The wires[] array in the new sound performer are exactly the same as in the deprecated sound player performer.

Configure a Sound Scenery

Configure a sound scenery following the steps below:

  1. Create an object in the sceneries[] array of the select-denom-modal.scene file by entering a set of curly braces ({}).

  2. Enter a identifier in the id property. This consists of the name of the scene and a unique name for the scenery.

  3. Enter the type of the performer in the type property, in this example it is GDK.Scenery.SoundScenery.

  4. Enter the timelineSceneryId and the soundName in a data{} object.

select-denom-modal.scene > sceneries[]

{
id: "SelectDenomModalScene.ButtonSoundScenery",
type: GDK.Scenery.SoundScenery,
data:{
timelineSceneryId: "GlobalScene.TimelineScenery",
soundName: "betbeep2.wav"
	}
},

Configure a Sound Performer

Property Type Description
id string A unique name for the performer object being instantiated. The name should adhere to the <sceneName>.<newObjectName> format.
type GDK.Performer.SoundPerformer Enter this in the type property to instantiate a SoundPerformer object.
data configuration object Contains references to all the objects having resources consumed by the performer.
wires array[{}] An array of objects specifying specific events and their handlers.

Configure a sound performer following the steps below:

  1. Create an object in the performers[] array of the select-denom-modal.scene file by entering a set of curly braces ({}).

select-denom-modal.scene > performers[]

{
	...
}
  1. Enter a identifier in the id property. This consists of the name of the scene and a unique name for the scenery.

  2. Enter the type of the performer in the type property, in this example it is GDK.Performer.SoundPerformer.

  3. Enter the soundSceneryId the loopCount and the blocking properties in a data{} object. The soundSceneryId is the same as the id for the sound performer created above. Set the loopCount property to 0 so that the sound does not loop. Set the blocking property to true so that the sound will finish playing before the scene continues.

  4. Add the wires[] array.

  5. Populate the wires[] array with the play handler and the SelectDenomModalScene.DenomButton_*.Clicked event. The play handler plays the sound when a denom button is clicked.

Sound Performer Configuration Objects

Object Description
soundSceneryId The ID of a scenery implementing a SoundInterface
blocking When true:
 • The play() handler waits until the sound playback completes.
 • The stop() handler waits until the playback completes.
When false or the playback is playing an infinite loop:
 • The play() completes at the end of the current loop.
When the stop() handler is used, it determines when the handler is called.
loopCount An integer that specifies how many times the sound repeats when it is played. A value of -1 causes the sound to play in a continuous loop until the stop() handler is called. The default value of 0 plays the sound once.
volume A number that sets the volume of the sound with a value between 0 and 1, inclusive. The default value is 1.
fadeInSeconds A number that sets the time, in seconds, over which the sounds fades in from 0 to the volume specified in the volume property.
fadeOutSeconds A number that sets the time, in seconds, over which the sounds fades out after the sound clip is stopped.

Handlers

Handler Description
stop Stops a sound but allows it to complete its fades or loops depending on playback attributes.
stopImmediate Stops a sound immediatley and does not wait for the sound to finish.
pause Pauses a sound.
resume Resumes the playing of a paused sound.
mute Mutes a sound.
unmute Unmutes a sound.

select-denom-modal.scene > performers[]

{
id: "SelectDenomModalScene.SelectDenomSoundPerformer",
type: GDK.Performer.SoundPerformer,
data:{
soundSceneryId:"SelectDenomModalScene.ButtonSoundScenery",
loopCount:0,
blocking: true
	},
wires:[
		{
handler: "play",
event: "SelectDenomModalScene.DenomButton_*.Clicked"
		}
	]
}

Register the Scene File

After editing the scenery file, you must register your new scenery before you can use it in a scene. The scenery must be registered in the Scene Index.

The scene index (index.ts) is used by anything that needs to access the scene you are creating. Register your new scene with the index:

  1. Navigate to the scene directory for your game (src/frontend/scene) and open index.ts.
  2. Add a new import line to the class index with the path to the select-denom-modal.scene file.
  3. Add an new item to the export const scenes array[].

index.ts

...
import * as SelectDenomModal from "./select-denom-modal.scene";
...
export const scenes: Array<SceneConfig<any, any, any>> = [
	...
	SelectDenomModal.scene,
	...
];