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
|
|
|
*/
|
|
|
|
|
|
|
|
module Phaser.Components {
|
|
|
|
|
|
|
|
export class Events {
|
|
|
|
|
2013-06-01 18:59:20 +00:00
|
|
|
/**
|
|
|
|
* The Events component is a collection of events fired by the parent Sprite and its other components.
|
|
|
|
* @param parent The Sprite using this Input component
|
|
|
|
*/
|
2013-06-01 01:49:41 +00:00
|
|
|
constructor(parent: Sprite) {
|
2013-05-31 17:21:32 +00:00
|
|
|
|
2013-06-01 01:49:41 +00:00
|
|
|
this.game = parent.game;
|
2013-05-31 17:21:32 +00:00
|
|
|
this._sprite = parent;
|
|
|
|
|
2013-06-01 01:49:41 +00:00
|
|
|
this.onInputOver = new Phaser.Signal;
|
|
|
|
this.onInputOut = new Phaser.Signal;
|
|
|
|
this.onInputDown = new Phaser.Signal;
|
|
|
|
this.onInputUp = new Phaser.Signal;
|
2013-05-31 17:21:32 +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
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference to the Image stored in the Game.Cache that is used as the texture for the Sprite.
|
|
|
|
*/
|
2013-05-31 17:21:32 +00:00
|
|
|
private _sprite: Sprite;
|
|
|
|
|
2013-06-01 01:49:41 +00:00
|
|
|
// Creation and destruction
|
|
|
|
public onAdded: Phaser.Signal;
|
|
|
|
public onKilled: Phaser.Signal;
|
|
|
|
public onRevived: Phaser.Signal;
|
|
|
|
|
|
|
|
public onOutOfBounds: Phaser.Signal;
|
|
|
|
|
|
|
|
// Input related events
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|