Commit 716c4811 authored by wildfirecode's avatar wildfirecode

1

parent 34d1bd4a
...@@ -75,10 +75,13 @@ ...@@ -75,10 +75,13 @@
"recycling-start": { "recycling-start": {
"alias": "开始", "alias": "开始",
"data": { "data": {
"picUrl": "图片路径", "time": "游戏时间"
"blockUrl": "blockUrl"
} }
}, },
"recycling-end": {
"alias": "游戏结束",
"data": {}
},
"recycling-stop": { "recycling-stop": {
"alias": "停止" "alias": "停止"
} }
...@@ -105,5 +108,5 @@ ...@@ -105,5 +108,5 @@
} }
}, },
"id": "recycling", "id": "recycling",
"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.recycling = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\n\n\tfunction getTexture(uuid) {\n\t return engine.Texture.from(getAssetByUUID(uuid).uuid);\n\t}\n\tfunction getTextureByName(name) {\n\t return getTexture(engine.getAssetByName(name).uuid);\n\t}\n\tfunction createSvga(name, anchorName) {\n\t var inst = new svga.Svga();\n\t inst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\t return inst;\n\t}\n\t//# sourceMappingURL=utils.js.map\n\n\tvar props = {};\n\tfunction prepareProps() {\n\t var metaProps = getProps();\n\t engine.injectProp(props, metaProps);\n\t}\n\tfunction injectProps(p) {\n\t engine.injectProp(props, p);\n\t}\n\t//# sourceMappingURL=props.js.map\n\n\tvar uiConfig = (function () {\n\t return [\n\t {\n\t id: 'playBg',\n\t texture: 'playBg'\n\t },\n\t {\n\t id: 'idler0',\n\t texture: 'idlerWheel',\n\t pos: [75, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler1',\n\t texture: 'idlerWheel',\n\t pos: [175, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler2',\n\t texture: 'idlerWheel',\n\t pos: [275, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler3',\n\t texture: 'idlerWheel',\n\t pos: [375, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler4',\n\t texture: 'idlerWheel',\n\t pos: [475, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler5',\n\t texture: 'idlerWheel',\n\t pos: [575, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler6',\n\t texture: 'idlerWheel',\n\t pos: [675, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t ];\n\t});\n\t//# sourceMappingURL=uiConfig.js.map\n\n\tvar Conveyor = (function (_super) {\n\t tslib.__extends(Conveyor, _super);\n\t function Conveyor() {\n\t var _this = _super.call(this) || this;\n\t var sp = new engine.Sprite(getTextureByName('conveyor'));\n\t _this.addChild(sp);\n\t _this.idx0 = _this.createItem(75, 50);\n\t _this.idx1 = _this.createItem(225, 50);\n\t _this.idx2 = _this.createItem(375, 50);\n\t _this.idx3 = _this.createItem(525, 50);\n\t _this.idx4 = _this.createItem(675, 50);\n\t return _this;\n\t }\n\t Conveyor.prototype.createItem = function (x, y) {\n\t var sp = new engine.Sprite();\n\t this.addChild(sp);\n\t sp.x = x - 50;\n\t sp.y = y - 50;\n\t var g = new engine.Graphics;\n\t g.beginFill(0xff0000);\n\t g.drawRect(0, 0, 100, 100);\n\t g.endFill();\n\t sp.addChild(g);\n\t return sp;\n\t };\n\t return Conveyor;\n\t}(engine.Sprite));\n\t//# sourceMappingURL=Conveyor.js.map\n\n\tvar createBg = (function (a) {\n\t if (a === void 0) { a = 1; }\n\t var rect = new engine.Graphics();\n\t rect.beginFill(0);\n\t rect.drawRect(0, 0, 750, 1624);\n\t rect.endFill();\n\t rect.alpha = a;\n\t return rect;\n\t});\n\t//# sourceMappingURL=createBg.js.map\n\n\tvar createImg = (function (texture) {\n\t return new engine.Sprite(getTextureByName(texture));\n\t});\n\t//# sourceMappingURL=createImg.js.map\n\n\tvar CountDownGroup = (function (_super) {\n\t tslib.__extends(CountDownGroup, _super);\n\t function CountDownGroup() {\n\t var _this = _super.call(this) || this;\n\t _this.addChild(createBg(.6));\n\t _this.num1 = createImg('num1');\n\t _this.num2 = createImg('num2');\n\t _this.num3 = createImg('num3');\n\t _this.go = createImg('go');\n\t _this.go.anchorX = 240;\n\t _this.go.anchorY = 171.5;\n\t _this.num1.anchorX = 125.5;\n\t _this.num1.anchorY = 189;\n\t _this.num2.anchorX = 149.5;\n\t _this.num2.anchorY = 191.5;\n\t _this.num3.anchorX = 148.5;\n\t _this.num3.anchorY = 191.5;\n\t _this.go.x = 750 / 2 - 240;\n\t _this.go.y = 525 - 171.5;\n\t _this.num1.x = 750 / 2 - 125.5;\n\t _this.num1.y = 529 - 189;\n\t _this.num2.x = 750 / 2 - 149.5;\n\t _this.num2.y = 526 - 191.5;\n\t _this.num3.x = 750 / 2 - 148.5;\n\t _this.num3.y = 525 - 191.5;\n\t _this.addChild(_this.num1);\n\t _this.addChild(_this.num2);\n\t _this.addChild(_this.num3);\n\t _this.addChild(_this.go);\n\t _this.reset();\n\t return _this;\n\t }\n\t CountDownGroup.prototype.reset = function () {\n\t this.visible = false;\n\t this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0;\n\t this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3;\n\t this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3;\n\t };\n\t CountDownGroup.prototype.startCountDown = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t return [2, new Promise(function (r) {\n\t _this.visible = true;\n\t _this.num3.alpha = 1;\n\t var n3 = engine.Tween.get(_this.num3);\n\t n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {\n\t _this.num2.alpha = 1;\n\t var n2 = engine.Tween.get(_this.num2);\n\t n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {\n\t _this.num1.alpha = 1;\n\t var n1 = engine.Tween.get(_this.num1);\n\t n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {\n\t _this.go.alpha = 1;\n\t var go = engine.Tween.get(_this.go);\n\t go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(function () {\n\t _this.visible = false;\n\t r();\n\t });\n\t });\n\t });\n\t });\n\t })];\n\t });\n\t });\n\t };\n\t return CountDownGroup;\n\t}(engine.Sprite));\n\t//# sourceMappingURL=CountDownGroup.js.map\n\n\tvar getGuideInfo = (function () {\n\t if (!window.localStorage) {\n\t return 0;\n\t }\n\t return localStorage.getItem('recyclingGuide');\n\t});\n\tvar setGuide = function () {\n\t if (window.localStorage)\n\t localStorage.setItem('recyclingGuide', '1');\n\t};\n\t//# sourceMappingURL=getGuideInfo.js.map\n\n\tvar GuideView = (function (_super) {\n\t tslib.__extends(GuideView, _super);\n\t function GuideView() {\n\t var _this = _super.call(this) || this;\n\t _this.initUI();\n\t _this.visible = false;\n\t return _this;\n\t }\n\t GuideView.prototype.initUI = function () {\n\t this.addChild(createBg(.6));\n\t this.guideBg = createImg('guideBg');\n\t this.addChild(this.guideBg);\n\t this.guideEle = createImg('guideEle');\n\t this.addChild(this.guideEle);\n\t this.guideBg.x = 393;\n\t this.guideBg.y = 552;\n\t this.guideEle.x = 361;\n\t this.guideEle.y = 877;\n\t this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;\n\t var svga = createSvga(\"guideTips\");\n\t this.svga = svga;\n\t this.addChild(svga);\n\t svga.gotoAndStop(1);\n\t svga.mouseEnabled = svga.mouseChildren = false;\n\t };\n\t GuideView.prototype.checkHit = function (x, y, w, h) {\n\t var rect = new engine.Rectangle(393, 552, 281, 320);\n\t if (x > rect.x && y > rect.y && (x + w) < (rect.x + rect.width) && (y + h) < (rect.y + rect.height)) {\n\t return true;\n\t }\n\t return false;\n\t };\n\t GuideView.prototype.startGuide = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t return [2, new Promise(function (r) {\n\t _this.visible = true;\n\t _this.svga.gotoAndStop(1);\n\t _this.svga.play(false, true);\n\t _this.guideEle.scaleX = 1;\n\t _this.guideEle.scaleY = 1;\n\t var offset = [0, 0];\n\t var guideOver = function () {\n\t _this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);\n\t engine.Tween.get(_this.guideEle).to({ scaleX: 0, scaleY: 0 }, 300).call(function () {\n\t _this.visible = false;\n\t r();\n\t });\n\t };\n\t var onUp = function (e) {\n\t _this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);\n\t if (_this.checkHit(_this.guideEle.x, _this.guideEle.y, _this.guideEle.width, _this.guideEle.height)) {\n\t guideOver();\n\t }\n\t else {\n\t _this.svga.visible = true;\n\t _this.guideEle.x = 361;\n\t _this.guideEle.y = 877;\n\t }\n\t };\n\t var onMove = function (e) {\n\t _this.guideEle.x = e.stageX - offset[0];\n\t _this.guideEle.y = e.stageY - offset[1];\n\t };\n\t var ondown = function (e) {\n\t offset = [e.localX, e.localY];\n\t _this.svga.visible = false;\n\t _this.stage.once(engine.MouseEvent.MOUSE_UP, onUp, _this);\n\t _this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);\n\t };\n\t _this.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);\n\t })];\n\t });\n\t });\n\t };\n\t return GuideView;\n\t}(engine.Sprite));\n\n\tvar GameView = (function (_super) {\n\t tslib.__extends(GameView, _super);\n\t function GameView() {\n\t var _this = _super.call(this) || this;\n\t _this._timeCounter = 0;\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\n\t return _this;\n\t }\n\t GameView.prototype.configUI = function () {\n\t var uiMap = {};\n\t this.uiMap = uiMap;\n\t var config = uiConfig();\n\t for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {\n\t var item = config_1[_i];\n\t var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;\n\t var sp = new engine.Sprite(getTextureByName(texture));\n\t this.addChild(sp);\n\t uiMap[id] = sp;\n\t if (anchor) {\n\t sp.anchorX = anchor[0];\n\t sp.anchorY = anchor[1];\n\t }\n\t if (pos) {\n\t sp.x = pos[0];\n\t sp.y = pos[1];\n\t if (anchor) {\n\t sp.x = pos[0] - sp.anchorX;\n\t sp.y = pos[1] - sp.anchorY;\n\t }\n\t }\n\t }\n\t this.configConveyors();\n\t this.createRects();\n\t this.countdown = new CountDownGroup();\n\t this.addChild(this.countdown);\n\t this.guide = new GuideView();\n\t this.addChild(this.guide);\n\t };\n\t GameView.prototype.createRects = function () {\n\t this.wetWaste = this.createRect(74, 552, 301, 293, 0xffffff);\n\t this.harmfulWaste = this.createRect(75, 247, 300, 293, 0xff0000);\n\t this.dryWaste = this.createRect(389, 249, 286, 291, 0x000000);\n\t this.recoverableWaste = this.createRect(389, 551, 287, 292, 0x0000ff);\n\t };\n\t GameView.prototype.createRect = function (x, y, w, h, c) {\n\t var rect = new engine.Rectangle(x, y, w, h);\n\t var sp = new engine.Sprite();\n\t this.addChild(sp);\n\t sp.x = x;\n\t sp.y = y;\n\t var g = new engine.Graphics;\n\t g.alpha = 0.0;\n\t g.beginFill(c);\n\t g.drawRect(0, 0, w, h);\n\t g.endFill();\n\t sp.addChild(g);\n\t return rect;\n\t };\n\t GameView.prototype.configConveyors = function () {\n\t var conveyor1 = new Conveyor();\n\t conveyor1.x = 0;\n\t conveyor1.y = 904.21;\n\t var conveyor2 = new Conveyor();\n\t this.addChild(conveyor1);\n\t this.addChild(conveyor2);\n\t conveyor2.x = 764;\n\t conveyor2.y = 904.21;\n\t };\n\t GameView.prototype.playAni = function () {\n\t var _this = this;\n\t var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];\n\t idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });\n\t idlerWheels.forEach(function (i) {\n\t engine.Tween.get(i, { loop: true }).to({ rotation: 360 }, 3000);\n\t });\n\t };\n\t GameView.prototype.stopAni = function () {\n\t };\n\t GameView.prototype.start = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t if (!!getGuideInfo()) return [3, 2];\n\t return [4, this.guide.startGuide()];\n\t case 1:\n\t _a.sent();\n\t setGuide();\n\t _a.label = 2;\n\t case 2: return [4, this.countdown.startCountDown()];\n\t case 3:\n\t _a.sent();\n\t this.playAni();\n\t console.log('on start');\n\t engine.globalEvent.dispatchEvent('recycling-time-update', {\n\t second: this.getSecond(),\n\t });\n\t this._timer = setInterval(function () {\n\t _this.onTimer();\n\t }, 1000);\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.getSecond = function () { return 0; };\n\t GameView.prototype.onTimer = function () {\n\t engine.globalEvent.dispatchEvent('recycling-time-update', {\n\t second: this.getSecond(),\n\t });\n\t if (this.getSecond() == 0) {\n\t this.stop();\n\t engine.globalEvent.dispatchEvent('recycling-game-fail', {\n\t reason: 1\n\t });\n\t }\n\t };\n\t GameView.prototype.stop = function () {\n\t };\n\t GameView.prototype.setup = function () {\n\t console.log('onSteup', props);\n\t this.configUI();\n\t };\n\t GameView.prototype.onDown = function (e) {\n\t };\n\t GameView.prototype.stageOnUp = function (e) {\n\t };\n\t GameView.prototype.onSuccess = function () {\n\t };\n\t GameView.prototype.onMove = function (e) {\n\t };\n\t return GameView;\n\t}(engine.Container));\n\t//# sourceMappingURL=GameView.js.map\n\n\tvar GameWrapper = (function (_super) {\n\t tslib.__extends(GameWrapper, _super);\n\t function GameWrapper() {\n\t var _this = _super.call(this) || this;\n\t engine.globalEvent.addEventListener('recycling-start', _this.start, _this);\n\t engine.globalEvent.addEventListener('recycling-stop', _this.stop, _this);\n\t var gameView = _this._gameView = new GameView();\n\t _this.addChild(gameView);\n\t return _this;\n\t }\n\t GameWrapper.prototype.start = function (event) {\n\t injectProps(event.data);\n\t this._gameView.start();\n\t };\n\t GameWrapper.prototype.stop = function (event) {\n\t this._gameView.stop();\n\t };\n\t return GameWrapper;\n\t}(engine.Container));\n\t//# sourceMappingURL=GameWrapper.js.map\n\n\tfunction index (props) {\n\t prepareProps();\n\t injectProps(props);\n\t var instance = new GameWrapper();\n\t return instance;\n\t}\n\t//# sourceMappingURL=index.js.map\n\n\treturn index;\n\n})));\n" "code": "\"use strict\";var tslib=require(\"tslib\");function getTexture(e){return engine.Texture.from(getAssetByUUID(e).uuid)}function getTextureByName(e){return getTexture(engine.getAssetByName(e).uuid)}function createSvga(e,t){var n=new svga.Svga;return n.source=\"asset://\"+engine.getAssetByName(e).uuid,n}var props={};function prepareProps(){var e=getProps();engine.injectProp(props,e)}function injectProps(e){engine.injectProp(props,e)}var Conveyor=function(n){function e(){var e=n.call(this)||this,t=new engine.Sprite(getTextureByName(\"conveyor\"));return e.addChild(t),e.idx0=e.createItem(75,50),e.idx1=e.createItem(225,50),e.idx2=e.createItem(375,50),e.idx3=e.createItem(525,50),e.idx4=e.createItem(675,50),e}return tslib.__extends(e,n),e.prototype.createItem=function(e,t){var n=new engine.Sprite;this.addChild(n),n.x=e-50,n.y=t-50;var i=new engine.Graphics;return i.beginFill(16711680),i.drawRect(0,0,100,100),i.endFill(),n.addChild(i),n},e}(engine.Sprite),uiConfig=function(){return[{id:\"playBg\",texture:\"playBg\"},{id:\"idler0\",texture:\"idlerWheel\",pos:[75,1038],anchor:[20,21.5]},{id:\"idler1\",texture:\"idlerWheel\",pos:[175,1038],anchor:[20,21.5]},{id:\"idler2\",texture:\"idlerWheel\",pos:[275,1038],anchor:[20,21.5]},{id:\"idler3\",texture:\"idlerWheel\",pos:[375,1038],anchor:[20,21.5]},{id:\"idler4\",texture:\"idlerWheel\",pos:[475,1038],anchor:[20,21.5]},{id:\"idler5\",texture:\"idlerWheel\",pos:[575,1038],anchor:[20,21.5]},{id:\"idler6\",texture:\"idlerWheel\",pos:[675,1038],anchor:[20,21.5]}]},getGuideInfo=function(){return window.localStorage?localStorage.getItem(\"recyclingGuide\"):0},setGuide=function(){window.localStorage&&localStorage.setItem(\"recyclingGuide\",\"1\")},createBg=function(e){void 0===e&&(e=1);var t=new engine.Graphics;return t.beginFill(0),t.drawRect(0,0,750,1624),t.endFill(),t.alpha=e,t},createImg=function(e){return new engine.Sprite(getTextureByName(e))},CountDownGroup=function(t){function e(){var e=t.call(this)||this;return e.addChild(createBg(.6)),e.num1=createImg(\"num1\"),e.num2=createImg(\"num2\"),e.num3=createImg(\"num3\"),e.go=createImg(\"go\"),e.go.anchorX=240,e.go.anchorY=171.5,e.num1.anchorX=125.5,e.num1.anchorY=189,e.num2.anchorX=149.5,e.num2.anchorY=191.5,e.num3.anchorX=148.5,e.num3.anchorY=191.5,e.go.x=135,e.go.y=353.5,e.num1.x=249.5,e.num1.y=340,e.num2.x=225.5,e.num2.y=334.5,e.num3.x=226.5,e.num3.y=333.5,e.addChild(e.num1),e.addChild(e.num2),e.addChild(e.num3),e.addChild(e.go),e.visible=!1,e.reset(),e}return tslib.__extends(e,t),e.prototype.reset=function(){this.go.alpha=this.num1.alpha=this.num2.alpha=this.num3.alpha=0,this.go.scaleX=this.num1.scaleX=this.num2.scaleX=this.num3.scaleX=3,this.go.scaleY=this.num1.scaleY=this.num2.scaleY=this.num3.scaleY=3},e.prototype.startCountDown=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t=this;return tslib.__generator(this,function(e){return[2,new Promise(function(e){t.reset(),t.visible=!0,t.num3.alpha=1,engine.Tween.get(t.num3).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).to({scaleX:0,scaleY:0},200).call(function(){t.num2.alpha=1,engine.Tween.get(t.num2).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).to({scaleX:0,scaleY:0},200).call(function(){t.num1.alpha=1,engine.Tween.get(t.num1).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).to({scaleX:0,scaleY:0},200).call(function(){t.go.alpha=1,engine.Tween.get(t.go).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).call(function(){t.visible=!1,e()})})})})})]})})},e}(engine.Sprite),GuideView=function(t){function e(){var e=t.call(this)||this;return e.initUI(),e.visible=!1,e}return tslib.__extends(e,t),e.prototype.initUI=function(){this.addChild(createBg(.6)),this.guideBg=createImg(\"guideBg\"),this.addChild(this.guideBg),this.guideEle=createImg(\"guideEle\"),this.addChild(this.guideEle),this.guideBg.x=393,this.guideBg.y=552,this.guideEle.x=361,this.guideEle.y=877,this.guideEle.mouseEnabled=this.guideEle.mouseChildren=!0;var e=createSvga(\"guideTips\");this.svga=e,this.addChild(e),e.gotoAndStop(1),e.mouseEnabled=e.mouseChildren=!1},e.prototype.checkHit=function(e,t,n,i){var r=new engine.Rectangle(393,552,281,320);return e>r.x&&t>r.y&&e+n<r.x+r.width&&t+i<r.y+r.height},e.prototype.startGuide=function(){return tslib.__awaiter(this,void 0,void 0,function(){var a=this;return tslib.__generator(this,function(e){return[2,new Promise(function(t){a.visible=!0,a.svga.gotoAndStop(1),a.svga.play(!1,!0),a.guideEle.scaleX=1,a.guideEle.scaleY=1;function n(e){a.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE,r,a),a.checkHit(a.guideEle.x,a.guideEle.y,a.guideEle.width,a.guideEle.height)?(a.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN,o,a),engine.Tween.get(a.guideEle).to({scaleX:0,scaleY:0},300).call(function(){a.visible=!1,t()})):(a.svga.visible=!0,a.guideEle.x=361,a.guideEle.y=877)}var i=[0,0],r=function(e){a.guideEle.x=e.stageX-i[0],a.guideEle.y=e.stageY-i[1]},o=function(e){i=[e.localX,e.localY],a.svga.visible=!1,a.stage.once(engine.MouseEvent.MOUSE_UP,n,a),a.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE,r,a)};a.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN,o,a)})]})})},e}(engine.Sprite),GameView=function(t){function e(){var e=t.call(this)||this;return e._timeCounter=0,e.score=0,e.once(engine.Event.ADDED_TO_STAGE,e.setup,e),e}return tslib.__extends(e,t),e.prototype.configUI=function(){var e={};this.uiMap=e;for(var t=0,n=uiConfig();t<n.length;t++){var i=n[t],r=i.id,o=i.texture,a=i.pos,s=i.anchor,c=new engine.Sprite(getTextureByName(o));this.addChild(c),e[r]=c,s&&(c.anchorX=s[0],c.anchorY=s[1]),a&&(c.x=a[0],c.y=a[1],s&&(c.x=a[0]-c.anchorX,c.y=a[1]-c.anchorY))}this.configConveyors(),this.createRects(),this.countdown=new CountDownGroup,this.addChild(this.countdown),this.guide=new GuideView,this.addChild(this.guide)},e.prototype.createRects=function(){this.wetWaste=this.createRect(74,552,301,293,16777215),this.harmfulWaste=this.createRect(75,247,300,293,16711680),this.dryWaste=this.createRect(389,249,286,291,0),this.recoverableWaste=this.createRect(389,551,287,292,255)},e.prototype.createRect=function(e,t,n,i,r){var o=new engine.Rectangle(e,t,n,i),a=new engine.Sprite;this.addChild(a),a.x=e,a.y=t;var s=new engine.Graphics;return s.alpha=0,s.beginFill(r),s.drawRect(0,0,n,i),s.endFill(),a.addChild(s),o},e.prototype.configConveyors=function(){var e=new Conveyor;e.x=0,e.y=904.21;var t=new Conveyor;this.addChild(e),this.addChild(t),t.x=764,t.y=904.21},e.prototype.playAni=function(){var t=this,e=[\"idler0\",\"idler1\",\"idler2\",\"idler3\",\"idler4\",\"idler5\",\"idler6\"];(e=e.map(function(e){return t.uiMap[e]})).forEach(function(e){engine.Tween.get(e,{loop:!0}).to({rotation:360},3e3)})},e.prototype.stopAni=function(){},e.prototype.start=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return console.log(\"on start\"),this._timeCounter=0,getGuideInfo()?[3,2]:[4,this.guide.startGuide()];case 1:e.sent(),setGuide(),e.label=2;case 2:return[4,this.countdown.startCountDown()];case 3:return e.sent(),this.playAni(),engine.globalEvent.dispatchEvent(\"recycling-time-update\",{second:this.getSecond()}),this._timer=setInterval(function(){t.onTimer()},1e3),[2]}})})},e.prototype.getSecond=function(){return props.time-this._timeCounter},e.prototype.onTimer=function(){this._timeCounter++,engine.globalEvent.dispatchEvent(\"recycling-time-update\",{second:this.getSecond()}),0==this.getSecond()&&(this.stop(),engine.globalEvent.dispatchEvent(\"recycling-game-end\",{score:this.score}))},e.prototype.stop=function(){clearInterval(this._timer)},e.prototype.setup=function(){console.log(\"onSteup\",props),this.configUI()},e.prototype.onDown=function(e){},e.prototype.stageOnUp=function(e){},e.prototype.onSuccess=function(){},e.prototype.onMove=function(e){},e}(engine.Container),GameWrapper=function(n){function e(){var e=n.call(this)||this;engine.globalEvent.addEventListener(\"recycling-start\",e.start,e),engine.globalEvent.addEventListener(\"recycling-stop\",e.stop,e);var t=e._gameView=new GameView;return e.addChild(t),e}return tslib.__extends(e,n),e.prototype.start=function(e){injectProps(e.data),this._gameView.start()},e.prototype.stop=function(e){this._gameView.stop()},e}(engine.Container);function index(e){return prepareProps(),injectProps(e),new GameWrapper}module.exports=index;\n"
} }
...@@ -46,15 +46,21 @@ function launchWithCustomModule(customModule) { ...@@ -46,15 +46,21 @@ function launchWithCustomModule(customModule) {
}, 100); }, 100);
setTimeout(() => { setTimeout(() => {
engine.globalEvent.dispatchEvent('recycling-start', {}); engine.globalEvent.dispatchEvent('recycling-start', { time: 2 });
const d = engine.gameStage.sceneContainer.getChildAt(0); const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 200); }, 200);
setTimeout(() => {
engine.globalEvent.dispatchEvent('recycling-start', { time: 2 });
const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 1000 * 10);
}); });
engine.globalEvent.addEventListener('recycling-time-update', (e) => { engine.globalEvent.addEventListener('recycling-time-update', (e) => {
// console.log(e.type, e.data); console.log(e.type, e.data);
}); });
engine.globalEvent.addEventListener('recycling-game-fail', (e) => { engine.globalEvent.addEventListener('recycling-game-end', (e) => {
console.log(e.type, e.data); console.log(e.type, e.data);
}); });
engine.globalEvent.addEventListener('recycling-game-success', (e) => { engine.globalEvent.addEventListener('recycling-game-success', (e) => {
......
...@@ -45,6 +45,6 @@ ...@@ -45,6 +45,6 @@
<script src="load-assets.js"></script> <script src="load-assets.js"></script>
<script src="main.js"></script> <script src="main.js"></script>
<script> <script>
localStorage.clear() // localStorage.clear()
</script> </script>
</body> </body>
\ No newline at end of file
(function (global, factory) { "use strict";var tslib=require("tslib");function getTexture(e){return engine.Texture.from(getAssetByUUID(e).uuid)}function getTextureByName(e){return getTexture(engine.getAssetByName(e).uuid)}function createSvga(e,t){var n=new svga.Svga;return n.source="asset://"+engine.getAssetByName(e).uuid,n}var props={};function prepareProps(){var e=getProps();engine.injectProp(props,e)}function injectProps(e){engine.injectProp(props,e)}var Conveyor=function(n){function e(){var e=n.call(this)||this,t=new engine.Sprite(getTextureByName("conveyor"));return e.addChild(t),e.idx0=e.createItem(75,50),e.idx1=e.createItem(225,50),e.idx2=e.createItem(375,50),e.idx3=e.createItem(525,50),e.idx4=e.createItem(675,50),e}return tslib.__extends(e,n),e.prototype.createItem=function(e,t){var n=new engine.Sprite;this.addChild(n),n.x=e-50,n.y=t-50;var i=new engine.Graphics;return i.beginFill(16711680),i.drawRect(0,0,100,100),i.endFill(),n.addChild(i),n},e}(engine.Sprite),uiConfig=function(){return[{id:"playBg",texture:"playBg"},{id:"idler0",texture:"idlerWheel",pos:[75,1038],anchor:[20,21.5]},{id:"idler1",texture:"idlerWheel",pos:[175,1038],anchor:[20,21.5]},{id:"idler2",texture:"idlerWheel",pos:[275,1038],anchor:[20,21.5]},{id:"idler3",texture:"idlerWheel",pos:[375,1038],anchor:[20,21.5]},{id:"idler4",texture:"idlerWheel",pos:[475,1038],anchor:[20,21.5]},{id:"idler5",texture:"idlerWheel",pos:[575,1038],anchor:[20,21.5]},{id:"idler6",texture:"idlerWheel",pos:[675,1038],anchor:[20,21.5]}]},getGuideInfo=function(){return window.localStorage?localStorage.getItem("recyclingGuide"):0},setGuide=function(){window.localStorage&&localStorage.setItem("recyclingGuide","1")},createBg=function(e){void 0===e&&(e=1);var t=new engine.Graphics;return t.beginFill(0),t.drawRect(0,0,750,1624),t.endFill(),t.alpha=e,t},createImg=function(e){return new engine.Sprite(getTextureByName(e))},CountDownGroup=function(t){function e(){var e=t.call(this)||this;return e.addChild(createBg(.6)),e.num1=createImg("num1"),e.num2=createImg("num2"),e.num3=createImg("num3"),e.go=createImg("go"),e.go.anchorX=240,e.go.anchorY=171.5,e.num1.anchorX=125.5,e.num1.anchorY=189,e.num2.anchorX=149.5,e.num2.anchorY=191.5,e.num3.anchorX=148.5,e.num3.anchorY=191.5,e.go.x=135,e.go.y=353.5,e.num1.x=249.5,e.num1.y=340,e.num2.x=225.5,e.num2.y=334.5,e.num3.x=226.5,e.num3.y=333.5,e.addChild(e.num1),e.addChild(e.num2),e.addChild(e.num3),e.addChild(e.go),e.visible=!1,e.reset(),e}return tslib.__extends(e,t),e.prototype.reset=function(){this.go.alpha=this.num1.alpha=this.num2.alpha=this.num3.alpha=0,this.go.scaleX=this.num1.scaleX=this.num2.scaleX=this.num3.scaleX=3,this.go.scaleY=this.num1.scaleY=this.num2.scaleY=this.num3.scaleY=3},e.prototype.startCountDown=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t=this;return tslib.__generator(this,function(e){return[2,new Promise(function(e){t.reset(),t.visible=!0,t.num3.alpha=1,engine.Tween.get(t.num3).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).to({scaleX:0,scaleY:0},200).call(function(){t.num2.alpha=1,engine.Tween.get(t.num2).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).to({scaleX:0,scaleY:0},200).call(function(){t.num1.alpha=1,engine.Tween.get(t.num1).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).to({scaleX:0,scaleY:0},200).call(function(){t.go.alpha=1,engine.Tween.get(t.go).to({scaleX:.8,scaleY:.8},200).to({scaleX:1,scaleY:1},100).wait(500).call(function(){t.visible=!1,e()})})})})})]})})},e}(engine.Sprite),GuideView=function(t){function e(){var e=t.call(this)||this;return e.initUI(),e.visible=!1,e}return tslib.__extends(e,t),e.prototype.initUI=function(){this.addChild(createBg(.6)),this.guideBg=createImg("guideBg"),this.addChild(this.guideBg),this.guideEle=createImg("guideEle"),this.addChild(this.guideEle),this.guideBg.x=393,this.guideBg.y=552,this.guideEle.x=361,this.guideEle.y=877,this.guideEle.mouseEnabled=this.guideEle.mouseChildren=!0;var e=createSvga("guideTips");this.svga=e,this.addChild(e),e.gotoAndStop(1),e.mouseEnabled=e.mouseChildren=!1},e.prototype.checkHit=function(e,t,n,i){var r=new engine.Rectangle(393,552,281,320);return e>r.x&&t>r.y&&e+n<r.x+r.width&&t+i<r.y+r.height},e.prototype.startGuide=function(){return tslib.__awaiter(this,void 0,void 0,function(){var a=this;return tslib.__generator(this,function(e){return[2,new Promise(function(t){a.visible=!0,a.svga.gotoAndStop(1),a.svga.play(!1,!0),a.guideEle.scaleX=1,a.guideEle.scaleY=1;function n(e){a.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE,r,a),a.checkHit(a.guideEle.x,a.guideEle.y,a.guideEle.width,a.guideEle.height)?(a.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN,o,a),engine.Tween.get(a.guideEle).to({scaleX:0,scaleY:0},300).call(function(){a.visible=!1,t()})):(a.svga.visible=!0,a.guideEle.x=361,a.guideEle.y=877)}var i=[0,0],r=function(e){a.guideEle.x=e.stageX-i[0],a.guideEle.y=e.stageY-i[1]},o=function(e){i=[e.localX,e.localY],a.svga.visible=!1,a.stage.once(engine.MouseEvent.MOUSE_UP,n,a),a.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE,r,a)};a.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN,o,a)})]})})},e}(engine.Sprite),GameView=function(t){function e(){var e=t.call(this)||this;return e._timeCounter=0,e.score=0,e.once(engine.Event.ADDED_TO_STAGE,e.setup,e),e}return tslib.__extends(e,t),e.prototype.configUI=function(){var e={};this.uiMap=e;for(var t=0,n=uiConfig();t<n.length;t++){var i=n[t],r=i.id,o=i.texture,a=i.pos,s=i.anchor,c=new engine.Sprite(getTextureByName(o));this.addChild(c),e[r]=c,s&&(c.anchorX=s[0],c.anchorY=s[1]),a&&(c.x=a[0],c.y=a[1],s&&(c.x=a[0]-c.anchorX,c.y=a[1]-c.anchorY))}this.configConveyors(),this.createRects(),this.countdown=new CountDownGroup,this.addChild(this.countdown),this.guide=new GuideView,this.addChild(this.guide)},e.prototype.createRects=function(){this.wetWaste=this.createRect(74,552,301,293,16777215),this.harmfulWaste=this.createRect(75,247,300,293,16711680),this.dryWaste=this.createRect(389,249,286,291,0),this.recoverableWaste=this.createRect(389,551,287,292,255)},e.prototype.createRect=function(e,t,n,i,r){var o=new engine.Rectangle(e,t,n,i),a=new engine.Sprite;this.addChild(a),a.x=e,a.y=t;var s=new engine.Graphics;return s.alpha=0,s.beginFill(r),s.drawRect(0,0,n,i),s.endFill(),a.addChild(s),o},e.prototype.configConveyors=function(){var e=new Conveyor;e.x=0,e.y=904.21;var t=new Conveyor;this.addChild(e),this.addChild(t),t.x=764,t.y=904.21},e.prototype.playAni=function(){var t=this,e=["idler0","idler1","idler2","idler3","idler4","idler5","idler6"];(e=e.map(function(e){return t.uiMap[e]})).forEach(function(e){engine.Tween.get(e,{loop:!0}).to({rotation:360},3e3)})},e.prototype.stopAni=function(){},e.prototype.start=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return console.log("on start"),this._timeCounter=0,getGuideInfo()?[3,2]:[4,this.guide.startGuide()];case 1:e.sent(),setGuide(),e.label=2;case 2:return[4,this.countdown.startCountDown()];case 3:return e.sent(),this.playAni(),engine.globalEvent.dispatchEvent("recycling-time-update",{second:this.getSecond()}),this._timer=setInterval(function(){t.onTimer()},1e3),[2]}})})},e.prototype.getSecond=function(){return props.time-this._timeCounter},e.prototype.onTimer=function(){this._timeCounter++,engine.globalEvent.dispatchEvent("recycling-time-update",{second:this.getSecond()}),0==this.getSecond()&&(this.stop(),engine.globalEvent.dispatchEvent("recycling-game-end",{score:this.score}))},e.prototype.stop=function(){clearInterval(this._timer)},e.prototype.setup=function(){console.log("onSteup",props),this.configUI()},e.prototype.onDown=function(e){},e.prototype.stageOnUp=function(e){},e.prototype.onSuccess=function(){},e.prototype.onMove=function(e){},e}(engine.Container),GameWrapper=function(n){function e(){var e=n.call(this)||this;engine.globalEvent.addEventListener("recycling-start",e.start,e),engine.globalEvent.addEventListener("recycling-stop",e.stop,e);var t=e._gameView=new GameView;return e.addChild(t),e}return tslib.__extends(e,n),e.prototype.start=function(e){injectProps(e.data),this._gameView.start()},e.prototype.stop=function(e){this._gameView.stop()},e}(engine.Container);function index(e){return prepareProps(),injectProps(e),new GameWrapper}module.exports=index;
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
(global = global || self, global.recycling = factory(global.tslib));
}(this, (function (tslib) { 'use strict';
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var props = {};
function prepareProps() {
var metaProps = getProps();
engine.injectProp(props, metaProps);
}
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var uiConfig = (function () {
return [
{
id: 'playBg',
texture: 'playBg'
},
{
id: 'idler0',
texture: 'idlerWheel',
pos: [75, 1038],
anchor: [20, 21.5]
},
{
id: 'idler1',
texture: 'idlerWheel',
pos: [175, 1038],
anchor: [20, 21.5]
},
{
id: 'idler2',
texture: 'idlerWheel',
pos: [275, 1038],
anchor: [20, 21.5]
},
{
id: 'idler3',
texture: 'idlerWheel',
pos: [375, 1038],
anchor: [20, 21.5]
},
{
id: 'idler4',
texture: 'idlerWheel',
pos: [475, 1038],
anchor: [20, 21.5]
},
{
id: 'idler5',
texture: 'idlerWheel',
pos: [575, 1038],
anchor: [20, 21.5]
},
{
id: 'idler6',
texture: 'idlerWheel',
pos: [675, 1038],
anchor: [20, 21.5]
},
];
});
//# sourceMappingURL=uiConfig.js.map
var Conveyor = (function (_super) {
tslib.__extends(Conveyor, _super);
function Conveyor() {
var _this = _super.call(this) || this;
var sp = new engine.Sprite(getTextureByName('conveyor'));
_this.addChild(sp);
_this.idx0 = _this.createItem(75, 50);
_this.idx1 = _this.createItem(225, 50);
_this.idx2 = _this.createItem(375, 50);
_this.idx3 = _this.createItem(525, 50);
_this.idx4 = _this.createItem(675, 50);
return _this;
}
Conveyor.prototype.createItem = function (x, y) {
var sp = new engine.Sprite();
this.addChild(sp);
sp.x = x - 50;
sp.y = y - 50;
var g = new engine.Graphics;
g.beginFill(0xff0000);
g.drawRect(0, 0, 100, 100);
g.endFill();
sp.addChild(g);
return sp;
};
return Conveyor;
}(engine.Sprite));
//# sourceMappingURL=Conveyor.js.map
var createBg = (function (a) {
if (a === void 0) { a = 1; }
var rect = new engine.Graphics();
rect.beginFill(0);
rect.drawRect(0, 0, 750, 1624);
rect.endFill();
rect.alpha = a;
return rect;
});
//# sourceMappingURL=createBg.js.map
var createImg = (function (texture) {
return new engine.Sprite(getTextureByName(texture));
});
//# sourceMappingURL=createImg.js.map
var CountDownGroup = (function (_super) {
tslib.__extends(CountDownGroup, _super);
function CountDownGroup() {
var _this = _super.call(this) || this;
_this.addChild(createBg(.6));
_this.num1 = createImg('num1');
_this.num2 = createImg('num2');
_this.num3 = createImg('num3');
_this.go = createImg('go');
_this.go.anchorX = 240;
_this.go.anchorY = 171.5;
_this.num1.anchorX = 125.5;
_this.num1.anchorY = 189;
_this.num2.anchorX = 149.5;
_this.num2.anchorY = 191.5;
_this.num3.anchorX = 148.5;
_this.num3.anchorY = 191.5;
_this.go.x = 750 / 2 - 240;
_this.go.y = 525 - 171.5;
_this.num1.x = 750 / 2 - 125.5;
_this.num1.y = 529 - 189;
_this.num2.x = 750 / 2 - 149.5;
_this.num2.y = 526 - 191.5;
_this.num3.x = 750 / 2 - 148.5;
_this.num3.y = 525 - 191.5;
_this.addChild(_this.num1);
_this.addChild(_this.num2);
_this.addChild(_this.num3);
_this.addChild(_this.go);
_this.reset();
return _this;
}
CountDownGroup.prototype.reset = function () {
this.visible = false;
this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0;
this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3;
this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3;
};
CountDownGroup.prototype.startCountDown = function () {
return tslib.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib.__generator(this, function (_a) {
return [2, new Promise(function (r) {
_this.visible = true;
_this.num3.alpha = 1;
var n3 = engine.Tween.get(_this.num3);
n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
_this.num2.alpha = 1;
var n2 = engine.Tween.get(_this.num2);
n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
_this.num1.alpha = 1;
var n1 = engine.Tween.get(_this.num1);
n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
_this.go.alpha = 1;
var go = engine.Tween.get(_this.go);
go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(function () {
_this.visible = false;
r();
});
});
});
});
})];
});
});
};
return CountDownGroup;
}(engine.Sprite));
//# sourceMappingURL=CountDownGroup.js.map
var getGuideInfo = (function () {
if (!window.localStorage) {
return 0;
}
return localStorage.getItem('recyclingGuide');
});
var setGuide = function () {
if (window.localStorage)
localStorage.setItem('recyclingGuide', '1');
};
//# sourceMappingURL=getGuideInfo.js.map
var GuideView = (function (_super) {
tslib.__extends(GuideView, _super);
function GuideView() {
var _this = _super.call(this) || this;
_this.initUI();
_this.visible = false;
return _this;
}
GuideView.prototype.initUI = function () {
this.addChild(createBg(.6));
this.guideBg = createImg('guideBg');
this.addChild(this.guideBg);
this.guideEle = createImg('guideEle');
this.addChild(this.guideEle);
this.guideBg.x = 393;
this.guideBg.y = 552;
this.guideEle.x = 361;
this.guideEle.y = 877;
this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;
var svga = createSvga("guideTips");
this.svga = svga;
this.addChild(svga);
svga.gotoAndStop(1);
svga.mouseEnabled = svga.mouseChildren = false;
};
GuideView.prototype.checkHit = function (x, y, w, h) {
var rect = new engine.Rectangle(393, 552, 281, 320);
if (x > rect.x && y > rect.y && (x + w) < (rect.x + rect.width) && (y + h) < (rect.y + rect.height)) {
return true;
}
return false;
};
GuideView.prototype.startGuide = function () {
return tslib.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib.__generator(this, function (_a) {
return [2, new Promise(function (r) {
_this.visible = true;
_this.svga.gotoAndStop(1);
_this.svga.play(false, true);
_this.guideEle.scaleX = 1;
_this.guideEle.scaleY = 1;
var offset = [0, 0];
var guideOver = function () {
_this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);
engine.Tween.get(_this.guideEle).to({ scaleX: 0, scaleY: 0 }, 300).call(function () {
_this.visible = false;
r();
});
};
var onUp = function (e) {
_this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);
if (_this.checkHit(_this.guideEle.x, _this.guideEle.y, _this.guideEle.width, _this.guideEle.height)) {
guideOver();
}
else {
_this.svga.visible = true;
_this.guideEle.x = 361;
_this.guideEle.y = 877;
}
};
var onMove = function (e) {
_this.guideEle.x = e.stageX - offset[0];
_this.guideEle.y = e.stageY - offset[1];
};
var ondown = function (e) {
offset = [e.localX, e.localY];
_this.svga.visible = false;
_this.stage.once(engine.MouseEvent.MOUSE_UP, onUp, _this);
_this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, _this);
};
_this.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);
})];
});
});
};
return GuideView;
}(engine.Sprite));
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this._timeCounter = 0;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
GameView.prototype.configUI = function () {
var uiMap = {};
this.uiMap = uiMap;
var config = uiConfig();
for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {
var item = config_1[_i];
var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;
var sp = new engine.Sprite(getTextureByName(texture));
this.addChild(sp);
uiMap[id] = sp;
if (anchor) {
sp.anchorX = anchor[0];
sp.anchorY = anchor[1];
}
if (pos) {
sp.x = pos[0];
sp.y = pos[1];
if (anchor) {
sp.x = pos[0] - sp.anchorX;
sp.y = pos[1] - sp.anchorY;
}
}
}
this.configConveyors();
this.createRects();
this.countdown = new CountDownGroup();
this.addChild(this.countdown);
this.guide = new GuideView();
this.addChild(this.guide);
};
GameView.prototype.createRects = function () {
this.wetWaste = this.createRect(74, 552, 301, 293, 0xffffff);
this.harmfulWaste = this.createRect(75, 247, 300, 293, 0xff0000);
this.dryWaste = this.createRect(389, 249, 286, 291, 0x000000);
this.recoverableWaste = this.createRect(389, 551, 287, 292, 0x0000ff);
};
GameView.prototype.createRect = function (x, y, w, h, c) {
var rect = new engine.Rectangle(x, y, w, h);
var sp = new engine.Sprite();
this.addChild(sp);
sp.x = x;
sp.y = y;
var g = new engine.Graphics;
g.alpha = 0.0;
g.beginFill(c);
g.drawRect(0, 0, w, h);
g.endFill();
sp.addChild(g);
return rect;
};
GameView.prototype.configConveyors = function () {
var conveyor1 = new Conveyor();
conveyor1.x = 0;
conveyor1.y = 904.21;
var conveyor2 = new Conveyor();
this.addChild(conveyor1);
this.addChild(conveyor2);
conveyor2.x = 764;
conveyor2.y = 904.21;
};
GameView.prototype.playAni = function () {
var _this = this;
var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];
idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });
idlerWheels.forEach(function (i) {
engine.Tween.get(i, { loop: true }).to({ rotation: 360 }, 3000);
});
};
GameView.prototype.stopAni = function () {
};
GameView.prototype.start = function () {
return tslib.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!!getGuideInfo()) return [3, 2];
return [4, this.guide.startGuide()];
case 1:
_a.sent();
setGuide();
_a.label = 2;
case 2: return [4, this.countdown.startCountDown()];
case 3:
_a.sent();
this.playAni();
console.log('on start');
engine.globalEvent.dispatchEvent('recycling-time-update', {
second: this.getSecond(),
});
this._timer = setInterval(function () {
_this.onTimer();
}, 1000);
return [2];
}
});
});
};
GameView.prototype.getSecond = function () { return 0; };
GameView.prototype.onTimer = function () {
engine.globalEvent.dispatchEvent('recycling-time-update', {
second: this.getSecond(),
});
if (this.getSecond() == 0) {
this.stop();
engine.globalEvent.dispatchEvent('recycling-game-fail', {
reason: 1
});
}
};
GameView.prototype.stop = function () {
};
GameView.prototype.setup = function () {
console.log('onSteup', props);
this.configUI();
};
GameView.prototype.onDown = function (e) {
};
GameView.prototype.stageOnUp = function (e) {
};
GameView.prototype.onSuccess = function () {
};
GameView.prototype.onMove = function (e) {
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
function GameWrapper() {
var _this = _super.call(this) || this;
engine.globalEvent.addEventListener('recycling-start', _this.start, _this);
engine.globalEvent.addEventListener('recycling-stop', _this.stop, _this);
var gameView = _this._gameView = new GameView();
_this.addChild(gameView);
return _this;
}
GameWrapper.prototype.start = function (event) {
injectProps(event.data);
this._gameView.start();
};
GameWrapper.prototype.stop = function (event) {
this._gameView.stop();
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
injectProps(props);
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/recycling/src/game/utils.ts","src/custom/recycling/src/props.ts","src/custom/recycling/src/game/uiConfig.ts","src/custom/recycling/src/game/Conveyor.ts","src/custom/recycling/src/game/views/createBg.ts","src/custom/recycling/src/game/views/createImg.ts","src/custom/recycling/src/game/views/CountDownGroup.ts","src/custom/recycling/src/game/utils/getGuideInfo.ts","src/custom/recycling/src/game/views/guideView.ts","src/custom/recycling/src/game/GameView.ts","src/custom/recycling/src/game/GameWrapper.ts","src/custom/recycling/src/index.ts"],"sourcesContent":["/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport function getTexture(uuid) {\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\n}\n\nexport function getTextureByName(name) {\n\treturn getTexture(engine.getAssetByName(name).uuid);\n}\n\nexport function playSound(name) {\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\n}\nexport function createSvga(name, anchorName?) {\n\tlet inst = new svga.Svga();\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\treturn inst;\n}\n\nexport function getIndexFromRC(row,col,maxCol){\n\tlet index;\n\tindex = row * maxCol + col ;\n\treturn index\n}\n\n\n\n\nexport function getRandomArray(array){\n\tarray.sort(function() {\n\t\treturn .5 - Math.random();\n\t});\n}","/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport let props: any = {};\n\nexport function prepareProps() {\n\tlet metaProps = getProps();\n\n\tengine.injectProp(props, metaProps);\n}\n\nexport function injectProps(p) {\n\tengine.injectProp(props, p);\n}\n","export default () => {\n return [\n {\n id: 'playBg',\n texture: 'playBg'\n },\n {\n id: 'idler0',\n texture: 'idlerWheel',\n pos: [75, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler1',\n texture: 'idlerWheel',\n pos: [175, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler2',\n texture: 'idlerWheel',\n pos: [275, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler3',\n texture: 'idlerWheel',\n pos: [375, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler4',\n texture: 'idlerWheel',\n pos: [475, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler5',\n texture: 'idlerWheel',\n pos: [575, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler6',\n texture: 'idlerWheel',\n pos: [675, 1038],\n anchor: [20, 21.5]\n },\n ]\n}","import { getTextureByName } from \"./utils\";\n\nexport default class Conveyor extends engine.Sprite {\n\n idx0: engine.Sprite;\n idx1: engine.Sprite;\n idx2: engine.Sprite;\n idx3: engine.Sprite;\n idx4: engine.Sprite;\n constructor() {\n super();\n const sp = new engine.Sprite(getTextureByName('conveyor'));\n this.addChild(sp);\n\n this.idx0 = this.createItem(75,50);\n this.idx1 = this.createItem(225,50);\n this.idx2 = this.createItem(375,50);\n this.idx3 = this.createItem(525,50);\n this.idx4 = this.createItem(675,50);\n }\n\n createItem(x,y) {\n const sp = new engine.Sprite();\n this.addChild(sp);\n sp.x = x - 50;\n sp.y = y- 50;\n\n const g = new engine.Graphics;\n g.beginFill(0xff0000);\n g.drawRect(0,0,100,100);\n g.endFill();\n sp.addChild(g);\n\n return sp\n }\n}","export default (a=1)=>{\n const rect = new engine.Graphics();\n rect.beginFill(0)\n rect.drawRect(0,0,750,1624)\n rect.endFill();\n rect.alpha=a\n return rect\n}","import { getTextureByName } from \"../utils\";\n\nexport default (texture)=>{\n return new engine.Sprite(getTextureByName(texture));\n}","import createBg from \"./createBg\";\nimport createImg from \"./createImg\";\n\nexport default class CountDownGroup extends engine.Sprite {\n num1: engine.Sprite;\n num2: engine.Sprite;\n num3: engine.Sprite;\n go: engine.Sprite;\n constructor() {\n super();\n\n this.addChild(createBg(.6))\n\n this.num1 = createImg('num1')\n this.num2 = createImg('num2')\n this.num3 = createImg('num3')\n this.go = createImg('go')\n this.go.anchorX = 240\n this.go.anchorY = 171.5\n this.num1.anchorX = 125.5\n this.num1.anchorY = 189\n this.num2.anchorX = 149.5\n this.num2.anchorY = 191.5\n this.num3.anchorX = 148.5\n this.num3.anchorY = 191.5\n this.go.x = 750 / 2 - 240\n this.go.y = 525 - 171.5\n this.num1.x = 750 / 2 - 125.5\n this.num1.y = 529 - 189\n this.num2.x = 750 / 2 - 149.5\n this.num2.y = 526 - 191.5\n this.num3.x = 750 / 2 - 148.5\n this.num3.y = 525 - 191.5\n this.addChild(this.num1)\n this.addChild(this.num2)\n this.addChild(this.num3)\n this.addChild(this.go)\n\n this.reset();\n }\n\n private reset() {\n this.visible = false;\n this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0;\n this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3;\n this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3;\n }\n\n async startCountDown() {\n return new Promise((r) => {\n\n this.visible = true;\n\n this.num3.alpha = 1;\n let n3 = engine.Tween.get(this.num3);\n\n // if (GameConst.isPlayMusic) {\n\n // playSound(\"numCountDown\");\n // }\n\n n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {\n this.num2.alpha = 1;\n let n2 = engine.Tween.get(this.num2);\n // if (GameConst.isPlayMusic) {\n\n // playSound(\"numCountDown\");\n // }\n n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {\n this.num1.alpha = 1;\n let n1 = engine.Tween.get(this.num1);\n // if (GameConst.isPlayMusic) {\n\n // playSound(\"numCountDown\");\n // }\n n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {\n this.go.alpha = 1;\n let go = engine.Tween.get(this.go);\n // if (GameConst.isPlayMusic) {\n // window[\"playMusic\"](\"go\");\n // }\n go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(() => {\n this.visible = false;\n r()\n })\n })\n })\n })\n\n\n })\n\n }\n}","export default () => {\n //0 未引导\n if (!window.localStorage) {\n return 0\n }\n\n return localStorage.getItem('recyclingGuide')\n}\n\nexport const setGuide = () => {\n if (window.localStorage)\n localStorage.setItem('recyclingGuide', '1')\n}","import createBg from \"./createBg\";\nimport createImg from \"./createImg\";\nimport { createSvga } from \"../utils\";\n\nexport default class GuideView extends engine.Sprite {\n guideBg: engine.Sprite;\n guideEle: engine.Sprite;\n svga: svga.Svga;\n\n constructor() {\n super();\n this.initUI();\n this.visible = false;\n }\n\n initUI() {\n this.addChild(createBg(.6))\n this.guideBg = createImg('guideBg')\n this.addChild(this.guideBg)\n this.guideEle = createImg('guideEle')\n this.addChild(this.guideEle)\n this.guideBg.x = 393;\n this.guideBg.y = 552;\n this.guideEle.x = 361;\n this.guideEle.y = 877;\n this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;\n\n let svga = createSvga(\"guideTips\");\n this.svga = svga\n this.addChild(svga);\n svga.gotoAndStop(1);\n svga.mouseEnabled = svga.mouseChildren = false;\n }\n\n checkHit(x, y, w, h) {\n const rect = new engine.Rectangle(393, 552, 281, 320)\n if (x > rect.x && y > rect.y && (x + w) < (rect.x + rect.width) && (y + h) < (rect.y + rect.height)) {\n return true\n }\n return false;\n }\n\n async startGuide() {\n return new Promise((r) => {\n this.visible = true;\n this.svga.gotoAndStop(1);\n this.svga.play(false, true)\n this.guideEle.scaleX = 1;\n this.guideEle.scaleY = 1;\n\n let offset = [0, 0]\n const guideOver = () => {\n this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, this)\n engine.Tween.get(this.guideEle).to({scaleX:0,scaleY:0},300).call(()=>{\n this.visible = false;\n r();\n });\n }\n\n const onUp = (e: engine.MouseEvent) => {\n this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, this)\n if (this.checkHit(this.guideEle.x, this.guideEle.y, this.guideEle.width, this.guideEle.height)) {\n guideOver();\n } else {\n this.svga.visible = true;\n this.guideEle.x = 361;\n this.guideEle.y = 877;\n }\n }\n\n const onMove = (e: engine.MouseEvent) => {\n this.guideEle.x = e.stageX - offset[0];\n this.guideEle.y = e.stageY - offset[1];\n }\n\n const ondown = (e: engine.MouseEvent) => {\n offset = [e.localX, e.localY]\n this.svga.visible = false;\n this.stage.once(engine.MouseEvent.MOUSE_UP, onUp, this)\n this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, this)\n }\n\n this.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, this)\n\n })\n }\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { getTextureByName } from \"../../../recycling/src/game/utils\";\nimport { props } from \"../props\";\nimport uiConfig from \"./uiConfig\";\nimport Conveyor from \"./Conveyor\";\nimport CountDownGroup from \"./views/CountDownGroup\";\nimport getGuideInfo, { setGuide } from \"./utils/getGuideInfo\";\nimport GuideView from \"./views/guideView\";\n\nexport default class GameView extends engine.Container {\n private _timer;\n private _timeCounter = 0;\n uiMap: any;\n wetWaste: engine.Rectangle;\n harmfulWaste: engine.Rectangle;\n dryWaste: engine.Rectangle;\n recoverableWaste: engine.Rectangle;\n countdown: CountDownGroup;\n guide: GuideView;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n configUI() {\n\n const uiMap: any = {};\n this.uiMap = uiMap;\n const config = uiConfig();\n for (const item of config) {\n const { id, texture, pos, anchor } = item;\n const sp = new engine.Sprite(getTextureByName(texture));\n this.addChild(sp);\n uiMap[id] = sp;\n if (anchor) {\n sp.anchorX = anchor[0];\n sp.anchorY = anchor[1];\n }\n if (pos) {\n sp.x = pos[0];\n sp.y = pos[1];\n if (anchor) {\n sp.x = pos[0] - sp.anchorX;\n sp.y = pos[1] - sp.anchorY;\n }\n }\n }\n\n this.configConveyors();\n\n this.createRects();\n\n this.countdown = new CountDownGroup();\n this.addChild(this.countdown)\n\n this.guide = new GuideView();\n this.addChild(this.guide)\n\n }\n\n private createRects() {\n this.wetWaste = this.createRect(74, 552, 301, 293, 0xffffff);\n this.harmfulWaste = this.createRect(75, 247, 300, 293, 0xff0000);\n this.dryWaste = this.createRect(389, 249, 286, 291, 0x000000);\n this.recoverableWaste = this.createRect(389, 551, 287, 292, 0x0000ff);\n }\n\n createRect(x, y, w, h,c) {\n const rect = new engine.Rectangle(x, y, w, h);\n\n const sp = new engine.Sprite();\n this.addChild(sp);\n sp.x = x;\n sp.y = y;\n\n const g = new engine.Graphics;\n g.alpha=0.0;\n g.beginFill(c);\n g.drawRect(0, 0, w, h);\n g.endFill();\n sp.addChild(g);\n\n return rect;\n }\n\n private configConveyors() {\n const conveyor1 = new Conveyor();\n conveyor1.x = 0;\n conveyor1.y = 904.21;\n const conveyor2 = new Conveyor();\n this.addChild(conveyor1);\n this.addChild(conveyor2);\n conveyor2.x = 764;\n conveyor2.y = 904.21;\n }\n\n playAni() {\n let idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];\n idlerWheels = idlerWheels.map(i => this.uiMap[i]);\n idlerWheels.forEach(i => {\n engine.Tween.get(i, { loop: true }).to({ rotation: 360 }, 3000);\n })\n }\n\n stopAni() {\n\n }\n\n async start() {\n\n if(!getGuideInfo()) {\n await this.guide.startGuide();\n setGuide();\n }\n\n await this.countdown.startCountDown();\n\n this.playAni();\n\n console.log('on start')\n\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n\n this._timer = setInterval(() => {\n this.onTimer();\n }, 1000)\n }\n\n getSecond() { return 0 }\n\n onTimer() {\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n\n if (this.getSecond() == 0) {\n // GAME_TIME = props.GAME_TIME\n this.stop();\n engine.globalEvent.dispatchEvent('recycling-game-fail', {\n reason: 1\n });\n }\n }\n\n stop() {\n\n\n }\n\n setup() {\n console.log('onSteup', props);\n this.configUI();\n }\n\n onDown(e: engine.MouseEvent) {\n\n }\n\n stageOnUp(e) {\n\n\n }\n\n private onSuccess() {\n\n\n }\n\n onMove(e: engine.MouseEvent) {\n\n }\n\n}\n","/**\n * Created by rockyl on 2020-01-09.\n */\n\nimport GameView from \"./GameView\";\nimport { injectProps } from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\t// private _status;\n\tprivate _gameView: GameView;\n\tconstructor() {\n\t\tsuper();\n\n\t\tengine.globalEvent.addEventListener('recycling-start', this.start, this);\n\t\tengine.globalEvent.addEventListener('recycling-stop', this.stop, this);\n\n\t\t//创建实例\n\t\tlet gameView = this._gameView = new GameView();\n\t\tthis.addChild(gameView);\n\n\t}\n\n\tstart(event: engine.Event) {\n\t\tinjectProps(event.data);\n\n\t\tthis._gameView.start();\n\t}\n\tstop(event: engine.Event) {\n\t\t\n\t\tthis._gameView.stop();\n\t}\n}\n","/**\n * Created by rockyl on 2019-11-20.\n */\n\nimport {GameWrapper} from \"./game/GameWrapper\";\nimport {injectProps, prepareProps} from \"./props\";\n\nexport default function (props) {\n\tprepareProps();\n\tinjectProps(props);\n\n\tlet instance = new GameWrapper();\n\t\n\treturn instance;\n}\n"],"names":["__extends"],"mappings":";;;;;;UAIgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;UAEe,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;UAKe,UAAU,CAAC,IAAI,EAAE,UAAW;KAC3C,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;KAC3B,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;KAC5D,OAAO,IAAI,CAAC;CACb,CAAC;;;CCfM,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;;;ACdD,iBAAe;KACX,OAAO;SACH;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,QAAQ;UACpB;SACD;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,YAAY;aACrB,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;aACf,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;UACrB;SACD;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,YAAY;aACrB,GAAG,EAAE,CAAC,G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AED,yBAAM,GAAN,UAAO,CAAoB;MAE1B;KAEH,eAAC;CAAD,CAAC,CAtKqC,MAAM,CAAC,SAAS,GAsKrD;;;CC1KD;KAAiCA,qCAAgB;KAGhD;SAAA,YACC,iBAAO,SASP;SAPA,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;SACzE,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,KAAI,CAAC,IAAI,EAAE,KAAI,CAAC,CAAC;SAGvE,IAAI,QAAQ,GAAG,KAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/C,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;MAExB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAExB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAEvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KACF,kBAAC;CAAD,CAAC,CAxBgC,MAAM,CAAC,SAAS,GAwBhD;;;iBCzBwB,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/recycling/src/game/utils.ts","src/custom/recycling/src/props.ts","src/custom/recycling/src/game/Conveyor.ts","src/custom/recycling/src/game/uiConfig.ts","src/custom/recycling/src/game/utils/getGuideInfo.ts","src/custom/recycling/src/game/views/createBg.ts","src/custom/recycling/src/game/views/createImg.ts","src/custom/recycling/src/game/views/CountDownGroup.ts","src/custom/recycling/src/game/views/guideView.ts","src/custom/recycling/src/game/GameView.ts","src/custom/recycling/src/game/GameWrapper.ts","src/custom/recycling/src/index.ts"],"sourcesContent":["/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport function getTexture(uuid) {\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\n}\n\nexport function getTextureByName(name) {\n\treturn getTexture(engine.getAssetByName(name).uuid);\n}\n\nexport function playSound(name) {\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\n}\nexport function createSvga(name, anchorName?) {\n\tlet inst = new svga.Svga();\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\treturn inst;\n}\n\nexport function getIndexFromRC(row,col,maxCol){\n\tlet index;\n\tindex = row * maxCol + col ;\n\treturn index\n}\n\n\n\n\nexport function getRandomArray(array){\n\tarray.sort(function() {\n\t\treturn .5 - Math.random();\n\t});\n}","/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport let props: any = {};\n\nexport function prepareProps() {\n\tlet metaProps = getProps();\n\n\tengine.injectProp(props, metaProps);\n}\n\nexport function injectProps(p) {\n\tengine.injectProp(props, p);\n}\n","import { getTextureByName } from \"./utils\";\n\nexport default class Conveyor extends engine.Sprite {\n\n idx0: engine.Sprite;\n idx1: engine.Sprite;\n idx2: engine.Sprite;\n idx3: engine.Sprite;\n idx4: engine.Sprite;\n constructor() {\n super();\n const sp = new engine.Sprite(getTextureByName('conveyor'));\n this.addChild(sp);\n\n this.idx0 = this.createItem(75,50);\n this.idx1 = this.createItem(225,50);\n this.idx2 = this.createItem(375,50);\n this.idx3 = this.createItem(525,50);\n this.idx4 = this.createItem(675,50);\n }\n\n createItem(x,y) {\n const sp = new engine.Sprite();\n this.addChild(sp);\n sp.x = x - 50;\n sp.y = y- 50;\n\n const g = new engine.Graphics;\n g.beginFill(0xff0000);\n g.drawRect(0,0,100,100);\n g.endFill();\n sp.addChild(g);\n\n return sp\n }\n}","export default () => {\n return [\n {\n id: 'playBg',\n texture: 'playBg'\n },\n {\n id: 'idler0',\n texture: 'idlerWheel',\n pos: [75, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler1',\n texture: 'idlerWheel',\n pos: [175, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler2',\n texture: 'idlerWheel',\n pos: [275, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler3',\n texture: 'idlerWheel',\n pos: [375, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler4',\n texture: 'idlerWheel',\n pos: [475, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler5',\n texture: 'idlerWheel',\n pos: [575, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler6',\n texture: 'idlerWheel',\n pos: [675, 1038],\n anchor: [20, 21.5]\n },\n ]\n}","export default () => {\n //0 未引导\n if (!window.localStorage) {\n return 0\n }\n\n return localStorage.getItem('recyclingGuide')\n}\n\nexport const setGuide = () => {\n if (window.localStorage)\n localStorage.setItem('recyclingGuide', '1')\n}","export default (a=1)=>{\n const rect = new engine.Graphics();\n rect.beginFill(0)\n rect.drawRect(0,0,750,1624)\n rect.endFill();\n rect.alpha=a\n return rect\n}","import { getTextureByName } from \"../utils\";\n\nexport default (texture)=>{\n return new engine.Sprite(getTextureByName(texture));\n}","import createBg from \"./createBg\";\nimport createImg from \"./createImg\";\n\nexport default class CountDownGroup extends engine.Sprite {\n num1: engine.Sprite;\n num2: engine.Sprite;\n num3: engine.Sprite;\n go: engine.Sprite;\n constructor() {\n super();\n\n this.addChild(createBg(.6))\n\n this.num1 = createImg('num1')\n this.num2 = createImg('num2')\n this.num3 = createImg('num3')\n this.go = createImg('go')\n this.go.anchorX = 240\n this.go.anchorY = 171.5\n this.num1.anchorX = 125.5\n this.num1.anchorY = 189\n this.num2.anchorX = 149.5\n this.num2.anchorY = 191.5\n this.num3.anchorX = 148.5\n this.num3.anchorY = 191.5\n this.go.x = 750 / 2 - 240\n this.go.y = 525 - 171.5\n this.num1.x = 750 / 2 - 125.5\n this.num1.y = 529 - 189\n this.num2.x = 750 / 2 - 149.5\n this.num2.y = 526 - 191.5\n this.num3.x = 750 / 2 - 148.5\n this.num3.y = 525 - 191.5\n this.addChild(this.num1)\n this.addChild(this.num2)\n this.addChild(this.num3)\n this.addChild(this.go)\n\n this.visible = false;\n this.reset();\n }\n\n private reset() {\n this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0;\n this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3;\n this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3;\n }\n\n async startCountDown() {\n return new Promise((r) => {\n this.reset();\n this.visible = true;\n\n this.num3.alpha = 1;\n let n3 = engine.Tween.get(this.num3);\n\n // if (GameConst.isPlayMusic) {\n\n // playSound(\"numCountDown\");\n // }\n\n n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {\n this.num2.alpha = 1;\n let n2 = engine.Tween.get(this.num2);\n // if (GameConst.isPlayMusic) {\n\n // playSound(\"numCountDown\");\n // }\n n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {\n this.num1.alpha = 1;\n let n1 = engine.Tween.get(this.num1);\n // if (GameConst.isPlayMusic) {\n\n // playSound(\"numCountDown\");\n // }\n n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {\n this.go.alpha = 1;\n let go = engine.Tween.get(this.go);\n // if (GameConst.isPlayMusic) {\n // window[\"playMusic\"](\"go\");\n // }\n go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(() => {\n this.visible = false;\n r()\n })\n })\n })\n })\n\n\n })\n\n }\n}","import createBg from \"./createBg\";\nimport createImg from \"./createImg\";\nimport { createSvga } from \"../utils\";\n\nexport default class GuideView extends engine.Sprite {\n guideBg: engine.Sprite;\n guideEle: engine.Sprite;\n svga: svga.Svga;\n\n constructor() {\n super();\n this.initUI();\n this.visible = false;\n }\n\n initUI() {\n this.addChild(createBg(.6))\n this.guideBg = createImg('guideBg')\n this.addChild(this.guideBg)\n this.guideEle = createImg('guideEle')\n this.addChild(this.guideEle)\n this.guideBg.x = 393;\n this.guideBg.y = 552;\n this.guideEle.x = 361;\n this.guideEle.y = 877;\n this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;\n\n let svga = createSvga(\"guideTips\");\n this.svga = svga\n this.addChild(svga);\n svga.gotoAndStop(1);\n svga.mouseEnabled = svga.mouseChildren = false;\n }\n\n checkHit(x, y, w, h) {\n const rect = new engine.Rectangle(393, 552, 281, 320)\n if (x > rect.x && y > rect.y && (x + w) < (rect.x + rect.width) && (y + h) < (rect.y + rect.height)) {\n return true\n }\n return false;\n }\n\n async startGuide() {\n return new Promise((r) => {\n this.visible = true;\n this.svga.gotoAndStop(1);\n this.svga.play(false, true)\n this.guideEle.scaleX = 1;\n this.guideEle.scaleY = 1;\n\n let offset = [0, 0]\n const guideOver = () => {\n this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, this)\n engine.Tween.get(this.guideEle).to({scaleX:0,scaleY:0},300).call(()=>{\n this.visible = false;\n r();\n });\n }\n\n const onUp = (e: engine.MouseEvent) => {\n this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, this)\n if (this.checkHit(this.guideEle.x, this.guideEle.y, this.guideEle.width, this.guideEle.height)) {\n guideOver();\n } else {\n this.svga.visible = true;\n this.guideEle.x = 361;\n this.guideEle.y = 877;\n }\n }\n\n const onMove = (e: engine.MouseEvent) => {\n this.guideEle.x = e.stageX - offset[0];\n this.guideEle.y = e.stageY - offset[1];\n }\n\n const ondown = (e: engine.MouseEvent) => {\n offset = [e.localX, e.localY]\n this.svga.visible = false;\n this.stage.once(engine.MouseEvent.MOUSE_UP, onUp, this)\n this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, onMove, this)\n }\n\n this.guideEle.addEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, this)\n\n })\n }\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { getTextureByName } from \"../../../recycling/src/game/utils\";\nimport { props } from \"../props\";\nimport Conveyor from \"./Conveyor\";\nimport uiConfig from \"./uiConfig\";\nimport getGuideInfo, { setGuide } from \"./utils/getGuideInfo\";\nimport CountDownGroup from \"./views/CountDownGroup\";\nimport GuideView from \"./views/guideView\";\n\nexport default class GameView extends engine.Container {\n private _timer;\n private _timeCounter = 0;\n score = 0;\n uiMap: any;\n wetWaste: engine.Rectangle;\n harmfulWaste: engine.Rectangle;\n dryWaste: engine.Rectangle;\n recoverableWaste: engine.Rectangle;\n countdown: CountDownGroup;\n guide: GuideView;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n configUI() {\n\n const uiMap: any = {};\n this.uiMap = uiMap;\n const config = uiConfig();\n for (const item of config) {\n const { id, texture, pos, anchor } = item;\n const sp = new engine.Sprite(getTextureByName(texture));\n this.addChild(sp);\n uiMap[id] = sp;\n if (anchor) {\n sp.anchorX = anchor[0];\n sp.anchorY = anchor[1];\n }\n if (pos) {\n sp.x = pos[0];\n sp.y = pos[1];\n if (anchor) {\n sp.x = pos[0] - sp.anchorX;\n sp.y = pos[1] - sp.anchorY;\n }\n }\n }\n\n this.configConveyors();\n\n this.createRects();\n\n this.countdown = new CountDownGroup();\n this.addChild(this.countdown)\n\n this.guide = new GuideView();\n this.addChild(this.guide)\n\n }\n\n private createRects() {\n this.wetWaste = this.createRect(74, 552, 301, 293, 0xffffff);\n this.harmfulWaste = this.createRect(75, 247, 300, 293, 0xff0000);\n this.dryWaste = this.createRect(389, 249, 286, 291, 0x000000);\n this.recoverableWaste = this.createRect(389, 551, 287, 292, 0x0000ff);\n }\n\n createRect(x, y, w, h, c) {\n const rect = new engine.Rectangle(x, y, w, h);\n\n const sp = new engine.Sprite();\n this.addChild(sp);\n sp.x = x;\n sp.y = y;\n\n const g = new engine.Graphics;\n g.alpha = 0.0;\n g.beginFill(c);\n g.drawRect(0, 0, w, h);\n g.endFill();\n sp.addChild(g);\n\n return rect;\n }\n\n private configConveyors() {\n const conveyor1 = new Conveyor();\n conveyor1.x = 0;\n conveyor1.y = 904.21;\n const conveyor2 = new Conveyor();\n this.addChild(conveyor1);\n this.addChild(conveyor2);\n conveyor2.x = 764;\n conveyor2.y = 904.21;\n }\n\n playAni() {\n let idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];\n idlerWheels = idlerWheels.map(i => this.uiMap[i]);\n idlerWheels.forEach(i => {\n engine.Tween.get(i, { loop: true }).to({ rotation: 360 }, 3000);\n })\n }\n\n stopAni() {\n\n }\n\n async start() {\n console.log('on start')\n this._timeCounter = 0;\n\n if (!getGuideInfo()) {\n await this.guide.startGuide();\n setGuide();\n }\n\n await this.countdown.startCountDown();\n\n this.playAni();\n\n\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n\n this._timer = setInterval(() => {\n this.onTimer();\n }, 1000)\n }\n\n getSecond() { \n \n return props.time - this._timeCounter\n }\n\n onTimer() {\n this._timeCounter++;\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n \n if (this.getSecond() == 0) {\n this.stop();\n engine.globalEvent.dispatchEvent('recycling-game-end', { score: this.score });\n }\n }\n\n stop() {\n clearInterval(this._timer);\n }\n\n setup() {\n console.log('onSteup', props);\n this.configUI();\n }\n\n onDown(e: engine.MouseEvent) {\n\n }\n\n stageOnUp(e) {\n\n\n }\n\n private onSuccess() {\n\n\n }\n\n onMove(e: engine.MouseEvent) {\n\n }\n\n}\n","/**\n * Created by rockyl on 2020-01-09.\n */\n\nimport GameView from \"./GameView\";\nimport { injectProps } from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\t// private _status;\n\tprivate _gameView: GameView;\n\tconstructor() {\n\t\tsuper();\n\n\t\tengine.globalEvent.addEventListener('recycling-start', this.start, this);\n\t\tengine.globalEvent.addEventListener('recycling-stop', this.stop, this);\n\n\t\t//创建实例\n\t\tlet gameView = this._gameView = new GameView();\n\t\tthis.addChild(gameView);\n\n\t}\n\n\tstart(event: engine.Event) {\n\t\tinjectProps(event.data);\n\n\t\tthis._gameView.start();\n\t}\n\tstop(event: engine.Event) {\n\t\t\n\t\tthis._gameView.stop();\n\t}\n}\n","/**\n * Created by rockyl on 2019-11-20.\n */\n\nimport {GameWrapper} from \"./game/GameWrapper\";\nimport {injectProps, prepareProps} from \"./props\";\n\nexport default function (props) {\n\tprepareProps();\n\tinjectProps(props);\n\n\tlet instance = new GameWrapper();\n\t\n\treturn instance;\n}\n"],"names":["__extends"],"mappings":";;;;;;UAIgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;UAEe,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;UAKe,UAAU,CAAC,IAAI,EAAE,UAAW;KAC3C,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;KAC3B,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;KAC5D,OAAO,IAAI,CAAC;CACb,CAAC;;;CCfM,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,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AI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAEvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KACF,kBAAC;CAAD,CAAC,CAxBgC,MAAM,CAAC,SAAS,GAwBhD;;;iBCzBwB,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
...@@ -74,10 +74,13 @@ ...@@ -74,10 +74,13 @@
"recycling-start": { "recycling-start": {
"alias": "开始", "alias": "开始",
"data": { "data": {
"picUrl": "图片路径", "time": "游戏时间"
"blockUrl": "blockUrl"
} }
}, },
"recycling-end": {
"alias": "游戏结束",
"data": {}
},
"recycling-stop": { "recycling-stop": {
"alias": "停止" "alias": "停止"
} }
...@@ -89,12 +92,16 @@ ...@@ -89,12 +92,16 @@
"time": "剩余时间" "time": "剩余时间"
} }
}, },
"recycling-game-fail": { "recycling-score-update": {
"alias": "游戏结束", "alias": "分数更新",
"data": { "data": {
"reason": "结束原因(1:时间到了)" "score": "分数"
} }
}, },
"recycling-game-end": {
"alias": "游戏结束",
"data": {}
},
"recycling-game-success": { "recycling-game-success": {
"alias": "游戏成功", "alias": "游戏成功",
"data": { "data": {
......
...@@ -4,15 +4,16 @@ ...@@ -4,15 +4,16 @@
import { getTextureByName } from "../../../recycling/src/game/utils"; import { getTextureByName } from "../../../recycling/src/game/utils";
import { props } from "../props"; import { props } from "../props";
import uiConfig from "./uiConfig";
import Conveyor from "./Conveyor"; import Conveyor from "./Conveyor";
import CountDownGroup from "./views/CountDownGroup"; import uiConfig from "./uiConfig";
import getGuideInfo, { setGuide } from "./utils/getGuideInfo"; import getGuideInfo, { setGuide } from "./utils/getGuideInfo";
import CountDownGroup from "./views/CountDownGroup";
import GuideView from "./views/guideView"; import GuideView from "./views/guideView";
export default class GameView extends engine.Container { export default class GameView extends engine.Container {
private _timer; private _timer;
private _timeCounter = 0; private _timeCounter = 0;
score = 0;
uiMap: any; uiMap: any;
wetWaste: engine.Rectangle; wetWaste: engine.Rectangle;
harmfulWaste: engine.Rectangle; harmfulWaste: engine.Rectangle;
...@@ -69,7 +70,7 @@ export default class GameView extends engine.Container { ...@@ -69,7 +70,7 @@ export default class GameView extends engine.Container {
this.recoverableWaste = this.createRect(389, 551, 287, 292, 0x0000ff); this.recoverableWaste = this.createRect(389, 551, 287, 292, 0x0000ff);
} }
createRect(x, y, w, h,c) { createRect(x, y, w, h, c) {
const rect = new engine.Rectangle(x, y, w, h); const rect = new engine.Rectangle(x, y, w, h);
const sp = new engine.Sprite(); const sp = new engine.Sprite();
...@@ -78,7 +79,7 @@ export default class GameView extends engine.Container { ...@@ -78,7 +79,7 @@ export default class GameView extends engine.Container {
sp.y = y; sp.y = y;
const g = new engine.Graphics; const g = new engine.Graphics;
g.alpha=0.0; g.alpha = 0.0;
g.beginFill(c); g.beginFill(c);
g.drawRect(0, 0, w, h); g.drawRect(0, 0, w, h);
g.endFill(); g.endFill();
...@@ -111,8 +112,10 @@ export default class GameView extends engine.Container { ...@@ -111,8 +112,10 @@ export default class GameView extends engine.Container {
} }
async start() { async start() {
console.log('on start')
this._timeCounter = 0;
if(!getGuideInfo()) { if (!getGuideInfo()) {
await this.guide.startGuide(); await this.guide.startGuide();
setGuide(); setGuide();
} }
...@@ -121,7 +124,6 @@ export default class GameView extends engine.Container { ...@@ -121,7 +124,6 @@ export default class GameView extends engine.Container {
this.playAni(); this.playAni();
console.log('on start')
engine.globalEvent.dispatchEvent('recycling-time-update', { engine.globalEvent.dispatchEvent('recycling-time-update', {
second: this.getSecond(), second: this.getSecond(),
...@@ -132,25 +134,25 @@ export default class GameView extends engine.Container { ...@@ -132,25 +134,25 @@ export default class GameView extends engine.Container {
}, 1000) }, 1000)
} }
getSecond() { return 0 } getSecond() {
return props.time - this._timeCounter
}
onTimer() { onTimer() {
this._timeCounter++;
engine.globalEvent.dispatchEvent('recycling-time-update', { engine.globalEvent.dispatchEvent('recycling-time-update', {
second: this.getSecond(), second: this.getSecond(),
}); });
if (this.getSecond() == 0) { if (this.getSecond() == 0) {
// GAME_TIME = props.GAME_TIME
this.stop(); this.stop();
engine.globalEvent.dispatchEvent('recycling-game-fail', { engine.globalEvent.dispatchEvent('recycling-game-end', { });
reason: 1
});
} }
} }
stop() { stop() {
clearInterval(this._timer);
} }
setup() { setup() {
......
...@@ -36,11 +36,11 @@ export default class CountDownGroup extends engine.Sprite { ...@@ -36,11 +36,11 @@ export default class CountDownGroup extends engine.Sprite {
this.addChild(this.num3) this.addChild(this.num3)
this.addChild(this.go) this.addChild(this.go)
this.visible = false;
this.reset(); this.reset();
} }
private reset() { private reset() {
this.visible = false;
this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0; this.go.alpha = this.num1.alpha = this.num2.alpha = this.num3.alpha = 0;
this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3; this.go.scaleX = this.num1.scaleX = this.num2.scaleX = this.num3.scaleX = 3;
this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3; this.go.scaleY = this.num1.scaleY = this.num2.scaleY = this.num3.scaleY = 3;
...@@ -48,7 +48,7 @@ export default class CountDownGroup extends engine.Sprite { ...@@ -48,7 +48,7 @@ export default class CountDownGroup extends engine.Sprite {
async startCountDown() { async startCountDown() {
return new Promise((r) => { return new Promise((r) => {
this.reset();
this.visible = true; this.visible = true;
this.num3.alpha = 1; this.num3.alpha = 1;
......
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