/**
 * Created by rockyl on 2019-11-22.
 */

export class Test1 extends engine.Container {
	constructor() {
		super();

		let sprite = new engine.Sprite(engine.Texture.from(getAssetByUUID('20191216114509').uuid));
		this.addChild(sprite);

		sprite.addEventListener(engine.MouseEvent.CLICK, this.onClick, this);

		engine.globalEvent.addEventListener('start-game', this.onGameStart, this);
	}

	private onClick(e){
		engine.globalEvent.dispatchEvent('update-game-status', {score: 1});
	}

	private onGameStart(e){
		console.log(e.type, e.data, 'test');

		let rect = new engine.Rect();
		rect.x = 100;
		rect.y = 200;
		rect.width = 100;
		rect.height = 100;
		rect.fillColor = 'green';
		this.addChild(rect);
	}
}
