mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
More typedefs
This commit is contained in:
parent
42cb39749f
commit
0db663d901
25 changed files with 146 additions and 128 deletions
|
@ -89,7 +89,7 @@ var InputPlugin = new Class({
|
|||
* A reference to the Scene Systems Settings.
|
||||
*
|
||||
* @name Phaser.Input.InputPlugin#settings
|
||||
* @type {Phaser.Scenes.Settings.Object}
|
||||
* @type {Phaser.Scenes.Types.SettingsObject}
|
||||
* @since 3.5.0
|
||||
*/
|
||||
this.settings = scene.sys.settings;
|
||||
|
|
|
@ -78,7 +78,7 @@ var GamepadPlugin = new Class({
|
|||
* A reference to the Scene Systems Settings.
|
||||
*
|
||||
* @name Phaser.Input.Gamepad.GamepadPlugin#settings
|
||||
* @type {Phaser.Scenes.Settings.Object}
|
||||
* @type {Phaser.Scenes.Types.SettingsObject}
|
||||
* @since 3.10.0
|
||||
*/
|
||||
this.settings = this.scene.sys.settings;
|
||||
|
|
|
@ -94,7 +94,7 @@ var KeyboardPlugin = new Class({
|
|||
* A reference to the Scene Systems Settings.
|
||||
*
|
||||
* @name Phaser.Input.Keyboard.KeyboardPlugin#settings
|
||||
* @type {Phaser.Scenes.Settings.Object}
|
||||
* @type {Phaser.Scenes.Types.SettingsObject}
|
||||
* @since 3.10.0
|
||||
*/
|
||||
this.settings = this.scene.sys.settings;
|
||||
|
|
|
@ -16,7 +16,7 @@ var Systems = require('./Systems');
|
|||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {(string|Phaser.Scenes.Settings.Config)} config - Scene specific configuration settings.
|
||||
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - Scene specific configuration settings.
|
||||
*/
|
||||
var Scene = new Class({
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ var SceneManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`.
|
||||
* @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene
|
||||
* @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The config for the Scene
|
||||
* @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added.
|
||||
* @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`.
|
||||
*
|
||||
|
@ -706,7 +706,7 @@ var SceneManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - The key of the Scene.
|
||||
* @param {(string|Phaser.Scenes.Settings.Config)} sceneConfig - The Scene config.
|
||||
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} sceneConfig - The Scene config.
|
||||
*
|
||||
* @return {Phaser.Scene} The created Scene.
|
||||
*/
|
||||
|
@ -784,7 +784,7 @@ var SceneManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - The key to check in the Scene config.
|
||||
* @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The Scene config.
|
||||
* @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The Scene config.
|
||||
*
|
||||
* @return {string} The Scene key.
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ var ScenePlugin = new Class({
|
|||
* The settings of the Scene this ScenePlugin belongs to.
|
||||
*
|
||||
* @name Phaser.Scenes.ScenePlugin#settings
|
||||
* @type {Phaser.Scenes.Settings.Object}
|
||||
* @type {Phaser.Scenes.Types.SettingsObject}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.settings = scene.sys.settings;
|
||||
|
@ -226,20 +226,6 @@ var ScenePlugin = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* @typedef {object} SceneTransitionConfig
|
||||
*
|
||||
* @property {string} target - The Scene key to transition to.
|
||||
* @property {integer} [duration=1000] - The duration, in ms, for the transition to last.
|
||||
* @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`)
|
||||
* @property {boolean} [allowInput=false] - Will the Scenes Input system be able to process events while it is transitioning in or out?
|
||||
* @property {boolean} [moveAbove] - Move the target Scene to be above 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 {any} [onUpdateScope] - The context in which the callback is invoked.
|
||||
* @property {any} [data] - An object containing any data you wish to be passed to the target Scenes init / create methods.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This will start a transition from the current Scene to the target Scene given.
|
||||
*
|
||||
|
@ -274,7 +260,7 @@ var ScenePlugin = new Class({
|
|||
* @fires Phaser.Scenes.Events#TRANSITION_OUT
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param {SceneTransitionConfig} config - The transition configuration object.
|
||||
* @param {Phaser.Scenes.Types.SceneTransitionConfig} config - The transition configuration object.
|
||||
*
|
||||
* @return {boolean} `true` is the transition was started, otherwise `false`.
|
||||
*/
|
||||
|
@ -444,7 +430,7 @@ var ScenePlugin = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - The Scene key.
|
||||
* @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene.
|
||||
* @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The config for the Scene.
|
||||
* @param {boolean} autoStart - Whether to start the Scene after it's added.
|
||||
* @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`.
|
||||
*
|
||||
|
|
|
@ -13,42 +13,6 @@ var InjectionMap = require('./InjectionMap');
|
|||
* @namespace Phaser.Scenes.Settings
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} Phaser.Scenes.Settings.Config
|
||||
*
|
||||
* @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance.
|
||||
* @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step.
|
||||
* @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step.
|
||||
* @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins.
|
||||
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object.
|
||||
* @property {Object.<string, string>} [map] - Overwrites the default injection map for a scene.
|
||||
* @property {Object.<string, string>} [mapAdd] - Extends the injection map for a scene.
|
||||
* @property {object} [physics={}] - The physics configuration object for the Scene.
|
||||
* @property {object} [loader={}] - The loader configuration object for the Scene.
|
||||
* @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} Phaser.Scenes.Settings.Object
|
||||
*
|
||||
* @property {number} status - The current status of the Scene. Maps to the Scene constants.
|
||||
* @property {string} key - The unique key of this Scene. Unique within the entire Game instance.
|
||||
* @property {boolean} active - The active state of this Scene. An active Scene updates each step.
|
||||
* @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step.
|
||||
* @property {boolean} isBooted - Has the Scene finished booting?
|
||||
* @property {boolean} isTransition - Is the Scene in a state of transition?
|
||||
* @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set.
|
||||
* @property {integer} transitionDuration - The duration of the transition, if set.
|
||||
* @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions?
|
||||
* @property {object} data - a data bundle passed to this Scene from the Scene Manager.
|
||||
* @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins.
|
||||
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - The Camera configuration object.
|
||||
* @property {Object.<string, string>} map - The Scene's Injection Map.
|
||||
* @property {object} physics - The physics configuration object for the Scene.
|
||||
* @property {object} loader - The loader configuration object for the Scene.
|
||||
* @property {(false|*)} plugins - The plugin configuration object for the Scene.
|
||||
*/
|
||||
|
||||
var Settings = {
|
||||
|
||||
/**
|
||||
|
@ -57,9 +21,9 @@ var Settings = {
|
|||
* @function Phaser.Scenes.Settings.create
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {(string|Phaser.Scenes.Settings.Config)} config - The Scene configuration object used to create this Scene Settings.
|
||||
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - The Scene configuration object used to create this Scene Settings.
|
||||
*
|
||||
* @return {Phaser.Scenes.Settings.Object} The Scene Settings object created as a result of the config and default settings.
|
||||
* @return {Phaser.Scenes.Types.SettingsObject} The Scene Settings object created as a result of the config and default settings.
|
||||
*/
|
||||
create: function (config)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ var Settings = require('./Settings');
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Scene} scene - The Scene that owns this Systems instance.
|
||||
* @param {(string|Phaser.Scenes.Settings.Config)} config - Scene specific configuration settings.
|
||||
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - Scene specific configuration settings.
|
||||
*/
|
||||
var Systems = new Class({
|
||||
|
||||
|
@ -69,7 +69,7 @@ var Systems = new Class({
|
|||
* The Scene Configuration object, as passed in when creating the Scene.
|
||||
*
|
||||
* @name Phaser.Scenes.Systems#config
|
||||
* @type {(string|Phaser.Scenes.Settings.Config)}
|
||||
* @type {(string|Phaser.Scenes.Types.SettingsConfig)}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.config = config;
|
||||
|
@ -78,7 +78,7 @@ var Systems = new Class({
|
|||
* The Scene Settings. This is the parsed output based on the Scene configuration.
|
||||
*
|
||||
* @name Phaser.Scenes.Systems#settings
|
||||
* @type {Phaser.Scenes.Settings.Object}
|
||||
* @type {Phaser.Scenes.Types.SettingsObject}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.settings = Settings.create(config);
|
||||
|
|
14
src/scene/typedefs/SceneTransitionConfig.js
Normal file
14
src/scene/typedefs/SceneTransitionConfig.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* @typedef {object} Phaser.Scenes.Types.SceneTransitionConfig
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @property {string} target - The Scene key to transition to.
|
||||
* @property {integer} [duration=1000] - The duration, in ms, for the transition to last.
|
||||
* @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`)
|
||||
* @property {boolean} [allowInput=false] - Will the Scenes Input system be able to process events while it is transitioning in or out?
|
||||
* @property {boolean} [moveAbove] - Move the target Scene to be above 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 {any} [onUpdateScope] - The context in which the callback is invoked.
|
||||
* @property {any} [data] - An object containing any data you wish to be passed to the target Scenes init / create methods.
|
||||
*/
|
15
src/scene/typedefs/SettingsConfig.js
Normal file
15
src/scene/typedefs/SettingsConfig.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* @typedef {object} Phaser.Scenes.Types.SettingsConfig
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance.
|
||||
* @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step.
|
||||
* @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step.
|
||||
* @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins.
|
||||
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object.
|
||||
* @property {Object.<string, string>} [map] - Overwrites the default injection map for a scene.
|
||||
* @property {Object.<string, string>} [mapAdd] - Extends the injection map for a scene.
|
||||
* @property {object} [physics={}] - The physics configuration object for the Scene.
|
||||
* @property {object} [loader={}] - The loader configuration object for the Scene.
|
||||
* @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene.
|
||||
*/
|
21
src/scene/typedefs/SettingsObject.js
Normal file
21
src/scene/typedefs/SettingsObject.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* @typedef {object} Phaser.Scenes.Types.SettingsObject
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @property {number} status - The current status of the Scene. Maps to the Scene constants.
|
||||
* @property {string} key - The unique key of this Scene. Unique within the entire Game instance.
|
||||
* @property {boolean} active - The active state of this Scene. An active Scene updates each step.
|
||||
* @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step.
|
||||
* @property {boolean} isBooted - Has the Scene finished booting?
|
||||
* @property {boolean} isTransition - Is the Scene in a state of transition?
|
||||
* @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set.
|
||||
* @property {integer} transitionDuration - The duration of the transition, if set.
|
||||
* @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions?
|
||||
* @property {object} data - a data bundle passed to this Scene from the Scene Manager.
|
||||
* @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins.
|
||||
* @property {?(Phaser.Cameras.Scene2D.Types.JSONCamera|Phaser.Cameras.Scene2D.Types.JSONCamera[])} cameras - The Camera configuration object.
|
||||
* @property {Object.<string, string>} map - The Scene's Injection Map.
|
||||
* @property {object} physics - The physics configuration object for the Scene.
|
||||
* @property {object} loader - The loader configuration object for the Scene.
|
||||
* @property {(false|*)} plugins - The plugin configuration object for the Scene.
|
||||
*/
|
9
src/scene/typedefs/index.js
Normal file
9
src/scene/typedefs/index.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2019 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace Phaser.Scenes.Types
|
||||
*/
|
|
@ -23,7 +23,7 @@ var NOOP = require('../utils/NOOP');
|
|||
*
|
||||
* @param {Phaser.Sound.BaseSoundManager} manager - Reference to the current sound manager instance.
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
*/
|
||||
var BaseSound = new Class({
|
||||
|
||||
|
@ -116,7 +116,7 @@ var BaseSound = new Class({
|
|||
* Default values will be set by properties' setters.
|
||||
*
|
||||
* @name Phaser.Sound.BaseSound#config
|
||||
* @type {SoundConfig}
|
||||
* @type {Phaser.Sound.Types.SoundConfig}
|
||||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
@ -137,7 +137,7 @@ var BaseSound = new Class({
|
|||
* It could be default config or marker config.
|
||||
*
|
||||
* @name Phaser.Sound.BaseSound#currentConfig
|
||||
* @type {SoundConfig}
|
||||
* @type {Phaser.Sound.Types.SoundConfig}
|
||||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
@ -149,7 +149,7 @@ var BaseSound = new Class({
|
|||
* Object containing markers definitions.
|
||||
*
|
||||
* @name Phaser.Sound.BaseSound#markers
|
||||
* @type {Object.<string, SoundMarker>}
|
||||
* @type {Object.<string, Phaser.Sound.Types.SoundMarker>}
|
||||
* @default {}
|
||||
* @readonly
|
||||
* @since 3.0.0
|
||||
|
@ -161,7 +161,7 @@ var BaseSound = new Class({
|
|||
* 'null' if whole sound is playing.
|
||||
*
|
||||
* @name Phaser.Sound.BaseSound#currentMarker
|
||||
* @type {SoundMarker}
|
||||
* @type {Phaser.Sound.Types.SoundMarker}
|
||||
* @default null
|
||||
* @readonly
|
||||
* @since 3.0.0
|
||||
|
@ -232,7 +232,7 @@ var BaseSound = new Class({
|
|||
* @method Phaser.Sound.BaseSound#updateMarker
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {SoundMarker} marker - Marker object with updated values.
|
||||
* @param {Phaser.Sound.Types.SoundMarker} marker - Marker object with updated values.
|
||||
*
|
||||
* @return {boolean} Whether the marker was updated successfully.
|
||||
*/
|
||||
|
@ -264,7 +264,7 @@ var BaseSound = new Class({
|
|||
*
|
||||
* @param {string} markerName - The name of the marker to remove.
|
||||
*
|
||||
* @return {?SoundMarker} Removed marker object or 'null' if there was no marker with provided name.
|
||||
* @return {?Phaser.Sound.Types.SoundMarker} Removed marker object or 'null' if there was no marker with provided name.
|
||||
*/
|
||||
removeMarker: function (markerName)
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ var BaseSound = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound.
|
||||
* @param {SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
|
||||
*
|
||||
* @return {boolean} Whether the sound started playing successfully.
|
||||
*/
|
||||
|
|
|
@ -12,23 +12,6 @@ var Events = require('./events');
|
|||
var GameEvents = require('../core/events');
|
||||
var NOOP = require('../utils/NOOP');
|
||||
|
||||
/**
|
||||
* @callback EachActiveSoundCallback
|
||||
*
|
||||
* @param {Phaser.Sound.BaseSoundManager} manager - The SoundManager
|
||||
* @param {Phaser.Sound.BaseSound} sound - The current active Sound
|
||||
* @param {number} index - The index of the current active Sound
|
||||
* @param {Phaser.Sound.BaseSound[]} sounds - All sounds
|
||||
*/
|
||||
|
||||
/**
|
||||
* Audio sprite sound type.
|
||||
*
|
||||
* @typedef {object} AudioSpriteSound
|
||||
*
|
||||
* @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback.
|
||||
|
@ -192,7 +175,7 @@ var BaseSoundManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
*
|
||||
* @return {Phaser.Sound.BaseSound} The new sound instance.
|
||||
*/
|
||||
|
@ -207,9 +190,9 @@ var BaseSoundManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
*
|
||||
* @return {AudioSpriteSound} The new audio sprite sound instance.
|
||||
* @return {Phaser.Sound.Types.AudioSpriteSound} The new audio sprite sound instance.
|
||||
*/
|
||||
addAudioSprite: function (key, config)
|
||||
{
|
||||
|
@ -252,7 +235,7 @@ var BaseSoundManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {(SoundConfig|SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object.
|
||||
* @param {(Phaser.Sound.Types.SoundConfig|Phaser.Sound.Types.SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object.
|
||||
*
|
||||
* @return {boolean} Whether the sound started playing successfully.
|
||||
*/
|
||||
|
@ -291,7 +274,7 @@ var BaseSoundManager = new Class({
|
|||
*
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {string} spriteName - The name of the sound sprite to play.
|
||||
* @param {SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
*
|
||||
* @return {boolean} Whether the audio sprite sound started playing successfully.
|
||||
*/
|
||||
|
@ -513,7 +496,7 @@ var BaseSoundManager = new Class({
|
|||
* @private
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void
|
||||
* @param {Phaser.Sound.Types.EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void
|
||||
* @param {*} [scope] - Callback context.
|
||||
*/
|
||||
forEachActiveSound: function (callback, scope)
|
||||
|
|
|
@ -21,7 +21,7 @@ var Events = require('../events');
|
|||
*
|
||||
* @param {Phaser.Sound.HTML5AudioSoundManager} manager - Reference to the current sound manager instance.
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config={}] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config={}] - An optional config object containing default sound settings.
|
||||
*/
|
||||
var HTML5AudioSound = new Class({
|
||||
|
||||
|
@ -105,7 +105,7 @@ var HTML5AudioSound = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound.
|
||||
* @param {SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
|
||||
*
|
||||
* @return {boolean} Whether the sound started playing successfully.
|
||||
*/
|
||||
|
|
|
@ -133,7 +133,7 @@ var HTML5AudioSoundManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
*
|
||||
* @return {Phaser.Sound.HTML5AudioSound} The new sound instance.
|
||||
*/
|
||||
|
|
|
@ -9,31 +9,6 @@
|
|||
* @namespace Phaser.Sound
|
||||
*/
|
||||
|
||||
/**
|
||||
* Config object containing various sound settings.
|
||||
*
|
||||
* @typedef {object} SoundConfig
|
||||
*
|
||||
* @property {boolean} [mute=false] - Boolean indicating whether the sound should be muted or not.
|
||||
* @property {number} [volume=1] - A value between 0 (silence) and 1 (full volume).
|
||||
* @property {number} [rate=1] - Defines the speed at which the sound should be played.
|
||||
* @property {number} [detune=0] - Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
|
||||
* @property {number} [seek=0] - Position of playback for this sound, in seconds.
|
||||
* @property {boolean} [loop=false] - Whether or not the sound or current sound marker should loop.
|
||||
* @property {number} [delay=0] - Time, in seconds, that should elapse before the sound actually starts its playback.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marked section of a sound represented by name, and optionally start time, duration, and config object.
|
||||
*
|
||||
* @typedef {object} SoundMarker
|
||||
*
|
||||
* @property {string} name - Unique identifier of a sound marker.
|
||||
* @property {number} [start=0] - Sound position offset at witch playback should start.
|
||||
* @property {number} [duration] - Playback duration of this marker.
|
||||
* @property {SoundConfig} [config] - An optional config object containing default marker settings.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
SoundManagerCreator: require('./SoundManagerCreator'),
|
||||
|
|
|
@ -27,7 +27,7 @@ var Extend = require('../../utils/object/Extend');
|
|||
*
|
||||
* @param {Phaser.Sound.NoAudioSoundManager} manager - Reference to the current sound manager instance.
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config={}] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config={}] - An optional config object containing default sound settings.
|
||||
*/
|
||||
var NoAudioSound = new Class({
|
||||
|
||||
|
|
8
src/sound/typedefs/AudioSpriteSound.js
Normal file
8
src/sound/typedefs/AudioSpriteSound.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Audio sprite sound type.
|
||||
*
|
||||
* @typedef {object} Phaser.Sound.Types.AudioSpriteSound
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool.
|
||||
*/
|
9
src/sound/typedefs/EachActiveSoundCallback.js
Normal file
9
src/sound/typedefs/EachActiveSoundCallback.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @callback Phaser.Sound.Types.EachActiveSoundCallback
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Sound.BaseSoundManager} manager - The SoundManager
|
||||
* @param {Phaser.Sound.BaseSound} sound - The current active Sound
|
||||
* @param {number} index - The index of the current active Sound
|
||||
* @param {Phaser.Sound.BaseSound[]} sounds - All sounds
|
||||
*/
|
14
src/sound/typedefs/SoundConfig.js
Normal file
14
src/sound/typedefs/SoundConfig.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Config object containing various sound settings.
|
||||
*
|
||||
* @typedef {object} Phaser.Sound.Types.SoundConfig
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @property {boolean} [mute=false] - Boolean indicating whether the sound should be muted or not.
|
||||
* @property {number} [volume=1] - A value between 0 (silence) and 1 (full volume).
|
||||
* @property {number} [rate=1] - Defines the speed at which the sound should be played.
|
||||
* @property {number} [detune=0] - Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
|
||||
* @property {number} [seek=0] - Position of playback for this sound, in seconds.
|
||||
* @property {boolean} [loop=false] - Whether or not the sound or current sound marker should loop.
|
||||
* @property {number} [delay=0] - Time, in seconds, that should elapse before the sound actually starts its playback.
|
||||
*/
|
11
src/sound/typedefs/SoundMarker.js
Normal file
11
src/sound/typedefs/SoundMarker.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Marked section of a sound represented by name, and optionally start time, duration, and config object.
|
||||
*
|
||||
* @typedef {object} Phaser.Sound.Types.SoundMarker
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @property {string} name - Unique identifier of a sound marker.
|
||||
* @property {number} [start=0] - Sound position offset at witch playback should start.
|
||||
* @property {number} [duration] - Playback duration of this marker.
|
||||
* @property {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default marker settings.
|
||||
*/
|
9
src/sound/typedefs/index.js
Normal file
9
src/sound/typedefs/index.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2019 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace Phaser.Sound.Types
|
||||
*/
|
|
@ -21,7 +21,7 @@ var Events = require('../events');
|
|||
*
|
||||
* @param {Phaser.Sound.WebAudioSoundManager} manager - Reference to the current sound manager instance.
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config={}] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config={}] - An optional config object containing default sound settings.
|
||||
*/
|
||||
var WebAudioSound = new Class({
|
||||
|
||||
|
@ -187,7 +187,7 @@ var WebAudioSound = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound.
|
||||
* @param {SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
|
||||
*
|
||||
* @return {boolean} Whether the sound started playing successfully.
|
||||
*/
|
||||
|
|
|
@ -120,7 +120,7 @@ var WebAudioSoundManager = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} key - Asset key for the sound.
|
||||
* @param {SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
* @param {Phaser.Sound.Types.SoundConfig} [config] - An optional config object containing default sound settings.
|
||||
*
|
||||
* @return {Phaser.Sound.WebAudioSound} The new sound instance.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue