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
1d483254
Commit
1d483254
authored
Dec 04, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
4553efeb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
jump-high-3.json
dist/customs/jump-high-3.json
+1
-1
main.js
src/custom/jump-high-3/debug/main.js
+1
-1
GameView.ts
src/custom/jump-high-3/src/game/GameView.ts
+3
-0
No files found.
dist/customs/jump-high-3.json
View file @
1d483254
...
@@ -465,5 +465,5 @@
...
@@ -465,5 +465,5 @@
}
}
},
},
"id"
:
"jump-high-3"
,
"id"
:
"jump-high-3"
,
"code"
:
"
\"
use strict
\"
;var tslib=require(
\"
tslib
\"
),props={};function prepareProps(){var e=getProps();engine.injectProp(props,e)}function injectProps(e){engine.injectProp(props,e)}function getTexture(e){return engine.Texture.from(getAssetByUUID(e).uuid)}function getTextureByName(e){return getTexture(engine.getAssetByName(e).uuid)}function getBlockAsset(){return engine.getAssetByName(props.blockAssets[0])}function createSvga(e,t){var i=new svga.Svga;i.source=
\"
asset://
\"
+engine.getAssetByName(e).uuid;var n=props[t];return n&&(i.x=-n.x,i.y=-n.y,i.anchorX=n.x,i.anchorY=n.y),i}function playSound(e){engine.playSound(engine.getAssetByName(e).uuid,{keep:!0})}var Background=function(e){function t(){return e.call(this)||this}return tslib.__extends(t,e),t.prototype.setup=function(){var e=this.stage,t=(e.width,e.height,this._bg=new engine.Image(getTextureByName(
\"
背景图
\"
)));this.addChild(t)},t.prototype.playZoom=function(i,n){var s=this;return void 0===n&&(n=700),new Promise(function(e){var t=
\"
in
\"
===i?1:s._minScale;engine.Tween.get(s._bg,null,null,!0).to({scaleX:t,scaleY:t},n,engine.Ease.cubicInOut).call(e)})},t}(engine.Container),Base=function(e){function t(){return e.call(this,getTextureByName(
\"
底座
\"
))||this}return tslib.__extends(t,e),t.prototype.setup=function(){this.x=-this.width/2},t.prototype.reset=function(){this.y=-props.baseOffset},t}(engine.Image),Block=function(i){function e(){var e=i.call(this)||this,t=e.body=new svga.Svga;return t.x=-props.blockWidth/2,t.y=-props.blockHitHeight-props.blockPaddingTop,e.addChild(t),e}return tslib.__extends(e,i),e.prototype.reset=function(e){var t=e.type;this.dir=.5<Math.random()?1:-1,this.type=t;var i=getBlockAsset();this.body.source=
\"
asset://
\"
+i.uuid,this.scaleX=this.dir,this.body.gotoAndStop(1),this.body.visible=!0},e.prototype.playEnter=function(e,t){var i=this;this.visible=!0,this.x=this.dir*this.stage.width;var n=props.blockDurationRange,s=n[0],o=n[1],r=Math.max(o-e*props.blockDurationStep,s);return r+=o*Math.random()*props.blockDurationRandom*(.5<Math.random()?1:-1),new Promise(function(e){t?engine.Tween.get(i,null,null,!0).to({x:0},r).call(e):(i.x=0,setTimeout(function(){},200),e())})},e.prototype.playLeave=function(){this.visible=!1},e.prototype.playEffect=function(){var e=this.body;e.play(!0,!1),e.once(engine.Event.END_FRAME,function(){e.gotoAndStop(1)},this)},e.prototype.stop=function(){engine.Tween.removeTweens(this)},e}(engine.Container),GoldBag=function(t){function e(){var e=t.call(this)||this;return e.setup(),e}return tslib.__extends(e,t),e.prototype.setup=function(){var e=this.avatar=new engine.Sprite(getTextureByName(
\"
钱袋-静态
\"
));e.x=-props.goldPackAvatarAnchor.x,e.y=-props.goldPackAvatarAnchor.y,this.addChild(e);var t=this.svga=createSvga(
\"
钱袋
\"
,
\"
goldPackAnchor
\"
);t.visible=!1,this.addChild(t)},e.prototype.reset=function(e){this.y=e.y,this.avatar.visible=!0,this.svga.visible=!1,this.svga.gotoAndStop(1),this.remain=e.remain},e.prototype.playOpen=function(){var t=this;return this.avatar.visible=!1,this.svga.visible=!0,new Promise(function(e){t.svga.play(!0,!1),t.svga.once(engine.Event.END_FRAME,function(){this.svga.visible=!1,e()},t)})},e}(engine.Container),GuideLayer=function(t){function e(){var e=t.call(this)||this;return e.setup(),e}return tslib.__extends(e,t),e.prototype.setup=function(){},e.prototype.show=function(e,a){var h=this;return new Promise(function(e){var t,i,n,s,o,r;h.visible=!0,h.guideMask||(i=(t=h.stage).width,n=t.height,s=h.guideMask=new engine.Container,(o=new engine.Image(getTextureByName(
\"
引导遮罩
\"
))).x=(i-o.width)/2,o.y=a.y-100,s.addChild(o),h.createRect(s,0,0,i,o.y),h.createRect(s,0,o.y,o.x,o.height),h.createRect(s,o.x+o.width,o.y,i-o.x-o.width,o.height),h.createRect(s,0,o.y+o.height,i,n-o.y-o.height),(r=h.label=new engine.Label).fillColor=
\"
white
\"
,r.size=25,r.text=props.guideText,r.x=(i-r.width)/2,r.y=o.y+o.height+50,s.addChild(r),h.addChild(s)),h.once(engine.MouseEvent.CLICK,function(){this.visible=!1,e()},h)})},e.prototype.createRect=function(e,t,i,n,s){var o=new engine.Rect;o.x=t,o.y=i,o.width=n,o.height=s,o.fillColor=
\"
black
\"
,o.alpha=.7,e.addChild(o)},e}(engine.Container),svgaAssets={aniReady:{name:
\"
准备立正
\"
,dir:1},aniReady2:{name:
\"
准备立正
\"
,dir:1},aniJump:{name:
\"
跳上升
\"
,dir:1},aniFall:{name:
\"
跳下落
\"
,dir:1},aniLandNormal:{name:
\"
普通着地
\"
,dir:1},aniLandSide:{name:
\"
边缘着地
\"
,dir:-1},aniHit:{name:
\"
被撞开
\"
,dir:-1},aniParachute:{name:
\"
降落pic
\"
,dir:-1,type:
\"
pic
\"
},aniLandPerfect:{name:
\"
完美着地_笑
\"
,dir:1}},Player=function(t){function e(){var e=t.call(this)||this;return e.g=props.gravity,e.addEventListener(engine.Event.ENTER_FRAME,e.onEnterFrame,e),e}return tslib.__extends(e,t),e.prototype.switchAni=function(n,s,o,r){var a=this;return void 0===s&&(s=1),void 0===o&&(o=!0),void 0===r&&(r=!1),new Promise(function(e){var t,i;a.scaleX=s,a._aniName!==n&&(a._aniName=n,(t=a.removeChild(a.getChildByName(
\"
body
\"
)))&&t.stop&&t.stop(),i=a._currentAni=a[
\"
ani
\"
+n],a.addChild(i),i.y=-300,o?(i.play&&i.play(!1,r),r?e():i.once(engine.Event.END_FRAME,e)):e())})},e.prototype.setup=function(){for(var e in this.prefectEffect=createSvga(
\"
完美着地特效
\"
,
\"
playerLandPrefectAnchor
\"
),this.landEffect=createSvga(
\"
着地特效
\"
,
\"
playerLandEffectAnchor
\"
),svgaAssets){var t,i,n=void 0,s=svgaAssets[e],o=s.name,r=s.dir;
\"
pic
\"
==s.type?(t=75,i=122,(n=this[e]=new engine.Image(getTextureByName(
\"
降落pic
\"
))).x=-t,n.y=-i,n.anchorX=t,n.anchorY=i):n=this[e]=createSvga(o,e.replace(
\"
ani
\"
,
\"
player
\"
)+
\"
Anchor
\"
),n.name=
\"
body
\"
,n.scaleX=r}},e.prototype.reset=function(e){this.x=0,this.rotation=0,this.scaleX=this.scaleY=1,this._prefectLandCounting=0,engine.Tween.removeTweens(this),e&&this.switchAni(
\"
Jump
\"
,1,!1)},e.prototype.playReady=function(){var t=this;return new Promise(function(e){t.switchAni(
\"
Ready
\"
,1),setTimeout(function(){t.switchAni(
\"
Ready2
\"
,1,!0,!0),e()},200)})},e.prototype.onEnterFrame=function(e){this.playing&&(this.vy+=this.g,this.y+=this.vy,0<this.vy&&
\"
Fall
\"
!==this._aniName&&(this.dispatchEvent(
\"
jump-on-top
\"
),this.switchAni(
\"
Fall
\"
)),this.y>this.baseY&&(this.y=this.baseY,this.playing=!1,this.jumpPromise&&this.jumpPromise({aboveBlock:this.aboveBlock}),this.jumpPromise=null))},e.prototype.changeBaseY=function(e){this.baseY!=e&&(this.aboveBlock=!0,this.baseY=e)},e.prototype.jump=function(){var t=this;return playSound(
\"
跳起音效
\"
),this.switchAni(
\"
Jump
\"
,1,!1),this._currentAni.play(!1,!1),this.aboveBlock=!1,this.playing=!0,this.baseY=this.y,this.vy=-props.jumpSpeed,new Promise(function(e){t.jumpPromise=e})},e.prototype.playLand=function(n,s){return tslib.__awaiter(this,void 0,void 0,function(){var t,i;return tslib.__generator(this,function(e){switch(e.label){case 0:switch(n){case 0:return[3,1];case 1:case 2:return[3,4];case 3:return[3,5]}return[3,6];case 1:return this._prefectLandCounting++,playSound(
\"
完美落地音效
\"
+Math.min(4,this._prefectLandCounting)),t=this.prefectEffect,this.addChildAt(t,0),t.gotoAndPlay(1),t.once(engine.Event.END_FRAME,function(){this.removeChild(t)},this),i=this.landEffect,this.addChildAt(i,0),i.gotoAndPlay(1),i.once(engine.Event.END_FRAME,function(){this.removeChild(i)},this),[4,this.switchAni(
\"
LandPerfect
\"
)];case 2:return e.sent(),[4,this.switchAni(
\"
Ready2
\"
,1,!0,!0)];case 3:return e.sent(),[3,6];case 4:return this._prefectLandCounting=0,playSound(
\"
普通落地音效
\"
),this.switchAni(
\"
Ready2
\"
,1,!0,!0),[3,6];case 5:return this._prefectLandCounting=0,playSound(
\"
边缘落地音效
\"
),this.switchAni(
\"
LandSide
\"
,s),[3,6];case 6:return[2]}})})},e.prototype.hitAway=function(i){return tslib.__awaiter(this,void 0,void 0,function(){var t=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return this.jumpPromise&&this.jumpPromise(),this.jumpPromise=null,playSound(
\"
被撞开音效
\"
),this.switchAni(
\"
Hit
\"
,i),this.vy=0,[4,new Promise(function(e){engine.Tween.get(t).to({x:-i*props.hitAwayDistance.x},props.hitAwayDuration,engine.Ease.quartOut),engine.Tween.get(t).to({y:t.y+props.hitAwayDistance.y},props.hitAwayDuration,engine.Ease.cubicOut).call(e)})];case 1:return e.sent(),[2]}})})},e.prototype.parachute=function(e){var t=this;return this.switchAni(
\"
Parachute
\"
,e),new Promise(function(e){engine.Tween.get(t).call(function(){playSound(
\"
降落伞下落音效
\"
)}).to({y:t.y+props.parachuteDistance},props.parachuteDuration).set({anchorOffsetY:0}).call(e)})},e}(engine.Container),ObjectPool=engine.ObjectPool,PoolName=
\"
gold-bag
\"
;ObjectPool.registerPool(PoolName,function(){return new GoldBag},function(e,t){e.reset(t)});var GameView=function(t){function e(){var e=t.call(this)||this;return e.index=-1,e.goldBags=[],e.baseOffset=-props.baseOffset+props.playerOffset,e.once(engine.Event.ADDED_TO_STAGE,e.setup,e),e}return tslib.__extends(e,t),e.prototype.setup=function(){var e,t,i,n,s,o,r,a,h,c,l;this._hasSetup||(this._hasSetup=!0,t=(e=this.stage).width,i=e.height,(n=this.background=new Background).y=i-1624,this.addChild(n),n.setup(),(s=this.frontContainer=new engine.Container).x=t/2,this.addChild(s),o=this.guideLayer=new GuideLayer,this.addChild(o),r=this.blockContainer=new engine.Container,s.addChild(r),a=this.base=new Base,s.addChild(a),a.setup(),h=this.player=new Player,s.addChildAt(h,0),h.setup(),h.addEventListener(
\"
jump-on-top
\"
,this.onPlayerJumpOnTop,this),(c=this.scoreAddTipsContainer=new engine.Container).width=750,c.anchorX=c.width/2,c.anchorY=c.height/2,(l=this.scoreAddTips=new engine.Label).width=750,l.fillColor=props.scoreAddFontColor,l.textAlign=engine.TEXT_ALIGN.CENTER,l.size=props.scoreAddFontSize,l.alpha=0,l.text=
\"
+0
\"
,l.x=this.player.x-l.width/2,c.addChild(l),s.addChildAt(h,0),s.addChild(c),ObjectPool.recycleObject(PoolName,ObjectPool.getObject(PoolName,{y:0,remain:0})),this.hitEffect=createSvga(
\"
被撞烟雾
\"
,
\"
hitEffectAnchor
\"
),this.pos=0,this.background.setup(),this.addEventListener(engine.Event.ENTER_FRAME,this.onEnterFrame,this),this.reset())},e.prototype.setScoreText=function(i){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.scoreAddTips.text=i,t.scoreAddTips.y=0,t.scoreAddTips.alpha=1,engine.Tween.get(t.scoreAddTips,null,null,!0).to({y:-100,alpha:0},500,engine.Ease.cubicInOut).call(e)})]})})},e.prototype.reset=function(o){return void 0===o&&(o=!1),tslib.__awaiter(this,void 0,void 0,function(){var t,i,n,s;return tslib.__generator(this,function(e){if(this.base.reset(),this.index=-1,this._score=0,!o)for(this.pos=0,t=this.blockContainer,i=0,n=t.children.length;i<n;i++)t.getChildAt(i).playLeave();for(i=0;i<props.initBlockCount;i++)this.addBlock(!1);for(i=0,n=this.goldBags.length;i<n;i++)s=this.goldBags[i],this.frontContainer.removeChild(s),ObjectPool.recycleObject(PoolName,s);return this.goldBags.splice(0),this.resetPlayer(o),[2]})})},e.prototype.resetPlayer=function(e){void 0===e&&(e=!1),this.player.reset(e),this.player.y=this.baseOffset-(this.index+1)*props.blockHitHeight+props.blockBaseOffset},e.prototype.start=function(n){return void 0===n&&(n=!1),tslib.__awaiter(this,void 0,void 0,function(){var t,i=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return this.scoreAddTipsContainer.y=this.player.y+props.scoreAddTipsOffset,n?[3,2]:[4,this.player.playReady()];case 1:e.sent(),e.label=2;case 2:return(console.log(
\"
开始
\"
),t=
\"
jump-high-guide_
\"
+props.guideFlagKey,localStorage.getItem(t))?[3,4]:(localStorage.setItem(t,
\"
1
\"
),[4,this.guideLayer.show(
\"\"
,{y:this.stage.height+this.player.y-280})]);case 3:e.sent(),e.label=4;case 4:return this.lastLandType=0,this._remainToShowGoldBag=props.goldBagScoreMultiple-props.goldBagScoreSubtraction,this._touchEnabled=!0,setTimeout(function(){i.addBlock()},100),engine.globalEvent.dispatchEvent(
\"
jump-high-game-start
\"
),[2]}})})},e.prototype.pause=function(){this.currentBlock&&engine.Tween.pauseTweens(this.currentBlock),engine.Tween.pauseTweens(this.player)},e.prototype.resume=function(){this.currentBlock&&engine.Tween.resumeTweens(this.currentBlock),engine.Tween.resumeTweens(this.player)},e.prototype.revive=function(){return tslib.__awaiter(this,void 0,void 0,function(){return tslib.__generator(this,function(e){switch(e.label){case 0:return this.blockContainer.getChildAt(this.index).visible=!1,this.index--,[4,this.resetPlayer(!0)];case 1:return e.sent(),this.start(!0),[2]}})})},e.prototype.addBlock=function(e){var t=this;void 0===e&&(e=!0),this.index++;var i,n=this.blockContainer;n.children.length>this.index?(i=n.getChildAt(this.index)).visible=!0:(i=new Block,n.addChildAt(i,0)),n.addChildAt(i,0),i.reset({type:Math.floor(Math.random()*props.blockAssets.length)}),console.log(
\"
addblock
\"
,this.index),i.y=this.baseOffset-this.index*props.blockHitHeight+props.blockBaseOffset,this.blockComplete=!1,i.playEnter(this.index,e).then(function(e){t.blockComplete=!0}),e&&(this.needHitTest=!0),this.currentBlock=i},e.prototype.addGoldBag=function(){var e=ObjectPool.getObject(PoolName,{y:this.baseOffset-(this.blockCount+props.goldBagDistance+props.goldBagJumpSubtraction)*props.blockHitHeight,remain:props.goldBagDistance});this.frontContainer.addChild(e),this.goldBags.push(e)},e.prototype.playOpenGoldBag=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t,i,n;return tslib.__generator(this,function(e){switch(e.label){case 0:t=0,i=this.goldBags.length,e.label=1;case 1:return t<i?((n=this.goldBags[t]).remain--,n.remain<=0?(this.goldBags.splice(t,1),t--,i--,this.nextToUpdateScore=!0,[4,n.playOpen()]):[3,3]):[3,4];case 2:e.sent(),this.frontContainer.removeChild(n),ObjectPool.recycleObject(PoolName,n),e.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},e.prototype.onPlayerJumpOnTop=function(){this.nextToUpdateScore&&(this.nextToUpdateScore=!1,this.scoreChange(4),playSound(
\"
撞击钱袋音效
\"
))},Object.defineProperty(e.prototype,
\"
blockCount
\"
,{get:function(){return this.index-props.initBlockCount+1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,
\"
pos
\"
,{get:function(){return this._pos},set:function(e){this._pos=e,this.updatePos()},enumerable:!1,configurable:!0}),e.prototype.updatePos=function(){this.frontContainer.y=this.stage.height+this._pos},e.prototype.onEnterFrame=function(e){var t,i,n,s,o,r,a,h,c,l,p;this.needHitTest&&this.currentBlock&&(i=(t=this.currentBlock).x,n=t.y,s=t.dir,r=(o=this.player).x,a=o.y,h=props.blockHitWidth,c=props.blockHitHeight,l=props.playerWidth,p=!1,Math.abs(r-i)<(h+l)/2&&(this.player.changeBaseY(n-c),n-c<a&&(p=!0)),p&&this.onHitOn(s))},e.prototype.onHitOn=function(t){return tslib.__awaiter(this,void 0,void 0,function(){return tslib.__generator(this,function(e){switch(e.label){case 0:return this._touchEnabled=!1,this.needHitTest=!1,clearInterval(this.timer),[4,this.player.hitAway(t)];case 1:return e.sent(),this.frontContainer.addChild(this.player),[4,this.player.parachute(t)];case 2:return e.sent(),console.log(
\"
jump-high-game-end
\"
),engine.globalEvent.dispatchEvent(
\"
jump-high-game-end
\"
),[2]}})})},e.prototype.jump=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t,i,n,s,o=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return this._touchEnabled?(this._touchEnabled=!1,this.playOpenGoldBag(),[4,this.player.jump()]):[2];case 1:return(t=e.sent())?t.aboveBlock?(i=Math.abs(this.currentBlock.x),(n=0)<i&&(n=0<i&&i<props.scoreThreshold?2:3),s=this.lastLandType,0===(this.lastLandType=n)&&s!==n&&(n=1),this.currentBlock.playEffect(),this.player.playLand(n,this.currentBlock.dir),this.currentBlock.stop(),this.scoreChange(n),[4,new Promise(function(e){engine.Tween.get(o,null,null,!0).to({pos:props.blockHitHeight*o.index},300,engine.Ease.cubicOut).call(e)})]):[3,3]:[3,4];case 2:e.sent(),this.addBlock(),e.label=3;case 3:this._touchEnabled=!0,e.label=4;case 4:return[2]}})})},e.prototype.scoreChange=function(e){var t=props.scoreWeights[e];this._score+=t,this._remainToShowGoldBag-=t;var i=this._score;engine.globalEvent.dispatchEvent(
\"
jump-high-score
\"
,{type:e,score:i,scoreAdd:t}),this.scoreAddTipsContainer.y=this.player.y+props.scoreAddTipsOffset,this.setScoreText(
\"
+
\"
+t),console.log(i,this._remainToShowGoldBag),this._remainToShowGoldBag<=0&&(this._remainToShowGoldBag+=props.goldBagScoreMultiple,this.addGoldBag(),console.log(
\"
addGoldBag
\"
))},e.prototype.playHitEffect=function(e){var t=this.hitEffect;t.scaleX=e,t.y=this.player.y-props.hitEffectAnchor.y,t.play(!0,!1),t.once(engine.Event.END_FRAME,function(){this.frontContainer.removeChild(t)},this),this.frontContainer.addChild(t)},e}(engine.Container),JumpHigh=function(i){function e(){var e=i.call(this)||this;engine.globalEvent.addEventListener(
\"
jump-high-reset
\"
,e.reset,e),engine.globalEvent.addEventListener(
\"
jump-high-start
\"
,e.start,e),engine.globalEvent.addEventListener(
\"
jump-high-pause
\"
,e.pause,e),engine.globalEvent.addEventListener(
\"
jump-high-resume
\"
,e.resume,e),engine.globalEvent.addEventListener(
\"
jump-high-revive
\"
,e.revive,e),e.addEventListener(engine.MouseEvent.MOUSE_DOWN,e.onTap,e);var t=e._gameView=new GameView;return e.addChild(t),e}return tslib.__extends(e,i),e.prototype.reset=function(){this._gameView.reset()},e.prototype.start=function(e){injectProps(e.data),this._status=1,this._gameView.start()},e.prototype.pause=function(){this._gameView.pause()},e.prototype.resume=function(){this._gameView.resume()},e.prototype.revive=function(){this._gameView.revive()},e.prototype.onTap=function(e){this._gameView.jump()},e}(engine.Container);function index(e){return prepareProps(),injectProps(e),new JumpHigh}module.exports=index;
\n
"
"code"
:
"
\"
use strict
\"
;var tslib=require(
\"
tslib
\"
),props={};function prepareProps(){var e=getProps();engine.injectProp(props,e)}function injectProps(e){engine.injectProp(props,e)}function getTexture(e){return engine.Texture.from(getAssetByUUID(e).uuid)}function getTextureByName(e){return getTexture(engine.getAssetByName(e).uuid)}function getBlockAsset(){return engine.getAssetByName(props.blockAssets[0])}function createSvga(e,t){var i=new svga.Svga;i.source=
\"
asset://
\"
+engine.getAssetByName(e).uuid;var n=props[t];return n&&(i.x=-n.x,i.y=-n.y,i.anchorX=n.x,i.anchorY=n.y),i}function playSound(e){engine.playSound(engine.getAssetByName(e).uuid,{keep:!0})}var Background=function(e){function t(){return e.call(this)||this}return tslib.__extends(t,e),t.prototype.setup=function(){var e=this.stage,t=(e.width,e.height,this._bg=new engine.Image(getTextureByName(
\"
背景图
\"
)));this.addChild(t)},t.prototype.playZoom=function(i,n){var s=this;return void 0===n&&(n=700),new Promise(function(e){var t=
\"
in
\"
===i?1:s._minScale;engine.Tween.get(s._bg,null,null,!0).to({scaleX:t,scaleY:t},n,engine.Ease.cubicInOut).call(e)})},t}(engine.Container),Base=function(e){function t(){return e.call(this,getTextureByName(
\"
底座
\"
))||this}return tslib.__extends(t,e),t.prototype.setup=function(){this.x=-this.width/2},t.prototype.reset=function(){this.y=-props.baseOffset},t}(engine.Image),Block=function(i){function e(){var e=i.call(this)||this,t=e.body=new svga.Svga;return t.x=-props.blockWidth/2,t.y=-props.blockHitHeight-props.blockPaddingTop,e.addChild(t),e}return tslib.__extends(e,i),e.prototype.reset=function(e){var t=e.type;this.dir=.5<Math.random()?1:-1,this.type=t;var i=getBlockAsset();this.body.source=
\"
asset://
\"
+i.uuid,this.scaleX=this.dir,this.body.gotoAndStop(1),this.body.visible=!0},e.prototype.playEnter=function(e,t){var i=this;this.visible=!0,this.x=this.dir*this.stage.width;var n=props.blockDurationRange,s=n[0],o=n[1],r=Math.max(o-e*props.blockDurationStep,s);return r+=o*Math.random()*props.blockDurationRandom*(.5<Math.random()?1:-1),new Promise(function(e){t?engine.Tween.get(i,null,null,!0).to({x:0},r).call(e):(i.x=0,setTimeout(function(){},200),e())})},e.prototype.playLeave=function(){this.visible=!1},e.prototype.playEffect=function(){var e=this.body;e.play(!0,!1),e.once(engine.Event.END_FRAME,function(){e.gotoAndStop(1)},this)},e.prototype.stop=function(){engine.Tween.removeTweens(this)},e}(engine.Container),GoldBag=function(t){function e(){var e=t.call(this)||this;return e.setup(),e}return tslib.__extends(e,t),e.prototype.setup=function(){var e=this.avatar=new engine.Sprite(getTextureByName(
\"
钱袋-静态
\"
));e.x=-props.goldPackAvatarAnchor.x,e.y=-props.goldPackAvatarAnchor.y,this.addChild(e);var t=this.svga=createSvga(
\"
钱袋
\"
,
\"
goldPackAnchor
\"
);t.visible=!1,this.addChild(t)},e.prototype.reset=function(e){this.y=e.y,this.avatar.visible=!0,this.svga.visible=!1,this.svga.gotoAndStop(1),this.remain=e.remain},e.prototype.playOpen=function(){var t=this;return this.avatar.visible=!1,this.svga.visible=!0,new Promise(function(e){t.svga.play(!0,!1),t.svga.once(engine.Event.END_FRAME,function(){this.svga.visible=!1,e()},t)})},e}(engine.Container),GuideLayer=function(t){function e(){var e=t.call(this)||this;return e.setup(),e}return tslib.__extends(e,t),e.prototype.setup=function(){},e.prototype.show=function(e,a){var h=this;return new Promise(function(e){var t,i,n,s,o,r;h.visible=!0,h.guideMask||(i=(t=h.stage).width,n=t.height,s=h.guideMask=new engine.Container,(o=new engine.Image(getTextureByName(
\"
引导遮罩
\"
))).x=(i-o.width)/2,o.y=a.y-100,s.addChild(o),h.createRect(s,0,0,i,o.y),h.createRect(s,0,o.y,o.x,o.height),h.createRect(s,o.x+o.width,o.y,i-o.x-o.width,o.height),h.createRect(s,0,o.y+o.height,i,n-o.y-o.height),(r=h.label=new engine.Label).fillColor=
\"
white
\"
,r.size=25,r.text=props.guideText,r.x=(i-r.width)/2,r.y=o.y+o.height+50,s.addChild(r),h.addChild(s)),h.once(engine.MouseEvent.CLICK,function(){this.visible=!1,e()},h)})},e.prototype.createRect=function(e,t,i,n,s){var o=new engine.Rect;o.x=t,o.y=i,o.width=n,o.height=s,o.fillColor=
\"
black
\"
,o.alpha=.7,e.addChild(o)},e}(engine.Container),svgaAssets={aniReady:{name:
\"
准备立正
\"
,dir:1},aniReady2:{name:
\"
准备立正
\"
,dir:1},aniJump:{name:
\"
跳上升
\"
,dir:1},aniFall:{name:
\"
跳下落
\"
,dir:1},aniLandNormal:{name:
\"
普通着地
\"
,dir:1},aniLandSide:{name:
\"
边缘着地
\"
,dir:-1},aniHit:{name:
\"
被撞开
\"
,dir:-1},aniParachute:{name:
\"
降落pic
\"
,dir:-1,type:
\"
pic
\"
},aniLandPerfect:{name:
\"
完美着地_笑
\"
,dir:1}},Player=function(t){function e(){var e=t.call(this)||this;return e.g=props.gravity,e.addEventListener(engine.Event.ENTER_FRAME,e.onEnterFrame,e),e}return tslib.__extends(e,t),e.prototype.switchAni=function(n,s,o,r){var a=this;return void 0===s&&(s=1),void 0===o&&(o=!0),void 0===r&&(r=!1),new Promise(function(e){var t,i;a.scaleX=s,a._aniName!==n&&(a._aniName=n,(t=a.removeChild(a.getChildByName(
\"
body
\"
)))&&t.stop&&t.stop(),i=a._currentAni=a[
\"
ani
\"
+n],a.addChild(i),i.y=-300,o?(i.play&&i.play(!1,r),r?e():i.once(engine.Event.END_FRAME,e)):e())})},e.prototype.setup=function(){for(var e in this.prefectEffect=createSvga(
\"
完美着地特效
\"
,
\"
playerLandPrefectAnchor
\"
),this.landEffect=createSvga(
\"
着地特效
\"
,
\"
playerLandEffectAnchor
\"
),svgaAssets){var t,i,n=void 0,s=svgaAssets[e],o=s.name,r=s.dir;
\"
pic
\"
==s.type?(t=75,i=122,(n=this[e]=new engine.Image(getTextureByName(
\"
降落pic
\"
))).x=-t,n.y=-i,n.anchorX=t,n.anchorY=i):n=this[e]=createSvga(o,e.replace(
\"
ani
\"
,
\"
player
\"
)+
\"
Anchor
\"
),n.name=
\"
body
\"
,n.scaleX=r}},e.prototype.reset=function(e){this.x=0,this.rotation=0,this.scaleX=this.scaleY=1,this._prefectLandCounting=0,engine.Tween.removeTweens(this),e&&this.switchAni(
\"
Jump
\"
,1,!1)},e.prototype.playReady=function(){var t=this;return new Promise(function(e){t.switchAni(
\"
Ready
\"
,1),setTimeout(function(){t.switchAni(
\"
Ready2
\"
,1,!0,!0),e()},200)})},e.prototype.onEnterFrame=function(e){this.playing&&(this.vy+=this.g,this.y+=this.vy,0<this.vy&&
\"
Fall
\"
!==this._aniName&&(this.dispatchEvent(
\"
jump-on-top
\"
),this.switchAni(
\"
Fall
\"
)),this.y>this.baseY&&(this.y=this.baseY,this.playing=!1,this.jumpPromise&&this.jumpPromise({aboveBlock:this.aboveBlock}),this.jumpPromise=null))},e.prototype.changeBaseY=function(e){this.baseY!=e&&(this.aboveBlock=!0,this.baseY=e)},e.prototype.jump=function(){var t=this;return playSound(
\"
跳起音效
\"
),this.switchAni(
\"
Jump
\"
,1,!1),this._currentAni.play(!1,!1),this.aboveBlock=!1,this.playing=!0,this.baseY=this.y,this.vy=-props.jumpSpeed,new Promise(function(e){t.jumpPromise=e})},e.prototype.playLand=function(n,s){return tslib.__awaiter(this,void 0,void 0,function(){var t,i;return tslib.__generator(this,function(e){switch(e.label){case 0:switch(n){case 0:return[3,1];case 1:case 2:return[3,4];case 3:return[3,5]}return[3,6];case 1:return this._prefectLandCounting++,playSound(
\"
完美落地音效
\"
+Math.min(4,this._prefectLandCounting)),t=this.prefectEffect,this.addChildAt(t,0),t.gotoAndPlay(1),t.once(engine.Event.END_FRAME,function(){this.removeChild(t)},this),i=this.landEffect,this.addChildAt(i,0),i.gotoAndPlay(1),i.once(engine.Event.END_FRAME,function(){this.removeChild(i)},this),[4,this.switchAni(
\"
LandPerfect
\"
)];case 2:return e.sent(),[4,this.switchAni(
\"
Ready2
\"
,1,!0,!0)];case 3:return e.sent(),[3,6];case 4:return this._prefectLandCounting=0,playSound(
\"
普通落地音效
\"
),this.switchAni(
\"
Ready2
\"
,1,!0,!0),[3,6];case 5:return this._prefectLandCounting=0,playSound(
\"
边缘落地音效
\"
),this.switchAni(
\"
LandSide
\"
,s),[3,6];case 6:return[2]}})})},e.prototype.hitAway=function(i){return tslib.__awaiter(this,void 0,void 0,function(){var t=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return this.jumpPromise&&this.jumpPromise(),this.jumpPromise=null,playSound(
\"
被撞开音效
\"
),this.switchAni(
\"
Hit
\"
,i),this.vy=0,[4,new Promise(function(e){engine.Tween.get(t).to({x:-i*props.hitAwayDistance.x},props.hitAwayDuration,engine.Ease.quartOut),engine.Tween.get(t).to({y:t.y+props.hitAwayDistance.y},props.hitAwayDuration,engine.Ease.cubicOut).call(e)})];case 1:return e.sent(),[2]}})})},e.prototype.parachute=function(e){var t=this;return this.switchAni(
\"
Parachute
\"
,e),new Promise(function(e){engine.Tween.get(t).call(function(){playSound(
\"
降落伞下落音效
\"
)}).to({y:t.y+props.parachuteDistance},props.parachuteDuration).set({anchorOffsetY:0}).call(e)})},e}(engine.Container),ObjectPool=engine.ObjectPool,PoolName=
\"
gold-bag
\"
;ObjectPool.registerPool(PoolName,function(){return new GoldBag},function(e,t){e.reset(t)});var GameView=function(t){function e(){var e=t.call(this)||this;return e.index=-1,e.goldBags=[],e.baseOffset=-props.baseOffset+props.playerOffset,e.once(engine.Event.ADDED_TO_STAGE,e.setup,e),e}return tslib.__extends(e,t),e.prototype.setup=function(){var e,t,i,n,s,o,r,a,h,c,l;this._hasSetup||(this._hasSetup=!0,t=(e=this.stage).width,i=e.height,(n=this.background=new Background).y=i-1624,this.addChild(n),n.setup(),(s=this.frontContainer=new engine.Container).x=t/2,this.addChild(s),o=this.guideLayer=new GuideLayer,this.addChild(o),r=this.blockContainer=new engine.Container,s.addChild(r),a=this.base=new Base,s.addChild(a),a.setup(),h=this.player=new Player,s.addChildAt(h,0),h.setup(),h.addEventListener(
\"
jump-on-top
\"
,this.onPlayerJumpOnTop,this),(c=this.scoreAddTipsContainer=new engine.Container).width=750,c.anchorX=c.width/2,c.anchorY=c.height/2,(l=this.scoreAddTips=new engine.Label).width=750,l.fillColor=props.scoreAddFontColor,l.textAlign=engine.TEXT_ALIGN.CENTER,l.size=props.scoreAddFontSize,l.alpha=0,l.text=
\"
+0
\"
,l.x=this.player.x-l.width/2,c.addChild(l),s.addChildAt(h,0),s.addChild(c),ObjectPool.recycleObject(PoolName,ObjectPool.getObject(PoolName,{y:0,remain:0})),this.hitEffect=createSvga(
\"
被撞烟雾
\"
,
\"
hitEffectAnchor
\"
),this.pos=0,this.background.setup(),this.addEventListener(engine.Event.ENTER_FRAME,this.onEnterFrame,this),this.reset())},e.prototype.setScoreText=function(i){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.scoreAddTips.text=i,t.scoreAddTips.y=0,t.scoreAddTips.alpha=1,engine.Tween.get(t.scoreAddTips,null,null,!0).to({y:-100,alpha:0},500,engine.Ease.cubicInOut).call(e)})]})})},e.prototype.reset=function(o){return void 0===o&&(o=!1),tslib.__awaiter(this,void 0,void 0,function(){var t,i,n,s;return tslib.__generator(this,function(e){if(this.base.reset(),this.index=-1,this._score=0,
this.frontContainer&&this.player&&this.frontContainer.addChildAt(this.player,0),
!o)for(this.pos=0,t=this.blockContainer,i=0,n=t.children.length;i<n;i++)t.getChildAt(i).playLeave();for(i=0;i<props.initBlockCount;i++)this.addBlock(!1);for(i=0,n=this.goldBags.length;i<n;i++)s=this.goldBags[i],this.frontContainer.removeChild(s),ObjectPool.recycleObject(PoolName,s);return this.goldBags.splice(0),this.resetPlayer(o),[2]})})},e.prototype.resetPlayer=function(e){void 0===e&&(e=!1),this.player.reset(e),this.player.y=this.baseOffset-(this.index+1)*props.blockHitHeight+props.blockBaseOffset},e.prototype.start=function(n){return void 0===n&&(n=!1),tslib.__awaiter(this,void 0,void 0,function(){var t,i=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return this.scoreAddTipsContainer.y=this.player.y+props.scoreAddTipsOffset,n?[3,2]:[4,this.player.playReady()];case 1:e.sent(),e.label=2;case 2:return(console.log(
\"
开始
\"
),t=
\"
jump-high-guide_
\"
+props.guideFlagKey,localStorage.getItem(t))?[3,4]:(localStorage.setItem(t,
\"
1
\"
),[4,this.guideLayer.show(
\"\"
,{y:this.stage.height+this.player.y-280})]);case 3:e.sent(),e.label=4;case 4:return this.lastLandType=0,this._remainToShowGoldBag=props.goldBagScoreMultiple-props.goldBagScoreSubtraction,this._touchEnabled=!0,setTimeout(function(){i.addBlock()},100),engine.globalEvent.dispatchEvent(
\"
jump-high-game-start
\"
),[2]}})})},e.prototype.pause=function(){this.currentBlock&&engine.Tween.pauseTweens(this.currentBlock),engine.Tween.pauseTweens(this.player)},e.prototype.resume=function(){this.currentBlock&&engine.Tween.resumeTweens(this.currentBlock),engine.Tween.resumeTweens(this.player)},e.prototype.revive=function(){return tslib.__awaiter(this,void 0,void 0,function(){return tslib.__generator(this,function(e){switch(e.label){case 0:return this.blockContainer.getChildAt(this.index).visible=!1,this.index--,[4,this.resetPlayer(!0)];case 1:return e.sent(),this.start(!0),[2]}})})},e.prototype.addBlock=function(e){var t=this;void 0===e&&(e=!0),this.index++;var i,n=this.blockContainer;n.children.length>this.index?(i=n.getChildAt(this.index)).visible=!0:(i=new Block,n.addChildAt(i,0)),n.addChildAt(i,0),i.reset({type:Math.floor(Math.random()*props.blockAssets.length)}),console.log(
\"
addblock
\"
,this.index),i.y=this.baseOffset-this.index*props.blockHitHeight+props.blockBaseOffset,this.blockComplete=!1,i.playEnter(this.index,e).then(function(e){t.blockComplete=!0}),e&&(this.needHitTest=!0),this.currentBlock=i},e.prototype.addGoldBag=function(){var e=ObjectPool.getObject(PoolName,{y:this.baseOffset-(this.blockCount+props.goldBagDistance+props.goldBagJumpSubtraction)*props.blockHitHeight,remain:props.goldBagDistance});this.frontContainer.addChild(e),this.goldBags.push(e)},e.prototype.playOpenGoldBag=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t,i,n;return tslib.__generator(this,function(e){switch(e.label){case 0:t=0,i=this.goldBags.length,e.label=1;case 1:return t<i?((n=this.goldBags[t]).remain--,n.remain<=0?(this.goldBags.splice(t,1),t--,i--,this.nextToUpdateScore=!0,[4,n.playOpen()]):[3,3]):[3,4];case 2:e.sent(),this.frontContainer.removeChild(n),ObjectPool.recycleObject(PoolName,n),e.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},e.prototype.onPlayerJumpOnTop=function(){this.nextToUpdateScore&&(this.nextToUpdateScore=!1,this.scoreChange(4),playSound(
\"
撞击钱袋音效
\"
))},Object.defineProperty(e.prototype,
\"
blockCount
\"
,{get:function(){return this.index-props.initBlockCount+1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,
\"
pos
\"
,{get:function(){return this._pos},set:function(e){this._pos=e,this.updatePos()},enumerable:!1,configurable:!0}),e.prototype.updatePos=function(){this.frontContainer.y=this.stage.height+this._pos},e.prototype.onEnterFrame=function(e){var t,i,n,s,o,r,a,h,c,l,p;this.needHitTest&&this.currentBlock&&(i=(t=this.currentBlock).x,n=t.y,s=t.dir,r=(o=this.player).x,a=o.y,h=props.blockHitWidth,c=props.blockHitHeight,l=props.playerWidth,p=!1,Math.abs(r-i)<(h+l)/2&&(this.player.changeBaseY(n-c),n-c<a&&(p=!0)),p&&this.onHitOn(s))},e.prototype.onHitOn=function(t){return tslib.__awaiter(this,void 0,void 0,function(){return tslib.__generator(this,function(e){switch(e.label){case 0:return this._touchEnabled=!1,this.needHitTest=!1,clearInterval(this.timer),[4,this.player.hitAway(t)];case 1:return e.sent(),this.frontContainer.addChild(this.player),[4,this.player.parachute(t)];case 2:return e.sent(),console.log(
\"
jump-high-game-end
\"
),engine.globalEvent.dispatchEvent(
\"
jump-high-game-end
\"
),[2]}})})},e.prototype.jump=function(){return tslib.__awaiter(this,void 0,void 0,function(){var t,i,n,s,o=this;return tslib.__generator(this,function(e){switch(e.label){case 0:return this._touchEnabled?(this._touchEnabled=!1,this.playOpenGoldBag(),[4,this.player.jump()]):[2];case 1:return(t=e.sent())?t.aboveBlock?(i=Math.abs(this.currentBlock.x),(n=0)<i&&(n=0<i&&i<props.scoreThreshold?2:3),s=this.lastLandType,0===(this.lastLandType=n)&&s!==n&&(n=1),this.currentBlock.playEffect(),this.player.playLand(n,this.currentBlock.dir),this.currentBlock.stop(),this.scoreChange(n),[4,new Promise(function(e){engine.Tween.get(o,null,null,!0).to({pos:props.blockHitHeight*o.index},300,engine.Ease.cubicOut).call(e)})]):[3,3]:[3,4];case 2:e.sent(),this.addBlock(),e.label=3;case 3:this._touchEnabled=!0,e.label=4;case 4:return[2]}})})},e.prototype.scoreChange=function(e){var t=props.scoreWeights[e];this._score+=t,this._remainToShowGoldBag-=t;var i=this._score;engine.globalEvent.dispatchEvent(
\"
jump-high-score
\"
,{type:e,score:i,scoreAdd:t}),this.scoreAddTipsContainer.y=this.player.y+props.scoreAddTipsOffset,this.setScoreText(
\"
+
\"
+t),console.log(i,this._remainToShowGoldBag),this._remainToShowGoldBag<=0&&(this._remainToShowGoldBag+=props.goldBagScoreMultiple,this.addGoldBag(),console.log(
\"
addGoldBag
\"
))},e.prototype.playHitEffect=function(e){var t=this.hitEffect;t.scaleX=e,t.y=this.player.y-props.hitEffectAnchor.y,t.play(!0,!1),t.once(engine.Event.END_FRAME,function(){this.frontContainer.removeChild(t)},this),this.frontContainer.addChild(t)},e}(engine.Container),JumpHigh=function(i){function e(){var e=i.call(this)||this;engine.globalEvent.addEventListener(
\"
jump-high-reset
\"
,e.reset,e),engine.globalEvent.addEventListener(
\"
jump-high-start
\"
,e.start,e),engine.globalEvent.addEventListener(
\"
jump-high-pause
\"
,e.pause,e),engine.globalEvent.addEventListener(
\"
jump-high-resume
\"
,e.resume,e),engine.globalEvent.addEventListener(
\"
jump-high-revive
\"
,e.revive,e),e.addEventListener(engine.MouseEvent.MOUSE_DOWN,e.onTap,e);var t=e._gameView=new GameView;return e.addChild(t),e}return tslib.__extends(e,i),e.prototype.reset=function(){this._gameView.reset()},e.prototype.start=function(e){injectProps(e.data),this._status=1,this._gameView.start()},e.prototype.pause=function(){this._gameView.pause()},e.prototype.resume=function(){this._gameView.resume()},e.prototype.revive=function(){this._gameView.revive()},e.prototype.onTap=function(e){this._gameView.jump()},e}(engine.Container);function index(e){return prepareProps(),injectProps(e),new JumpHigh}module.exports=index;
\n
"
}
}
src/custom/jump-high-3/debug/main.js
View file @
1d483254
"use strict"
;
var
tslib
=
require
(
"tslib"
),
props
=
{};
function
prepareProps
(){
var
e
=
getProps
();
engine
.
injectProp
(
props
,
e
)}
function
injectProps
(
e
){
engine
.
injectProp
(
props
,
e
)}
function
getTexture
(
e
){
return
engine
.
Texture
.
from
(
getAssetByUUID
(
e
).
uuid
)}
function
getTextureByName
(
e
){
return
getTexture
(
engine
.
getAssetByName
(
e
).
uuid
)}
function
getBlockAsset
(){
return
engine
.
getAssetByName
(
props
.
blockAssets
[
0
])}
function
createSvga
(
e
,
t
){
var
i
=
new
svga
.
Svga
;
i
.
source
=
"asset://"
+
engine
.
getAssetByName
(
e
).
uuid
;
var
n
=
props
[
t
];
return
n
&&
(
i
.
x
=-
n
.
x
,
i
.
y
=-
n
.
y
,
i
.
anchorX
=
n
.
x
,
i
.
anchorY
=
n
.
y
),
i
}
function
playSound
(
e
){
engine
.
playSound
(
engine
.
getAssetByName
(
e
).
uuid
,{
keep
:
!
0
})}
var
Background
=
function
(
e
){
function
t
(){
return
e
.
call
(
this
)
||
this
}
return
tslib
.
__extends
(
t
,
e
),
t
.
prototype
.
setup
=
function
(){
var
e
=
this
.
stage
,
t
=
(
e
.
width
,
e
.
height
,
this
.
_bg
=
new
engine
.
Image
(
getTextureByName
(
"背景图"
)));
this
.
addChild
(
t
)},
t
.
prototype
.
playZoom
=
function
(
i
,
n
){
var
s
=
this
;
return
void
0
===
n
&&
(
n
=
700
),
new
Promise
(
function
(
e
){
var
t
=
"in"
===
i
?
1
:
s
.
_minScale
;
engine
.
Tween
.
get
(
s
.
_bg
,
null
,
null
,
!
0
).
to
({
scaleX
:
t
,
scaleY
:
t
},
n
,
engine
.
Ease
.
cubicInOut
).
call
(
e
)})},
t
}(
engine
.
Container
),
Base
=
function
(
e
){
function
t
(){
return
e
.
call
(
this
,
getTextureByName
(
"底座"
))
||
this
}
return
tslib
.
__extends
(
t
,
e
),
t
.
prototype
.
setup
=
function
(){
this
.
x
=-
this
.
width
/
2
},
t
.
prototype
.
reset
=
function
(){
this
.
y
=-
props
.
baseOffset
},
t
}(
engine
.
Image
),
Block
=
function
(
i
){
function
e
(){
var
e
=
i
.
call
(
this
)
||
this
,
t
=
e
.
body
=
new
svga
.
Svga
;
return
t
.
x
=-
props
.
blockWidth
/
2
,
t
.
y
=-
props
.
blockHitHeight
-
props
.
blockPaddingTop
,
e
.
addChild
(
t
),
e
}
return
tslib
.
__extends
(
e
,
i
),
e
.
prototype
.
reset
=
function
(
e
){
var
t
=
e
.
type
;
this
.
dir
=
.
5
<
Math
.
random
()?
1
:
-
1
,
this
.
type
=
t
;
var
i
=
getBlockAsset
();
this
.
body
.
source
=
"asset://"
+
i
.
uuid
,
this
.
scaleX
=
this
.
dir
,
this
.
body
.
gotoAndStop
(
1
),
this
.
body
.
visible
=!
0
},
e
.
prototype
.
playEnter
=
function
(
e
,
t
){
var
i
=
this
;
this
.
visible
=!
0
,
this
.
x
=
this
.
dir
*
this
.
stage
.
width
;
var
n
=
props
.
blockDurationRange
,
s
=
n
[
0
],
o
=
n
[
1
],
r
=
Math
.
max
(
o
-
e
*
props
.
blockDurationStep
,
s
);
return
r
+=
o
*
Math
.
random
()
*
props
.
blockDurationRandom
*
(.
5
<
Math
.
random
()?
1
:
-
1
),
new
Promise
(
function
(
e
){
t
?
engine
.
Tween
.
get
(
i
,
null
,
null
,
!
0
).
to
({
x
:
0
},
r
).
call
(
e
):(
i
.
x
=
0
,
setTimeout
(
function
(){},
200
),
e
())})},
e
.
prototype
.
playLeave
=
function
(){
this
.
visible
=!
1
},
e
.
prototype
.
playEffect
=
function
(){
var
e
=
this
.
body
;
e
.
play
(
!
0
,
!
1
),
e
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
e
.
gotoAndStop
(
1
)},
this
)},
e
.
prototype
.
stop
=
function
(){
engine
.
Tween
.
removeTweens
(
this
)},
e
}(
engine
.
Container
),
GoldBag
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
setup
(),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
setup
=
function
(){
var
e
=
this
.
avatar
=
new
engine
.
Sprite
(
getTextureByName
(
"钱袋-静态"
));
e
.
x
=-
props
.
goldPackAvatarAnchor
.
x
,
e
.
y
=-
props
.
goldPackAvatarAnchor
.
y
,
this
.
addChild
(
e
);
var
t
=
this
.
svga
=
createSvga
(
"钱袋"
,
"goldPackAnchor"
);
t
.
visible
=!
1
,
this
.
addChild
(
t
)},
e
.
prototype
.
reset
=
function
(
e
){
this
.
y
=
e
.
y
,
this
.
avatar
.
visible
=!
0
,
this
.
svga
.
visible
=!
1
,
this
.
svga
.
gotoAndStop
(
1
),
this
.
remain
=
e
.
remain
},
e
.
prototype
.
playOpen
=
function
(){
var
t
=
this
;
return
this
.
avatar
.
visible
=!
1
,
this
.
svga
.
visible
=!
0
,
new
Promise
(
function
(
e
){
t
.
svga
.
play
(
!
0
,
!
1
),
t
.
svga
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
svga
.
visible
=!
1
,
e
()},
t
)})},
e
}(
engine
.
Container
),
GuideLayer
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
setup
(),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
setup
=
function
(){},
e
.
prototype
.
show
=
function
(
e
,
a
){
var
h
=
this
;
return
new
Promise
(
function
(
e
){
var
t
,
i
,
n
,
s
,
o
,
r
;
h
.
visible
=!
0
,
h
.
guideMask
||
(
i
=
(
t
=
h
.
stage
).
width
,
n
=
t
.
height
,
s
=
h
.
guideMask
=
new
engine
.
Container
,(
o
=
new
engine
.
Image
(
getTextureByName
(
"引导遮罩"
))).
x
=
(
i
-
o
.
width
)
/
2
,
o
.
y
=
a
.
y
-
100
,
s
.
addChild
(
o
),
h
.
createRect
(
s
,
0
,
0
,
i
,
o
.
y
),
h
.
createRect
(
s
,
0
,
o
.
y
,
o
.
x
,
o
.
height
),
h
.
createRect
(
s
,
o
.
x
+
o
.
width
,
o
.
y
,
i
-
o
.
x
-
o
.
width
,
o
.
height
),
h
.
createRect
(
s
,
0
,
o
.
y
+
o
.
height
,
i
,
n
-
o
.
y
-
o
.
height
),(
r
=
h
.
label
=
new
engine
.
Label
).
fillColor
=
"white"
,
r
.
size
=
25
,
r
.
text
=
props
.
guideText
,
r
.
x
=
(
i
-
r
.
width
)
/
2
,
r
.
y
=
o
.
y
+
o
.
height
+
50
,
s
.
addChild
(
r
),
h
.
addChild
(
s
)),
h
.
once
(
engine
.
MouseEvent
.
CLICK
,
function
(){
this
.
visible
=!
1
,
e
()},
h
)})},
e
.
prototype
.
createRect
=
function
(
e
,
t
,
i
,
n
,
s
){
var
o
=
new
engine
.
Rect
;
o
.
x
=
t
,
o
.
y
=
i
,
o
.
width
=
n
,
o
.
height
=
s
,
o
.
fillColor
=
"black"
,
o
.
alpha
=
.
7
,
e
.
addChild
(
o
)},
e
}(
engine
.
Container
),
svgaAssets
=
{
aniReady
:{
name
:
"准备立正"
,
dir
:
1
},
aniReady2
:{
name
:
"准备立正"
,
dir
:
1
},
aniJump
:{
name
:
"跳上升"
,
dir
:
1
},
aniFall
:{
name
:
"跳下落"
,
dir
:
1
},
aniLandNormal
:{
name
:
"普通着地"
,
dir
:
1
},
aniLandSide
:{
name
:
"边缘着地"
,
dir
:
-
1
},
aniHit
:{
name
:
"被撞开"
,
dir
:
-
1
},
aniParachute
:{
name
:
"降落pic"
,
dir
:
-
1
,
type
:
"pic"
},
aniLandPerfect
:{
name
:
"完美着地_笑"
,
dir
:
1
}},
Player
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
g
=
props
.
gravity
,
e
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
e
.
onEnterFrame
,
e
),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
switchAni
=
function
(
n
,
s
,
o
,
r
){
var
a
=
this
;
return
void
0
===
s
&&
(
s
=
1
),
void
0
===
o
&&
(
o
=!
0
),
void
0
===
r
&&
(
r
=!
1
),
new
Promise
(
function
(
e
){
var
t
,
i
;
a
.
scaleX
=
s
,
a
.
_aniName
!==
n
&&
(
a
.
_aniName
=
n
,(
t
=
a
.
removeChild
(
a
.
getChildByName
(
"body"
)))
&&
t
.
stop
&&
t
.
stop
(),
i
=
a
.
_currentAni
=
a
[
"ani"
+
n
],
a
.
addChild
(
i
),
i
.
y
=-
300
,
o
?(
i
.
play
&&
i
.
play
(
!
1
,
r
),
r
?
e
():
i
.
once
(
engine
.
Event
.
END_FRAME
,
e
)):
e
())})},
e
.
prototype
.
setup
=
function
(){
for
(
var
e
in
this
.
prefectEffect
=
createSvga
(
"完美着地特效"
,
"playerLandPrefectAnchor"
),
this
.
landEffect
=
createSvga
(
"着地特效"
,
"playerLandEffectAnchor"
),
svgaAssets
){
var
t
,
i
,
n
=
void
0
,
s
=
svgaAssets
[
e
],
o
=
s
.
name
,
r
=
s
.
dir
;
"pic"
==
s
.
type
?(
t
=
75
,
i
=
122
,(
n
=
this
[
e
]
=
new
engine
.
Image
(
getTextureByName
(
"降落pic"
))).
x
=-
t
,
n
.
y
=-
i
,
n
.
anchorX
=
t
,
n
.
anchorY
=
i
):
n
=
this
[
e
]
=
createSvga
(
o
,
e
.
replace
(
"ani"
,
"player"
)
+
"Anchor"
),
n
.
name
=
"body"
,
n
.
scaleX
=
r
}},
e
.
prototype
.
reset
=
function
(
e
){
this
.
x
=
0
,
this
.
rotation
=
0
,
this
.
scaleX
=
this
.
scaleY
=
1
,
this
.
_prefectLandCounting
=
0
,
engine
.
Tween
.
removeTweens
(
this
),
e
&&
this
.
switchAni
(
"Jump"
,
1
,
!
1
)},
e
.
prototype
.
playReady
=
function
(){
var
t
=
this
;
return
new
Promise
(
function
(
e
){
t
.
switchAni
(
"Ready"
,
1
),
setTimeout
(
function
(){
t
.
switchAni
(
"Ready2"
,
1
,
!
0
,
!
0
),
e
()},
200
)})},
e
.
prototype
.
onEnterFrame
=
function
(
e
){
this
.
playing
&&
(
this
.
vy
+=
this
.
g
,
this
.
y
+=
this
.
vy
,
0
<
this
.
vy
&&
"Fall"
!==
this
.
_aniName
&&
(
this
.
dispatchEvent
(
"jump-on-top"
),
this
.
switchAni
(
"Fall"
)),
this
.
y
>
this
.
baseY
&&
(
this
.
y
=
this
.
baseY
,
this
.
playing
=!
1
,
this
.
jumpPromise
&&
this
.
jumpPromise
({
aboveBlock
:
this
.
aboveBlock
}),
this
.
jumpPromise
=
null
))},
e
.
prototype
.
changeBaseY
=
function
(
e
){
this
.
baseY
!=
e
&&
(
this
.
aboveBlock
=!
0
,
this
.
baseY
=
e
)},
e
.
prototype
.
jump
=
function
(){
var
t
=
this
;
return
playSound
(
"跳起音效"
),
this
.
switchAni
(
"Jump"
,
1
,
!
1
),
this
.
_currentAni
.
play
(
!
1
,
!
1
),
this
.
aboveBlock
=!
1
,
this
.
playing
=!
0
,
this
.
baseY
=
this
.
y
,
this
.
vy
=-
props
.
jumpSpeed
,
new
Promise
(
function
(
e
){
t
.
jumpPromise
=
e
})},
e
.
prototype
.
playLand
=
function
(
n
,
s
){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
switch
(
n
){
case
0
:
return
[
3
,
1
];
case
1
:
case
2
:
return
[
3
,
4
];
case
3
:
return
[
3
,
5
]}
return
[
3
,
6
];
case
1
:
return
this
.
_prefectLandCounting
++
,
playSound
(
"完美落地音效"
+
Math
.
min
(
4
,
this
.
_prefectLandCounting
)),
t
=
this
.
prefectEffect
,
this
.
addChildAt
(
t
,
0
),
t
.
gotoAndPlay
(
1
),
t
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
removeChild
(
t
)},
this
),
i
=
this
.
landEffect
,
this
.
addChildAt
(
i
,
0
),
i
.
gotoAndPlay
(
1
),
i
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
removeChild
(
i
)},
this
),[
4
,
this
.
switchAni
(
"LandPerfect"
)];
case
2
:
return
e
.
sent
(),[
4
,
this
.
switchAni
(
"Ready2"
,
1
,
!
0
,
!
0
)];
case
3
:
return
e
.
sent
(),[
3
,
6
];
case
4
:
return
this
.
_prefectLandCounting
=
0
,
playSound
(
"普通落地音效"
),
this
.
switchAni
(
"Ready2"
,
1
,
!
0
,
!
0
),[
3
,
6
];
case
5
:
return
this
.
_prefectLandCounting
=
0
,
playSound
(
"边缘落地音效"
),
this
.
switchAni
(
"LandSide"
,
s
),[
3
,
6
];
case
6
:
return
[
2
]}})})},
e
.
prototype
.
hitAway
=
function
(
i
){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
=
this
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
jumpPromise
&&
this
.
jumpPromise
(),
this
.
jumpPromise
=
null
,
playSound
(
"被撞开音效"
),
this
.
switchAni
(
"Hit"
,
i
),
this
.
vy
=
0
,[
4
,
new
Promise
(
function
(
e
){
engine
.
Tween
.
get
(
t
).
to
({
x
:
-
i
*
props
.
hitAwayDistance
.
x
},
props
.
hitAwayDuration
,
engine
.
Ease
.
quartOut
),
engine
.
Tween
.
get
(
t
).
to
({
y
:
t
.
y
+
props
.
hitAwayDistance
.
y
},
props
.
hitAwayDuration
,
engine
.
Ease
.
cubicOut
).
call
(
e
)})];
case
1
:
return
e
.
sent
(),[
2
]}})})},
e
.
prototype
.
parachute
=
function
(
e
){
var
t
=
this
;
return
this
.
switchAni
(
"Parachute"
,
e
),
new
Promise
(
function
(
e
){
engine
.
Tween
.
get
(
t
).
call
(
function
(){
playSound
(
"降落伞下落音效"
)}).
to
({
y
:
t
.
y
+
props
.
parachuteDistance
},
props
.
parachuteDuration
).
set
({
anchorOffsetY
:
0
}).
call
(
e
)})},
e
}(
engine
.
Container
),
ObjectPool
=
engine
.
ObjectPool
,
PoolName
=
"gold-bag"
;
ObjectPool
.
registerPool
(
PoolName
,
function
(){
return
new
GoldBag
},
function
(
e
,
t
){
e
.
reset
(
t
)});
var
GameView
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
index
=-
1
,
e
.
goldBags
=
[],
e
.
baseOffset
=-
props
.
baseOffset
+
props
.
playerOffset
,
e
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
e
.
setup
,
e
),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
setup
=
function
(){
var
e
,
t
,
i
,
n
,
s
,
o
,
r
,
a
,
h
,
c
,
l
;
this
.
_hasSetup
||
(
this
.
_hasSetup
=!
0
,
t
=
(
e
=
this
.
stage
).
width
,
i
=
e
.
height
,(
n
=
this
.
background
=
new
Background
).
y
=
i
-
1624
,
this
.
addChild
(
n
),
n
.
setup
(),(
s
=
this
.
frontContainer
=
new
engine
.
Container
).
x
=
t
/
2
,
this
.
addChild
(
s
),
o
=
this
.
guideLayer
=
new
GuideLayer
,
this
.
addChild
(
o
),
r
=
this
.
blockContainer
=
new
engine
.
Container
,
s
.
addChild
(
r
),
a
=
this
.
base
=
new
Base
,
s
.
addChild
(
a
),
a
.
setup
(),
h
=
this
.
player
=
new
Player
,
s
.
addChildAt
(
h
,
0
),
h
.
setup
(),
h
.
addEventListener
(
"jump-on-top"
,
this
.
onPlayerJumpOnTop
,
this
),(
c
=
this
.
scoreAddTipsContainer
=
new
engine
.
Container
).
width
=
750
,
c
.
anchorX
=
c
.
width
/
2
,
c
.
anchorY
=
c
.
height
/
2
,(
l
=
this
.
scoreAddTips
=
new
engine
.
Label
).
width
=
750
,
l
.
fillColor
=
props
.
scoreAddFontColor
,
l
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
,
l
.
size
=
props
.
scoreAddFontSize
,
l
.
alpha
=
0
,
l
.
text
=
"+0"
,
l
.
x
=
this
.
player
.
x
-
l
.
width
/
2
,
c
.
addChild
(
l
),
s
.
addChildAt
(
h
,
0
),
s
.
addChild
(
c
),
ObjectPool
.
recycleObject
(
PoolName
,
ObjectPool
.
getObject
(
PoolName
,{
y
:
0
,
remain
:
0
})),
this
.
hitEffect
=
createSvga
(
"被撞烟雾"
,
"hitEffectAnchor"
),
this
.
pos
=
0
,
this
.
background
.
setup
(),
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
),
this
.
reset
())},
e
.
prototype
.
setScoreText
=
function
(
i
){
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
.
scoreAddTips
.
text
=
i
,
t
.
scoreAddTips
.
y
=
0
,
t
.
scoreAddTips
.
alpha
=
1
,
engine
.
Tween
.
get
(
t
.
scoreAddTips
,
null
,
null
,
!
0
).
to
({
y
:
-
100
,
alpha
:
0
},
500
,
engine
.
Ease
.
cubicInOut
).
call
(
e
)})]})})},
e
.
prototype
.
reset
=
function
(
o
){
return
void
0
===
o
&&
(
o
=!
1
),
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
,
n
,
s
;
return
tslib
.
__generator
(
this
,
function
(
e
){
if
(
this
.
base
.
reset
(),
this
.
index
=-
1
,
this
.
_score
=
0
,
!
o
)
for
(
this
.
pos
=
0
,
t
=
this
.
blockContainer
,
i
=
0
,
n
=
t
.
children
.
length
;
i
<
n
;
i
++
)
t
.
getChildAt
(
i
).
playLeave
();
for
(
i
=
0
;
i
<
props
.
initBlockCount
;
i
++
)
this
.
addBlock
(
!
1
);
for
(
i
=
0
,
n
=
this
.
goldBags
.
length
;
i
<
n
;
i
++
)
s
=
this
.
goldBags
[
i
],
this
.
frontContainer
.
removeChild
(
s
),
ObjectPool
.
recycleObject
(
PoolName
,
s
);
return
this
.
goldBags
.
splice
(
0
),
this
.
resetPlayer
(
o
),[
2
]})})},
e
.
prototype
.
resetPlayer
=
function
(
e
){
void
0
===
e
&&
(
e
=!
1
),
this
.
player
.
reset
(
e
),
this
.
player
.
y
=
this
.
baseOffset
-
(
this
.
index
+
1
)
*
props
.
blockHitHeight
+
props
.
blockBaseOffset
},
e
.
prototype
.
start
=
function
(
n
){
return
void
0
===
n
&&
(
n
=!
1
),
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
=
this
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
scoreAddTipsContainer
.
y
=
this
.
player
.
y
+
props
.
scoreAddTipsOffset
,
n
?[
3
,
2
]:[
4
,
this
.
player
.
playReady
()];
case
1
:
e
.
sent
(),
e
.
label
=
2
;
case
2
:
return
(
console
.
log
(
"开始"
),
t
=
"jump-high-guide_"
+
props
.
guideFlagKey
,
localStorage
.
getItem
(
t
))?[
3
,
4
]:(
localStorage
.
setItem
(
t
,
"1"
),[
4
,
this
.
guideLayer
.
show
(
""
,{
y
:
this
.
stage
.
height
+
this
.
player
.
y
-
280
})]);
case
3
:
e
.
sent
(),
e
.
label
=
4
;
case
4
:
return
this
.
lastLandType
=
0
,
this
.
_remainToShowGoldBag
=
props
.
goldBagScoreMultiple
-
props
.
goldBagScoreSubtraction
,
this
.
_touchEnabled
=!
0
,
setTimeout
(
function
(){
i
.
addBlock
()},
100
),
engine
.
globalEvent
.
dispatchEvent
(
"jump-high-game-start"
),[
2
]}})})},
e
.
prototype
.
pause
=
function
(){
this
.
currentBlock
&&
engine
.
Tween
.
pauseTweens
(
this
.
currentBlock
),
engine
.
Tween
.
pauseTweens
(
this
.
player
)},
e
.
prototype
.
resume
=
function
(){
this
.
currentBlock
&&
engine
.
Tween
.
resumeTweens
(
this
.
currentBlock
),
engine
.
Tween
.
resumeTweens
(
this
.
player
)},
e
.
prototype
.
revive
=
function
(){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
blockContainer
.
getChildAt
(
this
.
index
).
visible
=!
1
,
this
.
index
--
,[
4
,
this
.
resetPlayer
(
!
0
)];
case
1
:
return
e
.
sent
(),
this
.
start
(
!
0
),[
2
]}})})},
e
.
prototype
.
addBlock
=
function
(
e
){
var
t
=
this
;
void
0
===
e
&&
(
e
=!
0
),
this
.
index
++
;
var
i
,
n
=
this
.
blockContainer
;
n
.
children
.
length
>
this
.
index
?(
i
=
n
.
getChildAt
(
this
.
index
)).
visible
=!
0
:(
i
=
new
Block
,
n
.
addChildAt
(
i
,
0
)),
n
.
addChildAt
(
i
,
0
),
i
.
reset
({
type
:
Math
.
floor
(
Math
.
random
()
*
props
.
blockAssets
.
length
)}),
console
.
log
(
"addblock"
,
this
.
index
),
i
.
y
=
this
.
baseOffset
-
this
.
index
*
props
.
blockHitHeight
+
props
.
blockBaseOffset
,
this
.
blockComplete
=!
1
,
i
.
playEnter
(
this
.
index
,
e
).
then
(
function
(
e
){
t
.
blockComplete
=!
0
}),
e
&&
(
this
.
needHitTest
=!
0
),
this
.
currentBlock
=
i
},
e
.
prototype
.
addGoldBag
=
function
(){
var
e
=
ObjectPool
.
getObject
(
PoolName
,{
y
:
this
.
baseOffset
-
(
this
.
blockCount
+
props
.
goldBagDistance
+
props
.
goldBagJumpSubtraction
)
*
props
.
blockHitHeight
,
remain
:
props
.
goldBagDistance
});
this
.
frontContainer
.
addChild
(
e
),
this
.
goldBags
.
push
(
e
)},
e
.
prototype
.
playOpenGoldBag
=
function
(){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
,
n
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
t
=
0
,
i
=
this
.
goldBags
.
length
,
e
.
label
=
1
;
case
1
:
return
t
<
i
?((
n
=
this
.
goldBags
[
t
]).
remain
--
,
n
.
remain
<=
0
?(
this
.
goldBags
.
splice
(
t
,
1
),
t
--
,
i
--
,
this
.
nextToUpdateScore
=!
0
,[
4
,
n
.
playOpen
()]):[
3
,
3
]):[
3
,
4
];
case
2
:
e
.
sent
(),
this
.
frontContainer
.
removeChild
(
n
),
ObjectPool
.
recycleObject
(
PoolName
,
n
),
e
.
label
=
3
;
case
3
:
return
t
++
,[
3
,
1
];
case
4
:
return
[
2
]}})})},
e
.
prototype
.
onPlayerJumpOnTop
=
function
(){
this
.
nextToUpdateScore
&&
(
this
.
nextToUpdateScore
=!
1
,
this
.
scoreChange
(
4
),
playSound
(
"撞击钱袋音效"
))},
Object
.
defineProperty
(
e
.
prototype
,
"blockCount"
,{
get
:
function
(){
return
this
.
index
-
props
.
initBlockCount
+
1
},
enumerable
:
!
1
,
configurable
:
!
0
}),
Object
.
defineProperty
(
e
.
prototype
,
"pos"
,{
get
:
function
(){
return
this
.
_pos
},
set
:
function
(
e
){
this
.
_pos
=
e
,
this
.
updatePos
()},
enumerable
:
!
1
,
configurable
:
!
0
}),
e
.
prototype
.
updatePos
=
function
(){
this
.
frontContainer
.
y
=
this
.
stage
.
height
+
this
.
_pos
},
e
.
prototype
.
onEnterFrame
=
function
(
e
){
var
t
,
i
,
n
,
s
,
o
,
r
,
a
,
h
,
c
,
l
,
p
;
this
.
needHitTest
&&
this
.
currentBlock
&&
(
i
=
(
t
=
this
.
currentBlock
).
x
,
n
=
t
.
y
,
s
=
t
.
dir
,
r
=
(
o
=
this
.
player
).
x
,
a
=
o
.
y
,
h
=
props
.
blockHitWidth
,
c
=
props
.
blockHitHeight
,
l
=
props
.
playerWidth
,
p
=!
1
,
Math
.
abs
(
r
-
i
)
<
(
h
+
l
)
/
2
&&
(
this
.
player
.
changeBaseY
(
n
-
c
),
n
-
c
<
a
&&
(
p
=!
0
)),
p
&&
this
.
onHitOn
(
s
))},
e
.
prototype
.
onHitOn
=
function
(
t
){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
_touchEnabled
=!
1
,
this
.
needHitTest
=!
1
,
clearInterval
(
this
.
timer
),[
4
,
this
.
player
.
hitAway
(
t
)];
case
1
:
return
e
.
sent
(),
this
.
frontContainer
.
addChild
(
this
.
player
),[
4
,
this
.
player
.
parachute
(
t
)];
case
2
:
return
e
.
sent
(),
console
.
log
(
"jump-high-game-end"
),
engine
.
globalEvent
.
dispatchEvent
(
"jump-high-game-end"
),[
2
]}})})},
e
.
prototype
.
jump
=
function
(){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
,
n
,
s
,
o
=
this
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
_touchEnabled
?(
this
.
_touchEnabled
=!
1
,
this
.
playOpenGoldBag
(),[
4
,
this
.
player
.
jump
()]):[
2
];
case
1
:
return
(
t
=
e
.
sent
())?
t
.
aboveBlock
?(
i
=
Math
.
abs
(
this
.
currentBlock
.
x
),(
n
=
0
)
<
i
&&
(
n
=
0
<
i
&&
i
<
props
.
scoreThreshold
?
2
:
3
),
s
=
this
.
lastLandType
,
0
===
(
this
.
lastLandType
=
n
)
&&
s
!==
n
&&
(
n
=
1
),
this
.
currentBlock
.
playEffect
(),
this
.
player
.
playLand
(
n
,
this
.
currentBlock
.
dir
),
this
.
currentBlock
.
stop
(),
this
.
scoreChange
(
n
),[
4
,
new
Promise
(
function
(
e
){
engine
.
Tween
.
get
(
o
,
null
,
null
,
!
0
).
to
({
pos
:
props
.
blockHitHeight
*
o
.
index
},
300
,
engine
.
Ease
.
cubicOut
).
call
(
e
)})]):[
3
,
3
]:[
3
,
4
];
case
2
:
e
.
sent
(),
this
.
addBlock
(),
e
.
label
=
3
;
case
3
:
this
.
_touchEnabled
=!
0
,
e
.
label
=
4
;
case
4
:
return
[
2
]}})})},
e
.
prototype
.
scoreChange
=
function
(
e
){
var
t
=
props
.
scoreWeights
[
e
];
this
.
_score
+=
t
,
this
.
_remainToShowGoldBag
-=
t
;
var
i
=
this
.
_score
;
engine
.
globalEvent
.
dispatchEvent
(
"jump-high-score"
,{
type
:
e
,
score
:
i
,
scoreAdd
:
t
}),
this
.
scoreAddTipsContainer
.
y
=
this
.
player
.
y
+
props
.
scoreAddTipsOffset
,
this
.
setScoreText
(
"+"
+
t
),
console
.
log
(
i
,
this
.
_remainToShowGoldBag
),
this
.
_remainToShowGoldBag
<=
0
&&
(
this
.
_remainToShowGoldBag
+=
props
.
goldBagScoreMultiple
,
this
.
addGoldBag
(),
console
.
log
(
"addGoldBag"
))},
e
.
prototype
.
playHitEffect
=
function
(
e
){
var
t
=
this
.
hitEffect
;
t
.
scaleX
=
e
,
t
.
y
=
this
.
player
.
y
-
props
.
hitEffectAnchor
.
y
,
t
.
play
(
!
0
,
!
1
),
t
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
frontContainer
.
removeChild
(
t
)},
this
),
this
.
frontContainer
.
addChild
(
t
)},
e
}(
engine
.
Container
),
JumpHigh
=
function
(
i
){
function
e
(){
var
e
=
i
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
"jump-high-reset"
,
e
.
reset
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-start"
,
e
.
start
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-pause"
,
e
.
pause
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-resume"
,
e
.
resume
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-revive"
,
e
.
revive
,
e
),
e
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
e
.
onTap
,
e
);
var
t
=
e
.
_gameView
=
new
GameView
;
return
e
.
addChild
(
t
),
e
}
return
tslib
.
__extends
(
e
,
i
),
e
.
prototype
.
reset
=
function
(){
this
.
_gameView
.
reset
()},
e
.
prototype
.
start
=
function
(
e
){
injectProps
(
e
.
data
),
this
.
_status
=
1
,
this
.
_gameView
.
start
()},
e
.
prototype
.
pause
=
function
(){
this
.
_gameView
.
pause
()},
e
.
prototype
.
resume
=
function
(){
this
.
_gameView
.
resume
()},
e
.
prototype
.
revive
=
function
(){
this
.
_gameView
.
revive
()},
e
.
prototype
.
onTap
=
function
(
e
){
this
.
_gameView
.
jump
()},
e
}(
engine
.
Container
);
function
index
(
e
){
return
prepareProps
(),
injectProps
(
e
),
new
JumpHigh
}
module
.
exports
=
index
;
"use strict"
;
var
tslib
=
require
(
"tslib"
),
props
=
{};
function
prepareProps
(){
var
e
=
getProps
();
engine
.
injectProp
(
props
,
e
)}
function
injectProps
(
e
){
engine
.
injectProp
(
props
,
e
)}
function
getTexture
(
e
){
return
engine
.
Texture
.
from
(
getAssetByUUID
(
e
).
uuid
)}
function
getTextureByName
(
e
){
return
getTexture
(
engine
.
getAssetByName
(
e
).
uuid
)}
function
getBlockAsset
(){
return
engine
.
getAssetByName
(
props
.
blockAssets
[
0
])}
function
createSvga
(
e
,
t
){
var
i
=
new
svga
.
Svga
;
i
.
source
=
"asset://"
+
engine
.
getAssetByName
(
e
).
uuid
;
var
n
=
props
[
t
];
return
n
&&
(
i
.
x
=-
n
.
x
,
i
.
y
=-
n
.
y
,
i
.
anchorX
=
n
.
x
,
i
.
anchorY
=
n
.
y
),
i
}
function
playSound
(
e
){
engine
.
playSound
(
engine
.
getAssetByName
(
e
).
uuid
,{
keep
:
!
0
})}
var
Background
=
function
(
e
){
function
t
(){
return
e
.
call
(
this
)
||
this
}
return
tslib
.
__extends
(
t
,
e
),
t
.
prototype
.
setup
=
function
(){
var
e
=
this
.
stage
,
t
=
(
e
.
width
,
e
.
height
,
this
.
_bg
=
new
engine
.
Image
(
getTextureByName
(
"背景图"
)));
this
.
addChild
(
t
)},
t
.
prototype
.
playZoom
=
function
(
i
,
n
){
var
s
=
this
;
return
void
0
===
n
&&
(
n
=
700
),
new
Promise
(
function
(
e
){
var
t
=
"in"
===
i
?
1
:
s
.
_minScale
;
engine
.
Tween
.
get
(
s
.
_bg
,
null
,
null
,
!
0
).
to
({
scaleX
:
t
,
scaleY
:
t
},
n
,
engine
.
Ease
.
cubicInOut
).
call
(
e
)})},
t
}(
engine
.
Container
),
Base
=
function
(
e
){
function
t
(){
return
e
.
call
(
this
,
getTextureByName
(
"底座"
))
||
this
}
return
tslib
.
__extends
(
t
,
e
),
t
.
prototype
.
setup
=
function
(){
this
.
x
=-
this
.
width
/
2
},
t
.
prototype
.
reset
=
function
(){
this
.
y
=-
props
.
baseOffset
},
t
}(
engine
.
Image
),
Block
=
function
(
i
){
function
e
(){
var
e
=
i
.
call
(
this
)
||
this
,
t
=
e
.
body
=
new
svga
.
Svga
;
return
t
.
x
=-
props
.
blockWidth
/
2
,
t
.
y
=-
props
.
blockHitHeight
-
props
.
blockPaddingTop
,
e
.
addChild
(
t
),
e
}
return
tslib
.
__extends
(
e
,
i
),
e
.
prototype
.
reset
=
function
(
e
){
var
t
=
e
.
type
;
this
.
dir
=
.
5
<
Math
.
random
()?
1
:
-
1
,
this
.
type
=
t
;
var
i
=
getBlockAsset
();
this
.
body
.
source
=
"asset://"
+
i
.
uuid
,
this
.
scaleX
=
this
.
dir
,
this
.
body
.
gotoAndStop
(
1
),
this
.
body
.
visible
=!
0
},
e
.
prototype
.
playEnter
=
function
(
e
,
t
){
var
i
=
this
;
this
.
visible
=!
0
,
this
.
x
=
this
.
dir
*
this
.
stage
.
width
;
var
n
=
props
.
blockDurationRange
,
s
=
n
[
0
],
o
=
n
[
1
],
r
=
Math
.
max
(
o
-
e
*
props
.
blockDurationStep
,
s
);
return
r
+=
o
*
Math
.
random
()
*
props
.
blockDurationRandom
*
(.
5
<
Math
.
random
()?
1
:
-
1
),
new
Promise
(
function
(
e
){
t
?
engine
.
Tween
.
get
(
i
,
null
,
null
,
!
0
).
to
({
x
:
0
},
r
).
call
(
e
):(
i
.
x
=
0
,
setTimeout
(
function
(){},
200
),
e
())})},
e
.
prototype
.
playLeave
=
function
(){
this
.
visible
=!
1
},
e
.
prototype
.
playEffect
=
function
(){
var
e
=
this
.
body
;
e
.
play
(
!
0
,
!
1
),
e
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
e
.
gotoAndStop
(
1
)},
this
)},
e
.
prototype
.
stop
=
function
(){
engine
.
Tween
.
removeTweens
(
this
)},
e
}(
engine
.
Container
),
GoldBag
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
setup
(),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
setup
=
function
(){
var
e
=
this
.
avatar
=
new
engine
.
Sprite
(
getTextureByName
(
"钱袋-静态"
));
e
.
x
=-
props
.
goldPackAvatarAnchor
.
x
,
e
.
y
=-
props
.
goldPackAvatarAnchor
.
y
,
this
.
addChild
(
e
);
var
t
=
this
.
svga
=
createSvga
(
"钱袋"
,
"goldPackAnchor"
);
t
.
visible
=!
1
,
this
.
addChild
(
t
)},
e
.
prototype
.
reset
=
function
(
e
){
this
.
y
=
e
.
y
,
this
.
avatar
.
visible
=!
0
,
this
.
svga
.
visible
=!
1
,
this
.
svga
.
gotoAndStop
(
1
),
this
.
remain
=
e
.
remain
},
e
.
prototype
.
playOpen
=
function
(){
var
t
=
this
;
return
this
.
avatar
.
visible
=!
1
,
this
.
svga
.
visible
=!
0
,
new
Promise
(
function
(
e
){
t
.
svga
.
play
(
!
0
,
!
1
),
t
.
svga
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
svga
.
visible
=!
1
,
e
()},
t
)})},
e
}(
engine
.
Container
),
GuideLayer
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
setup
(),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
setup
=
function
(){},
e
.
prototype
.
show
=
function
(
e
,
a
){
var
h
=
this
;
return
new
Promise
(
function
(
e
){
var
t
,
i
,
n
,
s
,
o
,
r
;
h
.
visible
=!
0
,
h
.
guideMask
||
(
i
=
(
t
=
h
.
stage
).
width
,
n
=
t
.
height
,
s
=
h
.
guideMask
=
new
engine
.
Container
,(
o
=
new
engine
.
Image
(
getTextureByName
(
"引导遮罩"
))).
x
=
(
i
-
o
.
width
)
/
2
,
o
.
y
=
a
.
y
-
100
,
s
.
addChild
(
o
),
h
.
createRect
(
s
,
0
,
0
,
i
,
o
.
y
),
h
.
createRect
(
s
,
0
,
o
.
y
,
o
.
x
,
o
.
height
),
h
.
createRect
(
s
,
o
.
x
+
o
.
width
,
o
.
y
,
i
-
o
.
x
-
o
.
width
,
o
.
height
),
h
.
createRect
(
s
,
0
,
o
.
y
+
o
.
height
,
i
,
n
-
o
.
y
-
o
.
height
),(
r
=
h
.
label
=
new
engine
.
Label
).
fillColor
=
"white"
,
r
.
size
=
25
,
r
.
text
=
props
.
guideText
,
r
.
x
=
(
i
-
r
.
width
)
/
2
,
r
.
y
=
o
.
y
+
o
.
height
+
50
,
s
.
addChild
(
r
),
h
.
addChild
(
s
)),
h
.
once
(
engine
.
MouseEvent
.
CLICK
,
function
(){
this
.
visible
=!
1
,
e
()},
h
)})},
e
.
prototype
.
createRect
=
function
(
e
,
t
,
i
,
n
,
s
){
var
o
=
new
engine
.
Rect
;
o
.
x
=
t
,
o
.
y
=
i
,
o
.
width
=
n
,
o
.
height
=
s
,
o
.
fillColor
=
"black"
,
o
.
alpha
=
.
7
,
e
.
addChild
(
o
)},
e
}(
engine
.
Container
),
svgaAssets
=
{
aniReady
:{
name
:
"准备立正"
,
dir
:
1
},
aniReady2
:{
name
:
"准备立正"
,
dir
:
1
},
aniJump
:{
name
:
"跳上升"
,
dir
:
1
},
aniFall
:{
name
:
"跳下落"
,
dir
:
1
},
aniLandNormal
:{
name
:
"普通着地"
,
dir
:
1
},
aniLandSide
:{
name
:
"边缘着地"
,
dir
:
-
1
},
aniHit
:{
name
:
"被撞开"
,
dir
:
-
1
},
aniParachute
:{
name
:
"降落pic"
,
dir
:
-
1
,
type
:
"pic"
},
aniLandPerfect
:{
name
:
"完美着地_笑"
,
dir
:
1
}},
Player
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
g
=
props
.
gravity
,
e
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
e
.
onEnterFrame
,
e
),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
switchAni
=
function
(
n
,
s
,
o
,
r
){
var
a
=
this
;
return
void
0
===
s
&&
(
s
=
1
),
void
0
===
o
&&
(
o
=!
0
),
void
0
===
r
&&
(
r
=!
1
),
new
Promise
(
function
(
e
){
var
t
,
i
;
a
.
scaleX
=
s
,
a
.
_aniName
!==
n
&&
(
a
.
_aniName
=
n
,(
t
=
a
.
removeChild
(
a
.
getChildByName
(
"body"
)))
&&
t
.
stop
&&
t
.
stop
(),
i
=
a
.
_currentAni
=
a
[
"ani"
+
n
],
a
.
addChild
(
i
),
i
.
y
=-
300
,
o
?(
i
.
play
&&
i
.
play
(
!
1
,
r
),
r
?
e
():
i
.
once
(
engine
.
Event
.
END_FRAME
,
e
)):
e
())})},
e
.
prototype
.
setup
=
function
(){
for
(
var
e
in
this
.
prefectEffect
=
createSvga
(
"完美着地特效"
,
"playerLandPrefectAnchor"
),
this
.
landEffect
=
createSvga
(
"着地特效"
,
"playerLandEffectAnchor"
),
svgaAssets
){
var
t
,
i
,
n
=
void
0
,
s
=
svgaAssets
[
e
],
o
=
s
.
name
,
r
=
s
.
dir
;
"pic"
==
s
.
type
?(
t
=
75
,
i
=
122
,(
n
=
this
[
e
]
=
new
engine
.
Image
(
getTextureByName
(
"降落pic"
))).
x
=-
t
,
n
.
y
=-
i
,
n
.
anchorX
=
t
,
n
.
anchorY
=
i
):
n
=
this
[
e
]
=
createSvga
(
o
,
e
.
replace
(
"ani"
,
"player"
)
+
"Anchor"
),
n
.
name
=
"body"
,
n
.
scaleX
=
r
}},
e
.
prototype
.
reset
=
function
(
e
){
this
.
x
=
0
,
this
.
rotation
=
0
,
this
.
scaleX
=
this
.
scaleY
=
1
,
this
.
_prefectLandCounting
=
0
,
engine
.
Tween
.
removeTweens
(
this
),
e
&&
this
.
switchAni
(
"Jump"
,
1
,
!
1
)},
e
.
prototype
.
playReady
=
function
(){
var
t
=
this
;
return
new
Promise
(
function
(
e
){
t
.
switchAni
(
"Ready"
,
1
),
setTimeout
(
function
(){
t
.
switchAni
(
"Ready2"
,
1
,
!
0
,
!
0
),
e
()},
200
)})},
e
.
prototype
.
onEnterFrame
=
function
(
e
){
this
.
playing
&&
(
this
.
vy
+=
this
.
g
,
this
.
y
+=
this
.
vy
,
0
<
this
.
vy
&&
"Fall"
!==
this
.
_aniName
&&
(
this
.
dispatchEvent
(
"jump-on-top"
),
this
.
switchAni
(
"Fall"
)),
this
.
y
>
this
.
baseY
&&
(
this
.
y
=
this
.
baseY
,
this
.
playing
=!
1
,
this
.
jumpPromise
&&
this
.
jumpPromise
({
aboveBlock
:
this
.
aboveBlock
}),
this
.
jumpPromise
=
null
))},
e
.
prototype
.
changeBaseY
=
function
(
e
){
this
.
baseY
!=
e
&&
(
this
.
aboveBlock
=!
0
,
this
.
baseY
=
e
)},
e
.
prototype
.
jump
=
function
(){
var
t
=
this
;
return
playSound
(
"跳起音效"
),
this
.
switchAni
(
"Jump"
,
1
,
!
1
),
this
.
_currentAni
.
play
(
!
1
,
!
1
),
this
.
aboveBlock
=!
1
,
this
.
playing
=!
0
,
this
.
baseY
=
this
.
y
,
this
.
vy
=-
props
.
jumpSpeed
,
new
Promise
(
function
(
e
){
t
.
jumpPromise
=
e
})},
e
.
prototype
.
playLand
=
function
(
n
,
s
){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
switch
(
n
){
case
0
:
return
[
3
,
1
];
case
1
:
case
2
:
return
[
3
,
4
];
case
3
:
return
[
3
,
5
]}
return
[
3
,
6
];
case
1
:
return
this
.
_prefectLandCounting
++
,
playSound
(
"完美落地音效"
+
Math
.
min
(
4
,
this
.
_prefectLandCounting
)),
t
=
this
.
prefectEffect
,
this
.
addChildAt
(
t
,
0
),
t
.
gotoAndPlay
(
1
),
t
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
removeChild
(
t
)},
this
),
i
=
this
.
landEffect
,
this
.
addChildAt
(
i
,
0
),
i
.
gotoAndPlay
(
1
),
i
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
removeChild
(
i
)},
this
),[
4
,
this
.
switchAni
(
"LandPerfect"
)];
case
2
:
return
e
.
sent
(),[
4
,
this
.
switchAni
(
"Ready2"
,
1
,
!
0
,
!
0
)];
case
3
:
return
e
.
sent
(),[
3
,
6
];
case
4
:
return
this
.
_prefectLandCounting
=
0
,
playSound
(
"普通落地音效"
),
this
.
switchAni
(
"Ready2"
,
1
,
!
0
,
!
0
),[
3
,
6
];
case
5
:
return
this
.
_prefectLandCounting
=
0
,
playSound
(
"边缘落地音效"
),
this
.
switchAni
(
"LandSide"
,
s
),[
3
,
6
];
case
6
:
return
[
2
]}})})},
e
.
prototype
.
hitAway
=
function
(
i
){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
=
this
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
jumpPromise
&&
this
.
jumpPromise
(),
this
.
jumpPromise
=
null
,
playSound
(
"被撞开音效"
),
this
.
switchAni
(
"Hit"
,
i
),
this
.
vy
=
0
,[
4
,
new
Promise
(
function
(
e
){
engine
.
Tween
.
get
(
t
).
to
({
x
:
-
i
*
props
.
hitAwayDistance
.
x
},
props
.
hitAwayDuration
,
engine
.
Ease
.
quartOut
),
engine
.
Tween
.
get
(
t
).
to
({
y
:
t
.
y
+
props
.
hitAwayDistance
.
y
},
props
.
hitAwayDuration
,
engine
.
Ease
.
cubicOut
).
call
(
e
)})];
case
1
:
return
e
.
sent
(),[
2
]}})})},
e
.
prototype
.
parachute
=
function
(
e
){
var
t
=
this
;
return
this
.
switchAni
(
"Parachute"
,
e
),
new
Promise
(
function
(
e
){
engine
.
Tween
.
get
(
t
).
call
(
function
(){
playSound
(
"降落伞下落音效"
)}).
to
({
y
:
t
.
y
+
props
.
parachuteDistance
},
props
.
parachuteDuration
).
set
({
anchorOffsetY
:
0
}).
call
(
e
)})},
e
}(
engine
.
Container
),
ObjectPool
=
engine
.
ObjectPool
,
PoolName
=
"gold-bag"
;
ObjectPool
.
registerPool
(
PoolName
,
function
(){
return
new
GoldBag
},
function
(
e
,
t
){
e
.
reset
(
t
)});
var
GameView
=
function
(
t
){
function
e
(){
var
e
=
t
.
call
(
this
)
||
this
;
return
e
.
index
=-
1
,
e
.
goldBags
=
[],
e
.
baseOffset
=-
props
.
baseOffset
+
props
.
playerOffset
,
e
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
e
.
setup
,
e
),
e
}
return
tslib
.
__extends
(
e
,
t
),
e
.
prototype
.
setup
=
function
(){
var
e
,
t
,
i
,
n
,
s
,
o
,
r
,
a
,
h
,
c
,
l
;
this
.
_hasSetup
||
(
this
.
_hasSetup
=!
0
,
t
=
(
e
=
this
.
stage
).
width
,
i
=
e
.
height
,(
n
=
this
.
background
=
new
Background
).
y
=
i
-
1624
,
this
.
addChild
(
n
),
n
.
setup
(),(
s
=
this
.
frontContainer
=
new
engine
.
Container
).
x
=
t
/
2
,
this
.
addChild
(
s
),
o
=
this
.
guideLayer
=
new
GuideLayer
,
this
.
addChild
(
o
),
r
=
this
.
blockContainer
=
new
engine
.
Container
,
s
.
addChild
(
r
),
a
=
this
.
base
=
new
Base
,
s
.
addChild
(
a
),
a
.
setup
(),
h
=
this
.
player
=
new
Player
,
s
.
addChildAt
(
h
,
0
),
h
.
setup
(),
h
.
addEventListener
(
"jump-on-top"
,
this
.
onPlayerJumpOnTop
,
this
),(
c
=
this
.
scoreAddTipsContainer
=
new
engine
.
Container
).
width
=
750
,
c
.
anchorX
=
c
.
width
/
2
,
c
.
anchorY
=
c
.
height
/
2
,(
l
=
this
.
scoreAddTips
=
new
engine
.
Label
).
width
=
750
,
l
.
fillColor
=
props
.
scoreAddFontColor
,
l
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
,
l
.
size
=
props
.
scoreAddFontSize
,
l
.
alpha
=
0
,
l
.
text
=
"+0"
,
l
.
x
=
this
.
player
.
x
-
l
.
width
/
2
,
c
.
addChild
(
l
),
s
.
addChildAt
(
h
,
0
),
s
.
addChild
(
c
),
ObjectPool
.
recycleObject
(
PoolName
,
ObjectPool
.
getObject
(
PoolName
,{
y
:
0
,
remain
:
0
})),
this
.
hitEffect
=
createSvga
(
"被撞烟雾"
,
"hitEffectAnchor"
),
this
.
pos
=
0
,
this
.
background
.
setup
(),
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
),
this
.
reset
())},
e
.
prototype
.
setScoreText
=
function
(
i
){
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
.
scoreAddTips
.
text
=
i
,
t
.
scoreAddTips
.
y
=
0
,
t
.
scoreAddTips
.
alpha
=
1
,
engine
.
Tween
.
get
(
t
.
scoreAddTips
,
null
,
null
,
!
0
).
to
({
y
:
-
100
,
alpha
:
0
},
500
,
engine
.
Ease
.
cubicInOut
).
call
(
e
)})]})})},
e
.
prototype
.
reset
=
function
(
o
){
return
void
0
===
o
&&
(
o
=!
1
),
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
,
n
,
s
;
return
tslib
.
__generator
(
this
,
function
(
e
){
if
(
this
.
base
.
reset
(),
this
.
index
=-
1
,
this
.
_score
=
0
,
this
.
frontContainer
&&
this
.
player
&&
this
.
frontContainer
.
addChildAt
(
this
.
player
,
0
),
!
o
)
for
(
this
.
pos
=
0
,
t
=
this
.
blockContainer
,
i
=
0
,
n
=
t
.
children
.
length
;
i
<
n
;
i
++
)
t
.
getChildAt
(
i
).
playLeave
();
for
(
i
=
0
;
i
<
props
.
initBlockCount
;
i
++
)
this
.
addBlock
(
!
1
);
for
(
i
=
0
,
n
=
this
.
goldBags
.
length
;
i
<
n
;
i
++
)
s
=
this
.
goldBags
[
i
],
this
.
frontContainer
.
removeChild
(
s
),
ObjectPool
.
recycleObject
(
PoolName
,
s
);
return
this
.
goldBags
.
splice
(
0
),
this
.
resetPlayer
(
o
),[
2
]})})},
e
.
prototype
.
resetPlayer
=
function
(
e
){
void
0
===
e
&&
(
e
=!
1
),
this
.
player
.
reset
(
e
),
this
.
player
.
y
=
this
.
baseOffset
-
(
this
.
index
+
1
)
*
props
.
blockHitHeight
+
props
.
blockBaseOffset
},
e
.
prototype
.
start
=
function
(
n
){
return
void
0
===
n
&&
(
n
=!
1
),
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
=
this
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
scoreAddTipsContainer
.
y
=
this
.
player
.
y
+
props
.
scoreAddTipsOffset
,
n
?[
3
,
2
]:[
4
,
this
.
player
.
playReady
()];
case
1
:
e
.
sent
(),
e
.
label
=
2
;
case
2
:
return
(
console
.
log
(
"开始"
),
t
=
"jump-high-guide_"
+
props
.
guideFlagKey
,
localStorage
.
getItem
(
t
))?[
3
,
4
]:(
localStorage
.
setItem
(
t
,
"1"
),[
4
,
this
.
guideLayer
.
show
(
""
,{
y
:
this
.
stage
.
height
+
this
.
player
.
y
-
280
})]);
case
3
:
e
.
sent
(),
e
.
label
=
4
;
case
4
:
return
this
.
lastLandType
=
0
,
this
.
_remainToShowGoldBag
=
props
.
goldBagScoreMultiple
-
props
.
goldBagScoreSubtraction
,
this
.
_touchEnabled
=!
0
,
setTimeout
(
function
(){
i
.
addBlock
()},
100
),
engine
.
globalEvent
.
dispatchEvent
(
"jump-high-game-start"
),[
2
]}})})},
e
.
prototype
.
pause
=
function
(){
this
.
currentBlock
&&
engine
.
Tween
.
pauseTweens
(
this
.
currentBlock
),
engine
.
Tween
.
pauseTweens
(
this
.
player
)},
e
.
prototype
.
resume
=
function
(){
this
.
currentBlock
&&
engine
.
Tween
.
resumeTweens
(
this
.
currentBlock
),
engine
.
Tween
.
resumeTweens
(
this
.
player
)},
e
.
prototype
.
revive
=
function
(){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
blockContainer
.
getChildAt
(
this
.
index
).
visible
=!
1
,
this
.
index
--
,[
4
,
this
.
resetPlayer
(
!
0
)];
case
1
:
return
e
.
sent
(),
this
.
start
(
!
0
),[
2
]}})})},
e
.
prototype
.
addBlock
=
function
(
e
){
var
t
=
this
;
void
0
===
e
&&
(
e
=!
0
),
this
.
index
++
;
var
i
,
n
=
this
.
blockContainer
;
n
.
children
.
length
>
this
.
index
?(
i
=
n
.
getChildAt
(
this
.
index
)).
visible
=!
0
:(
i
=
new
Block
,
n
.
addChildAt
(
i
,
0
)),
n
.
addChildAt
(
i
,
0
),
i
.
reset
({
type
:
Math
.
floor
(
Math
.
random
()
*
props
.
blockAssets
.
length
)}),
console
.
log
(
"addblock"
,
this
.
index
),
i
.
y
=
this
.
baseOffset
-
this
.
index
*
props
.
blockHitHeight
+
props
.
blockBaseOffset
,
this
.
blockComplete
=!
1
,
i
.
playEnter
(
this
.
index
,
e
).
then
(
function
(
e
){
t
.
blockComplete
=!
0
}),
e
&&
(
this
.
needHitTest
=!
0
),
this
.
currentBlock
=
i
},
e
.
prototype
.
addGoldBag
=
function
(){
var
e
=
ObjectPool
.
getObject
(
PoolName
,{
y
:
this
.
baseOffset
-
(
this
.
blockCount
+
props
.
goldBagDistance
+
props
.
goldBagJumpSubtraction
)
*
props
.
blockHitHeight
,
remain
:
props
.
goldBagDistance
});
this
.
frontContainer
.
addChild
(
e
),
this
.
goldBags
.
push
(
e
)},
e
.
prototype
.
playOpenGoldBag
=
function
(){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
,
n
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
t
=
0
,
i
=
this
.
goldBags
.
length
,
e
.
label
=
1
;
case
1
:
return
t
<
i
?((
n
=
this
.
goldBags
[
t
]).
remain
--
,
n
.
remain
<=
0
?(
this
.
goldBags
.
splice
(
t
,
1
),
t
--
,
i
--
,
this
.
nextToUpdateScore
=!
0
,[
4
,
n
.
playOpen
()]):[
3
,
3
]):[
3
,
4
];
case
2
:
e
.
sent
(),
this
.
frontContainer
.
removeChild
(
n
),
ObjectPool
.
recycleObject
(
PoolName
,
n
),
e
.
label
=
3
;
case
3
:
return
t
++
,[
3
,
1
];
case
4
:
return
[
2
]}})})},
e
.
prototype
.
onPlayerJumpOnTop
=
function
(){
this
.
nextToUpdateScore
&&
(
this
.
nextToUpdateScore
=!
1
,
this
.
scoreChange
(
4
),
playSound
(
"撞击钱袋音效"
))},
Object
.
defineProperty
(
e
.
prototype
,
"blockCount"
,{
get
:
function
(){
return
this
.
index
-
props
.
initBlockCount
+
1
},
enumerable
:
!
1
,
configurable
:
!
0
}),
Object
.
defineProperty
(
e
.
prototype
,
"pos"
,{
get
:
function
(){
return
this
.
_pos
},
set
:
function
(
e
){
this
.
_pos
=
e
,
this
.
updatePos
()},
enumerable
:
!
1
,
configurable
:
!
0
}),
e
.
prototype
.
updatePos
=
function
(){
this
.
frontContainer
.
y
=
this
.
stage
.
height
+
this
.
_pos
},
e
.
prototype
.
onEnterFrame
=
function
(
e
){
var
t
,
i
,
n
,
s
,
o
,
r
,
a
,
h
,
c
,
l
,
p
;
this
.
needHitTest
&&
this
.
currentBlock
&&
(
i
=
(
t
=
this
.
currentBlock
).
x
,
n
=
t
.
y
,
s
=
t
.
dir
,
r
=
(
o
=
this
.
player
).
x
,
a
=
o
.
y
,
h
=
props
.
blockHitWidth
,
c
=
props
.
blockHitHeight
,
l
=
props
.
playerWidth
,
p
=!
1
,
Math
.
abs
(
r
-
i
)
<
(
h
+
l
)
/
2
&&
(
this
.
player
.
changeBaseY
(
n
-
c
),
n
-
c
<
a
&&
(
p
=!
0
)),
p
&&
this
.
onHitOn
(
s
))},
e
.
prototype
.
onHitOn
=
function
(
t
){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
_touchEnabled
=!
1
,
this
.
needHitTest
=!
1
,
clearInterval
(
this
.
timer
),[
4
,
this
.
player
.
hitAway
(
t
)];
case
1
:
return
e
.
sent
(),
this
.
frontContainer
.
addChild
(
this
.
player
),[
4
,
this
.
player
.
parachute
(
t
)];
case
2
:
return
e
.
sent
(),
console
.
log
(
"jump-high-game-end"
),
engine
.
globalEvent
.
dispatchEvent
(
"jump-high-game-end"
),[
2
]}})})},
e
.
prototype
.
jump
=
function
(){
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
(){
var
t
,
i
,
n
,
s
,
o
=
this
;
return
tslib
.
__generator
(
this
,
function
(
e
){
switch
(
e
.
label
){
case
0
:
return
this
.
_touchEnabled
?(
this
.
_touchEnabled
=!
1
,
this
.
playOpenGoldBag
(),[
4
,
this
.
player
.
jump
()]):[
2
];
case
1
:
return
(
t
=
e
.
sent
())?
t
.
aboveBlock
?(
i
=
Math
.
abs
(
this
.
currentBlock
.
x
),(
n
=
0
)
<
i
&&
(
n
=
0
<
i
&&
i
<
props
.
scoreThreshold
?
2
:
3
),
s
=
this
.
lastLandType
,
0
===
(
this
.
lastLandType
=
n
)
&&
s
!==
n
&&
(
n
=
1
),
this
.
currentBlock
.
playEffect
(),
this
.
player
.
playLand
(
n
,
this
.
currentBlock
.
dir
),
this
.
currentBlock
.
stop
(),
this
.
scoreChange
(
n
),[
4
,
new
Promise
(
function
(
e
){
engine
.
Tween
.
get
(
o
,
null
,
null
,
!
0
).
to
({
pos
:
props
.
blockHitHeight
*
o
.
index
},
300
,
engine
.
Ease
.
cubicOut
).
call
(
e
)})]):[
3
,
3
]:[
3
,
4
];
case
2
:
e
.
sent
(),
this
.
addBlock
(),
e
.
label
=
3
;
case
3
:
this
.
_touchEnabled
=!
0
,
e
.
label
=
4
;
case
4
:
return
[
2
]}})})},
e
.
prototype
.
scoreChange
=
function
(
e
){
var
t
=
props
.
scoreWeights
[
e
];
this
.
_score
+=
t
,
this
.
_remainToShowGoldBag
-=
t
;
var
i
=
this
.
_score
;
engine
.
globalEvent
.
dispatchEvent
(
"jump-high-score"
,{
type
:
e
,
score
:
i
,
scoreAdd
:
t
}),
this
.
scoreAddTipsContainer
.
y
=
this
.
player
.
y
+
props
.
scoreAddTipsOffset
,
this
.
setScoreText
(
"+"
+
t
),
console
.
log
(
i
,
this
.
_remainToShowGoldBag
),
this
.
_remainToShowGoldBag
<=
0
&&
(
this
.
_remainToShowGoldBag
+=
props
.
goldBagScoreMultiple
,
this
.
addGoldBag
(),
console
.
log
(
"addGoldBag"
))},
e
.
prototype
.
playHitEffect
=
function
(
e
){
var
t
=
this
.
hitEffect
;
t
.
scaleX
=
e
,
t
.
y
=
this
.
player
.
y
-
props
.
hitEffectAnchor
.
y
,
t
.
play
(
!
0
,
!
1
),
t
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
this
.
frontContainer
.
removeChild
(
t
)},
this
),
this
.
frontContainer
.
addChild
(
t
)},
e
}(
engine
.
Container
),
JumpHigh
=
function
(
i
){
function
e
(){
var
e
=
i
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
"jump-high-reset"
,
e
.
reset
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-start"
,
e
.
start
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-pause"
,
e
.
pause
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-resume"
,
e
.
resume
,
e
),
engine
.
globalEvent
.
addEventListener
(
"jump-high-revive"
,
e
.
revive
,
e
),
e
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
e
.
onTap
,
e
);
var
t
=
e
.
_gameView
=
new
GameView
;
return
e
.
addChild
(
t
),
e
}
return
tslib
.
__extends
(
e
,
i
),
e
.
prototype
.
reset
=
function
(){
this
.
_gameView
.
reset
()},
e
.
prototype
.
start
=
function
(
e
){
injectProps
(
e
.
data
),
this
.
_status
=
1
,
this
.
_gameView
.
start
()},
e
.
prototype
.
pause
=
function
(){
this
.
_gameView
.
pause
()},
e
.
prototype
.
resume
=
function
(){
this
.
_gameView
.
resume
()},
e
.
prototype
.
revive
=
function
(){
this
.
_gameView
.
revive
()},
e
.
prototype
.
onTap
=
function
(
e
){
this
.
_gameView
.
jump
()},
e
}(
engine
.
Container
);
function
index
(
e
){
return
prepareProps
(),
injectProps
(
e
),
new
JumpHigh
}
module
.
exports
=
index
;
src/custom/jump-high-3/src/game/GameView.ts
View file @
1d483254
...
@@ -142,6 +142,9 @@ export default class GameView extends engine.Container {
...
@@ -142,6 +142,9 @@ export default class GameView extends engine.Container {
this
.
index
=
-
1
;
this
.
index
=
-
1
;
this
.
_score
=
0
;
this
.
_score
=
0
;
if
(
this
.
frontContainer
&&
this
.
player
)
this
.
frontContainer
.
addChildAt
(
this
.
player
,
0
);
if
(
revive
)
{
if
(
revive
)
{
}
else
{
}
else
{
this
.
pos
=
0
;
this
.
pos
=
0
;
...
...
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