YAML event sheets
Introduction¶
Event sheets contains main condition(s) and actions, in YAML format.
- Author: Rex
- Member of scene
Live demos¶
Usage¶
Install plugin¶
Load minify file¶
- Load plugin (minify file) in preload stage
scene.load.plugin('rexyamleventsheetsplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexyamleventsheetsplugin.min.js', true); - Add event-sheet-manager object
var eventSheetManager = scene.plugins.get('rexyamleventsheetsplugin').add(config);
Import plugin¶
- Install rex plugins from npm
npm i phaser3-rex-plugins - Install plugin in configuration of game
import YAMLEventSheetsPlugin from 'phaser3-rex-plugins/plugins/yamleventsheets-plugin.js'; var config = { // ... plugins: { global: [{ key: 'rexYAMLEventSheets', plugin: YAMLEventSheetsPlugin, start: true }, // ... ] } // ... }; var game = new Phaser.Game(config); - Add event-sheet-manager object
var eventSheetManager = scene.plugins.get('rexYAMLEventSheets').add(config);
Import class¶
- Install rex plugins from npm
npm i phaser3-rex-plugins - Import class
import YAMLEventSheets from 'phaser3-rex-plugins/plugins/yamleventsheets.js'; - Add event-sheet-manager object
var eventSheetManager = new YAMLEventSheets(config);
Create instance¶
var eventSheetManager = scene.plugins.get('rexYAMLEventSheets').add({
commandExecutor: Object,
parallel: false
});
commandExecutor: Command executor of actions.- This plugin provides a built-in command executor.
parallel:false: Test condition then execute event sheet one by one. Default behavior.true: Test all condition of event sheets then execute event sheets one by one.
Add event sheet¶
Each event sheet belong a group.
eventSheetManager.addEventSheet(content, {
parallel: undefined,
active: true,
once: false
})
or
eventSheetManager.addEventSheet(content, groupName, {
parallel: undefined,
active: true,
once: false
})
or
eventSheetManager.addEventSheet(content, {
groupName: '_',
parallel: undefined,
active: true,
once: false
})
content: See structure of event sheetparallel:undefined: Use defaultparallelproperty.
active:true: Eval condition of this event sheet every round. Default behavior.false: Skip this event sheet.
once:true: Setactiveof this event sheet tofalsewhen exection of this event sheet is complete.false: Do nothing when exection of this event sheet is complete. Default behavior.
groupName: Each event sheet belong a group. Ignore this parameter to use default group.'_': Default group name.
Remove event sheet¶
- Remove an event sheet in default group
eventSheetManager.removeEventSheet(title); - Remove an event sheet in a specific group
eventSheetManager.removeEventSheet(title, groupName); - Remove all event sheets in default group
eventSheetManager.removeAllEventSheets(); - Remove all event sheets in a specific group
eventSheetManager.removeAllEventSheets(groupName);
Start running¶
Starting command will be ignored if group is running.
Start running a group of event sheets¶
- Start running default group
eventSheetManager.startGroup(); - Start running a specific group of event sheets
eventSheetManager.startGroup(groupName);
Flow chart¶
graph TD
startGroup{{"startGroup()"}} ------> eventstart>Fire event\nstart]
eventstart --> foreacheventsheet((For each\nevent sheet))
foreacheventsheet --> |Next| activate{activate}
subgraph Event sheet
activate --> |True| condition{"Test\n[condition]"}
condition --> |True| enterevent>Fire event\neventsheet.enter]
condition --> |False| eventcatch>Fire event\neventsheet.catch]
subgraph Run
enterevent --> actions[Run\nactions\n...\n...]
actions --> exitevent>Fire event\neventsheet.exit]
end
subgraph Catch
eventcatch --> catch["Run\n[catch]"]
end
end
exitevent --> foreacheventsheet
catch --> foreacheventsheet
activate --> |False| foreacheventsheet
foreacheventsheet --> eventcomplete>Fire event\ncomplete]
eventcomplete --> endnode{{End}}
Start running a event sheet in a group¶
- Start running default group
eventSheetManager.start(); - Start running an event sheet (indexed by
title) without condition testing, in default group.eventSheetManager.start(title); - Start running an event sheet (indexed by
title) without condition testing, in a specific group.eventSheetManager.start(title, groupName); - Start running an event sheet (indexed by
title) with condition testing, in default group.eventSheetManager.start(title, false); - Start running an event sheet (indexed by
title) with condition testing, in a specific group.eventSheetManager.start(title, groupName, false);
Start running a group by event¶
eventSheetManager.startGroup(eventName, groupName);
// eventSheetManager.startGroup(eventName, groupName, once);
or
eventSheetManager.startGroup({
eventName:
groupName:
once: false
});
Round counter¶
Round counter is started from 0.
- Increase round counter
eventSheetManager.updateRoundCounter(); // eventSheetManager.$roundCounter += 1; - Set round counter
eventSheetManager.updateRoundCounter(value); // eventSheetManager.$roundCounter = value; - Get round counter
var roundCounter = eventSheetManager.getRoundCounter(); // var roundCounter = eventSheetManager.$roundCounter;
Active¶
- Activate state of event sheet (indexed by
title)eventSheetManager.setEventSheetActiveState(title); // eventSheetManager.setEventSheetActiveState(title, true); - Inactivate state of event sheet (indexed by
title)eventSheetManager.setEventSheetActiveState(title, false); - Get active state of event sheet (indexed by
title)var active = eventSheetManager.getEventSheetActiveState(title);
Note
Event sheet which has once property will set active property to false
when exection of this event sheet is complete.
Stop running¶
Stop running a group of event sheet, also fires 'eventsheet.exit' event.
And game objects with 'autoClear' will be destroyed.
- Stop running default group
or
eventSheetManager.stopGroup();eventSheetManager.stop(); - Stop running a specific group of event sheets
or
eventSheetManager.stopGroup(groupName);eventSheetManager.stop(groupName);
Local memory¶
Local memory is shared for all event sheets.
- Set value
or
eventSheetManager.setData(key, value);eventSheetManager.setData(data); // data : a plain json object - Toggle value
eventSheetManager.toggleData(key, value); - Increase value
eventSheetManager.incData(key, inc); - Get value
var value = eventSheetManager.getData(key); - Has key
var hasData = eventSheetManager.hasData(key); - Local memory as a dictionary
var data = eventSheetManager.memory;
Custom expression¶
eventSheetManager.addExpression(name, callback);
name: A string valuecallback: A function object retuen a numberfunction(a, b, c, ...) { return x; }
For example :
eventSheetManager.addExpression('randomInt', function (a, b) {
return Math.floor(a + Math.random() * (b - a + 1));
});
Expression will store at local memory
States¶
- Dump state of event sheets of all groups
var states = eventSheetManager.dumpState(); - Load state of event sheet of all groups
eventSheetManager.loadState(states);
Events¶
- Start A group of event sheets
eventSheetManager.on('start', function(groupName, eventSheetManager){ }); - A group of event sheets has been executed completed
eventSheetManager.on('complete', function(groupName, eventSheetManager){ }); - Enter an event sheet
eventSheetManager.on('eventsheet.enter', function(title, groupName, eventSheetManager){ }); - Exit an event sheet
eventSheetManager.on('eventsheet.exit', function(title, groupName, eventSheetManager){ }); - Enter a label an event sheet
eventSheetManager.on('label.enter', function(headingTitle, eventSheetTitle, groupName, eventSheetManager){ }); - Exit a label of an event sheet
eventSheetManager.on('label.exit', function(headingTitle, eventSheetTitle, groupName, eventSheetManager){ }); - Test condition of an event sheet failed
eventSheetManager.on('eventsheet.catch', function(title, groupName, eventSheetManager){ });
Structure of event sheet¶
Main headings¶
title: Title
groupName:
parallel:
active: false
once: false
condition: expression
script:
fallback:
title: Title of this event sheetgroupName: AssigngroupNamein event sheet, put this event sheet in to that group.parallel: Setparallelproperty of this event sheet totrue.active=false: Setactiveproperty of this event sheet tofalse.once: Setonceproperty of this event sheet totrue.condition: Main condition.- A string : Single boolean expression
condition: "hp > 0 && mp > 0" - An array : Represents OR, elements can be
- A string : Single expression
- An array : Represents AND, e.g.,
["a", "b"]->(a) && (b) - Object
{and: [...]}: Equivalent to ANDcondition: - "score > 0" # (score > 0) - ["hp > 0", "mp > 0"] # OR ((hp > 0) && (mp > 0)) - and: ["stage == 1", "boss"] # OR ((stage == 1) && (boss)) - When omitted or malformed, defaults to
"true"
- Read data from local memory
- A string : Single boolean expression
script: Actions when main condition istrue.- Flow control instructions
- Actions : Custom command
fallback: Actions when main condition isfalse.
Flow control instructions¶
If, Else if, Else¶
- type: if
branches:
- condition: coin > 10 # IF
- actions:
# - name:
- condition: (coin > 5) && (coin <10) # ELSE IF
- actions:
# - name:
- actions: # ELSE
# - name:
type: ifwithbranches:, each branch containscondition: expression, andactions:condition: expression- Read data from local memory
- Boolean expression AND/OR :
&&. - Boolean expression OR :
||. - No
condition: ELSE part
- And
actions:, run actions when expression istrue.
Note
Using Label with condition: expression for single if condition
Repeat loop¶
- type: repeat
times: 3
actions:
# - name:
or
- type: repeat
times: loopCount
actions:
# - name:
or
- times: 3
actions:
# - name:
For loop¶
- type: for
init:
# - name:
condition: expression
step:
# - name:
actions:
# - name:
type: forinit: Actions executed at the beginningcondition: expression: Evaluate the condition at the beginning of each loop.- Read data from local memory
- Boolean expression AND/OR :
&&. - Boolean expression OR :
||. - No
condition: ELSE part
step: Actions executed at the end of each loop- And
actions:, the loop body.
While loop¶
- type: while
condition: loopCount > 0
actions:
# - name:
Label¶
- title: labelTitle
actions:
# - name:
or
- actions:
# - name:
or
- title: labelTitle
type: label
actions:
# - name:
or
- title: labelTitle
condition: expression
type: label
actions:
# - name:
or
- condition: expression
actions:
# - name:
title: labelTitle: Optional title name.actions: Run commands sequentiallycondition: expression: Run commands ifexpressionreturntrue, optional- Each custom command can have this
conditionproperty, including all command in Command executor
- Each custom command can have this
Break¶
- type: break
or
- type: break
condition: expression
- Action
type: break: Ignore remainder actions in current level.
Continue¶
- type: continue
or
- type: continue
condition: expression
- Action
type: continue: Simulatecontinueinstruction of programming language.
Exit¶
- type: exit
or
- type: exit
condition: expression
- Action
type: exit: Skip remainder instructions.
Deactivate¶
- type: deactivate
or
- type: deactivate
target: eventSheetTitle
or
- type: deactivate
condition: expression
target: eventSheetTitle
- Action
type: deactivate: Deactivate this event sheet, or deactivate event sheet by title in the same tree group. i.e. Setactiveproperty of this event shhet tofalse.
Activate¶
- type: activate
or
- type: activate
target: eventSheetTitle
or
- type: activate
condition: expression
target: eventSheetTitle
- Action
type: activate: Activate this event sheet, or activate event sheet by title in the same tree group. i.e. Setactiveproperty of this event shhet totrue.
Custom command¶
- type: command
name: commandName
parameters:
param0: value
param1: value
or
- name: commandName
parameters:
param0: value,
param1: value
or
- condition: expression
name: commandName
parameters:
param0: value
param1: value
name: commandName:- Invoke
commandExecutor.commandNamemethod if thiscommandNamemethod is existed.commandName(config, eventSheetManager) { // var resumeCallback = eventSheetManager.pauseEventSheet(); // ... // resumeCallback() }config: Parameter and value in a dictionary.eventSheetManager: This event mangager.- Pause running of current event sheet
var resumeCallback = eventSheetManager.pauseEventSheet(); // resumeCallback(); // Resume running of current event sheet - Pause running of current event sheet until another
eventNamefiring fromeventEmittereventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);
- Pause running of current event sheet
- Otherwise, invoke
commandExecutor.defaultHandler.defaultHandler(commandName, config, eventSheetManager) { // var resumeCallback = eventSheetManager.pauseEventSheet(); // ... // resumeCallback() }commandName: Command name.config: Parameter and value in a dictionary.eventSheetManager: This event mangager.- Pause running of current event sheet
var resumeCallback = eventSheetManager.pauseEventSheet(); // resumeCallback(); // Resume running of current event sheet - Pause running of current event sheet until another
eventNamefiring fromeventEmittereventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);
- Pause running of current event sheet
- Invoke
condition: expression: Run command ifexpressionreturntrue, optional- Each custom command can have this
conditionproperty, including all command in Command executor
- Each custom command can have this
Command executor¶
A command executor for phaser3 engine.
Create command executor instance¶
var commandExecutor = scene.plugins.get('rexYAMLEventSheets').addCommandExecutor(scene, {
// layers: ['layer0', 'layer1', ...]
// layers: [{name, cameraName}, ...]
// layerDepth: undefined,
// rootLayer: undefined,
log: {
delimiters: '[]'
enable: true
}
});
// Add to event sheet manager
// var eventSheetManager = scene.plugins.get('rexYAMLEventSheets').add({
// commandExecutor: commandExecutor
// });
or
// import YAMLEventSheets from 'phaser3-rex-plugins/plugins/yamleventsheets.js';
// import CommandExecutor from 'phaser3-rex-plugins/plugins/commandexecutor.js';
var commandExecutor = new CommandExecutor(scene, config);
// var eventSheetManager = new YAMLEventSheets({
// commandExecutor: commandExecutor
// });
layers: Add some initial layers- A string array : Add layers by string name
- A array of plain object
{ name, cameraName }- Add layer by string name
- Bind this layer to dedicate camera (indexed by
cameraName), ignore other cameras Add a new camera if this target camera is not existing
layerDepth: Setdepthto each layer game object.undefined: Keep defaultdepthvalue (0)
rootLayer: Add all layer game objects created by layer-manager into this root layer.log: Configuration of BBCodeLoglog.delimiters: String of left-delimiter and right-delimiter.- A single string with 2 characters. Default value is
'[]'. - A array with 2 strings
- A single string with 2 characters. Default value is
log.enable:true: Can print message on console. Default behavior.false: Don't print any message on console.
Local memory of event sheet manager¶
- Set value by key
- name: setData parameters: { key: value } - Increase value of key
or
- name: incData parameters: { key: value }- name: setData parameters: { key: "#(key+value)" } - Toggle value of key
- name: toggleData parameters: { key: true }
See Local memory
BBCode Log¶
Print message on console¶
- name: log
parameters: { text: "..." }
or
- name: log
parameters:
logType: log
showTitle: true
titleL : "..."
titleColor: green
text: "..."
# condition: expression
text: Message with bbcode format.[color=gold]...[/color][bgcolor=green]...[/bgcolor][b]...[/b][i]...[/i][u]...[/u]
logType:'log':console.log. Default value.'warn':console.warn
showTitletrue: Show title before text message. Default behavior.false: Don't show title.
titleundefined: Using title of current event sheet. Default behavior.- A string, custom string before text message.
titleColor: Background color of title block, default value is'green'
Disable console message¶
- name: log.disable
- Disable console message of current event sheet.
or
- name: log.disable
parameters: {title: "..." }
# condition: expression
title: Disable console message of event sheet by title.
Enable console message¶
- name: log.enable
- Enable console message of current event sheet.
or
- name: log.enable
paramterers : { title: "..." }
# condition: expression
title: Enable console message of event sheet by title.
Dump memory¶
- name: log.memory
- Dump all key in memory
or
- name: log.memory
parameters:
text: "..."
keys: "a,b,c"
# condition: expression
keys: Dump part of memory by keys.text: Message with bbcode format.
Game object¶
Register custom game object¶
commandExecutor.addGameObjectManager({
name: GOTYPE,
viewportCoordinate: false,
// viewportCoordinate: { viewport: new Phaser.Geom.Rectangle() },
fade: 500,
// fade: {mode: 'tint', time: 500},
defaultLayer: layerName,
autoClear: true,
commands: {
commandName(gameObject, config, commandExecutor, eventSheetManager, eventSheet) {
// commandExecutor.waitEvent(eventEmitter, eventName);
}
}
})
name: A string name of game object's type. Will register commandGOTYPEto this command executor.createGameObject: A callback for creating game objectfunction(scene, config) { return gameObject; }config: Parameters passed from event sheet.id,layer,autoClear,eventSheetManager,eventsheet: These parameters are reserved.eventSheetManager: This event sheet manager.
viewportCoordinate: Apply viewportCoordinate behavior to game object.true: Attachvpx,vpy,vpto sprite game object.vpx,vpy: Number between0~1. Proportion of viewport.vp: Viewport in rectangle
false: Do nothing, default behavior.
fade:0: No fade-in or fade-out when adding or removing a sprite.- A number : Duration of fading. Default value is
500. - A plain object contains
mode,timefade.mode: Fade modefade.time: Duration of fading. Default value is500.
defaultLayer: A layer name defined inlayersparameter ofaddCommandExecutormethodautoClear:true: Clear game objects when exiting current event sheet. Default behavior.false: Ignore this behavior.
commands: Custom commands, each command is a callback indexed by command namecommandName: function(gameObject, config, commandExecutor, eventSheetManager) { // commandExecutor.waitEvent(eventEmitter, eventName); }commandName: Command name. These command names are reserved :to,yoyo,destroygameObject: Game object instance.config: Parameters passed from event sheet.commandExecutor: This command executor instance. See alsoeventSheetManager: This event sheet manager instance.- Store variable into blackboard of eventSheetManager :
eventSheetManager.setData(key, value)
- Store variable into blackboard of eventSheetManager :
Create custom game object¶
- name: GOTYPE
parameters:
id: NAME
layer:
autoClear:
param0: value
param1: value
# condition: expression
- Create custom game object
GOTYPEwith config{param0, param1}, indexed byid layer: Put this game object atlayer.undefined: Put this game object at default layer
autoClear: Clear game objects when exiting current event sheet.undefined: Use default value ofautoClear
Reserved id : time, click, key, bgm, bgm2, se, se2, camera.
Will store reference of this game object into memory at key @NAME,
can see it by log.memory, or get property of game object via #(@NAME.x + 3).
Set properties of custom game object¶
- Set properties of a game object indexing by
NAME- name: NAME.set parameters: x: vpx: y: vpy: alpha: # condition: expressionvpx,vpy: viewportCoordinate properties injected ifviewportCoordinateistrue.- Add empty line above and below this command block.
- Set properties of all game objects belong GOTYPE
- name: GOTYPE.set parameters: x: vpx: y: vpy: alpha: # condition: expression - Set properties of all game objects belong GOTYPE excluding
NAME- name: "!NAME.set" parameters: x: vpx: y: vpy: alpha: # condition: expression
Ease properties of custom game object¶
- Ease properties of a game object indexing by
NAME- name: NAME.to parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression- name: NAME.from parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression- name: NAME.yoyo parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression- These properties are reserved :
id,duration,delay,ease,repeat,yoyo,wait wait:false: Run next command immediately. Default behavior.true: Run next command after playing sound complete.
- Add empty line above and below this command block.
- These properties are reserved :
- Ease properties of all game objects belong GOTYPE
- name: GOTYPE.to parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression- name: GOTYPE.from parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression- name: GOTYPE.yoyo parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression - Ease properties of all game objects belong GOTYPE excluding
NAME- name: "!NAME.to" parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression- name: "!NAME.from" parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression- name: "!NAME.yoyo" parameters: x: vpx: y: vpy: alpha: duration: 1000 delay: 0 ease: Linear repeat: 0 wait: # condition: expression
Invoke custom command¶
- Invoke custom command of a game object indexing by
NAME- name: NAME.commandName parameters: param0: value param1: value # condition: expression- Invoke custom command
commandNamemethod with these parametersgameObject: Indexed byNAMEconfig:{param0, param1}
- Add empty line above and below this command block.
value:- For string value, characters
\n(2 characters) will be replaced by\nnew line character (1 character)
- For string value, characters
- Invoke custom command
- Invoke custom command of all game objects belong GOTYPE
- name: GOTYPE.commandName parameters: param0: value param1: value # condition: expression - Invoke custom command of all game objects belong GOTYPE excluding
NAME- name: "!NAME.commandName" parameters: param0: value param1: value # condition: expression
Do nothing if gameObject or commandName is not found.
Destroy custom game object¶
- Destroy game object indexing by
NAME- name: NAME.destroy # condition: expression - Destroy all game objects belong GOTYPE
- name: GOTYPE.destroy # condition: expression - Destroy all game objects belong GOTYPE excluding
NAME- name: "!NAME.destroy" # condition: expression
Methods used in command¶
- Hold command execution until
eventEmitteremitseventNameevent.commandExecutor.waitEvent(eventEmitter, eventName); - Apply value to property of
commandExecutor.setGOProperty({ goType, id, property, ... });goType: GameObject type assigned bycommandExecutor.addGameObjectManager({name...}).id:NAMEof game object, which will store ingameObject.name.gameObject.name: Apply value to property of this game object.'!' + gameObject.name: Apply value to property of all game objects exclude this game object.undefined: All game objects.
propertyName: value: Assign value to property. Can assign one or many properties.
- Ease value of game object(s)' property
if (wait) { commandExecutor.setWaitEventFlag(); } commandExecutor.easeGOProperty({ goType, id, duration, ease, repeat, yoyo, wait, property, ... });goType: GameObject type assigned bycommandExecutor.addGameObjectManager({name...}).id:NAMEof game object, which will store ingameObject.name.gameObject.name: Apply value to property of this game object.'!' + gameObject.name: Apply value to property of all game objects exclude this game object.undefined: All game objects.
duration: Duration of easing task.ease: Ease functionrepeat: Repeat times.yoyo: Yoyo flag.wait: Wait until easing task complete.- Invoke
commandExecutor.setWaitEventFlag().
- Invoke
propertyName: value: Ease value of property. Can assign one or many properties.
Wait¶
Wait click¶
- name: click
# condition: expression
- Run next command after clicking.
Wait any¶
Run next command after...
- name: wait
parameters:
click: true
key: keyName
time:
GONAME.destroy: true
GONAME.PROPNAME: true
GONAME.DATAKEY: true
GONAME.EVTNAME: true
event: EVENTNAME
# condition: expression
click: Run next command after clicking.key: Run next command after key downtime: Run next command after time-out.GONAME.destroy: Run next command after game object has destroyed.GONAME.PROPNAME(ex.GONAME.x) : Run next command after game object's property tween completeGONAME.DATAKEY,GONAME.!DATAKEY(ex.GONAME.!hp) : Run next command after game object's data istrue(or> 0) orfalse(or<= 0). Will check PROPNAME first.GONAME.EVTNAME: Run next command after game object'sEVTNAMEfiring. Will checkPROPNAMEandDATAKEYfirst.event: Run next command after eventSheetManager firingEVENTNAMEevent.
Emit these events from eventSheetManager
- Wait click or key down
eventSheetManager.on('pause.input', function(){ });- Resume (run next command)
eventSheetManager.on('resume.input', function(){ });
- Resume (run next command)
- Wait click only
eventSheetManager.on('pause.click', function(){ }); - Wait key down only
eventSheetManager.on('pause.key', function(keyName){ });
Sound¶
This command executor provides
- 2 background music tracks :
bgm,bgm2 - 2 sound effects :
se,se2.
Sound properties¶
- name: bgm.set
parameters:
volume:
mute:
unmute:
# condition: expression
- Command name :
bgm,bgm2,se,se2
Play sound¶
- name: bgm.play
parameters:
key:
# volume:
# detune:
# rate:
# fadeIn: 0
# loop: false
wait: false
# condition: expression
- Command name :
bgm.play,bgm2.play,se.play,se2.play wait:false: Run next command immediately. Default behavior.true: Run next command after playing sound complete.
Cross fade in sound¶
- name: bgm.cross
parameters:
key:
duration: 500
wait: false
# condition: expression
- Command name :
bgm.cross,bgm2.cross wait:false: Run next command immediately. Default behavior.true: Run next command after playing sound complete.
Stop sound¶
- name: bgm.stop
# condition: expression
- Command name :
bgm.stop,bgm2.stop,se.stop,se2.stop
Fade out sound¶
- name: bgm.fadeOut
parameters:
duration: 500
stop: true
wait: false
# condition: expression
- Command name :
bgm.fadeOut,bgm2.fadeOut,se.fadeOut,se2.fadeOut wait:false: Run next command immediately. Default behavior.true: Run next command after playing sound complete.
Fade in sound¶
- name: bgm.fadeIn
parameters: { duration: 500 }
# condition: expression
- Command name :
bgm.fadeIn,bgm2.fadeIn
Pause sound¶
- name: bgm.pause
# condition: expression
- Command name :
bgm.pause,bgm2.pause
Resume sound¶
- name: bgm.resume
# condition: expression
- Command name :
bgm.resume,bgm2.resume
Mute sound¶
- name: bgm.mute
# condition: expression
- Command name :
bgm.mute,bgm2.mute,se.mute,se2.mute
Unmute sound¶
- name: bgm.unmute
# condition: expression
- Command name :
bgm.unmute,bgm2.unmute,se.unmute,se2.unmute
Camera¶
Camera properties¶
- name: camera.set
parameters:
x:
y:
rotate:
zoom:
name:
# condition: expression
x,y: Scrollrotate: Rotate in degreezoom: Zoomname: Target camera indexed by name. Default is main camera.
Run next command immediately.
Fade in¶
- name: camera.fadeIn
parameters:
duration: 1000
red:
green:
blue:
name:
wait: false
# condition: expression
duration,red,green,blue: See fade effectname: Target camera indexed by name. Default is main camera.wait:false: Run next command immediately. Default behavior.true: Run next command after effect complete.
Fade out¶
- name: camera.fadeOut
parameters:
duration: 1000
red:
green:
blue:
name:
wait: false
# condition: expression
duration,red,green,blue: See fade effectname: Target camera indexed by name. Default is main camera.wait:false: Run next command immediately. Default behavior.true: Run next command after effect complete.
Flash¶
- name: camera.flash
parameters:
duration: 1000
red:
green:
blue:
name:
wait: false
# condition: expression
duration,red,green,blue: See flash effectname: Target camera indexed by name. Default is main camera.wait:false: Run next command immediately. Default behavior.true: Run next command after effect complete.
Shake¶
- name: camera.shake
parameters:
duration: 1000
intensity:
name:
wait: false
# condition: expression
duration,intensity: See shake effectname: Target camera indexed by name. Default is main camera.wait:false: Run next command immediately. Default behavior.true: Run next command after effect complete.
Zoom¶
- name: camera.zoomTo
parameters:
duration: 1000
zoom:
name:
wait: false
# condition: expression
duration,zoom: See zoom effectname: Target camera indexed by name. Default is main camera.wait:false: Run next command immediately. Default behavior.true: Run next command after effect complete.
Rotate to¶
- name: camera.rotateTo
parameters:
duration: 1000
rotate:
ease:
name:
wait: false
# condition: expression
duration,rotate,ease: See rotateTo effectname: Target camera indexed by name. Default is main camera.wait:false: Run next command immediately. Default behavior.true: Run next command after effect complete.
Scroll to¶
- name: camera.scrollTo
parameters:
duration: 1000
x:
y:
ease:
name:
wait: false
# condition: expression
duration,x,y,ease: Scroll to position.name: Target camera indexed by name. Default is main camera.wait:false: Run next command immediately. Default behavior.true: Run next command after effect complete.
Add custom command¶
commandExecutor.addCommand(commandName, function(config, eventSheetManager){
// var resumeCallback = eventSheetManager.pauseEventSheet();
// ...
// resumeCallback()
}, scope);
config: Parameters passed from event sheet.eventSheetManager: This event mangager.- Pause running of current event sheet
var resumeCallback = eventSheetManager.pauseEventSheet(); // resumeCallback(); // Resume running of current event sheet - Pause running of current event sheet until another
eventNamefiring fromeventEmittereventSheetManager.pauseEventSheetUnitlEvent(eventEmitter, eventName);
- Pause running of current event sheet