Commit f0f9841e authored by zjz1994's avatar zjz1994

代码暂存

parent 38829cf5
...@@ -61,6 +61,12 @@ ...@@ -61,6 +61,12 @@
"url": "//yun.duiba.com.cn/aurora/assets/1c384d986504d5aabfffeb5125dc67e73ce1b539.png", "url": "//yun.duiba.com.cn/aurora/assets/1c384d986504d5aabfffeb5125dc67e73ce1b539.png",
"uuid": "kuang4", "uuid": "kuang4",
"ext": ".png" "ext": ".png"
},
{
"name": "testimg",
"url": "//yun.duiba.com.cn/aurora/assets/2628186c60c3b80013ae3178ff21a73ffbe71d43.jpg",
"uuid": "morentu",
"ext": ".jpg"
} }
], ],
"events": { "events": {
...@@ -128,5 +134,5 @@ ...@@ -128,5 +134,5 @@
} }
}, },
"id": "pintu", "id": "pintu",
"code": "(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :\n\ttypeof define === 'function' && define.amd ? define(['tslib'], factory) :\n\t(global = global || self, global.pintu = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\n\n\tvar props = {};\r\n\tfunction prepareProps() {\r\n\t var metaProps = getProps();\r\n\t engine.injectProp(props, metaProps);\r\n\t}\r\n\tfunction injectProps(p) {\r\n\t engine.injectProp(props, p);\r\n\t}\r\n\t//# sourceMappingURL=props.js.map\n\n\tfunction getTexture(uuid) {\r\n\t return engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n\t}\r\n\tfunction getTextureByName(name) {\r\n\t return getTexture(engine.getAssetByName(name).uuid);\r\n\t}\r\n\tfunction loadImageByUrl(url) {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t return tslib.__generator(this, function (_a) {\r\n\t console.log('loadImageByUrl----------:', url);\r\n\t return [2, new Promise(function (resolve) {\r\n\t if (engine.TextureCache[url]) {\r\n\t resolve(engine.TextureCache[url]);\r\n\t }\r\n\t else {\r\n\t var t = engine.Texture.from(url);\r\n\t t.addEventListener(\"loaded\", function () { resolve(t); });\r\n\t }\r\n\t })];\r\n\t });\r\n\t });\r\n\t}\r\n\t//# sourceMappingURL=utils.js.map\n\n\tvar qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () {\r\n\t var t, setimgwid, mwid1, mhei1, mwid, mhei, picarr, picnames, chax, chay, startlix, addlix, startliy, addliy, twid1, thei1, r, startx, c, starty, nsprite, isprite, nsp, ispritename, e_1;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t _a.trys.push([0, 6, , 7]);\r\n\t t = void 0;\r\n\t if (!(type1 == 1)) return [3, 1];\r\n\t t = url;\r\n\t return [3, 3];\r\n\t case 1: return [4, loadImageByUrl(url)];\r\n\t case 2:\r\n\t t = (_a.sent());\r\n\t _a.label = 3;\r\n\t case 3:\r\n\t setimgwid = 612;\r\n\t mwid1 = setimgwid / rows;\r\n\t mhei1 = setimgwid / cols;\r\n\t mwid = t.width;\r\n\t mhei = t.height;\r\n\t if (!(mwid < 10 || mhei < 10)) return [3, 5];\r\n\t return [4, new Promise(function (res) {\r\n\t setTimeout(function () {\r\n\t res();\r\n\t }, 200);\r\n\t })];\r\n\t case 4:\r\n\t _a.sent();\r\n\t return [2, qietu(t, 1, rows, cols)];\r\n\t case 5:\r\n\t if (mwid > mhei) {\r\n\t if (mhei < setimgwid) {\r\n\t mwid = mwid * setimgwid / mhei;\r\n\t mhei = setimgwid;\r\n\t }\r\n\t }\r\n\t else {\r\n\t if (mwid < setimgwid) {\r\n\t mhei = mhei * setimgwid / mwid;\r\n\t mwid = setimgwid;\r\n\t }\r\n\t }\r\n\t picarr = {};\r\n\t picnames = [];\r\n\t chax = void 0;\r\n\t chay = void 0;\r\n\t startlix = void 0;\r\n\t addlix = void 0;\r\n\t startliy = void 0;\r\n\t addliy = void 0;\r\n\t twid1 = void 0;\r\n\t thei1 = void 0;\r\n\t if (mwid > mhei) {\r\n\t chax = (mwid - mhei) / 2;\r\n\t startlix = chax / mwid;\r\n\t addlix = (mhei / cols) / mwid;\r\n\t startliy = 0;\r\n\t addliy = 1 / rows;\r\n\t twid1 = mwid * setimgwid / mhei;\r\n\t thei1 = setimgwid;\r\n\t }\r\n\t else {\r\n\t startlix = 0;\r\n\t addlix = 1 / cols;\r\n\t chay = (mhei - mwid) / 2;\r\n\t startliy = chay / mhei;\r\n\t addliy = (mwid / rows) / mhei;\r\n\t thei1 = mhei * setimgwid / mwid;\r\n\t twid1 = setimgwid;\r\n\t }\r\n\t for (r = 0; r < rows; r++) {\r\n\t startx = startlix + addlix * r;\r\n\t for (c = 0; c < cols; c++) {\r\n\t starty = startliy + addliy * c;\r\n\t nsprite = new engine.Container();\r\n\t isprite = new engine.ScrollView();\r\n\t nsp = new engine.Sprite(t);\r\n\t isprite.addChild(nsp);\r\n\t nsp.width = twid1;\r\n\t nsp.height = thei1;\r\n\t isprite.mouseEnabled = false;\r\n\t isprite.mouseChildren = false;\r\n\t nsp.x = -starty * twid1;\r\n\t nsp.y = -startx * thei1;\r\n\t isprite.width = mwid1;\r\n\t isprite.height = mhei1;\r\n\t nsprite.addChild(isprite);\r\n\t nsprite.width = mwid1;\r\n\t nsprite.height = mhei1;\r\n\t ispritename = \"pic_\" + c + \"_\" + r;\r\n\t nsprite.name = ispritename;\r\n\t picarr[ispritename] = nsprite;\r\n\t picnames.push(ispritename);\r\n\t }\r\n\t }\r\n\t return [2, {\r\n\t res: true,\r\n\t picarr: picarr,\r\n\t mwid: mwid1,\r\n\t mhei: mhei1,\r\n\t picnames: picnames\r\n\t }];\r\n\t case 6:\r\n\t e_1 = _a.sent();\r\n\t return [2, {\r\n\t res: false\r\n\t }];\r\n\t case 7: return [2];\r\n\t }\r\n\t });\r\n\t}); });\r\n\t//# sourceMappingURL=qietu.js.map\n\n\tvar GameView = (function (_super) {\r\n\t tslib.__extends(GameView, _super);\r\n\t function GameView() {\r\n\t var _this = _super.call(this) || this;\r\n\t _this.ingame = false;\r\n\t _this.selectImgArr = [];\r\n\t _this.sucposData = {};\r\n\t _this.gameUrls = [];\r\n\t _this.gameTimes = [];\r\n\t _this.onegamePics = [];\r\n\t _this.movesteps = 0;\r\n\t _this.startime = 0;\r\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.initScene, _this);\r\n\t return _this;\r\n\t }\r\n\t GameView.prototype.initScene = function () {\r\n\t this.lineShape = new engine.Shape();\r\n\t this.selectimg3 = new engine.Image(getTextureByName(\"框3\"));\r\n\t this.selectimg4 = new engine.Image(getTextureByName(\"框4\"));\r\n\t this.selectimg3.mouseEnabled = false;\r\n\t this.selectimg4.mouseEnabled = false;\r\n\t this.dicont = new engine.Container();\r\n\t this.linecont = new engine.Container();\r\n\t this.blockcont = new engine.Container();\r\n\t this.addChild(this.dicont);\r\n\t this.addChild(this.linecont);\r\n\t this.addChild(this.blockcont);\r\n\t this.linecont.addChild(this.lineShape);\r\n\t console.log(\"拼图初始化完毕--------------\");\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-initcomp\", {});\r\n\t this.removeEventListener(engine.Event.ADDED_TO_STAGE, this.initScene, this);\r\n\t };\r\n\t GameView.prototype.initgame = function () {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t var l, lurl, lt;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t console.log(\"initgame---------\");\r\n\t this.gameUrls = props.gameUrls;\r\n\t this.gameTimes = props.gameTimes;\r\n\t this.onegamePics = new Array();\r\n\t l = 0;\r\n\t _a.label = 1;\r\n\t case 1:\r\n\t if (!(l < this.gameUrls.length)) return [3, 4];\r\n\t lurl = this.gameUrls[l];\r\n\t return [4, loadImageByUrl(lurl)];\r\n\t case 2:\r\n\t lt = _a.sent();\r\n\t this.onegamePics.push(lt);\r\n\t if (this.onegamePics.length == 1) {\r\n\t this.startfirst();\r\n\t }\r\n\t _a.label = 3;\r\n\t case 3:\r\n\t l++;\r\n\t return [3, 1];\r\n\t case 4:\r\n\t this.removeSelectImg();\r\n\t return [2];\r\n\t }\r\n\t });\r\n\t });\r\n\t };\r\n\t GameView.prototype.removeSelectImg = function () {\r\n\t if (this.selectimg3) {\r\n\t this.blockcont.removeChild(this.selectimg3);\r\n\t }\r\n\t if (this.selectimg4) {\r\n\t this.blockcont.removeChild(this.selectimg4);\r\n\t }\r\n\t };\r\n\t GameView.prototype.startfirst = function () {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t var actidx, tex, type1, result, res, picarr, mwid, mhei, picnames, gap, r, c, ipicx, ipicy, npicname, ipic, rl, cl;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t this.dicont.removeChildren();\r\n\t this.movesteps = 0;\r\n\t this.startime = Date.now();\r\n\t this.removeSelectImg();\r\n\t actidx = 0;\r\n\t this.gametime = this.gameTimes[actidx];\r\n\t this.showtime = this.gameTimes[actidx];\r\n\t this.passtime = 0;\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-update\", {\r\n\t time: this.showtime,\r\n\t });\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-passtime\", {\r\n\t passtime: this.passtime\r\n\t });\r\n\t console.log(\"start-----------------\", actidx);\r\n\t this.rows = 3;\r\n\t this.cols = 3;\r\n\t this.nselectimg = null;\r\n\t if (this.rows == 3) {\r\n\t this.nselectimg = this.selectimg3;\r\n\t }\r\n\t if (this.rows == 4) {\r\n\t this.nselectimg = this.selectimg4;\r\n\t }\r\n\t this.selectImgArr = new Array();\r\n\t this.sucposData = {};\r\n\t tex = this.onegamePics[actidx];\r\n\t type1 = 1;\r\n\t if (!tex) {\r\n\t tex = this.gameUrls[actidx];\r\n\t type1 = 2;\r\n\t }\r\n\t return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)];\r\n\t case 1:\r\n\t result = _a.sent();\r\n\t res = result.res;\r\n\t if (res) {\r\n\t picarr = result.picarr;\r\n\t mwid = result.mwid;\r\n\t mhei = result.mhei;\r\n\t picnames = result.picnames;\r\n\t this.mwid = mwid;\r\n\t this.mhei = mhei;\r\n\t this.picarr = picarr;\r\n\t this.picnames = picnames;\r\n\t gap = 2;\r\n\t for (r = 0; r < this.rows; r++) {\r\n\t for (c = 0; c < this.cols; c++) {\r\n\t ipicx = mwid * c + gap;\r\n\t ipicy = mhei * r + gap;\r\n\t npicname = \"pic_\" + c + \"_\" + r;\r\n\t ipic = picarr[npicname];\r\n\t this.dicont.addChild(ipic);\r\n\t ipic.x = ipicx;\r\n\t ipic.y = ipicy;\r\n\t }\r\n\t }\r\n\t this.lineShape.clear();\r\n\t this.lineShape.beginStroke(0x0069df, 4, engine.LINE_CAP.BUTT, engine.LINE_JOIN.BEVEL, 100);\r\n\t this.lineShape.moveTo(0 + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, 0 + gap);\r\n\t for (rl = 1; rl < this.rows; rl++) {\r\n\t this.lineShape.moveTo(0 + gap, rl * mhei + gap);\r\n\t this.lineShape.lineTo(mwid * this.cols + gap, rl * mhei + gap);\r\n\t }\r\n\t for (cl = 1; cl < this.cols; cl++) {\r\n\t this.lineShape.moveTo(cl * mwid + gap, 0 + gap);\r\n\t this.lineShape.lineTo(cl * mwid + gap, this.rows * mhei + gap);\r\n\t }\r\n\t this.lineShape.endStroke();\r\n\t engine.globalEvent.dispatchEvent(\"pictures-load-complete\");\r\n\t this.ticker && clearInterval(this.ticker);\r\n\t this.ticker = setInterval(this.update, 10);\r\n\t }\r\n\t else {\r\n\t console.error(\"图片处理失败\");\r\n\t }\r\n\t return [2];\r\n\t }\r\n\t });\r\n\t });\r\n\t };\r\n\t GameView.prototype.start = function () {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t var actidx, tex, type1, result, res, picarr, mwid, mhei, picnames, gap, r, c, ipicx, ipicy, npicname, ipic, rl, cl;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t this.dicont.removeChildren();\r\n\t this.movesteps = 0;\r\n\t this.startime = Date.now();\r\n\t this.removeSelectImg();\r\n\t actidx = props.actidx;\r\n\t this.gametime = this.gameTimes[actidx];\r\n\t this.showtime = this.gameTimes[actidx];\r\n\t this.passtime = 0;\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-update\", {\r\n\t time: this.showtime,\r\n\t });\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-passtime\", {\r\n\t passtime: this.passtime\r\n\t });\r\n\t this.rows = props.rows;\r\n\t this.cols = props.cols;\r\n\t this.nselectimg = null;\r\n\t if (this.rows == 3) {\r\n\t this.nselectimg = this.selectimg3;\r\n\t }\r\n\t if (this.rows == 4) {\r\n\t this.nselectimg = this.selectimg4;\r\n\t }\r\n\t this.selectImgArr = new Array();\r\n\t this.sucposData = {};\r\n\t tex = this.onegamePics[actidx];\r\n\t type1 = 1;\r\n\t if (!tex) {\r\n\t tex = this.gameUrls[actidx];\r\n\t type1 = 2;\r\n\t }\r\n\t return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)];\r\n\t case 1:\r\n\t result = _a.sent();\r\n\t res = result.res;\r\n\t if (res) {\r\n\t picarr = result.picarr;\r\n\t mwid = result.mwid;\r\n\t mhei = result.mhei;\r\n\t picnames = result.picnames;\r\n\t this.mwid = mwid;\r\n\t this.mhei = mhei;\r\n\t this.picarr = picarr;\r\n\t this.picnames = picnames;\r\n\t gap = 2;\r\n\t for (r = 0; r < this.rows; r++) {\r\n\t for (c = 0; c < this.cols; c++) {\r\n\t ipicx = mwid * c + gap;\r\n\t ipicy = mhei * r + gap;\r\n\t npicname = \"pic_\" + c + \"_\" + r;\r\n\t ipic = picarr[npicname];\r\n\t this.dicont.addChild(ipic);\r\n\t ipic.x = ipicx;\r\n\t ipic.y = ipicy;\r\n\t }\r\n\t }\r\n\t this.lineShape.clear();\r\n\t this.lineShape.beginStroke(0x0069df, 4, engine.LINE_CAP.BUTT, engine.LINE_JOIN.BEVEL, 100);\r\n\t this.lineShape.moveTo(0 + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, 0 + gap);\r\n\t for (rl = 1; rl < this.rows; rl++) {\r\n\t this.lineShape.moveTo(0 + gap, rl * mhei + gap);\r\n\t this.lineShape.lineTo(mwid * this.cols + gap, rl * mhei + gap);\r\n\t }\r\n\t for (cl = 1; cl < this.cols; cl++) {\r\n\t this.lineShape.moveTo(cl * mwid + gap, 0 + gap);\r\n\t this.lineShape.lineTo(cl * mwid + gap, this.rows * mhei + gap);\r\n\t }\r\n\t this.lineShape.endStroke();\r\n\t this.ticker && clearInterval(this.ticker);\r\n\t this.ticker = setInterval(this.update, 10);\r\n\t }\r\n\t else {\r\n\t console.error(\"图片处理失败\");\r\n\t }\r\n\t return [2];\r\n\t }\r\n\t });\r\n\t });\r\n\t };\r\n\t GameView.prototype.luanxu = function () {\r\n\t var gap = 2;\r\n\t for (var r = 0; r < this.rows; r++) {\r\n\t for (var c = 0; c < this.cols; c++) {\r\n\t var ipicx = this.mwid * c + gap;\r\n\t var ipicy = this.mhei * r + gap;\r\n\t var npicname = \"pic_\" + c + \"_\" + r;\r\n\t this.sucposData[npicname] = r + \"_\" + c;\r\n\t var selidx = Math.floor(Math.random() * this.picnames.length);\r\n\t var ipicname = this.picnames[selidx];\r\n\t if (r == c && r != this.rows - 1) {\r\n\t while (ipicname == npicname) {\r\n\t selidx = Math.floor(Math.random() * this.picnames.length);\r\n\t ipicname = this.picnames[selidx];\r\n\t }\r\n\t }\r\n\t var ipic = this.picarr[ipicname];\r\n\t this.picnames.splice(selidx, 1);\r\n\t ipic.x = ipicx;\r\n\t ipic.y = ipicy;\r\n\t ipic[\"postr\"] = r + \"_\" + c;\r\n\t ipic.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.touchPic, this);\r\n\t }\r\n\t }\r\n\t };\r\n\t GameView.prototype.pause = function () {\r\n\t this.ingame = false;\r\n\t console.error(\"拼图暂停\");\r\n\t };\r\n\t GameView.prototype.resume = function () {\r\n\t this.lastframetime = Date.now();\r\n\t this.ingame = true;\r\n\t console.error(\"拼图继续\");\r\n\t };\r\n\t GameView.prototype.update = function () {\r\n\t var ntime = Date.now();\r\n\t if (!this.lastframetime) {\r\n\t this.lastframetime = ntime;\r\n\t return;\r\n\t }\r\n\t if (this.ingame) {\r\n\t var passtime = (ntime - this.lastframetime) / 1000;\r\n\t this.passtime += passtime;\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-passtime\", {\r\n\t passtime: this.passtime\r\n\t });\r\n\t var showtime1 = Math.round(this.gametime - this.passtime);\r\n\t if (this.showtime != showtime1) {\r\n\t this.showtime = showtime1;\r\n\t if (this.showtime <= 0) {\r\n\t this.showtime = 0;\r\n\t this.gameover(2);\r\n\t }\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-update\", {\r\n\t time: this.showtime\r\n\t });\r\n\t }\r\n\t }\r\n\t this.lastframetime = ntime;\r\n\t };\r\n\t GameView.prototype.touchPic = function (e) {\r\n\t if (!this.ingame) {\r\n\t return;\r\n\t }\r\n\t var selectname = e.target.name;\r\n\t var spx = e.target.x;\r\n\t var spy = e.target.y;\r\n\t var gap = 2;\r\n\t if (this.selectImgArr.length == 0) {\r\n\t if (this.nselectimg) {\r\n\t this.blockcont.addChild(this.nselectimg);\r\n\t this.nselectimg.x = spx - gap;\r\n\t this.nselectimg.y = spy - gap;\r\n\t }\r\n\t this.selectImgArr.push(selectname);\r\n\t }\r\n\t else if (this.selectImgArr.length == 1) {\r\n\t if (selectname == this.selectImgArr[0]) {\r\n\t if (this.nselectimg) {\r\n\t this.blockcont.removeChild(this.nselectimg);\r\n\t }\r\n\t this.selectImgArr = new Array();\r\n\t return;\r\n\t }\r\n\t else {\r\n\t this.selectImgArr.push(selectname);\r\n\t this.changeImgPos();\r\n\t }\r\n\t }\r\n\t };\r\n\t GameView.prototype.changeImgPos = function () {\r\n\t var img1name = this.selectImgArr[0];\r\n\t var img2name = this.selectImgArr[1];\r\n\t var img1 = this.dicont.getChildByName(img1name);\r\n\t var img2 = this.dicont.getChildByName(img2name);\r\n\t var imgpos1x = img1.x;\r\n\t var imgpos1y = img1.y;\r\n\t var imgpos2x = img2.x;\r\n\t var imgpos2y = img2.y;\r\n\t var imgpostr1 = img1.postr;\r\n\t var imgpostr2 = img2.postr;\r\n\t img1.x = imgpos2x;\r\n\t img1.y = imgpos2y;\r\n\t img1.postr = imgpostr2;\r\n\t img2.x = imgpos1x;\r\n\t img2.y = imgpos1y;\r\n\t img2.postr = imgpostr1;\r\n\t this.selectImgArr = new Array();\r\n\t this.movesteps += 1;\r\n\t if (this.nselectimg) {\r\n\t this.blockcont.removeChild(this.nselectimg);\r\n\t }\r\n\t var isuc = this.checkSuccess();\r\n\t if (isuc) {\r\n\t console.error(\"成功过关\");\r\n\t this.gameover(1);\r\n\t }\r\n\t };\r\n\t GameView.prototype.checkSuccess = function () {\r\n\t var isuc = true;\r\n\t for (var r = 0; r < this.rows; r++) {\r\n\t for (var c = 0; c < this.cols; c++) {\r\n\t var ipicname = \"pic_\" + c + \"_\" + r;\r\n\t var npicstr = r + \"_\" + c;\r\n\t var ipic = this.dicont.getChildByName(ipicname);\r\n\t var ipostr = ipic.postr;\r\n\t if (npicstr != ipostr) {\r\n\t isuc = false;\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t return isuc;\r\n\t };\r\n\t GameView.prototype.gameover = function (reason) {\r\n\t this.ingame = false;\r\n\t this.ticker && clearInterval(this.ticker);\r\n\t var ntime = Date.now();\r\n\t var gametime = ntime - this.startime;\r\n\t engine.globalEvent.dispatchEvent('pictures-game-over', {\r\n\t reason: reason,\r\n\t time: this.passtime,\r\n\t number: this.movesteps,\r\n\t gametime: gametime\r\n\t });\r\n\t };\r\n\t return GameView;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=GameView.js.map\n\n\tvar GameWrapper = (function (_super) {\r\n\t tslib.__extends(GameWrapper, _super);\r\n\t function GameWrapper() {\r\n\t var _this = _super.call(this) || this;\r\n\t _this._gameView = new GameView();\r\n\t _this.addChild(_this._gameView);\r\n\t engine.globalEvent.addEventListener('pictures-initgame', _this.initgame, _this);\r\n\t engine.globalEvent.addEventListener('pictures-start', _this.start, _this);\r\n\t engine.globalEvent.addEventListener('pictures-luanxu', _this.luanxu, _this);\r\n\t engine.globalEvent.addEventListener('pictures-pause', _this.pause, _this);\r\n\t engine.globalEvent.addEventListener('pictures-resume', _this.resume, _this);\r\n\t return _this;\r\n\t }\r\n\t GameWrapper.prototype.initgame = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.initgame();\r\n\t };\r\n\t GameWrapper.prototype.start = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.start();\r\n\t };\r\n\t GameWrapper.prototype.luanxu = function () {\r\n\t this._gameView.luanxu();\r\n\t };\r\n\t GameWrapper.prototype.pause = function (event) {\r\n\t this._gameView.pause();\r\n\t };\r\n\t GameWrapper.prototype.resume = function (event) {\r\n\t this._gameView.resume();\r\n\t };\r\n\t return GameWrapper;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=GameWrapper.js.map\n\n\tfunction index (props) {\r\n\t prepareProps();\r\n\t injectProps(props);\r\n\t var instance = new GameWrapper();\r\n\t return instance;\r\n\t}\r\n\t//# sourceMappingURL=index.js.map\n\n\treturn index;\n\n})));\n" "code": "(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :\n\ttypeof define === 'function' && define.amd ? define(['tslib'], factory) :\n\t(global = global || self, global.pintu = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\n\n\tvar props = {};\r\n\tfunction prepareProps() {\r\n\t var metaProps = getProps();\r\n\t engine.injectProp(props, metaProps);\r\n\t}\r\n\tfunction injectProps(p) {\r\n\t engine.injectProp(props, p);\r\n\t}\r\n\t//# sourceMappingURL=props.js.map\n\n\tfunction getTexture(uuid) {\r\n\t return engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n\t}\r\n\tfunction getTextureByName(name) {\r\n\t return getTexture(engine.getAssetByName(name).uuid);\r\n\t}\r\n\tfunction loadImageByUrl(url) {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t return tslib.__generator(this, function (_a) {\r\n\t try {\r\n\t return [2, new Promise(function (resolve) {\r\n\t var t1 = setTimeout(function () {\r\n\t return resolve(null);\r\n\t }, 2000);\r\n\t if (engine.TextureCache[url]) {\r\n\t clearTimeout(t1);\r\n\t resolve(engine.TextureCache[url]);\r\n\t }\r\n\t else {\r\n\t var t = engine.Texture.from(url);\r\n\t t.addEventListener(\"loaded\", function () { clearTimeout(t1); resolve(t); });\r\n\t }\r\n\t })];\r\n\t }\r\n\t catch (e) {\r\n\t return [2, null];\r\n\t }\r\n\t return [2];\r\n\t });\r\n\t });\r\n\t}\r\n\t//# sourceMappingURL=utils.js.map\n\n\tvar Tool = (function () {\r\n\t function Tool() {\r\n\t }\r\n\t Tool.getOnePic = function () {\r\n\t if (this.picPool.length > 0) {\r\n\t return this.picPool.shift();\r\n\t }\r\n\t else {\r\n\t var ipic = new engine.Container();\r\n\t var isprite = new engine.ScrollView();\r\n\t isprite.name = \"iscrollv\";\r\n\t var nsp = new engine.Sprite();\r\n\t nsp.name = \"isprite\";\r\n\t nsp.texture;\r\n\t isprite.addChild(nsp);\r\n\t ipic.addChild(isprite);\r\n\t isprite.mouseEnabled = false;\r\n\t nsp.mouseEnabled = false;\r\n\t return ipic;\r\n\t }\r\n\t };\r\n\t Tool.repushToPool = function (icont) {\r\n\t this.picPool.push(icont);\r\n\t };\r\n\t Tool.picPool = new Array();\r\n\t return Tool;\r\n\t}());\r\n\t//# sourceMappingURL=Tool.js.map\n\n\tvar qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () {\r\n\t var t, t1, setimgwid, mwid1, mhei1, picarr, picnames, startlix, addlix, startliy, addliy, twid1, thei1, r, startx, c, starty, nsprite, isprite, nsp, ispritename, e_1;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t _a.trys.push([0, 6, , 8]);\r\n\t t = void 0;\r\n\t if (!(type1 == 1)) return [3, 1];\r\n\t t = url;\r\n\t return [3, 5];\r\n\t case 1:\r\n\t if (!(type1 == 2)) return [3, 3];\r\n\t return [4, loadImageByUrl(url)];\r\n\t case 2:\r\n\t t1 = _a.sent();\r\n\t if (t1) {\r\n\t t = t1;\r\n\t }\r\n\t return [3, 5];\r\n\t case 3:\r\n\t if (!(type1 == 3)) return [3, 5];\r\n\t return [4, getTextureByName(\"testimg\")];\r\n\t case 4:\r\n\t t = (_a.sent());\r\n\t _a.label = 5;\r\n\t case 5:\r\n\t if (!t) {\r\n\t return [2, qietu(\"testimg\", 3, rows, cols)];\r\n\t }\r\n\t setimgwid = 612;\r\n\t mwid1 = setimgwid / rows;\r\n\t mhei1 = setimgwid / cols;\r\n\t picarr = {};\r\n\t picnames = [];\r\n\t startlix = 0;\r\n\t addlix = 1 / rows;\r\n\t startliy = 0;\r\n\t addliy = 1 / cols;\r\n\t twid1 = setimgwid;\r\n\t thei1 = setimgwid;\r\n\t for (r = 0; r < rows; r++) {\r\n\t startx = startlix + addlix * r;\r\n\t for (c = 0; c < cols; c++) {\r\n\t starty = startliy + addliy * c;\r\n\t nsprite = Tool.getOnePic();\r\n\t isprite = nsprite.getChildByName(\"iscrollv\");\r\n\t nsp = isprite.getChildByName(\"isprite\");\r\n\t nsp.texture = t;\r\n\t nsp.width = twid1;\r\n\t nsp.height = thei1;\r\n\t nsp.x = -starty * twid1;\r\n\t nsp.y = -startx * thei1;\r\n\t isprite.width = mwid1;\r\n\t isprite.height = mhei1;\r\n\t nsprite.width = mwid1;\r\n\t nsprite.height = mhei1;\r\n\t ispritename = \"pic_\" + c + \"_\" + r;\r\n\t nsprite.name = ispritename;\r\n\t picarr[ispritename] = nsprite;\r\n\t picnames.push(ispritename);\r\n\t }\r\n\t }\r\n\t return [2, {\r\n\t res: true,\r\n\t picarr: picarr,\r\n\t mwid: mwid1,\r\n\t mhei: mhei1,\r\n\t picnames: picnames\r\n\t }];\r\n\t case 6:\r\n\t e_1 = _a.sent();\r\n\t return [4, new Promise(function (res) {\r\n\t setTimeout(function () {\r\n\t res();\r\n\t }, 200);\r\n\t })];\r\n\t case 7:\r\n\t _a.sent();\r\n\t return [2, qietu(\"testimg\", 3, rows, cols)];\r\n\t case 8: return [2];\r\n\t }\r\n\t });\r\n\t}); });\r\n\t//# sourceMappingURL=qietu.js.map\n\n\tvar GameView = (function (_super) {\r\n\t tslib.__extends(GameView, _super);\r\n\t function GameView() {\r\n\t var _this = _super.call(this) || this;\r\n\t _this.ingame = false;\r\n\t _this.selectImgArr = [];\r\n\t _this.sucposData = {};\r\n\t _this.gameUrls = [];\r\n\t _this.gameTimes = [];\r\n\t _this.onegamePics = [];\r\n\t _this.movesteps = 0;\r\n\t _this.startime = 0;\r\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.initScene, _this);\r\n\t return _this;\r\n\t }\r\n\t GameView.prototype.initScene = function () {\r\n\t this.lineShape = new engine.Shape();\r\n\t this.selectimg3 = new engine.Image(getTextureByName(\"框3\"));\r\n\t this.selectimg4 = new engine.Image(getTextureByName(\"框4\"));\r\n\t this.selectimg3.mouseEnabled = false;\r\n\t this.selectimg4.mouseEnabled = false;\r\n\t this.dicont = new engine.Container();\r\n\t this.linecont = new engine.Container();\r\n\t this.blockcont = new engine.Container();\r\n\t this.addChild(this.dicont);\r\n\t this.addChild(this.linecont);\r\n\t this.addChild(this.blockcont);\r\n\t this.linecont.addChild(this.lineShape);\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-initcomp\", {});\r\n\t this.removeEventListener(engine.Event.ADDED_TO_STAGE, this.initScene, this);\r\n\t };\r\n\t GameView.prototype.initgame = function () {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t var l, lurl, lt;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t this.gameUrls = props.gameUrls || [\"https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/28.jpg\", \"https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/29.jpg\", \"https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/30.jpg\"];\r\n\t this.gameTimes = props.gameTimes || [30, 60, 60];\r\n\t this.onegamePics = new Array();\r\n\t l = 0;\r\n\t _a.label = 1;\r\n\t case 1:\r\n\t if (!(l < this.gameUrls.length)) return [3, 4];\r\n\t lurl = this.gameUrls[l];\r\n\t return [4, loadImageByUrl(lurl)];\r\n\t case 2:\r\n\t lt = _a.sent();\r\n\t if (lt) {\r\n\t lt = lt;\r\n\t }\r\n\t else {\r\n\t lt = null;\r\n\t }\r\n\t this.onegamePics.push(lt);\r\n\t if (this.onegamePics.length == 1) {\r\n\t this.startfirst();\r\n\t }\r\n\t _a.label = 3;\r\n\t case 3:\r\n\t l++;\r\n\t return [3, 1];\r\n\t case 4:\r\n\t this.removeSelectImg();\r\n\t return [2];\r\n\t }\r\n\t });\r\n\t });\r\n\t };\r\n\t GameView.prototype.removeSelectImg = function () {\r\n\t if (this.selectimg3) {\r\n\t this.blockcont.removeChild(this.selectimg3);\r\n\t }\r\n\t if (this.selectimg4) {\r\n\t this.blockcont.removeChild(this.selectimg4);\r\n\t }\r\n\t };\r\n\t GameView.prototype.removeDiPics = function () {\r\n\t var nume = this.dicont.children.length;\r\n\t for (var i = nume - 1; i >= 0; i--) {\r\n\t var ichild = this.dicont.getChildAt(i);\r\n\t if (ichild) {\r\n\t ichild.removeEventListener(engine.MouseEvent.MOUSE_DOWN, this.touchPic, this);\r\n\t this.dicont.removeChild(ichild);\r\n\t Tool.repushToPool(ichild);\r\n\t }\r\n\t }\r\n\t };\r\n\t GameView.prototype.startfirst = function () {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t var actidx, tex, type1, result, res, picarr, mwid, mhei, picnames, gap, r, c, ipicx, ipicy, npicname, ipic, rl, cl;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t this.removeDiPics();\r\n\t this.movesteps = 0;\r\n\t this.startime = Date.now();\r\n\t this.removeSelectImg();\r\n\t actidx = 0;\r\n\t this.gametime = this.gameTimes[actidx];\r\n\t this.showtime = this.gameTimes[actidx];\r\n\t this.passtime = 0;\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-update\", {\r\n\t time: this.showtime,\r\n\t });\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-passtime\", {\r\n\t passtime: this.passtime\r\n\t });\r\n\t this.rows = 3;\r\n\t this.cols = 3;\r\n\t this.nselectimg = null;\r\n\t if (this.rows == 3) {\r\n\t this.nselectimg = this.selectimg3;\r\n\t }\r\n\t if (this.rows == 4) {\r\n\t this.nselectimg = this.selectimg4;\r\n\t }\r\n\t this.selectImgArr = new Array();\r\n\t this.sucposData = {};\r\n\t tex = this.onegamePics[actidx];\r\n\t type1 = 1;\r\n\t if (!tex) {\r\n\t tex = this.gameUrls[actidx];\r\n\t type1 = 3;\r\n\t }\r\n\t return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)];\r\n\t case 1:\r\n\t result = _a.sent();\r\n\t res = result.res;\r\n\t if (res) {\r\n\t picarr = result.picarr;\r\n\t mwid = result.mwid;\r\n\t mhei = result.mhei;\r\n\t picnames = result.picnames;\r\n\t this.mwid = mwid;\r\n\t this.mhei = mhei;\r\n\t this.picarr = picarr;\r\n\t this.picnames = picnames;\r\n\t gap = 2;\r\n\t for (r = 0; r < this.rows; r++) {\r\n\t for (c = 0; c < this.cols; c++) {\r\n\t ipicx = mwid * c + gap;\r\n\t ipicy = mhei * r + gap;\r\n\t npicname = \"pic_\" + c + \"_\" + r;\r\n\t ipic = picarr[npicname];\r\n\t this.dicont.addChild(ipic);\r\n\t ipic.x = ipicx;\r\n\t ipic.y = ipicy;\r\n\t }\r\n\t }\r\n\t this.lineShape.clear();\r\n\t this.lineShape.beginStroke(0x0069df, 4, engine.LINE_CAP.BUTT, engine.LINE_JOIN.BEVEL, 100);\r\n\t this.lineShape.moveTo(0 + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, 0 + gap);\r\n\t for (rl = 1; rl < this.rows; rl++) {\r\n\t this.lineShape.moveTo(0 + gap, rl * mhei + gap);\r\n\t this.lineShape.lineTo(mwid * this.cols + gap, rl * mhei + gap);\r\n\t }\r\n\t for (cl = 1; cl < this.cols; cl++) {\r\n\t this.lineShape.moveTo(cl * mwid + gap, 0 + gap);\r\n\t this.lineShape.lineTo(cl * mwid + gap, this.rows * mhei + gap);\r\n\t }\r\n\t this.lineShape.endStroke();\r\n\t engine.globalEvent.dispatchEvent(\"pictures-load-complete\");\r\n\t this.ticker && clearInterval(this.ticker);\r\n\t this.ticker = setInterval(this.update, 10);\r\n\t }\r\n\t else {\r\n\t console.error(\"图片处理失败\");\r\n\t }\r\n\t return [2];\r\n\t }\r\n\t });\r\n\t });\r\n\t };\r\n\t GameView.prototype.start = function () {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t var actidx, tex, type1, result, res, picarr, mwid, mhei, picnames, gap, r, c, ipicx, ipicy, npicname, ipic, rl, cl;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t switch (_a.label) {\r\n\t case 0:\r\n\t this.removeDiPics();\r\n\t this.movesteps = 0;\r\n\t this.startime = Date.now();\r\n\t this.removeSelectImg();\r\n\t actidx = props.actidx;\r\n\t this.gametime = this.gameTimes[actidx];\r\n\t this.showtime = this.gameTimes[actidx];\r\n\t this.passtime = 0;\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-update\", {\r\n\t time: this.showtime,\r\n\t });\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-passtime\", {\r\n\t passtime: this.passtime\r\n\t });\r\n\t this.rows = props.rows;\r\n\t this.cols = props.cols;\r\n\t this.nselectimg = null;\r\n\t if (this.rows == 3) {\r\n\t this.nselectimg = this.selectimg3;\r\n\t }\r\n\t if (this.rows == 4) {\r\n\t this.nselectimg = this.selectimg4;\r\n\t }\r\n\t this.selectImgArr = new Array();\r\n\t this.sucposData = {};\r\n\t tex = this.onegamePics[actidx];\r\n\t type1 = 1;\r\n\t if (!tex) {\r\n\t tex = this.gameUrls[actidx];\r\n\t type1 = 3;\r\n\t }\r\n\t return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)];\r\n\t case 1:\r\n\t result = _a.sent();\r\n\t res = result.res;\r\n\t if (res) {\r\n\t picarr = result.picarr;\r\n\t mwid = result.mwid;\r\n\t mhei = result.mhei;\r\n\t picnames = result.picnames;\r\n\t this.mwid = mwid;\r\n\t this.mhei = mhei;\r\n\t this.picarr = picarr;\r\n\t this.picnames = picnames;\r\n\t gap = 2;\r\n\t for (r = 0; r < this.rows; r++) {\r\n\t for (c = 0; c < this.cols; c++) {\r\n\t ipicx = mwid * c + gap;\r\n\t ipicy = mhei * r + gap;\r\n\t npicname = \"pic_\" + c + \"_\" + r;\r\n\t ipic = picarr[npicname];\r\n\t this.dicont.addChild(ipic);\r\n\t ipic.x = ipicx;\r\n\t ipic.y = ipicy;\r\n\t }\r\n\t }\r\n\t this.lineShape.clear();\r\n\t this.lineShape.beginStroke(0x0069df, 4, engine.LINE_CAP.BUTT, engine.LINE_JOIN.BEVEL, 100);\r\n\t this.lineShape.moveTo(0 + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, 0 + gap);\r\n\t this.lineShape.lineTo(mhei * this.cols + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, mwid * this.rows + gap);\r\n\t this.lineShape.lineTo(0 + gap, 0 + gap);\r\n\t for (rl = 1; rl < this.rows; rl++) {\r\n\t this.lineShape.moveTo(0 + gap, rl * mhei + gap);\r\n\t this.lineShape.lineTo(mwid * this.cols + gap, rl * mhei + gap);\r\n\t }\r\n\t for (cl = 1; cl < this.cols; cl++) {\r\n\t this.lineShape.moveTo(cl * mwid + gap, 0 + gap);\r\n\t this.lineShape.lineTo(cl * mwid + gap, this.rows * mhei + gap);\r\n\t }\r\n\t this.lineShape.endStroke();\r\n\t this.ticker && clearInterval(this.ticker);\r\n\t this.ticker = setInterval(this.update, 10);\r\n\t }\r\n\t else {\r\n\t console.error(\"图片处理失败\");\r\n\t }\r\n\t return [2];\r\n\t }\r\n\t });\r\n\t });\r\n\t };\r\n\t GameView.prototype.luanxu = function () {\r\n\t var gap = 2;\r\n\t for (var r = 0; r < this.rows; r++) {\r\n\t for (var c = 0; c < this.cols; c++) {\r\n\t var ipicx = this.mwid * c + gap;\r\n\t var ipicy = this.mhei * r + gap;\r\n\t var npicname = \"pic_\" + c + \"_\" + r;\r\n\t this.sucposData[npicname] = r + \"_\" + c;\r\n\t var selidx = Math.floor(Math.random() * this.picnames.length);\r\n\t var ipicname = this.picnames[selidx];\r\n\t if (r == c && r != this.rows - 1) {\r\n\t while (ipicname == npicname) {\r\n\t selidx = Math.floor(Math.random() * this.picnames.length);\r\n\t ipicname = this.picnames[selidx];\r\n\t }\r\n\t }\r\n\t var ipic = this.picarr[ipicname];\r\n\t this.picnames.splice(selidx, 1);\r\n\t ipic.x = ipicx;\r\n\t ipic.y = ipicy;\r\n\t ipic[\"postr\"] = r + \"_\" + c;\r\n\t ipic.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.touchPic, this);\r\n\t }\r\n\t }\r\n\t };\r\n\t GameView.prototype.pause = function () {\r\n\t this.ingame = false;\r\n\t };\r\n\t GameView.prototype.resume = function () {\r\n\t this.lastframetime = Date.now();\r\n\t this.ingame = true;\r\n\t };\r\n\t GameView.prototype.update = function () {\r\n\t var ntime = Date.now();\r\n\t if (!this.lastframetime) {\r\n\t this.lastframetime = ntime;\r\n\t return;\r\n\t }\r\n\t if (this.ingame) {\r\n\t var passtime = (ntime - this.lastframetime) / 1000;\r\n\t this.passtime += passtime;\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-passtime\", {\r\n\t passtime: this.passtime\r\n\t });\r\n\t var showtime1 = Math.round(this.gametime - this.passtime);\r\n\t if (this.showtime != showtime1) {\r\n\t this.showtime = showtime1;\r\n\t if (this.showtime <= 0) {\r\n\t this.showtime = 0;\r\n\t this.gameover(2);\r\n\t }\r\n\t engine.globalEvent.dispatchEvent(\"pictures-time-update\", {\r\n\t time: this.showtime\r\n\t });\r\n\t }\r\n\t }\r\n\t this.lastframetime = ntime;\r\n\t };\r\n\t GameView.prototype.touchPic = function (e) {\r\n\t if (!this.ingame) {\r\n\t return;\r\n\t }\r\n\t var selectname = e.target.name;\r\n\t var spx = e.target.x;\r\n\t var spy = e.target.y;\r\n\t var gap = 2;\r\n\t if (this.selectImgArr.length == 0) {\r\n\t if (this.nselectimg) {\r\n\t this.blockcont.addChild(this.nselectimg);\r\n\t this.nselectimg.x = spx - gap;\r\n\t this.nselectimg.y = spy - gap;\r\n\t }\r\n\t this.selectImgArr.push(selectname);\r\n\t }\r\n\t else if (this.selectImgArr.length == 1) {\r\n\t if (selectname == this.selectImgArr[0]) {\r\n\t if (this.nselectimg) {\r\n\t this.blockcont.removeChild(this.nselectimg);\r\n\t }\r\n\t this.selectImgArr = new Array();\r\n\t return;\r\n\t }\r\n\t else {\r\n\t this.selectImgArr.push(selectname);\r\n\t this.changeImgPos();\r\n\t }\r\n\t }\r\n\t };\r\n\t GameView.prototype.changeImgPos = function () {\r\n\t var img1name = this.selectImgArr[0];\r\n\t var img2name = this.selectImgArr[1];\r\n\t var img1 = this.dicont.getChildByName(img1name);\r\n\t var img2 = this.dicont.getChildByName(img2name);\r\n\t var imgpos1x = img1.x;\r\n\t var imgpos1y = img1.y;\r\n\t var imgpos2x = img2.x;\r\n\t var imgpos2y = img2.y;\r\n\t var imgpostr1 = img1.postr;\r\n\t var imgpostr2 = img2.postr;\r\n\t img1.x = imgpos2x;\r\n\t img1.y = imgpos2y;\r\n\t img1.postr = imgpostr2;\r\n\t img2.x = imgpos1x;\r\n\t img2.y = imgpos1y;\r\n\t img2.postr = imgpostr1;\r\n\t this.selectImgArr = new Array();\r\n\t this.movesteps += 1;\r\n\t if (this.nselectimg) {\r\n\t this.blockcont.removeChild(this.nselectimg);\r\n\t }\r\n\t var isuc = this.checkSuccess();\r\n\t if (isuc) {\r\n\t this.gameover(1);\r\n\t }\r\n\t };\r\n\t GameView.prototype.checkSuccess = function () {\r\n\t var isuc = true;\r\n\t for (var r = 0; r < this.rows; r++) {\r\n\t for (var c = 0; c < this.cols; c++) {\r\n\t var ipicname = \"pic_\" + c + \"_\" + r;\r\n\t var npicstr = r + \"_\" + c;\r\n\t var ipic = this.dicont.getChildByName(ipicname);\r\n\t var ipostr = ipic.postr;\r\n\t if (npicstr != ipostr) {\r\n\t isuc = false;\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t return isuc;\r\n\t };\r\n\t GameView.prototype.gameover = function (reason) {\r\n\t this.ingame = false;\r\n\t this.ticker && clearInterval(this.ticker);\r\n\t var ntime = Date.now();\r\n\t var gametime = ntime - this.startime;\r\n\t engine.globalEvent.dispatchEvent('pictures-game-over', {\r\n\t reason: reason,\r\n\t time: this.passtime,\r\n\t number: this.movesteps,\r\n\t gametime: gametime\r\n\t });\r\n\t };\r\n\t return GameView;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=GameView.js.map\n\n\tvar GameWrapper = (function (_super) {\r\n\t tslib.__extends(GameWrapper, _super);\r\n\t function GameWrapper() {\r\n\t var _this = _super.call(this) || this;\r\n\t _this._gameView = new GameView();\r\n\t _this.addChild(_this._gameView);\r\n\t engine.globalEvent.addEventListener('pictures-initgame', _this.initgame, _this);\r\n\t engine.globalEvent.addEventListener('pictures-start', _this.start, _this);\r\n\t engine.globalEvent.addEventListener('pictures-luanxu', _this.luanxu, _this);\r\n\t engine.globalEvent.addEventListener('pictures-pause', _this.pause, _this);\r\n\t engine.globalEvent.addEventListener('pictures-resume', _this.resume, _this);\r\n\t return _this;\r\n\t }\r\n\t GameWrapper.prototype.initgame = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.initgame();\r\n\t };\r\n\t GameWrapper.prototype.start = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.start();\r\n\t };\r\n\t GameWrapper.prototype.luanxu = function () {\r\n\t this._gameView.luanxu();\r\n\t };\r\n\t GameWrapper.prototype.pause = function (event) {\r\n\t this._gameView.pause();\r\n\t };\r\n\t GameWrapper.prototype.resume = function (event) {\r\n\t this._gameView.resume();\r\n\t };\r\n\t return GameWrapper;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=GameWrapper.js.map\n\n\tfunction index (props) {\r\n\t prepareProps();\r\n\t injectProps(props);\r\n\t var instance = new GameWrapper();\r\n\t return instance;\r\n\t}\r\n\t//# sourceMappingURL=index.js.map\n\n\treturn index;\n\n})));\n"
} }
...@@ -48,7 +48,7 @@ function launchWithCustomModule(customModule) { ...@@ -48,7 +48,7 @@ function launchWithCustomModule(customModule) {
setTimeout(()=>{ setTimeout(()=>{
engine.globalEvent.dispatchEvent('pictures-initgame', { engine.globalEvent.dispatchEvent('pictures-initgame', {
gameUrls:[ gameUrls:[
"https://yun.duiba.com.cn/aurora/assets/5906e5670cb7061dfc77306087e9a79d4bbcb250.jpg", "https://yun.duiba.com.cn/aurora/assets/5906e5670cb7061dfc77306087e9a79d4bbcb2501.jpg",
"https://yun.duiba.com.cn/aurora/assets/61fd0754d7924305fd2851be86a480d71d2c2981.jpg", "https://yun.duiba.com.cn/aurora/assets/61fd0754d7924305fd2851be86a480d71d2c2981.jpg",
"https://yun.duiba.com.cn/aurora/assets/6b70d7ec626f35f21347bf5bc3e61bedc44167be.jpg" "https://yun.duiba.com.cn/aurora/assets/6b70d7ec626f35f21347bf5bc3e61bedc44167be.jpg"
], ],
......
...@@ -23,108 +23,113 @@ ...@@ -23,108 +23,113 @@
function loadImageByUrl(url) { function loadImageByUrl(url) {
return tslib.__awaiter(this, void 0, void 0, function () { return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
console.log('loadImageByUrl----------:', url); try {
return [2, new Promise(function (resolve) { return [2, new Promise(function (resolve) {
var t1 = setTimeout(function () {
return resolve(null);
}, 2000);
if (engine.TextureCache[url]) { if (engine.TextureCache[url]) {
clearTimeout(t1);
resolve(engine.TextureCache[url]); resolve(engine.TextureCache[url]);
} }
else { else {
var t = engine.Texture.from(url); var t = engine.Texture.from(url);
t.addEventListener("loaded", function () { resolve(t); }); t.addEventListener("loaded", function () { clearTimeout(t1); resolve(t); });
} }
})]; })];
}
catch (e) {
return [2, null];
}
return [2];
}); });
}); });
} }
//# sourceMappingURL=utils.js.map //# sourceMappingURL=utils.js.map
var Tool = (function () {
function Tool() {
}
Tool.getOnePic = function () {
if (this.picPool.length > 0) {
return this.picPool.shift();
}
else {
var ipic = new engine.Container();
var isprite = new engine.ScrollView();
isprite.name = "iscrollv";
var nsp = new engine.Sprite();
nsp.name = "isprite";
nsp.texture;
isprite.addChild(nsp);
ipic.addChild(isprite);
isprite.mouseEnabled = false;
nsp.mouseEnabled = false;
return ipic;
}
};
Tool.repushToPool = function (icont) {
this.picPool.push(icont);
};
Tool.picPool = new Array();
return Tool;
}());
//# sourceMappingURL=Tool.js.map
var qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () { var qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () {
var t, setimgwid, mwid1, mhei1, mwid, mhei, picarr, picnames, chax, chay, startlix, addlix, startliy, addliy, twid1, thei1, r, startx, c, starty, nsprite, isprite, nsp, ispritename, e_1; var t, t1, setimgwid, mwid1, mhei1, picarr, picnames, startlix, addlix, startliy, addliy, twid1, thei1, r, startx, c, starty, nsprite, isprite, nsp, ispritename, e_1;
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
_a.trys.push([0, 6, , 7]); _a.trys.push([0, 6, , 8]);
t = void 0; t = void 0;
if (!(type1 == 1)) return [3, 1]; if (!(type1 == 1)) return [3, 1];
t = url; t = url;
return [3, 3]; return [3, 5];
case 1: return [4, loadImageByUrl(url)]; case 1:
if (!(type1 == 2)) return [3, 3];
return [4, loadImageByUrl(url)];
case 2: case 2:
t = (_a.sent()); t1 = _a.sent();
_a.label = 3; if (t1) {
t = t1;
}
return [3, 5];
case 3: case 3:
setimgwid = 612; if (!(type1 == 3)) return [3, 5];
mwid1 = setimgwid / rows; return [4, getTextureByName("testimg")];
mhei1 = setimgwid / cols;
mwid = t.width;
mhei = t.height;
if (!(mwid < 10 || mhei < 10)) return [3, 5];
return [4, new Promise(function (res) {
setTimeout(function () {
res();
}, 200);
})];
case 4: case 4:
_a.sent(); t = (_a.sent());
return [2, qietu(t, 1, rows, cols)]; _a.label = 5;
case 5: case 5:
if (mwid > mhei) { if (!t) {
if (mhei < setimgwid) { return [2, qietu("testimg", 3, rows, cols)];
mwid = mwid * setimgwid / mhei;
mhei = setimgwid;
}
}
else {
if (mwid < setimgwid) {
mhei = mhei * setimgwid / mwid;
mwid = setimgwid;
}
} }
setimgwid = 612;
mwid1 = setimgwid / rows;
mhei1 = setimgwid / cols;
picarr = {}; picarr = {};
picnames = []; picnames = [];
chax = void 0;
chay = void 0;
startlix = void 0;
addlix = void 0;
startliy = void 0;
addliy = void 0;
twid1 = void 0;
thei1 = void 0;
if (mwid > mhei) {
chax = (mwid - mhei) / 2;
startlix = chax / mwid;
addlix = (mhei / cols) / mwid;
startliy = 0;
addliy = 1 / rows;
twid1 = mwid * setimgwid / mhei;
thei1 = setimgwid;
}
else {
startlix = 0; startlix = 0;
addlix = 1 / cols; addlix = 1 / rows;
chay = (mhei - mwid) / 2; startliy = 0;
startliy = chay / mhei; addliy = 1 / cols;
addliy = (mwid / rows) / mhei;
thei1 = mhei * setimgwid / mwid;
twid1 = setimgwid; twid1 = setimgwid;
} thei1 = setimgwid;
for (r = 0; r < rows; r++) { for (r = 0; r < rows; r++) {
startx = startlix + addlix * r; startx = startlix + addlix * r;
for (c = 0; c < cols; c++) { for (c = 0; c < cols; c++) {
starty = startliy + addliy * c; starty = startliy + addliy * c;
nsprite = new engine.Container(); nsprite = Tool.getOnePic();
isprite = new engine.ScrollView(); isprite = nsprite.getChildByName("iscrollv");
nsp = new engine.Sprite(t); nsp = isprite.getChildByName("isprite");
isprite.addChild(nsp); nsp.texture = t;
nsp.width = twid1; nsp.width = twid1;
nsp.height = thei1; nsp.height = thei1;
isprite.mouseEnabled = false;
isprite.mouseChildren = false;
nsp.x = -starty * twid1; nsp.x = -starty * twid1;
nsp.y = -startx * thei1; nsp.y = -startx * thei1;
isprite.width = mwid1; isprite.width = mwid1;
isprite.height = mhei1; isprite.height = mhei1;
nsprite.addChild(isprite);
nsprite.width = mwid1; nsprite.width = mwid1;
nsprite.height = mhei1; nsprite.height = mhei1;
ispritename = "pic_" + c + "_" + r; ispritename = "pic_" + c + "_" + r;
...@@ -142,10 +147,15 @@ ...@@ -142,10 +147,15 @@
}]; }];
case 6: case 6:
e_1 = _a.sent(); e_1 = _a.sent();
return [2, { return [4, new Promise(function (res) {
res: false setTimeout(function () {
}]; res();
case 7: return [2]; }, 200);
})];
case 7:
_a.sent();
return [2, qietu("testimg", 3, rows, cols)];
case 8: return [2];
} }
}); });
}); }); }); });
...@@ -179,7 +189,6 @@ ...@@ -179,7 +189,6 @@
this.addChild(this.linecont); this.addChild(this.linecont);
this.addChild(this.blockcont); this.addChild(this.blockcont);
this.linecont.addChild(this.lineShape); this.linecont.addChild(this.lineShape);
console.log("拼图初始化完毕--------------");
engine.globalEvent.dispatchEvent("pictures-time-initcomp", {}); engine.globalEvent.dispatchEvent("pictures-time-initcomp", {});
this.removeEventListener(engine.Event.ADDED_TO_STAGE, this.initScene, this); this.removeEventListener(engine.Event.ADDED_TO_STAGE, this.initScene, this);
}; };
...@@ -189,9 +198,8 @@ ...@@ -189,9 +198,8 @@
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
console.log("initgame---------"); this.gameUrls = props.gameUrls || ["https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/28.jpg", "https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/29.jpg", "https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/30.jpg"];
this.gameUrls = props.gameUrls; this.gameTimes = props.gameTimes || [30, 60, 60];
this.gameTimes = props.gameTimes;
this.onegamePics = new Array(); this.onegamePics = new Array();
l = 0; l = 0;
_a.label = 1; _a.label = 1;
...@@ -201,6 +209,12 @@ ...@@ -201,6 +209,12 @@
return [4, loadImageByUrl(lurl)]; return [4, loadImageByUrl(lurl)];
case 2: case 2:
lt = _a.sent(); lt = _a.sent();
if (lt) {
lt = lt;
}
else {
lt = null;
}
this.onegamePics.push(lt); this.onegamePics.push(lt);
if (this.onegamePics.length == 1) { if (this.onegamePics.length == 1) {
this.startfirst(); this.startfirst();
...@@ -224,13 +238,24 @@ ...@@ -224,13 +238,24 @@
this.blockcont.removeChild(this.selectimg4); this.blockcont.removeChild(this.selectimg4);
} }
}; };
GameView.prototype.removeDiPics = function () {
var nume = this.dicont.children.length;
for (var i = nume - 1; i >= 0; i--) {
var ichild = this.dicont.getChildAt(i);
if (ichild) {
ichild.removeEventListener(engine.MouseEvent.MOUSE_DOWN, this.touchPic, this);
this.dicont.removeChild(ichild);
Tool.repushToPool(ichild);
}
}
};
GameView.prototype.startfirst = function () { GameView.prototype.startfirst = function () {
return tslib.__awaiter(this, void 0, void 0, function () { return tslib.__awaiter(this, void 0, void 0, function () {
var actidx, tex, type1, result, res, picarr, mwid, mhei, picnames, gap, r, c, ipicx, ipicy, npicname, ipic, rl, cl; var actidx, tex, type1, result, res, picarr, mwid, mhei, picnames, gap, r, c, ipicx, ipicy, npicname, ipic, rl, cl;
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
this.dicont.removeChildren(); this.removeDiPics();
this.movesteps = 0; this.movesteps = 0;
this.startime = Date.now(); this.startime = Date.now();
this.removeSelectImg(); this.removeSelectImg();
...@@ -244,7 +269,6 @@ ...@@ -244,7 +269,6 @@
engine.globalEvent.dispatchEvent("pictures-time-passtime", { engine.globalEvent.dispatchEvent("pictures-time-passtime", {
passtime: this.passtime passtime: this.passtime
}); });
console.log("start-----------------", actidx);
this.rows = 3; this.rows = 3;
this.cols = 3; this.cols = 3;
this.nselectimg = null; this.nselectimg = null;
...@@ -260,7 +284,7 @@ ...@@ -260,7 +284,7 @@
type1 = 1; type1 = 1;
if (!tex) { if (!tex) {
tex = this.gameUrls[actidx]; tex = this.gameUrls[actidx];
type1 = 2; type1 = 3;
} }
return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)]; return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)];
case 1: case 1:
...@@ -321,7 +345,7 @@ ...@@ -321,7 +345,7 @@
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
this.dicont.removeChildren(); this.removeDiPics();
this.movesteps = 0; this.movesteps = 0;
this.startime = Date.now(); this.startime = Date.now();
this.removeSelectImg(); this.removeSelectImg();
...@@ -350,7 +374,7 @@ ...@@ -350,7 +374,7 @@
type1 = 1; type1 = 1;
if (!tex) { if (!tex) {
tex = this.gameUrls[actidx]; tex = this.gameUrls[actidx];
type1 = 2; type1 = 3;
} }
return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)]; return [4, qietu(tex, type1, this.rows, this.cols, this.dicont)];
case 1: case 1:
...@@ -431,12 +455,10 @@ ...@@ -431,12 +455,10 @@
}; };
GameView.prototype.pause = function () { GameView.prototype.pause = function () {
this.ingame = false; this.ingame = false;
console.error("拼图暂停");
}; };
GameView.prototype.resume = function () { GameView.prototype.resume = function () {
this.lastframetime = Date.now(); this.lastframetime = Date.now();
this.ingame = true; this.ingame = true;
console.error("拼图继续");
}; };
GameView.prototype.update = function () { GameView.prototype.update = function () {
var ntime = Date.now(); var ntime = Date.now();
...@@ -518,7 +540,6 @@ ...@@ -518,7 +540,6 @@
} }
var isuc = this.checkSuccess(); var isuc = this.checkSuccess();
if (isuc) { if (isuc) {
console.error("成功过关");
this.gameover(1); this.gameover(1);
} }
}; };
......
{"version":3,"file":"index.js","sources":["src/custom/pintu/src/props.ts","src/custom/pintu/src/game/utils.ts","src/custom/pintu/src/game/qietu.ts","src/custom/pintu/src/game/GameView.ts","src/custom/pintu/src/game/GameWrapper.ts","src/custom/pintu/src/index.ts"],"sourcesContent":["/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\r\n}\r\nexport function createSvga(name, anchorName?) {\r\n\tlet inst = new svga.Svga();\r\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\treturn inst;\r\n}\r\n\r\nexport async function loadImageByUrl(url){\r\n\tconsole.log('loadImageByUrl----------:',url);\r\n\treturn new Promise((resolve) => {\r\n\t\tif (engine.TextureCache[url]) {\r\n\t\t\tresolve(engine.TextureCache[url])\r\n\t\t} else {\r\n\t\t\tvar t = engine.Texture.from(url);\r\n\t\t\tt.addEventListener(\"loaded\", () => { resolve(t) })\r\n\t\t}\r\n\t})\r\n}","import { props } from \"../props\";\r\nimport { loadImageByUrl } from \"./utils\";\r\nimport qietu from \"./qietu\";\r\nconst urls = [];\r\nconst picMap = {};\r\nconst posMap = {};\r\nexport default async(url:any,type1:number, rows:number, cols:number,parent:engine.Container) => {\r\n try{\r\n let t:engine.Texture;\r\n if(type1==1){\r\n t = url;\r\n }else{\r\n t = await loadImageByUrl(url) as engine.Texture;\r\n }\r\n \r\n let setimgwid = 612;\r\n let mwid1 = setimgwid/rows;\r\n let mhei1 = setimgwid/cols;\r\n\r\n let mwid = t.width;\r\n let mhei = t.height;\r\n if(mwid<10||mhei<10){\r\n await new Promise(res=>{\r\n setTimeout(function(){\r\n res();\r\n },200);\r\n })\r\n return qietu(t,1,rows,cols,parent);\r\n }\r\n if(mwid>mhei){\r\n if(mhei<setimgwid){\r\n mwid = mwid*setimgwid/mhei;\r\n mhei = setimgwid;\r\n }\r\n }else{\r\n if(mwid<setimgwid){\r\n mhei = mhei*setimgwid/mwid;\r\n mwid = setimgwid;\r\n }\r\n }\r\n\r\n let picarr = {};\r\n let picnames = [];\r\n\r\n let chax;\r\n let chay;\r\n let startlix;\r\n let addlix;\r\n let startliy;\r\n let addliy;\r\n\r\n let twid1;\r\n let thei1;\r\n if(mwid>mhei){\r\n chax = (mwid-mhei)/2;\r\n startlix = chax/mwid;\r\n addlix = (mhei/cols)/mwid;\r\n\r\n startliy = 0;\r\n addliy = 1/rows;\r\n\r\n twid1 = mwid*setimgwid/mhei;\r\n thei1 = setimgwid;\r\n }else{\r\n startlix = 0;\r\n addlix = 1/cols;\r\n\r\n chay = (mhei-mwid)/2;\r\n startliy = chay/mhei;\r\n addliy = (mwid/rows)/mhei;\r\n\r\n thei1 = mhei*setimgwid/mwid;\r\n twid1 = setimgwid;\r\n }\r\n \r\n // console.log(\"切图准备\",startlix,addlix,startliy,addliy,mwid,mhei);\r\n // let txt1 = new engine.Label();\r\n // txt1.fillColor = \"red\";\r\n // txt1.size = 24;\r\n // txt1.text = startlix.toFixed(2)+\";\"+addlix.toFixed(2)+\";\"+startliy.toFixed(2)+\";\"+addliy.toFixed(2)+\";\"+mwid.toFixed(2)+\";\"+mhei.toFixed(2)+\";\"\r\n // parent.addChild(txt1);\r\n // txt1.y = -100;\r\n for(let r=0;r<rows;r++){\r\n let startx = startlix+addlix*r;\r\n let endx = startx + addlix;\r\n for(let c=0;c<cols;c++){\r\n let starty = startliy+addliy*c;\r\n let endy = starty+addliy;\r\n\r\n let uvs = new Float32Array([\r\n starty,\r\n startx,\r\n endy,\r\n startx,\r\n endy,\r\n endx,\r\n starty,\r\n endx\r\n ])\r\n // let isprite = new engine.Sprite(t);\r\n \r\n // isprite.uvs = uvs;\r\n let nsprite = new engine.Container();\r\n\r\n let isprite = new engine.ScrollView();\r\n let nsp = new engine.Sprite(t);\r\n isprite.addChild(nsp);\r\n nsp.width = twid1;\r\n nsp.height = thei1;\r\n\r\n isprite.mouseEnabled = false;\r\n isprite.mouseChildren = false;\r\n nsp.x = -starty*twid1;\r\n nsp.y = -startx*thei1;\r\n\r\n isprite.width = mwid1;\r\n isprite.height = mhei1;\r\n\r\n nsprite.addChild(isprite);\r\n nsprite.width = mwid1;\r\n nsprite.height = mhei1;\r\n\r\n let ispritename = \"pic_\"+c+\"_\"+r;\r\n nsprite.name = ispritename;\r\n picarr[ispritename] = nsprite;\r\n picnames.push(ispritename);\r\n }\r\n }\r\n return {\r\n res:true,\r\n picarr:picarr,\r\n mwid:mwid1,\r\n mhei:mhei1,\r\n picnames:picnames\r\n };\r\n }catch(e){\r\n return {\r\n res:false\r\n };\r\n }\r\n};\r\n","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport qietu from \"./qietu\";\r\nimport { getTexture, loadImageByUrl,getTextureByName } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\n\r\nexport default class GameView extends engine.Container {\r\n rows:number;\r\n cols:number;\r\n\r\n passtime:number;\r\n gametime:number;\r\n showtime:number;\r\n\r\n lastframetime:number;\r\n\r\n ingame:boolean = false;\r\n\r\n ticker;\r\n\r\n selectimg3:engine.Image;\r\n selectimg4:engine.Image;\r\n nselectimg:engine.Image;\r\n\r\n selectImgArr:Array<string> = [];\r\n sucposData:Object = {};\r\n\r\n dicont:engine.Container;\r\n linecont:engine.Container;\r\n blockcont:engine.Container;\r\n\r\n lineShape:engine.Shape;\r\n\r\n mwid:number;\r\n mhei:number;\r\n picnames:Array<string>;\r\n picarr;\r\n\r\n gameUrls:Array<string> = [];\r\n gameTimes:Array<number> = [];\r\n onegamePics:Array<engine.Texture> = [];\r\n movesteps:number = 0;\r\n startime:number = 0;\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.initScene, this);\r\n }\r\n initScene(){\r\n this.lineShape = new engine.Shape();\r\n this.selectimg3 = new engine.Image(getTextureByName(\"框3\"));\r\n this.selectimg4 = new engine.Image(getTextureByName(\"框4\"));\r\n this.selectimg3.mouseEnabled = false;\r\n this.selectimg4.mouseEnabled = false;\r\n //底图\r\n this.dicont = new engine.Container();\r\n //线\r\n this.linecont = new engine.Container();\r\n //亮片\r\n this.blockcont = new engine.Container();\r\n\r\n this.addChild(this.dicont);\r\n this.addChild(this.linecont);\r\n this.addChild(this.blockcont);\r\n \r\n this.linecont.addChild(this.lineShape);\r\n\r\n console.log(\"拼图初始化完毕--------------\");\r\n engine.globalEvent.dispatchEvent(\"pictures-time-initcomp\",{});\r\n this.removeEventListener(engine.Event.ADDED_TO_STAGE,this.initScene,this);\r\n }\r\n async initgame(){\r\n console.log(\"initgame---------\");\r\n this.gameUrls = props.gameUrls;\r\n this.gameTimes = props.gameTimes;\r\n \r\n this.onegamePics = new Array();\r\n for(let l=0;l<this.gameUrls.length;l++){\r\n let lurl = this.gameUrls[l];\r\n let lt = await loadImageByUrl(lurl) as engine.Texture;\r\n this.onegamePics.push(lt);\r\n if(this.onegamePics.length==1){//第一张图加载完毕,自动填充\r\n this.startfirst();\r\n\r\n }\r\n }\r\n this.removeSelectImg();\r\n \r\n }\r\n removeSelectImg(){\r\n if(this.selectimg3){\r\n this.blockcont.removeChild(this.selectimg3);\r\n }\r\n if(this.selectimg4){\r\n this.blockcont.removeChild(this.selectimg4);\r\n }\r\n }\r\n async startfirst(){\r\n this.dicont.removeChildren();\r\n this.movesteps = 0;\r\n this.startime = Date.now();\r\n this.removeSelectImg();\r\n\r\n let actidx = 0;\r\n this.gametime = this.gameTimes[actidx];\r\n this.showtime = this.gameTimes[actidx];\r\n this.passtime = 0;\r\n engine.globalEvent.dispatchEvent(\"pictures-time-update\",{\r\n time:this.showtime,\r\n });\r\n engine.globalEvent.dispatchEvent(\"pictures-time-passtime\",{\r\n passtime:this.passtime\r\n });\r\n console.log(\"start-----------------\",actidx);\r\n this.rows = 3;\r\n this.cols = 3;\r\n\r\n this.nselectimg = null;\r\n if(this.rows==3){\r\n this.nselectimg = this.selectimg3;\r\n }\r\n if(this.rows==4){\r\n this.nselectimg = this.selectimg4;\r\n }\r\n\r\n \r\n \r\n this.selectImgArr = new Array();\r\n this.sucposData = {};\r\n\r\n let tex:any = this.onegamePics[actidx];\r\n let type1 = 1;\r\n if(!tex){\r\n tex = this.gameUrls[actidx];\r\n type1 = 2;\r\n }\r\n let result = await qietu(tex,type1,this.rows,this.cols,this.dicont);\r\n let res = result.res;\r\n if(res){\r\n let picarr = result.picarr;\r\n let mwid = result.mwid;\r\n let mhei = result.mhei;\r\n let picnames = result.picnames;\r\n\r\n this.mwid = mwid;\r\n this.mhei = mhei;\r\n this.picarr = picarr;\r\n this.picnames = picnames;\r\n\r\n let gap = 2;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicx = mwid*c+gap;\r\n let ipicy = mhei*r+gap;\r\n let npicname = \"pic_\"+c+\"_\"+r;\r\n let ipic = picarr[npicname];\r\n this.dicont.addChild(ipic);\r\n ipic.x = ipicx;\r\n ipic.y = ipicy;\r\n }\r\n }\r\n //框线\r\n this.lineShape.clear();\r\n this.lineShape.beginStroke(0x0069df,4,engine.LINE_CAP.BUTT,engine.LINE_JOIN.BEVEL,100);\r\n\r\n this.lineShape.moveTo(0+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,0+gap);\r\n\r\n for(let rl=1;rl<this.rows;rl++){\r\n this.lineShape.moveTo(0+gap,rl*mhei+gap);\r\n this.lineShape.lineTo(mwid*this.cols+gap,rl*mhei+gap);\r\n }\r\n for(let cl=1;cl<this.cols;cl++){\r\n this.lineShape.moveTo(cl*mwid+gap,0+gap);\r\n this.lineShape.lineTo(cl*mwid+gap,this.rows*mhei+gap);\r\n }\r\n this.lineShape.endStroke();\r\n \r\n engine.globalEvent.dispatchEvent(\"pictures-load-complete\");\r\n this.ticker&&clearInterval(this.ticker);\r\n this.ticker = setInterval(this.update, 10);\r\n }else{\r\n console.error(\"图片处理失败\");\r\n }\r\n }\r\n async start() {\r\n \r\n this.dicont.removeChildren();\r\n this.movesteps = 0;\r\n this.startime = Date.now();\r\n this.removeSelectImg();\r\n\r\n let actidx = props.actidx;\r\n this.gametime = this.gameTimes[actidx];\r\n this.showtime = this.gameTimes[actidx];\r\n this.passtime = 0;\r\n engine.globalEvent.dispatchEvent(\"pictures-time-update\",{\r\n time:this.showtime,\r\n });\r\n engine.globalEvent.dispatchEvent(\"pictures-time-passtime\",{\r\n passtime:this.passtime\r\n });\r\n this.rows = props.rows;\r\n this.cols = props.cols;\r\n\r\n this.nselectimg = null;\r\n if(this.rows==3){\r\n this.nselectimg = this.selectimg3;\r\n }\r\n if(this.rows==4){\r\n this.nselectimg = this.selectimg4;\r\n }\r\n\r\n \r\n \r\n this.selectImgArr = new Array();\r\n this.sucposData = {};\r\n\r\n let tex:any = this.onegamePics[actidx];\r\n let type1 = 1;\r\n if(!tex){\r\n tex = this.gameUrls[actidx];\r\n type1 = 2;\r\n }\r\n let result = await qietu(tex,type1,this.rows,this.cols,this.dicont);\r\n let res = result.res;\r\n if(res){\r\n let picarr = result.picarr;\r\n let mwid = result.mwid;\r\n let mhei = result.mhei;\r\n let picnames = result.picnames;\r\n\r\n this.mwid = mwid;\r\n this.mhei = mhei;\r\n this.picarr = picarr;\r\n this.picnames = picnames;\r\n\r\n let gap = 2;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicx = mwid*c+gap;\r\n let ipicy = mhei*r+gap;\r\n let npicname = \"pic_\"+c+\"_\"+r;\r\n\r\n // this.sucposData[npicname] = r+\"_\"+c;\r\n\r\n // let selidx = Math.floor(Math.random()*picnames.length);\r\n // let ipicname:string = picnames[selidx];\r\n // if(r==c&&r!=this.rows-1){\r\n // while(ipicname==npicname){\r\n // selidx = Math.floor(Math.random()*picnames.length);\r\n // ipicname = picnames[selidx];\r\n // }\r\n // }\r\n let ipic = picarr[npicname];\r\n // picnames.splice(selidx,1);\r\n this.dicont.addChild(ipic);\r\n ipic.x = ipicx;\r\n ipic.y = ipicy;\r\n // ipic[\"postr\"] = r+\"_\"+c;\r\n\r\n // ipic.addEventListener(engine.MouseEvent.MOUSE_DOWN,\r\n // this.touchPic,this);\r\n }\r\n }\r\n //框线\r\n this.lineShape.clear();\r\n this.lineShape.beginStroke(0x0069df,4,engine.LINE_CAP.BUTT,engine.LINE_JOIN.BEVEL,100);\r\n\r\n this.lineShape.moveTo(0+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,0+gap);\r\n\r\n for(let rl=1;rl<this.rows;rl++){\r\n this.lineShape.moveTo(0+gap,rl*mhei+gap);\r\n this.lineShape.lineTo(mwid*this.cols+gap,rl*mhei+gap);\r\n }\r\n for(let cl=1;cl<this.cols;cl++){\r\n this.lineShape.moveTo(cl*mwid+gap,0+gap);\r\n this.lineShape.lineTo(cl*mwid+gap,this.rows*mhei+gap);\r\n }\r\n this.lineShape.endStroke();\r\n \r\n this.ticker&&clearInterval(this.ticker);\r\n this.ticker = setInterval(this.update, 10);\r\n }else{\r\n console.error(\"图片处理失败\");\r\n }\r\n }\r\n luanxu(){\r\n let gap = 2;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicx = this.mwid*c+gap;\r\n let ipicy = this.mhei*r+gap;\r\n let npicname = \"pic_\"+c+\"_\"+r;\r\n\r\n this.sucposData[npicname] = r+\"_\"+c;\r\n\r\n let selidx = Math.floor(Math.random()*this.picnames.length);\r\n let ipicname:string = this.picnames[selidx];\r\n if(r==c&&r!=this.rows-1){\r\n while(ipicname==npicname){\r\n selidx = Math.floor(Math.random()*this.picnames.length);\r\n ipicname = this.picnames[selidx];\r\n }\r\n }\r\n let ipic = this.picarr[ipicname];\r\n this.picnames.splice(selidx,1);\r\n ipic.x = ipicx;\r\n ipic.y = ipicy;\r\n ipic[\"postr\"] = r+\"_\"+c;\r\n\r\n ipic.addEventListener(engine.MouseEvent.MOUSE_DOWN,\r\n this.touchPic,this);\r\n }\r\n }\r\n }\r\n pause(){\r\n this.ingame = false;\r\n console.error(\"拼图暂停\");\r\n }\r\n resume(){\r\n this.lastframetime = Date.now();\r\n this.ingame = true;\r\n console.error(\"拼图继续\");\r\n }\r\n\r\n\r\n update() {\r\n let ntime = Date.now();\r\n if(!this.lastframetime){\r\n this.lastframetime = ntime;\r\n return;\r\n }\r\n if(this.ingame){\r\n let passtime = (ntime - this.lastframetime)/1000;\r\n this.passtime += passtime;\r\n engine.globalEvent.dispatchEvent(\"pictures-time-passtime\",{\r\n passtime:this.passtime\r\n });\r\n let showtime1 = Math.round(this.gametime - this.passtime);\r\n // console.log(passtime,this.passtime,this.gametime,this.showtime);\r\n if(this.showtime!=showtime1){\r\n this.showtime = showtime1;\r\n if(this.showtime<=0){\r\n this.showtime = 0;\r\n this.gameover(2);\r\n }\r\n // console.log(\"倒计时\",this.showtime);\r\n engine.globalEvent.dispatchEvent(\"pictures-time-update\",{\r\n time:this.showtime\r\n });\r\n }\r\n }\r\n this.lastframetime = ntime;\r\n }\r\n\r\n touchPic(e:engine.MouseEvent){\r\n if(!this.ingame){\r\n return;\r\n }\r\n // console.log(e.target.name);\r\n let selectname = e.target.name;\r\n let spx = e.target.x;\r\n let spy = e.target.y;\r\n let gap = 2;\r\n if(this.selectImgArr.length==0){\r\n if(this.nselectimg){\r\n this.blockcont.addChild(this.nselectimg);\r\n this.nselectimg.x = spx-gap;\r\n this.nselectimg.y = spy-gap;\r\n }\r\n this.selectImgArr.push(selectname);\r\n }else if(this.selectImgArr.length==1){\r\n if(selectname==this.selectImgArr[0]){\r\n if(this.nselectimg){\r\n this.blockcont.removeChild(this.nselectimg);\r\n }\r\n this.selectImgArr = new Array();\r\n return;\r\n }else{\r\n this.selectImgArr.push(selectname);\r\n this.changeImgPos();\r\n }\r\n }\r\n }\r\n changeImgPos(){\r\n let img1name = this.selectImgArr[0];\r\n let img2name = this.selectImgArr[1];\r\n\r\n let img1 = this.dicont.getChildByName(img1name);\r\n let img2 = this.dicont.getChildByName(img2name);\r\n\r\n let imgpos1x = img1.x;\r\n let imgpos1y = img1.y;\r\n let imgpos2x = img2.x;\r\n let imgpos2y = img2.y;\r\n\r\n let imgpostr1 = img1.postr;\r\n let imgpostr2 = img2.postr;\r\n\r\n img1.x = imgpos2x;\r\n img1.y = imgpos2y;\r\n img1.postr = imgpostr2;\r\n\r\n img2.x = imgpos1x;\r\n img2.y = imgpos1y;\r\n img2.postr = imgpostr1;\r\n\r\n this.selectImgArr = new Array();\r\n \r\n this.movesteps += 1;\r\n\r\n if(this.nselectimg){\r\n this.blockcont.removeChild(this.nselectimg);\r\n }\r\n let isuc = this.checkSuccess();\r\n if(isuc){\r\n console.error(\"成功过关\");\r\n this.gameover(1);\r\n }\r\n }\r\n checkSuccess(){\r\n let isuc:boolean = true;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicname = \"pic_\"+c+\"_\"+r;\r\n let npicstr = r+\"_\"+c;\r\n let ipic = this.dicont.getChildByName(ipicname);\r\n let ipostr = ipic.postr;\r\n if(npicstr!=ipostr){\r\n isuc = false;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return isuc;\r\n\r\n }\r\n /**\r\n * \r\n * @param reason 1成功,2失败\r\n */\r\n private gameover(reason:number) {\r\n this.ingame = false;\r\n this.ticker&&clearInterval(this.ticker);\r\n\r\n let ntime = Date.now();\r\n let gametime = ntime - this.startime;\r\n engine.globalEvent.dispatchEvent('pictures-game-over', {\r\n reason:reason,\r\n time: this.passtime,\r\n number:this.movesteps,\r\n gametime:gametime\r\n });\r\n }\r\n\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\r\n\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\t//创建实例\r\n\t\tthis._gameView = new GameView();\r\n\t\tthis.addChild(this._gameView);\r\n\r\n\t\tengine.globalEvent.addEventListener('pictures-initgame', this.initgame, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-luanxu', this.luanxu, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-pause', this.pause, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-resume', this.resume, this);\r\n\t}\r\n\tinitgame(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.initgame();\r\n\t}\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.start();\r\n\t}\r\n\tluanxu(){\r\n\t\tthis._gameView.luanxu();\r\n\t}\r\n\tpause(event: engine.Event) {\r\n\t\t\r\n\t\tthis._gameView.pause();\r\n\t}\r\n\tresume(event:engine.Event){\r\n\t\tthis._gameView.resume();\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;UCVe,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc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AAM,EAAE,KAAI,CAAC,CAAC;SAC1E,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;SACxE,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,KAAI,CAAC,MAAM,EAAE,KAAI,CAAC,CAAC;;MAC1E;KACD,8BAAQ,GAAR,UAAS,KAAmB;SAC3B,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAIxB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;MAC1B;KACD,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAIxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,4BAAM,GAAN;SACC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;MACxB;KACD,2BAAK,GAAL,UAAM,KAAmB;SAExB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,4BAAM,GAAN,UAAO,KAAkB;SACxB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;MACxB;KACF,kBAAC;CAAD,CAAC,CA7CgC,MAAM,CAAC,SAAS,GA6ChD;;;iBC9CwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"} {"version":3,"file":"index.js","sources":["src/custom/pintu/src/props.ts","src/custom/pintu/src/game/utils.ts","src/custom/pintu/src/game/Tool.ts","src/custom/pintu/src/game/qietu.ts","src/custom/pintu/src/game/GameView.ts","src/custom/pintu/src/game/GameWrapper.ts","src/custom/pintu/src/index.ts"],"sourcesContent":["/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\r\n}\r\nexport function createSvga(name, anchorName?) {\r\n\tlet inst = new svga.Svga();\r\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\treturn inst;\r\n}\r\n\r\nexport async function loadImageByUrl(url){\r\n\t// console.log('loadImageByUrl----------:',url);\r\n\ttry{\r\n\t\t// console.log(\"尝试加载44\");\r\n\t\treturn new Promise((resolve) => {\r\n\t\t\tlet t1 = setTimeout(()=>{\r\n\t\t\t\treturn resolve(null);\r\n\t\t\t},2000);\r\n\r\n\t\t\tif (engine.TextureCache[url]) {\r\n\t\t\t\tclearTimeout(t1);\r\n\t\t\t\tresolve(engine.TextureCache[url])\r\n\t\t\t} else {\r\n\t\t\t\tvar t = engine.Texture.from(url);\r\n\t\t\t\tt.addEventListener(\"loaded\", () => { clearTimeout(t1);resolve(t) });\r\n\t\t\t}\r\n\t\t})\r\n\t}catch(e){\r\n\t\treturn null;\r\n\t}\r\n}","export default class Tool{\r\n static picPool:Array<engine.Container> = new Array();\r\n static getOnePic(){\r\n if(this.picPool.length>0){\r\n return this.picPool.shift();\r\n }else{\r\n let ipic = new engine.Container();\r\n \r\n let isprite = new engine.ScrollView();\r\n isprite.name = \"iscrollv\";\r\n let nsp = new engine.Sprite();\r\n nsp.name = \"isprite\";\r\n nsp.texture\r\n\r\n isprite.addChild(nsp);\r\n\r\n ipic.addChild(isprite);\r\n\r\n isprite.mouseEnabled = false;\r\n nsp.mouseEnabled = false;\r\n\r\n return ipic;\r\n }\r\n }\r\n\r\n static repushToPool(icont:engine.Container){\r\n this.picPool.push(icont);\r\n }\r\n}","import { props } from \"../props\";\r\nimport { loadImageByUrl, getTextureByName ,getTexture} from \"./utils\";\r\nimport qietu from \"./qietu\";\r\nimport Tool from \"./Tool\";\r\nconst urls = [];\r\nconst picMap = {};\r\nconst posMap = {};\r\nexport default async(url:any,type1:number, rows:number, cols:number,parent:engine.Container) => {\r\n try{\r\n let t:engine.Texture;\r\n if(type1==1){\r\n t = url;\r\n }else if(type1==2){\r\n let t1 = await loadImageByUrl(url);// as engine.Texture;\r\n if(t1){\r\n t = t1 as engine.Texture;\r\n }\r\n }else if(type1==3){\r\n t = await getTextureByName(\"testimg\") as engine.Texture;\r\n }\r\n if(!t){\r\n return qietu(\"testimg\",3,rows,cols,parent);\r\n }\r\n \r\n let setimgwid = 612;\r\n let mwid1 = setimgwid/rows;\r\n let mhei1 = setimgwid/cols;\r\n\r\n // let mwid = t.width;\r\n // let mhei = t.height;\r\n // if(mwid<10||mhei<10){\r\n // await new Promise(res=>{\r\n // setTimeout(function(){\r\n // res();\r\n // },200);\r\n // })\r\n // return qietu(t,1,rows,cols,parent);\r\n // }\r\n // if(mwid>mhei){\r\n // if(mhei<setimgwid){\r\n // mwid = mwid*setimgwid/mhei;\r\n // mhei = setimgwid;\r\n // }\r\n // }else{\r\n // if(mwid<setimgwid){\r\n // mhei = mhei*setimgwid/mwid;\r\n // mwid = setimgwid;\r\n // }\r\n // }\r\n\r\n let picarr = {};\r\n let picnames = [];\r\n\r\n let chax;\r\n let chay;\r\n let startlix = 0;\r\n let addlix = 1/rows;\r\n let startliy = 0;\r\n let addliy = 1/cols;\r\n\r\n let twid1 = setimgwid;\r\n let thei1 = setimgwid;\r\n // if(mwid>mhei){\r\n // chax = (mwid-mhei)/2;\r\n // startlix = chax/mwid;\r\n // addlix = (mhei/cols)/mwid;\r\n\r\n // startliy = 0;\r\n // addliy = 1/rows;\r\n\r\n // twid1 = mwid*setimgwid/mhei;\r\n // thei1 = setimgwid;\r\n // }else{\r\n // startlix = 0;\r\n // addlix = 1/cols;\r\n\r\n // chay = (mhei-mwid)/2;\r\n // startliy = chay/mhei;\r\n // addliy = (mwid/rows)/mhei;\r\n\r\n // thei1 = mhei*setimgwid/mwid;\r\n // twid1 = setimgwid;\r\n // }\r\n \r\n // console.log(\"切图准备\",startlix,addlix,startliy,addliy,mwid,mhei);\r\n // let txt1 = new engine.Label();\r\n // txt1.fillColor = \"red\";\r\n // txt1.size = 24;\r\n // txt1.text = startlix.toFixed(2)+\";\"+addlix.toFixed(2)+\";\"+startliy.toFixed(2)+\";\"+addliy.toFixed(2)+\";\"+mwid.toFixed(2)+\";\"+mhei.toFixed(2)+\";\"\r\n // parent.addChild(txt1);\r\n // txt1.y = -100;\r\n for(let r=0;r<rows;r++){\r\n let startx = startlix+addlix*r;\r\n let endx = startx + addlix;\r\n for(let c=0;c<cols;c++){\r\n let starty = startliy+addliy*c;\r\n let endy = starty+addliy;\r\n\r\n // let uvs = new Float32Array([\r\n // starty,\r\n // startx,\r\n // endy,\r\n // startx,\r\n // endy,\r\n // endx,\r\n // starty,\r\n // endx\r\n // ])\r\n //方案1\r\n // let isprite = new engine.Sprite(t);\r\n // isprite.uvs = uvs;\r\n\r\n //方案2\r\n let nsprite = Tool.getOnePic();\r\n let isprite = nsprite.getChildByName(\"iscrollv\");\r\n let nsp = isprite.getChildByName(\"isprite\");\r\n nsp.texture = t;\r\n\r\n nsp.width = twid1;\r\n nsp.height = thei1;\r\n\r\n // let nsprite = new engine.Container();\r\n\r\n // let isprite = new engine.ScrollView();\r\n // let nsp = new engine.Sprite(t);\r\n // isprite.addChild(nsp);\r\n // nsp.width = twid1;\r\n // nsp.height = thei1;\r\n\r\n // isprite.mouseEnabled = false;\r\n // isprite.mouseChildren = false;\r\n nsp.x = -starty*twid1;\r\n nsp.y = -startx*thei1;\r\n\r\n isprite.width = mwid1;\r\n isprite.height = mhei1;\r\n\r\n // nsprite.addChild(isprite);\r\n nsprite.width = mwid1;\r\n nsprite.height = mhei1;\r\n\r\n let ispritename = \"pic_\"+c+\"_\"+r;\r\n nsprite.name = ispritename;\r\n picarr[ispritename] = nsprite;\r\n picnames.push(ispritename);\r\n }\r\n }\r\n return {\r\n res:true,\r\n picarr:picarr,\r\n mwid:mwid1,\r\n mhei:mhei1,\r\n picnames:picnames\r\n };\r\n }catch(e){\r\n //获取那图失败\r\n\r\n // return {\r\n // res:false\r\n // };\r\n await new Promise(res=>{\r\n setTimeout(function(){\r\n res();\r\n },200);\r\n })\r\n return qietu(\"testimg\",3,rows,cols,parent);\r\n }\r\n};\r\n","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport qietu from \"./qietu\";\r\nimport { getTexture, loadImageByUrl,getTextureByName } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\nimport Tool from \"./Tool\";\r\n\r\nexport default class GameView extends engine.Container {\r\n rows:number;\r\n cols:number;\r\n\r\n passtime:number;\r\n gametime:number;\r\n showtime:number;\r\n\r\n lastframetime:number;\r\n\r\n ingame:boolean = false;\r\n\r\n ticker;\r\n\r\n selectimg3:engine.Image;\r\n selectimg4:engine.Image;\r\n nselectimg:engine.Image;\r\n\r\n selectImgArr:Array<string> = [];\r\n sucposData:Object = {};\r\n\r\n dicont:engine.Container;\r\n linecont:engine.Container;\r\n blockcont:engine.Container;\r\n\r\n lineShape:engine.Shape;\r\n\r\n mwid:number;\r\n mhei:number;\r\n picnames:Array<string>;\r\n picarr;\r\n\r\n gameUrls:Array<string> = [];\r\n gameTimes:Array<number> = [];\r\n onegamePics:Array<any> = [];\r\n movesteps:number = 0;\r\n startime:number = 0;\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.initScene, this);\r\n }\r\n initScene(){\r\n this.lineShape = new engine.Shape();\r\n this.selectimg3 = new engine.Image(getTextureByName(\"框3\"));\r\n this.selectimg4 = new engine.Image(getTextureByName(\"框4\"));\r\n this.selectimg3.mouseEnabled = false;\r\n this.selectimg4.mouseEnabled = false;\r\n //底图\r\n this.dicont = new engine.Container();\r\n //线\r\n this.linecont = new engine.Container();\r\n //亮片\r\n this.blockcont = new engine.Container();\r\n\r\n this.addChild(this.dicont);\r\n this.addChild(this.linecont);\r\n this.addChild(this.blockcont);\r\n \r\n this.linecont.addChild(this.lineShape);\r\n\r\n // console.log(\"拼图初始化完毕--------------\");\r\n engine.globalEvent.dispatchEvent(\"pictures-time-initcomp\",{});\r\n this.removeEventListener(engine.Event.ADDED_TO_STAGE,this.initScene,this);\r\n\r\n // let testsuc = new engine.Label();\r\n // testsuc.text = \"直接成功\";\r\n // testsuc.size = 66;\r\n // testsuc.fillColor = \"red\";\r\n // this.addChild(testsuc);\r\n // testsuc.y = 500;\r\n // testsuc.width = 300;\r\n // testsuc.height = 200;\r\n // testsuc.addEventListener(engine.MouseEvent.CLICK,this.zhijieSuc,this);\r\n }\r\n // //测试直接成功\r\n // zhijieSuc(){\r\n // this.gameover(1);\r\n // }\r\n\r\n async initgame(){\r\n // console.log(\"initgame---------\");\r\n this.gameUrls = props.gameUrls||[\"https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/28.jpg\", \"https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/29.jpg\", \"https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/30.jpg\"];\r\n this.gameTimes = props.gameTimes||[30,60,60];\r\n \r\n this.onegamePics = new Array();\r\n for(let l=0;l<this.gameUrls.length;l++){\r\n let lurl = this.gameUrls[l];\r\n let lt = await loadImageByUrl(lurl);\r\n // console.log(lt);\r\n if(lt){\r\n lt = lt as engine.Texture\r\n }else{\r\n lt = null;\r\n }\r\n this.onegamePics.push(lt);\r\n if(this.onegamePics.length==1){//第一张图加载完毕,自动填充\r\n this.startfirst();\r\n }\r\n }\r\n this.removeSelectImg();\r\n }\r\n removeSelectImg(){\r\n if(this.selectimg3){\r\n this.blockcont.removeChild(this.selectimg3);\r\n }\r\n if(this.selectimg4){\r\n this.blockcont.removeChild(this.selectimg4);\r\n }\r\n }\r\n removeDiPics(){\r\n let nume = this.dicont.children.length;\r\n for(let i=nume-1;i>=0;i--){\r\n let ichild = this.dicont.getChildAt(i) as engine.Container;\r\n if(ichild){\r\n ichild.removeEventListener(engine.MouseEvent.MOUSE_DOWN,\r\n this.touchPic,this);\r\n this.dicont.removeChild(ichild);\r\n Tool.repushToPool(ichild);\r\n }\r\n }\r\n }\r\n async startfirst(){\r\n // this.dicont.removeChildren();\r\n this.removeDiPics();\r\n\r\n this.movesteps = 0;\r\n this.startime = Date.now();\r\n this.removeSelectImg();\r\n\r\n let actidx = 0;\r\n this.gametime = this.gameTimes[actidx];\r\n this.showtime = this.gameTimes[actidx];\r\n this.passtime = 0;\r\n engine.globalEvent.dispatchEvent(\"pictures-time-update\",{\r\n time:this.showtime,\r\n });\r\n engine.globalEvent.dispatchEvent(\"pictures-time-passtime\",{\r\n passtime:this.passtime\r\n });\r\n // console.log(\"start-----------------\",actidx);\r\n this.rows = 3;\r\n this.cols = 3;\r\n\r\n this.nselectimg = null;\r\n if(this.rows==3){\r\n this.nselectimg = this.selectimg3;\r\n }\r\n if(this.rows==4){\r\n this.nselectimg = this.selectimg4;\r\n }\r\n\r\n \r\n \r\n this.selectImgArr = new Array();\r\n this.sucposData = {};\r\n\r\n let tex:any = this.onegamePics[actidx];\r\n let type1 = 1;\r\n if(!tex){\r\n tex = this.gameUrls[actidx];\r\n type1 = 3;\r\n }\r\n // type1 = 3;\r\n let result = await qietu(tex,type1,this.rows,this.cols,this.dicont);\r\n let res = result.res;\r\n if(res){\r\n let picarr = result.picarr;\r\n let mwid = result.mwid;\r\n let mhei = result.mhei;\r\n let picnames = result.picnames;\r\n\r\n this.mwid = mwid;\r\n this.mhei = mhei;\r\n this.picarr = picarr;\r\n this.picnames = picnames;\r\n\r\n let gap = 2;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicx = mwid*c+gap;\r\n let ipicy = mhei*r+gap;\r\n let npicname = \"pic_\"+c+\"_\"+r;\r\n let ipic = picarr[npicname];\r\n this.dicont.addChild(ipic);\r\n ipic.x = ipicx;\r\n ipic.y = ipicy;\r\n }\r\n }\r\n //框线\r\n this.lineShape.clear();\r\n this.lineShape.beginStroke(0x0069df,4,engine.LINE_CAP.BUTT,engine.LINE_JOIN.BEVEL,100);\r\n\r\n this.lineShape.moveTo(0+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,0+gap);\r\n\r\n for(let rl=1;rl<this.rows;rl++){\r\n this.lineShape.moveTo(0+gap,rl*mhei+gap);\r\n this.lineShape.lineTo(mwid*this.cols+gap,rl*mhei+gap);\r\n }\r\n for(let cl=1;cl<this.cols;cl++){\r\n this.lineShape.moveTo(cl*mwid+gap,0+gap);\r\n this.lineShape.lineTo(cl*mwid+gap,this.rows*mhei+gap);\r\n }\r\n this.lineShape.endStroke();\r\n \r\n engine.globalEvent.dispatchEvent(\"pictures-load-complete\");\r\n this.ticker&&clearInterval(this.ticker);\r\n this.ticker = setInterval(this.update, 10);\r\n }else{\r\n console.error(\"图片处理失败\");\r\n }\r\n }\r\n async start() {\r\n \r\n // this.dicont.removeChildren();\r\n this.removeDiPics();\r\n this.movesteps = 0;\r\n this.startime = Date.now();\r\n this.removeSelectImg();\r\n\r\n let actidx = props.actidx;\r\n this.gametime = this.gameTimes[actidx];\r\n this.showtime = this.gameTimes[actidx];\r\n this.passtime = 0;\r\n engine.globalEvent.dispatchEvent(\"pictures-time-update\",{\r\n time:this.showtime,\r\n });\r\n engine.globalEvent.dispatchEvent(\"pictures-time-passtime\",{\r\n passtime:this.passtime\r\n });\r\n this.rows = props.rows;\r\n this.cols = props.cols;\r\n\r\n this.nselectimg = null;\r\n if(this.rows==3){\r\n this.nselectimg = this.selectimg3;\r\n }\r\n if(this.rows==4){\r\n this.nselectimg = this.selectimg4;\r\n }\r\n\r\n \r\n \r\n this.selectImgArr = new Array();\r\n this.sucposData = {};\r\n\r\n let tex:any = this.onegamePics[actidx];\r\n let type1 = 1;\r\n if(!tex){\r\n tex = this.gameUrls[actidx];\r\n type1 = 3;\r\n }\r\n let result = await qietu(tex,type1,this.rows,this.cols,this.dicont);\r\n let res = result.res;\r\n if(res){\r\n let picarr = result.picarr;\r\n let mwid = result.mwid;\r\n let mhei = result.mhei;\r\n let picnames = result.picnames;\r\n\r\n this.mwid = mwid;\r\n this.mhei = mhei;\r\n this.picarr = picarr;\r\n this.picnames = picnames;\r\n\r\n let gap = 2;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicx = mwid*c+gap;\r\n let ipicy = mhei*r+gap;\r\n let npicname = \"pic_\"+c+\"_\"+r;\r\n\r\n // this.sucposData[npicname] = r+\"_\"+c;\r\n\r\n // let selidx = Math.floor(Math.random()*picnames.length);\r\n // let ipicname:string = picnames[selidx];\r\n // if(r==c&&r!=this.rows-1){\r\n // while(ipicname==npicname){\r\n // selidx = Math.floor(Math.random()*picnames.length);\r\n // ipicname = picnames[selidx];\r\n // }\r\n // }\r\n let ipic = picarr[npicname];\r\n // picnames.splice(selidx,1);\r\n this.dicont.addChild(ipic);\r\n ipic.x = ipicx;\r\n ipic.y = ipicy;\r\n // ipic[\"postr\"] = r+\"_\"+c;\r\n\r\n // ipic.addEventListener(engine.MouseEvent.MOUSE_DOWN,\r\n // this.touchPic,this);\r\n }\r\n }\r\n //框线\r\n this.lineShape.clear();\r\n this.lineShape.beginStroke(0x0069df,4,engine.LINE_CAP.BUTT,engine.LINE_JOIN.BEVEL,100);\r\n\r\n this.lineShape.moveTo(0+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,0+gap);\r\n this.lineShape.lineTo(mhei*this.cols+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,mwid*this.rows+gap);\r\n this.lineShape.lineTo(0+gap,0+gap);\r\n\r\n for(let rl=1;rl<this.rows;rl++){\r\n this.lineShape.moveTo(0+gap,rl*mhei+gap);\r\n this.lineShape.lineTo(mwid*this.cols+gap,rl*mhei+gap);\r\n }\r\n for(let cl=1;cl<this.cols;cl++){\r\n this.lineShape.moveTo(cl*mwid+gap,0+gap);\r\n this.lineShape.lineTo(cl*mwid+gap,this.rows*mhei+gap);\r\n }\r\n this.lineShape.endStroke();\r\n \r\n this.ticker&&clearInterval(this.ticker);\r\n this.ticker = setInterval(this.update, 10);\r\n }else{\r\n console.error(\"图片处理失败\");\r\n }\r\n }\r\n luanxu(){\r\n let gap = 2;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicx = this.mwid*c+gap;\r\n let ipicy = this.mhei*r+gap;\r\n let npicname = \"pic_\"+c+\"_\"+r;\r\n\r\n this.sucposData[npicname] = r+\"_\"+c;\r\n\r\n let selidx = Math.floor(Math.random()*this.picnames.length);\r\n let ipicname:string = this.picnames[selidx];\r\n if(r==c&&r!=this.rows-1){\r\n while(ipicname==npicname){\r\n selidx = Math.floor(Math.random()*this.picnames.length);\r\n ipicname = this.picnames[selidx];\r\n }\r\n }\r\n let ipic = this.picarr[ipicname];\r\n this.picnames.splice(selidx,1);\r\n ipic.x = ipicx;\r\n ipic.y = ipicy;\r\n ipic[\"postr\"] = r+\"_\"+c;\r\n\r\n ipic.addEventListener(engine.MouseEvent.MOUSE_DOWN,\r\n this.touchPic,this);\r\n }\r\n }\r\n }\r\n pause(){\r\n this.ingame = false;\r\n // console.error(\"拼图暂停\");\r\n }\r\n resume(){\r\n this.lastframetime = Date.now();\r\n this.ingame = true;\r\n // console.error(\"拼图继续\");\r\n }\r\n\r\n\r\n update() {\r\n let ntime = Date.now();\r\n if(!this.lastframetime){\r\n this.lastframetime = ntime;\r\n return;\r\n }\r\n if(this.ingame){\r\n let passtime = (ntime - this.lastframetime)/1000;\r\n this.passtime += passtime;\r\n engine.globalEvent.dispatchEvent(\"pictures-time-passtime\",{\r\n passtime:this.passtime\r\n });\r\n let showtime1 = Math.round(this.gametime - this.passtime);\r\n // console.log(passtime,this.passtime,this.gametime,this.showtime);\r\n if(this.showtime!=showtime1){\r\n this.showtime = showtime1;\r\n if(this.showtime<=0){\r\n this.showtime = 0;\r\n this.gameover(2);\r\n }\r\n // console.log(\"倒计时\",this.showtime);\r\n engine.globalEvent.dispatchEvent(\"pictures-time-update\",{\r\n time:this.showtime\r\n });\r\n }\r\n }\r\n this.lastframetime = ntime;\r\n }\r\n\r\n touchPic(e:engine.MouseEvent){\r\n if(!this.ingame){\r\n return;\r\n }\r\n // console.log(e.target.name);\r\n let selectname = e.target.name;\r\n let spx = e.target.x;\r\n let spy = e.target.y;\r\n let gap = 2;\r\n if(this.selectImgArr.length==0){\r\n if(this.nselectimg){\r\n this.blockcont.addChild(this.nselectimg);\r\n this.nselectimg.x = spx-gap;\r\n this.nselectimg.y = spy-gap;\r\n }\r\n this.selectImgArr.push(selectname);\r\n }else if(this.selectImgArr.length==1){\r\n if(selectname==this.selectImgArr[0]){\r\n if(this.nselectimg){\r\n this.blockcont.removeChild(this.nselectimg);\r\n }\r\n this.selectImgArr = new Array();\r\n return;\r\n }else{\r\n this.selectImgArr.push(selectname);\r\n this.changeImgPos();\r\n }\r\n }\r\n }\r\n changeImgPos(){\r\n let img1name = this.selectImgArr[0];\r\n let img2name = this.selectImgArr[1];\r\n\r\n let img1 = this.dicont.getChildByName(img1name);\r\n let img2 = this.dicont.getChildByName(img2name);\r\n\r\n let imgpos1x = img1.x;\r\n let imgpos1y = img1.y;\r\n let imgpos2x = img2.x;\r\n let imgpos2y = img2.y;\r\n\r\n let imgpostr1 = img1.postr;\r\n let imgpostr2 = img2.postr;\r\n\r\n img1.x = imgpos2x;\r\n img1.y = imgpos2y;\r\n img1.postr = imgpostr2;\r\n\r\n img2.x = imgpos1x;\r\n img2.y = imgpos1y;\r\n img2.postr = imgpostr1;\r\n\r\n this.selectImgArr = new Array();\r\n \r\n this.movesteps += 1;\r\n\r\n if(this.nselectimg){\r\n this.blockcont.removeChild(this.nselectimg);\r\n }\r\n let isuc = this.checkSuccess();\r\n if(isuc){\r\n // console.error(\"成功过关\");\r\n this.gameover(1);\r\n }\r\n }\r\n checkSuccess(){\r\n let isuc:boolean = true;\r\n for(let r=0;r<this.rows;r++){\r\n for(let c=0;c<this.cols;c++){\r\n let ipicname = \"pic_\"+c+\"_\"+r;\r\n let npicstr = r+\"_\"+c;\r\n let ipic = this.dicont.getChildByName(ipicname);\r\n let ipostr = ipic.postr;\r\n if(npicstr!=ipostr){\r\n isuc = false;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return isuc;\r\n\r\n }\r\n /**\r\n * \r\n * @param reason 1成功,2失败\r\n */\r\n private gameover(reason:number) {\r\n this.ingame = false;\r\n this.ticker&&clearInterval(this.ticker);\r\n\r\n let ntime = Date.now();\r\n let gametime = ntime - this.startime;\r\n engine.globalEvent.dispatchEvent('pictures-game-over', {\r\n reason:reason,\r\n time: this.passtime,\r\n number:this.movesteps,\r\n gametime:gametime\r\n });\r\n }\r\n\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\r\n\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\t//创建实例\r\n\t\tthis._gameView = new GameView();\r\n\t\tthis.addChild(this._gameView);\r\n\r\n\t\tengine.globalEvent.addEventListener('pictures-initgame', this.initgame, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-luanxu', this.luanxu, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-pause', this.pause, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-resume', this.resume, this);\r\n\t}\r\n\tinitgame(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.initgame();\r\n\t}\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.start();\r\n\t}\r\n\tluanxu(){\r\n\t\tthis._gameView.luanxu();\r\n\t}\r\n\tpause(event: engine.Event) {\r\n\t\t\r\n\t\tthis._gameView.pause();\r\n\t}\r\n\tresume(event:engine.Event){\r\n\t\tthis._gameView.resume();\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;UCVe,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAA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AAC,CA7CgC,MAAM,CAAC,SAAS,GA6ChD;;;iBC9CwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file \ No newline at end of file
...@@ -61,6 +61,12 @@ ...@@ -61,6 +61,12 @@
"url": "//yun.duiba.com.cn/aurora/assets/1c384d986504d5aabfffeb5125dc67e73ce1b539.png", "url": "//yun.duiba.com.cn/aurora/assets/1c384d986504d5aabfffeb5125dc67e73ce1b539.png",
"uuid": "kuang4", "uuid": "kuang4",
"ext": ".png" "ext": ".png"
},
{
"name":"testimg",
"url":"//yun.duiba.com.cn/aurora/assets/2628186c60c3b80013ae3178ff21a73ffbe71d43.jpg",
"uuid":"morentu",
"ext":".jpg"
} }
], ],
"events": { "events": {
......
...@@ -6,6 +6,7 @@ import { props } from "../props"; ...@@ -6,6 +6,7 @@ import { props } from "../props";
import qietu from "./qietu"; import qietu from "./qietu";
import { getTexture, loadImageByUrl,getTextureByName } from "./utils"; import { getTexture, loadImageByUrl,getTextureByName } from "./utils";
import ObjectPool = engine.ObjectPool; import ObjectPool = engine.ObjectPool;
import Tool from "./Tool";
export default class GameView extends engine.Container { export default class GameView extends engine.Container {
rows:number; rows:number;
...@@ -41,7 +42,7 @@ export default class GameView extends engine.Container { ...@@ -41,7 +42,7 @@ export default class GameView extends engine.Container {
gameUrls:Array<string> = []; gameUrls:Array<string> = [];
gameTimes:Array<number> = []; gameTimes:Array<number> = [];
onegamePics:Array<engine.Texture> = []; onegamePics:Array<any> = [];
movesteps:number = 0; movesteps:number = 0;
startime:number = 0; startime:number = 0;
constructor() { constructor() {
...@@ -67,27 +68,46 @@ export default class GameView extends engine.Container { ...@@ -67,27 +68,46 @@ export default class GameView extends engine.Container {
this.linecont.addChild(this.lineShape); this.linecont.addChild(this.lineShape);
console.log("拼图初始化完毕--------------"); // console.log("拼图初始化完毕--------------");
engine.globalEvent.dispatchEvent("pictures-time-initcomp",{}); engine.globalEvent.dispatchEvent("pictures-time-initcomp",{});
this.removeEventListener(engine.Event.ADDED_TO_STAGE,this.initScene,this); this.removeEventListener(engine.Event.ADDED_TO_STAGE,this.initScene,this);
}
// let testsuc = new engine.Label();
// testsuc.text = "直接成功";
// testsuc.size = 66;
// testsuc.fillColor = "red";
// this.addChild(testsuc);
// testsuc.y = 500;
// testsuc.width = 300;
// testsuc.height = 200;
// testsuc.addEventListener(engine.MouseEvent.CLICK,this.zhijieSuc,this);
}
// //测试直接成功
// zhijieSuc(){
// this.gameover(1);
// }
async initgame(){ async initgame(){
console.log("initgame---------"); // console.log("initgame---------");
this.gameUrls = props.gameUrls; this.gameUrls = props.gameUrls||["https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/28.jpg", "https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/29.jpg", "https://yun.duiba.com.cn/db_games/activity/game/1596074071/resource/assets/ptimgs/30.jpg"];
this.gameTimes = props.gameTimes; this.gameTimes = props.gameTimes||[30,60,60];
this.onegamePics = new Array(); this.onegamePics = new Array();
for(let l=0;l<this.gameUrls.length;l++){ for(let l=0;l<this.gameUrls.length;l++){
let lurl = this.gameUrls[l]; let lurl = this.gameUrls[l];
let lt = await loadImageByUrl(lurl) as engine.Texture; let lt = await loadImageByUrl(lurl);
// console.log(lt);
if(lt){
lt = lt as engine.Texture
}else{
lt = null;
}
this.onegamePics.push(lt); this.onegamePics.push(lt);
if(this.onegamePics.length==1){//第一张图加载完毕,自动填充 if(this.onegamePics.length==1){//第一张图加载完毕,自动填充
this.startfirst(); this.startfirst();
} }
} }
this.removeSelectImg(); this.removeSelectImg();
} }
removeSelectImg(){ removeSelectImg(){
if(this.selectimg3){ if(this.selectimg3){
...@@ -97,8 +117,22 @@ export default class GameView extends engine.Container { ...@@ -97,8 +117,22 @@ export default class GameView extends engine.Container {
this.blockcont.removeChild(this.selectimg4); this.blockcont.removeChild(this.selectimg4);
} }
} }
removeDiPics(){
let nume = this.dicont.children.length;
for(let i=nume-1;i>=0;i--){
let ichild = this.dicont.getChildAt(i) as engine.Container;
if(ichild){
ichild.removeEventListener(engine.MouseEvent.MOUSE_DOWN,
this.touchPic,this);
this.dicont.removeChild(ichild);
Tool.repushToPool(ichild);
}
}
}
async startfirst(){ async startfirst(){
this.dicont.removeChildren(); // this.dicont.removeChildren();
this.removeDiPics();
this.movesteps = 0; this.movesteps = 0;
this.startime = Date.now(); this.startime = Date.now();
this.removeSelectImg(); this.removeSelectImg();
...@@ -113,7 +147,7 @@ export default class GameView extends engine.Container { ...@@ -113,7 +147,7 @@ export default class GameView extends engine.Container {
engine.globalEvent.dispatchEvent("pictures-time-passtime",{ engine.globalEvent.dispatchEvent("pictures-time-passtime",{
passtime:this.passtime passtime:this.passtime
}); });
console.log("start-----------------",actidx); // console.log("start-----------------",actidx);
this.rows = 3; this.rows = 3;
this.cols = 3; this.cols = 3;
...@@ -134,8 +168,9 @@ export default class GameView extends engine.Container { ...@@ -134,8 +168,9 @@ export default class GameView extends engine.Container {
let type1 = 1; let type1 = 1;
if(!tex){ if(!tex){
tex = this.gameUrls[actidx]; tex = this.gameUrls[actidx];
type1 = 2; type1 = 3;
} }
// type1 = 3;
let result = await qietu(tex,type1,this.rows,this.cols,this.dicont); let result = await qietu(tex,type1,this.rows,this.cols,this.dicont);
let res = result.res; let res = result.res;
if(res){ if(res){
...@@ -190,7 +225,8 @@ export default class GameView extends engine.Container { ...@@ -190,7 +225,8 @@ export default class GameView extends engine.Container {
} }
async start() { async start() {
this.dicont.removeChildren(); // this.dicont.removeChildren();
this.removeDiPics();
this.movesteps = 0; this.movesteps = 0;
this.startime = Date.now(); this.startime = Date.now();
this.removeSelectImg(); this.removeSelectImg();
...@@ -225,7 +261,7 @@ export default class GameView extends engine.Container { ...@@ -225,7 +261,7 @@ export default class GameView extends engine.Container {
let type1 = 1; let type1 = 1;
if(!tex){ if(!tex){
tex = this.gameUrls[actidx]; tex = this.gameUrls[actidx];
type1 = 2; type1 = 3;
} }
let result = await qietu(tex,type1,this.rows,this.cols,this.dicont); let result = await qietu(tex,type1,this.rows,this.cols,this.dicont);
let res = result.res; let res = result.res;
...@@ -325,12 +361,12 @@ export default class GameView extends engine.Container { ...@@ -325,12 +361,12 @@ export default class GameView extends engine.Container {
} }
pause(){ pause(){
this.ingame = false; this.ingame = false;
console.error("拼图暂停"); // console.error("拼图暂停");
} }
resume(){ resume(){
this.lastframetime = Date.now(); this.lastframetime = Date.now();
this.ingame = true; this.ingame = true;
console.error("拼图继续"); // console.error("拼图继续");
} }
...@@ -424,7 +460,7 @@ export default class GameView extends engine.Container { ...@@ -424,7 +460,7 @@ export default class GameView extends engine.Container {
} }
let isuc = this.checkSuccess(); let isuc = this.checkSuccess();
if(isuc){ if(isuc){
console.error("成功过关"); // console.error("成功过关");
this.gameover(1); this.gameover(1);
} }
} }
......
export default class Tool{
static picPool:Array<engine.Container> = new Array();
static getOnePic(){
if(this.picPool.length>0){
return this.picPool.shift();
}else{
let ipic = new engine.Container();
let isprite = new engine.ScrollView();
isprite.name = "iscrollv";
let nsp = new engine.Sprite();
nsp.name = "isprite";
nsp.texture
isprite.addChild(nsp);
ipic.addChild(isprite);
isprite.mouseEnabled = false;
nsp.mouseEnabled = false;
return ipic;
}
}
static repushToPool(icont:engine.Container){
this.picPool.push(icont);
}
}
\ No newline at end of file
import { props } from "../props"; import { props } from "../props";
import { loadImageByUrl } from "./utils"; import { loadImageByUrl, getTextureByName ,getTexture} from "./utils";
import qietu from "./qietu"; import qietu from "./qietu";
import Tool from "./Tool";
const urls = []; const urls = [];
const picMap = {}; const picMap = {};
const posMap = {}; const posMap = {};
...@@ -9,69 +10,77 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -9,69 +10,77 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
let t:engine.Texture; let t:engine.Texture;
if(type1==1){ if(type1==1){
t = url; t = url;
}else{ }else if(type1==2){
t = await loadImageByUrl(url) as engine.Texture; let t1 = await loadImageByUrl(url);// as engine.Texture;
if(t1){
t = t1 as engine.Texture;
}
}else if(type1==3){
t = await getTextureByName("testimg") as engine.Texture;
}
if(!t){
return qietu("testimg",3,rows,cols,parent);
} }
let setimgwid = 612; let setimgwid = 612;
let mwid1 = setimgwid/rows; let mwid1 = setimgwid/rows;
let mhei1 = setimgwid/cols; let mhei1 = setimgwid/cols;
let mwid = t.width; // let mwid = t.width;
let mhei = t.height; // let mhei = t.height;
if(mwid<10||mhei<10){ // if(mwid<10||mhei<10){
await new Promise(res=>{ // await new Promise(res=>{
setTimeout(function(){ // setTimeout(function(){
res(); // res();
},200); // },200);
}) // })
return qietu(t,1,rows,cols,parent); // return qietu(t,1,rows,cols,parent);
} // }
if(mwid>mhei){ // if(mwid>mhei){
if(mhei<setimgwid){ // if(mhei<setimgwid){
mwid = mwid*setimgwid/mhei; // mwid = mwid*setimgwid/mhei;
mhei = setimgwid; // mhei = setimgwid;
} // }
}else{ // }else{
if(mwid<setimgwid){ // if(mwid<setimgwid){
mhei = mhei*setimgwid/mwid; // mhei = mhei*setimgwid/mwid;
mwid = setimgwid; // mwid = setimgwid;
} // }
} // }
let picarr = {}; let picarr = {};
let picnames = []; let picnames = [];
let chax; let chax;
let chay; let chay;
let startlix; let startlix = 0;
let addlix; let addlix = 1/rows;
let startliy; let startliy = 0;
let addliy; let addliy = 1/cols;
let twid1; let twid1 = setimgwid;
let thei1; let thei1 = setimgwid;
if(mwid>mhei){ // if(mwid>mhei){
chax = (mwid-mhei)/2; // chax = (mwid-mhei)/2;
startlix = chax/mwid; // startlix = chax/mwid;
addlix = (mhei/cols)/mwid; // addlix = (mhei/cols)/mwid;
startliy = 0; // startliy = 0;
addliy = 1/rows; // addliy = 1/rows;
twid1 = mwid*setimgwid/mhei; // twid1 = mwid*setimgwid/mhei;
thei1 = setimgwid; // thei1 = setimgwid;
}else{ // }else{
startlix = 0; // startlix = 0;
addlix = 1/cols; // addlix = 1/cols;
chay = (mhei-mwid)/2; // chay = (mhei-mwid)/2;
startliy = chay/mhei; // startliy = chay/mhei;
addliy = (mwid/rows)/mhei; // addliy = (mwid/rows)/mhei;
thei1 = mhei*setimgwid/mwid; // thei1 = mhei*setimgwid/mwid;
twid1 = setimgwid; // twid1 = setimgwid;
} // }
// console.log("切图准备",startlix,addlix,startliy,addliy,mwid,mhei); // console.log("切图准备",startlix,addlix,startliy,addliy,mwid,mhei);
// let txt1 = new engine.Label(); // let txt1 = new engine.Label();
...@@ -87,36 +96,46 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -87,36 +96,46 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
let starty = startliy+addliy*c; let starty = startliy+addliy*c;
let endy = starty+addliy; let endy = starty+addliy;
let uvs = new Float32Array([ // let uvs = new Float32Array([
starty, // starty,
startx, // startx,
endy, // endy,
startx, // startx,
endy, // endy,
endx, // endx,
starty, // starty,
endx // endx
]) // ])
//方案1
// let isprite = new engine.Sprite(t); // let isprite = new engine.Sprite(t);
// isprite.uvs = uvs; // isprite.uvs = uvs;
let nsprite = new engine.Container();
let isprite = new engine.ScrollView(); //方案2
let nsp = new engine.Sprite(t); let nsprite = Tool.getOnePic();
isprite.addChild(nsp); let isprite = nsprite.getChildByName("iscrollv");
let nsp = isprite.getChildByName("isprite");
nsp.texture = t;
nsp.width = twid1; nsp.width = twid1;
nsp.height = thei1; nsp.height = thei1;
isprite.mouseEnabled = false; // let nsprite = new engine.Container();
isprite.mouseChildren = false;
// let isprite = new engine.ScrollView();
// let nsp = new engine.Sprite(t);
// isprite.addChild(nsp);
// nsp.width = twid1;
// nsp.height = thei1;
// isprite.mouseEnabled = false;
// isprite.mouseChildren = false;
nsp.x = -starty*twid1; nsp.x = -starty*twid1;
nsp.y = -startx*thei1; nsp.y = -startx*thei1;
isprite.width = mwid1; isprite.width = mwid1;
isprite.height = mhei1; isprite.height = mhei1;
nsprite.addChild(isprite); // nsprite.addChild(isprite);
nsprite.width = mwid1; nsprite.width = mwid1;
nsprite.height = mhei1; nsprite.height = mhei1;
...@@ -134,8 +153,16 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -134,8 +153,16 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
picnames:picnames picnames:picnames
}; };
}catch(e){ }catch(e){
return { //获取那图失败
res:false
}; // return {
// res:false
// };
await new Promise(res=>{
setTimeout(function(){
res();
},200);
})
return qietu("testimg",3,rows,cols,parent);
} }
}; };
...@@ -20,13 +20,23 @@ export function createSvga(name, anchorName?) { ...@@ -20,13 +20,23 @@ export function createSvga(name, anchorName?) {
} }
export async function loadImageByUrl(url){ export async function loadImageByUrl(url){
console.log('loadImageByUrl----------:',url); // console.log('loadImageByUrl----------:',url);
try{
// console.log("尝试加载44");
return new Promise((resolve) => { return new Promise((resolve) => {
let t1 = setTimeout(()=>{
return resolve(null);
},2000);
if (engine.TextureCache[url]) { if (engine.TextureCache[url]) {
clearTimeout(t1);
resolve(engine.TextureCache[url]) resolve(engine.TextureCache[url])
} else { } else {
var t = engine.Texture.from(url); var t = engine.Texture.from(url);
t.addEventListener("loaded", () => { resolve(t) }) t.addEventListener("loaded", () => { clearTimeout(t1);resolve(t) });
} }
}) })
}catch(e){
return null;
}
} }
\ No newline at end of file
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