Commit 7b6e842f authored by wildfirecode's avatar wildfirecode

1

parent 95b95b2b
This diff is collapsed.
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
function injectProps(p) { function injectProps(p) {
engine.injectProp(props, p); engine.injectProp(props, p);
} }
//# sourceMappingURL=props.js.map
var picMap = {}; var picMap = {};
var posMap = {}; var posMap = {};
...@@ -59,6 +60,7 @@ ...@@ -59,6 +60,7 @@
posMap[url] = pos.concat([]); posMap[url] = pos.concat([]);
return [spr, pos]; return [spr, pos];
}); });
//# sourceMappingURL=qietu.js.map
function getTexture(uuid) { function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid); return engine.Texture.from(getAssetByUUID(uuid).uuid);
...@@ -75,6 +77,7 @@ ...@@ -75,6 +77,7 @@
return .5 - Math.random(); return .5 - Math.random();
}); });
} }
//# sourceMappingURL=utils.js.map
var MAX_COL; var MAX_COL;
var MAX_ROW; var MAX_ROW;
...@@ -94,6 +97,11 @@ ...@@ -94,6 +97,11 @@
} }
GameView.prototype.start = function () { GameView.prototype.start = function () {
var _this = this; var _this = this;
for (var _i = 0, _a = this.pictures; _i < _a.length; _i++) {
var pic = _a[_i];
if (pic && pic.parent)
pic.parent.removeChild(pic);
}
console.log('on start'); console.log('on start');
engine.globalEvent.dispatchEvent('pictures-time-update', { engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(), second: this.getSecond(),
...@@ -110,7 +118,7 @@ ...@@ -110,7 +118,7 @@
for (; i < len; i++) { for (; i < len; i++) {
this.dragPic = this.pictures[i]; this.dragPic = this.pictures[i];
this.pictures[i].addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown, this); this.pictures[i].addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown, this);
var _a = posList[i], x = _a[0], y = _a[1]; var _b = posList[i], x = _b[0], y = _b[1];
this.dragPic.x = x; this.dragPic.x = x;
this.dragPic.y = y; this.dragPic.y = y;
} }
...@@ -221,7 +229,7 @@ ...@@ -221,7 +229,7 @@
GameView.prototype.onSuccess = function () { GameView.prototype.onSuccess = function () {
console.log('拼图成功!'); console.log('拼图成功!');
this.stop(); this.stop();
engine.globalEvent.dispatchEvent('pictures-game-success', {}); engine.globalEvent.dispatchEvent('pictures-game-success', { time: this._timeCounter });
}; };
GameView.prototype.onMove = function (e) { GameView.prototype.onMove = function (e) {
this.dragPic.x = e.stageX - this.localPicX; this.dragPic.x = e.stageX - this.localPicX;
...@@ -251,6 +259,7 @@ ...@@ -251,6 +259,7 @@
}; };
return GameWrapper; return GameWrapper;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) { function index (props) {
prepareProps(); prepareProps();
...@@ -258,6 +267,7 @@ ...@@ -258,6 +267,7 @@
var instance = new GameWrapper(); var instance = new GameWrapper();
return instance; return instance;
} }
//# sourceMappingURL=index.js.map
return index; return index;
......
This diff is collapsed.
...@@ -25,6 +25,10 @@ export default class GameView extends engine.Container { ...@@ -25,6 +25,10 @@ export default class GameView extends engine.Container {
// private countTime = 20; // private countTime = 20;
start() { start() {
for (const pic of this.pictures) {
if (pic && pic.parent)
pic.parent.removeChild(pic);
}
console.log('on start') console.log('on start')
engine.globalEvent.dispatchEvent('pictures-time-update', { engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(), second: this.getSecond(),
...@@ -80,12 +84,12 @@ export default class GameView extends engine.Container { ...@@ -80,12 +84,12 @@ export default class GameView extends engine.Container {
} }
} }
afterPointTwo(n){ afterPointTwo(n) {
var floatN = parseFloat(n); var floatN = parseFloat(n);
if(isNaN(floatN)){ if (isNaN(floatN)) {
return ; return;
} }
floatN = Math.round(floatN * 100) /100; floatN = Math.round(floatN * 100) / 100;
return floatN; return floatN;
} }
...@@ -118,7 +122,7 @@ export default class GameView extends engine.Container { ...@@ -118,7 +122,7 @@ export default class GameView extends engine.Container {
centerX: number; centerX: number;
centerY: number; centerY: number;
pictures; pictures: engine.Sprite[];
// 点击图片时的索引 // 点击图片时的索引
index; index;
...@@ -126,7 +130,7 @@ export default class GameView extends engine.Container { ...@@ -126,7 +130,7 @@ export default class GameView extends engine.Container {
indexJ: number; indexJ: number;
rightList: engine.Sprite[]; rightList: engine.Sprite[];
private picturesWrapper: engine.Sprite; private picturesWrapper: engine.Sprite;
private guideHole: engine.Sprite; private guideHole: engine.Sprite;
...@@ -235,7 +239,7 @@ export default class GameView extends engine.Container { ...@@ -235,7 +239,7 @@ export default class GameView extends engine.Container {
this.pictures[dragPicIndex] = dropPic; this.pictures[dragPicIndex] = dropPic;
// 图片还是在原来的位置 // 图片还是在原来的位置
if(dragPicIndex === dropPicIndex){ if (dragPicIndex === dropPicIndex) {
this.dragPic.x = this.distanceX this.dragPic.x = this.distanceX
this.dragPic.y = this.distanceY this.dragPic.y = this.distanceY
} }
...@@ -252,7 +256,7 @@ export default class GameView extends engine.Container { ...@@ -252,7 +256,7 @@ export default class GameView extends engine.Container {
this.onSuccess(); this.onSuccess();
} }
}else{ } else {
this.dragPic.x = this.distanceX this.dragPic.x = this.distanceX
this.dragPic.y = this.distanceY this.dragPic.y = this.distanceY
} }
...@@ -267,7 +271,7 @@ export default class GameView extends engine.Container { ...@@ -267,7 +271,7 @@ export default class GameView extends engine.Container {
private onSuccess() { private onSuccess() {
console.log('拼图成功!'); console.log('拼图成功!');
this.stop(); this.stop();
engine.globalEvent.dispatchEvent('pictures-game-success', {}); engine.globalEvent.dispatchEvent('pictures-game-success', { time: this._timeCounter });
} }
onMove(e: engine.MouseEvent) { onMove(e: engine.MouseEvent) {
......
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