Commit 6dff793e authored by zhangjinzhou's avatar zhangjinzhou

事件重命名

parent b5a62234
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -41,17 +41,17 @@ function launchWithCustomModule(customModule) { ...@@ -41,17 +41,17 @@ function launchWithCustomModule(customModule) {
}, 100); }, 100);
setTimeout(() => { setTimeout(() => {
engine.globalEvent.dispatchEvent('game-create', { engine.globalEvent.dispatchEvent('bqgame-create', {
}); });
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
engine.globalEvent.dispatchEvent('game-start', { engine.globalEvent.dispatchEvent('bqgame-start', {
guide:true guide:true
}); });
}, 510); }, 510);
engine.globalEvent.addEventListener('game-start', (e) => { engine.globalEvent.addEventListener('bqgame-start', (e) => {
console.log(e.type, e.data); console.log(e.type, e.data);
}); });
}); });
......
...@@ -858,11 +858,6 @@ ...@@ -858,11 +858,6 @@
function CarDi(wid, hei) { function CarDi(wid, hei) {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
engine.globalEvent.addEventListener("carDiMove", _this.carDiMove, _this); engine.globalEvent.addEventListener("carDiMove", _this.carDiMove, _this);
var rect = new engine.Shape();
rect.beginFill(0xff0000, 0.5);
rect.drawRect(0, 0, wid, hei);
rect.endFill();
_this.addChild(rect);
var collider = _this.collider = _this.addComponent(RectCollider); var collider = _this.collider = _this.addComponent(RectCollider);
collider.setData(0, 0, wid, hei); collider.setData(0, 0, wid, hei);
collider.group = ColliderGroup.Car; collider.group = ColliderGroup.Car;
...@@ -2733,7 +2728,7 @@ ...@@ -2733,7 +2728,7 @@
}; };
Game.prototype.over = function () { Game.prototype.over = function () {
this.pause = true; this.pause = true;
engine.globalEvent.dispatchEvent("game-over", this._updateData); engine.globalEvent.dispatchEvent("bqgame-over", this._updateData);
this.onGameOver && this.onGameOver(); this.onGameOver && this.onGameOver();
}; };
Game.prototype.createWall = function () { Game.prototype.createWall = function () {
...@@ -2814,7 +2809,7 @@ ...@@ -2814,7 +2809,7 @@
} }
} }
if (needSend) { if (needSend) {
engine.globalEvent.dispatchEvent("game-update", updateData); engine.globalEvent.dispatchEvent("bqgame-update", updateData);
} }
}; };
Game.prototype.updateMaxBallNum = function (bulletScore) { Game.prototype.updateMaxBallNum = function (bulletScore) {
...@@ -2898,7 +2893,7 @@ ...@@ -2898,7 +2893,7 @@
configurable: true configurable: true
}); });
Game.prototype.onGuideDone = function () { Game.prototype.onGuideDone = function () {
engine.globalEvent.dispatchEvent('game-start'); engine.globalEvent.dispatchEvent('bqgame-start');
}; };
Object.defineProperty(Game.prototype, "_PowerScore", { Object.defineProperty(Game.prototype, "_PowerScore", {
get: function () { get: function () {
...@@ -2920,28 +2915,28 @@ ...@@ -2920,28 +2915,28 @@
function ShootPlanet() { function ShootPlanet() {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this.game = null; _this.game = null;
_this.ntype = "game-create"; _this.ntype = "bqgame-create";
_this.customProperty(); _this.customProperty();
_this.width = 750; _this.width = 750;
_this.height = 1624; _this.height = 1624;
_this.init(); _this.init();
engine.globalEvent.addEventListener('game-create', _this.onActive, _this); engine.globalEvent.addEventListener('bqgame-create', _this.onActive, _this);
engine.globalEvent.addEventListener('game-destroy', _this.onSleep, _this); engine.globalEvent.addEventListener('bqgame-destroy', _this.onSleep, _this);
engine.globalEvent.addEventListener('game-revive', _this.onRevive, _this); engine.globalEvent.addEventListener('bqgame-revive', _this.onRevive, _this);
engine.globalEvent.addEventListener('game-pause', _this.onPause, _this); engine.globalEvent.addEventListener('bqgame-pause', _this.onPause, _this);
engine.globalEvent.addEventListener('game-resume', _this.onResume, _this); engine.globalEvent.addEventListener('bqgame-resume', _this.onResume, _this);
engine.globalEvent.addEventListener("game-start", _this.onStart, _this); engine.globalEvent.addEventListener("bqgame-start", _this.onStart, _this);
engine.globalEvent.addEventListener("game_reset", _this.onReset, _this); engine.globalEvent.addEventListener("bqgame_reset", _this.onReset, _this);
return _this; return _this;
} }
ShootPlanet.prototype.changeStage = function () { ShootPlanet.prototype.changeStage = function () {
if (this.ntype == "game-create") { if (this.ntype == "bqgame-create") {
this.onSleep(); this.onSleep();
this.ntype = "game-destroy"; this.ntype = "bqgame-destroy";
} }
else { else {
this.onActive(); this.onActive();
this.ntype = "game-create"; this.ntype = "bqgame-create";
} }
}; };
ShootPlanet.prototype.onActive = function () { ShootPlanet.prototype.onActive = function () {
...@@ -2990,6 +2985,7 @@ ...@@ -2990,6 +2985,7 @@
}; };
return ShootPlanet; return ShootPlanet;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=ShootPlanet.js.map
function index (props) { function index (props) {
prepareProps(); prepareProps();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -36,27 +36,27 @@ ...@@ -36,27 +36,27 @@
}, },
"events": { "events": {
"in": { "in": {
"game-create": { "bqgame-create": {
"alias": "初始化游戏" "alias": "初始化游戏"
}, },
"game-destroy": { "bqgame-destroy": {
"alias": "销毁游戏" "alias": "销毁游戏"
}, },
"game-pause": { "bqgame-pause": {
"alias": "暂停游戏" "alias": "暂停游戏"
}, },
"game-resume": { "bqgame-resume": {
"alias": "恢复游戏" "alias": "恢复游戏"
}, },
"game-revive": { "bqgame-revive": {
"alias": "复活" "alias": "复活"
} }
}, },
"out": { "out": {
"game-start": { "bqgame-start": {
"alias": "游戏开始" "alias": "游戏开始"
}, },
"game-update": { "bqgame-update": {
"alias": "游戏更新", "alias": "游戏更新",
"data": { "data": {
"score": "分数", "score": "分数",
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
"powerScore": "火力分数" "powerScore": "火力分数"
} }
}, },
"game-over": { "bqgame-over": {
"alias": "游戏结束", "alias": "游戏结束",
"data": { "data": {
"score": "分数", "score": "分数",
......
...@@ -13,11 +13,11 @@ export default class CarDi extends GameObject{ ...@@ -13,11 +13,11 @@ export default class CarDi extends GameObject{
engine.globalEvent.addEventListener("carDiMove",this.carDiMove,this); engine.globalEvent.addEventListener("carDiMove",this.carDiMove,this);
let rect = new engine.Shape(); // let rect = new engine.Shape();
rect.beginFill(0xff0000,0.5); // rect.beginFill(0xff0000,0.5);
rect.drawRect(0,0,wid,hei); // rect.drawRect(0,0,wid,hei);
rect.endFill(); // rect.endFill();
this.addChild(rect); // this.addChild(rect);
// //rect // //rect
// console.log("rect",rect); // console.log("rect",rect);
let collider = this.collider = this.addComponent<RectCollider>(RectCollider); let collider = this.collider = this.addComponent<RectCollider>(RectCollider);
......
...@@ -241,7 +241,7 @@ export default class Game { ...@@ -241,7 +241,7 @@ export default class Game {
private over() { private over() {
this.pause = true; this.pause = true;
engine.globalEvent.dispatchEvent("game-over", this._updateData); engine.globalEvent.dispatchEvent("bqgame-over", this._updateData);
this.onGameOver && this.onGameOver(); this.onGameOver && this.onGameOver();
} }
...@@ -347,7 +347,7 @@ export default class Game { ...@@ -347,7 +347,7 @@ export default class Game {
} }
} }
if (needSend) { if (needSend) {
engine.globalEvent.dispatchEvent("game-update", updateData); engine.globalEvent.dispatchEvent("bqgame-update", updateData);
} }
} }
...@@ -458,7 +458,7 @@ export default class Game { ...@@ -458,7 +458,7 @@ export default class Game {
} }
public onGuideDone() { public onGuideDone() {
engine.globalEvent.dispatchEvent('game-start'); engine.globalEvent.dispatchEvent('bqgame-start');
} }
public set _BulletScore(v: number) { public set _BulletScore(v: number) {
......
...@@ -17,13 +17,13 @@ export class ShootPlanet extends engine.Container { ...@@ -17,13 +17,13 @@ export class ShootPlanet extends engine.Container {
this.height = 1624; this.height = 1624;
this.init(); this.init();
engine.globalEvent.addEventListener('game-create', this.onActive, this); engine.globalEvent.addEventListener('bqgame-create', this.onActive, this);
engine.globalEvent.addEventListener('game-destroy', this.onSleep, this); engine.globalEvent.addEventListener('bqgame-destroy', this.onSleep, this);
engine.globalEvent.addEventListener('game-revive', this.onRevive, this); engine.globalEvent.addEventListener('bqgame-revive', this.onRevive, this);
engine.globalEvent.addEventListener('game-pause', this.onPause, this); engine.globalEvent.addEventListener('bqgame-pause', this.onPause, this);
engine.globalEvent.addEventListener('game-resume', this.onResume, this); engine.globalEvent.addEventListener('bqgame-resume', this.onResume, this);
engine.globalEvent.addEventListener("game-start",this.onStart,this); engine.globalEvent.addEventListener("bqgame-start",this.onStart,this);
engine.globalEvent.addEventListener("game_reset",this.onReset,this); engine.globalEvent.addEventListener("bqgame_reset",this.onReset,this);
// this.testbtn = new engine.Shape(); // this.testbtn = new engine.Shape();
// this.testbtn.beginFill(0xff0000,1); // this.testbtn.beginFill(0xff0000,1);
...@@ -33,14 +33,14 @@ export class ShootPlanet extends engine.Container { ...@@ -33,14 +33,14 @@ export class ShootPlanet extends engine.Container {
// this.testbtn.addEventListener(engine.MouseEvent.CLICK,this.changeStage,this); // this.testbtn.addEventListener(engine.MouseEvent.CLICK,this.changeStage,this);
} }
//stage测试233 //stage测试233
ntype = "game-create"; ntype = "bqgame-create";
changeStage(){ changeStage(){
if(this.ntype=="game-create"){ if(this.ntype=="bqgame-create"){
this.onSleep(); this.onSleep();
this.ntype = "game-destroy" this.ntype = "bqgame-destroy"
}else{ }else{
this.onActive(); this.onActive();
this.ntype = "game-create"; this.ntype = "bqgame-create";
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment