Commit 7b6e842f authored by wildfirecode's avatar wildfirecode

1

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