Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-libs
Commits
87951f14
Commit
87951f14
authored
Jun 12, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
716c4811
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
19 deletions
+48
-19
recycling.json
dist/customs/recycling.json
+8
-4
app.js
src/custom/recycling/debug/app.js
+7
-4
main.js
src/custom/recycling/debug/main.js
+1
-1
main.js.map
src/custom/recycling/debug/main.js.map
+1
-1
GameView.ts
src/custom/recycling/src/game/GameView.ts
+31
-9
No files found.
dist/customs/recycling.json
View file @
87951f14
...
...
@@ -93,12 +93,16 @@
"time"
:
"剩余时间"
}
},
"recycling-
game-fail
"
:
{
"alias"
:
"
游戏结束
"
,
"recycling-
score-update
"
:
{
"alias"
:
"
分数更新
"
,
"data"
:
{
"
reason"
:
"结束原因(1:时间到了)
"
"
score"
:
"分数
"
}
},
"recycling-game-end"
:
{
"alias"
:
"游戏结束"
,
"data"
:
{}
},
"recycling-game-success"
:
{
"alias"
:
"游戏成功"
,
"data"
:
{
...
...
@@ -108,5 +112,5 @@
}
},
"id"
:
"recycling"
,
"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
"
"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},1e3)})},e.prototype.stopAni=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.removeTweens(e)})},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,this.score=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.startGame(),engine.globalEvent.dispatchEvent(
\"
recycling-time-update
\"
,{second:this.getSecond()}),this._timer=setInterval(function(){t.onTimer()},1e3),[2]}})})},e.prototype.startGame=function(){this.playAni(),this.stage.addEventListener(engine.MouseEvent.CLICK,this.xxx,this)},e.prototype.xxx=function(){this.score++,engine.globalEvent.dispatchEvent(
\"
recycling-score-update
\"
,{score:this.score})},e.prototype.stopGame=function(){this.stage.removeEventListener(engine.MouseEvent.CLICK,this.xxx,this),this.stopAni()},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
\"
,{}))},e.prototype.stop=function(){clearInterval(this._timer),this.stopGame(
)},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
"
}
src/custom/recycling/debug/app.js
View file @
87951f14
...
...
@@ -51,15 +51,18 @@ function launchWithCustomModule(customModule) {
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
200
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
});
//
setTimeout(() => {
//
engine.globalEvent.dispatchEvent('recycling-start', { time: 2 });
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
1000
*
10
);
//
const d = engine.gameStage.sceneContainer.getChildAt(0);
//
}, 1000 * 10);
});
engine
.
globalEvent
.
addEventListener
(
'recycling-time-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'recycling-score-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'recycling-game-end'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
...
...
src/custom/recycling/debug/main.js
View file @
87951f14
"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
},
3
e3
)})},
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
()},
1
e3
),[
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
;
"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
},
1
e3
)})},
e
.
prototype
.
stopAni
=
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
.
removeTweens
(
e
)})},
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
,
this
.
score
=
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
.
startGame
(),
engine
.
globalEvent
.
dispatchEvent
(
"recycling-time-update"
,{
second
:
this
.
getSecond
()}),
this
.
_timer
=
setInterval
(
function
(){
t
.
onTimer
()},
1
e3
),[
2
]}})})},
e
.
prototype
.
startGame
=
function
(){
this
.
playAni
(),
this
.
stage
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
xxx
,
this
)},
e
.
prototype
.
xxx
=
function
(){
this
.
score
++
,
engine
.
globalEvent
.
dispatchEvent
(
"recycling-score-update"
,{
score
:
this
.
score
})},
e
.
prototype
.
stopGame
=
function
(){
this
.
stage
.
removeEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
xxx
,
this
),
this
.
stopAni
()},
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"
,{}))},
e
.
prototype
.
stop
=
function
(){
clearInterval
(
this
.
_timer
),
this
.
stopGame
(
)},
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
;
src/custom/recycling/debug/main.js.map
View file @
87951f14
{"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\t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AS,EAAE,KAAK,CAAC,CAAC;SAC9B,IAAI,CAAC,QAAQ,EAAE,CAAC;MACjB;KAED,yBAAM,GAAN,UAAO,CAAoB;MAE1B;KAED,4BAAS,GAAT,UAAU,CAAC;MAGV;KAEO,4BAAS,GAAjB;MAGC;KAED,yBAAM,GAAN,UAAO,CAAoB;MAE1B;KAEH,eAAC;CAAD,CAAC,CAxKqC,MAAM,CAAC,SAAS,GAwKrD;;;CC5KD;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;;;;;;;;;"}
\ 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/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 }, 1000);\n })\n }\n\n stopAni() {\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.removeTweens(i);\n })\n }\n\n async start() {\n console.log('on start')\n this._timeCounter = 0;\n this.score = 0;\n\n if (!getGuideInfo()) {\n await this.guide.startGuide();\n setGuide();\n }\n\n await this.countdown.startCountDown();\n\n this.startGame();\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 private startGame() {\n this.playAni();\n this.stage.addEventListener(engine.MouseEvent.CLICK, this.xxx, this);\n }\n\n private xxx() {\n this.score++;\n engine.globalEvent.dispatchEvent('recycling-score-update', {\n score: this.score\n });\n }\n\n private stopGame() {\n this.stage.removeEventListener(engine.MouseEvent.CLICK, this.xxx, this);\n this.stopAni();\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', {});\n }\n }\n\n stop() {\n clearInterval(this._timer);\n this.stopGame();\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,CA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gB,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;;;;;;;;;"}
\ No newline at end of file
src/custom/recycling/src/game/GameView.ts
View file @
87951f14
...
...
@@ -103,17 +103,22 @@ export default class GameView extends engine.Container {
let
idlerWheels
=
[
'idler0'
,
'idler1'
,
'idler2'
,
'idler3'
,
'idler4'
,
'idler5'
,
'idler6'
];
idlerWheels
=
idlerWheels
.
map
(
i
=>
this
.
uiMap
[
i
]);
idlerWheels
.
forEach
(
i
=>
{
engine
.
Tween
.
get
(
i
,
{
loop
:
true
}).
to
({
rotation
:
360
},
3
000
);
engine
.
Tween
.
get
(
i
,
{
loop
:
true
}).
to
({
rotation
:
-
360
},
1
000
);
})
}
stopAni
()
{
let
idlerWheels
=
[
'idler0'
,
'idler1'
,
'idler2'
,
'idler3'
,
'idler4'
,
'idler5'
,
'idler6'
];
idlerWheels
=
idlerWheels
.
map
(
i
=>
this
.
uiMap
[
i
]);
idlerWheels
.
forEach
(
i
=>
{
engine
.
Tween
.
removeTweens
(
i
);
})
}
async
start
()
{
console
.
log
(
'on start'
)
this
.
_timeCounter
=
0
;
this
.
score
=
0
;
if
(
!
getGuideInfo
())
{
await
this
.
guide
.
startGuide
();
...
...
@@ -122,8 +127,7 @@ export default class GameView extends engine.Container {
await
this
.
countdown
.
startCountDown
();
this
.
playAni
();
this
.
startGame
();
engine
.
globalEvent
.
dispatchEvent
(
'recycling-time-update'
,
{
second
:
this
.
getSecond
(),
...
...
@@ -134,6 +138,23 @@ export default class GameView extends engine.Container {
},
1000
)
}
private
startGame
()
{
this
.
playAni
();
this
.
stage
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
xxx
,
this
);
}
private
xxx
()
{
this
.
score
++
;
engine
.
globalEvent
.
dispatchEvent
(
'recycling-score-update'
,
{
score
:
this
.
score
});
}
private
stopGame
()
{
this
.
stage
.
removeEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
xxx
,
this
);
this
.
stopAni
();
}
getSecond
()
{
return
props
.
time
-
this
.
_timeCounter
...
...
@@ -147,12 +168,13 @@ export default class GameView extends engine.Container {
if
(
this
.
getSecond
()
==
0
)
{
this
.
stop
();
engine
.
globalEvent
.
dispatchEvent
(
'recycling-game-end'
,
{
});
engine
.
globalEvent
.
dispatchEvent
(
'recycling-game-end'
,
{});
}
}
stop
()
{
clearInterval
(
this
.
_timer
);
this
.
stopGame
();
}
setup
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment