2013-05-31 17:21:32 +00:00
|
|
|
/// <reference path="../../Game.ts" />
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Phaser - Components - Events
|
|
|
|
*
|
2013-06-01 01:49:41 +00:00
|
|
|
* Signals that are dispatched by the Sprite and its various components
|
2013-05-31 17:21:32 +00:00
|
|
|
*/
|
|
|
|
|
2013-06-06 01:47:08 +00:00
|
|
|
module Phaser.Components.Sprite {
|
2013-05-31 17:21:32 +00:00
|
|
|
|
|
|
|
export class Events {
|
|
|
|
|
2013-06-01 18:59:20 +00:00
|
|
|
/**
|
2013-07-12 02:28:46 +00:00
|
|
|
* The Events component is a collection of events fired by the parent game object and its components.
|
|
|
|
* @param parent The game object using this Input component
|
2013-06-01 18:59:20 +00:00
|
|
|
*/
|
2013-06-06 01:47:08 +00:00
|
|
|
constructor(parent: Phaser.Sprite) {
|
2013-05-31 17:21:32 +00:00
|
|
|
|
2013-06-01 01:49:41 +00:00
|
|
|
this.game = parent.game;
|
2013-07-12 02:28:46 +00:00
|
|
|
this._parent = parent;
|
2013-05-31 17:21:32 +00:00
|
|
|
|
2013-06-02 02:47:54 +00:00
|
|
|
this.onAddedToGroup = new Phaser.Signal;
|
|
|
|
this.onRemovedFromGroup = new Phaser.Signal;
|
|
|
|
this.onKilled = new Phaser.Signal;
|
|
|
|
this.onRevived = new Phaser.Signal;
|
2013-07-13 11:38:59 +00:00
|
|
|
this.onOutOfBounds = new Phaser.Signal;
|
2013-06-02 02:47:54 +00:00
|
|
|
|
2013-06-01 01:49:41 +00:00
|
|
|
}
|
2013-05-31 17:21:32 +00:00
|
|
|
|
2013-06-01 18:59:20 +00:00
|
|
|
/**
|
|
|
|
* Reference to Phaser.Game
|
|
|
|
*/
|
2013-06-01 01:49:41 +00:00
|
|
|
public game: Game;
|
2013-06-01 18:59:20 +00:00
|
|
|
|
|
|
|
/**
|
2013-07-12 02:28:46 +00:00
|
|
|
* Local private reference to its parent game object.
|
2013-06-01 18:59:20 +00:00
|
|
|
*/
|
2013-07-12 02:28:46 +00:00
|
|
|
private _parent: Phaser.Sprite;
|
2013-05-31 17:21:32 +00:00
|
|
|
|
2013-06-02 02:47:54 +00:00
|
|
|
/**
|
|
|
|
* Dispatched by the Group this Sprite is added to.
|
|
|
|
*/
|
|
|
|
public onAddedToGroup: Phaser.Signal;
|
2013-06-01 01:49:41 +00:00
|
|
|
|
2013-06-02 02:47:54 +00:00
|
|
|
/**
|
|
|
|
* Dispatched by the Group this Sprite is removed from.
|
|
|
|
*/
|
|
|
|
public onRemovedFromGroup: Phaser.Signal;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatched when this Sprite is killed.
|
|
|
|
*/
|
|
|
|
public onKilled: Phaser.Signal;
|
2013-06-01 01:49:41 +00:00
|
|
|
|
2013-06-02 02:47:54 +00:00
|
|
|
/**
|
|
|
|
* Dispatched when this Sprite is revived.
|
|
|
|
*/
|
|
|
|
public onRevived: Phaser.Signal;
|
2013-06-01 18:59:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatched by the Input component when a pointer moves over an Input enabled sprite.
|
|
|
|
*/
|
2013-05-31 17:21:32 +00:00
|
|
|
public onInputOver: Phaser.Signal;
|
2013-06-01 18:59:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatched by the Input component when a pointer moves out of an Input enabled sprite.
|
|
|
|
*/
|
2013-05-31 17:21:32 +00:00
|
|
|
public onInputOut: Phaser.Signal;
|
2013-06-01 18:59:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatched by the Input component when a pointer is pressed down on an Input enabled sprite.
|
|
|
|
*/
|
2013-05-31 17:21:32 +00:00
|
|
|
public onInputDown: Phaser.Signal;
|
2013-06-01 18:59:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatched by the Input component when a pointer is released over an Input enabled sprite
|
|
|
|
*/
|
2013-05-31 17:21:32 +00:00
|
|
|
public onInputUp: Phaser.Signal;
|
|
|
|
|
2013-07-02 22:41:25 +00:00
|
|
|
/**
|
|
|
|
* Dispatched by the Input component when the Sprite starts being dragged
|
|
|
|
*/
|
|
|
|
public onDragStart: Phaser.Signal;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatched by the Input component when the Sprite stops being dragged
|
|
|
|
*/
|
|
|
|
public onDragStop: Phaser.Signal;
|
2013-06-02 02:47:54 +00:00
|
|
|
|
2013-07-12 02:28:46 +00:00
|
|
|
/**
|
|
|
|
* Dispatched by the Animation component when the Sprite starts being animated
|
|
|
|
*/
|
|
|
|
public onAnimationStart: Phaser.Signal;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatched by the Animation component when the Sprite animation completes
|
|
|
|
*/
|
|
|
|
public onAnimationComplete: Phaser.Signal;
|
2013-06-02 02:47:54 +00:00
|
|
|
|
2013-07-12 02:28:46 +00:00
|
|
|
/**
|
|
|
|
* Dispatched by the Animation component when the Sprite animation loops
|
|
|
|
*/
|
|
|
|
public onAnimationLoop: Phaser.Signal;
|
2013-06-02 02:47:54 +00:00
|
|
|
|
2013-07-13 11:38:59 +00:00
|
|
|
/**
|
|
|
|
* Dispatched by the Sprite when it first leaves the world bounds
|
|
|
|
*/
|
2013-06-02 02:47:54 +00:00
|
|
|
public onOutOfBounds: Phaser.Signal;
|
|
|
|
|
2013-05-31 17:21:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|