Add onStart parameter into scene.transition(config)

It can define transition action of  scenes in a single scene.transition(config) call.
This commit is contained in:
Rex 2022-02-15 10:10:33 +08:00
parent 1abf11e4f9
commit 558589f851
2 changed files with 11 additions and 0 deletions

View file

@ -334,6 +334,15 @@ var ScenePlugin = new Class({
this.manager.start(key, GetFastValue(config, 'data')); this.manager.start(key, GetFastValue(config, 'data'));
} }
var onStartCallback = GetFastValue(config, 'onStart', null);
var onStartScope = GetFastValue(config, 'onStartScope', this.scene);
if (onStartCallback)
{
onStartCallback.call(onStartScope, this.scene, target, duration);
}
this.systems.events.emit(Events.TRANSITION_OUT, target, duration); this.systems.events.emit(Events.TRANSITION_OUT, target, duration);
this.systems.events.on(Events.UPDATE, this.step, this); this.systems.events.on(Events.UPDATE, this.step, this);

View file

@ -11,5 +11,7 @@
* @property {boolean} [moveBelow] - Move the target Scene to be below this one before the transition starts. * @property {boolean} [moveBelow] - Move the target Scene to be below this one before the transition starts.
* @property {function} [onUpdate] - This callback is invoked every frame for the duration of the transition. * @property {function} [onUpdate] - This callback is invoked every frame for the duration of the transition.
* @property {any} [onUpdateScope] - The context in which the callback is invoked. * @property {any} [onUpdateScope] - The context in which the callback is invoked.
* @property {function} [onStart] - This callback is invoked when transition starting.
* @property {any} [onStartScope] - The context in which the callback is invoked.
* @property {any} [data] - An object containing any data you wish to be passed to the target scene's init / create methods (if sleep is false) or to the target scene's wake event callback (if sleep is true). * @property {any} [data] - An object containing any data you wish to be passed to the target scene's init / create methods (if sleep is false) or to the target scene's wake event callback (if sleep is true).
*/ */