Commit 7e6d244d authored by 汪欢's avatar 汪欢

拼图计时器0.2

parents 851853ad c36439dd
No preview for this file type
No preview for this file type
This diff is collapsed.
...@@ -61,7 +61,7 @@ function launchWithCustomModule(customModule) { ...@@ -61,7 +61,7 @@ function launchWithCustomModule(customModule) {
// picUrl: "http://yun.duiba.com.cn/aurora/assets/d23e73d37ec01931e48cbd0a4095367044c5675c.png" // picUrl: "http://yun.duiba.com.cn/aurora/assets/d23e73d37ec01931e48cbd0a4095367044c5675c.png"
}); });
}, 2000); }, 10*1000);
}); });
engine.globalEvent.addEventListener('pictures-time-update', (e) => { engine.globalEvent.addEventListener('pictures-time-update', (e) => {
// console.log(e.type, e.data); // console.log(e.type, e.data);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
const assets = [ const assets = [
{ {
"name": "玩家icon", "name": "玩家icon",
"url": "//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png", "url": "//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png",
"uuid": "66f23d13-82a5-4cec-9496-301ec240d087", "uuid": "66f23d13-82a5-4cec-9496-301ec240d087",
"ext": ".png" "ext": ".png"
}, },
......
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
function GameView() { function GameView() {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this._timeCounter = 0; _this._timeCounter = 0;
_this.listenStageOn = 1;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this); _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this; return _this;
} }
...@@ -202,6 +203,7 @@ ...@@ -202,6 +203,7 @@
}; };
GameView.prototype.stageOnUp = function (e) { GameView.prototype.stageOnUp = function (e) {
this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this); this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this);
this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);
if (this.centerY < 0 || this.centerX < 0) { if (this.centerY < 0 || this.centerX < 0) {
this.dragPic.x = this.distanceX; this.dragPic.x = this.distanceX;
this.dragPic.y = this.distanceY; this.dragPic.y = this.distanceY;
...@@ -241,7 +243,6 @@ ...@@ -241,7 +243,6 @@
this.dragPic.x = this.distanceX; this.dragPic.x = this.distanceX;
this.dragPic.y = this.distanceY; this.dragPic.y = this.distanceY;
} }
this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);
}; };
GameView.prototype.onSuccess = function () { GameView.prototype.onSuccess = function () {
console.log('拼图成功!'); console.log('拼图成功!');
...@@ -257,7 +258,6 @@ ...@@ -257,7 +258,6 @@
}; };
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) { var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super); tslib.__extends(GameWrapper, _super);
......
This diff is collapsed.
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"MAX_COL": { "MAX_COL": {
"alias": "图片分成几列", "alias": "图片分成几列",
"type": "number", "type": "number",
"default": 2 "default": 3
}, },
"MAX_ROW": { "MAX_ROW": {
"alias": "图片分成几行", "alias": "图片分成几行",
"type": "number", "type": "number",
"default": 2 "default": 4
}, },
"W": { "W": {
"alias": "图片的宽度", "alias": "图片的宽度",
......
...@@ -237,13 +237,22 @@ export default class GameView extends engine.Container { ...@@ -237,13 +237,22 @@ export default class GameView extends engine.Container {
} }
listenStageOn=1;
stageOnUp(e) { stageOnUp(e) {
this.stage.removeEventListener( this.stage.removeEventListener(
engine.MouseEvent.MOUSE_MOVE, engine.MouseEvent.MOUSE_MOVE,
this.onMove, this.onMove,
this this
); );
this.stage.removeEventListener(
engine.MouseEvent.MOUSE_UP,
this.stageOnUp,
this
);
// 拖动的图片的中心位置在图片之外,回到原来的位置 // 拖动的图片的中心位置在图片之外,回到原来的位置
if (this.centerY < 0 || this.centerX < 0) { if (this.centerY < 0 || this.centerX < 0) {
this.dragPic.x = this.distanceX this.dragPic.x = this.distanceX
...@@ -309,11 +318,7 @@ export default class GameView extends engine.Container { ...@@ -309,11 +318,7 @@ export default class GameView extends engine.Container {
this.dragPic.y = this.distanceY this.dragPic.y = this.distanceY
} }
this.stage.removeEventListener(
engine.MouseEvent.MOUSE_UP,
this.stageOnUp,
this
);
} }
private onSuccess() { private onSuccess() {
......
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