Commit b08a4d5d authored by Master Q's avatar Master Q

添加 按压进度

parent 18dd1f4c
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"name": "GameResumeModal" "name": "GameResumeModal"
}, },
{ {
"keys": "back.png,bottomAtom.png,gele1.png,goBackBtn.png,player.png,scoreboard-t.png", "keys": "back.png,bottomAtom.png,gele1.png,goBackBtn.png,player.png,progressBack.png,scoreboard-t.png",
"name": "GameScene" "name": "GameScene"
}, },
{ {
......
...@@ -2,63 +2,720 @@ export const ResJson = { ...@@ -2,63 +2,720 @@ export const ResJson = {
"groups": [ "groups": [
{ {
"keys": "box1.png,box2.png,box3.png,box4.png,box5.png,box6.png,box7.png,box8.png", "keys": "box1.png,box2.png,box3.png,box4.png,box5.png,box6.png,box7.png,box8.png",
"name": "Boxes" "name": "Boxes",
"atlas": {
"box7.png": {
"x": 2,
"y": 2,
"w": 233,
"h": 442,
"ox": 26,
"oy": 7,
"sw": 283,
"sh": 449,
"ro": false
},
"box8.png": {
"x": 237,
"y": 2,
"w": 184,
"h": 429,
"ox": 50,
"oy": 20,
"sw": 283,
"sh": 449,
"ro": false
},
"box3.png": {
"x": 423,
"y": 2,
"w": 225,
"h": 284,
"ox": 29,
"oy": 44,
"sw": 283,
"sh": 328,
"ro": false
},
"box2.png": {
"x": 2,
"y": 446,
"w": 280,
"h": 204,
"ox": 0,
"oy": 91,
"sw": 283,
"sh": 328,
"ro": false
},
"box4.png": {
"x": 284,
"y": 433,
"w": 184,
"h": 276,
"ox": 50,
"oy": 52,
"sw": 283,
"sh": 328,
"ro": true
},
"box6.png": {
"x": 650,
"y": 2,
"w": 255,
"h": 221,
"ox": 14,
"oy": 95,
"sw": 283,
"sh": 328,
"ro": true
},
"box1.png": {
"x": 650,
"y": 259,
"w": 228,
"h": 214,
"ox": 28,
"oy": 92,
"sw": 283,
"sh": 328,
"ro": true
},
"box5.png": {
"x": 423,
"y": 288,
"w": 224,
"h": 142,
"ox": 30,
"oy": 151,
"sw": 283,
"sh": 328,
"ro": false
}
}
}, },
{ {
"keys": "DFM1.png,DFMB.png", "keys": "DFM1.png,DFMB.png",
"name": "DrawFailModal" "name": "DrawFailModal",
"atlas": {
"DFMB.png": {
"x": 2,
"y": 2,
"w": 541,
"h": 467,
"ox": 0,
"oy": 0,
"sw": 541,
"sh": 467,
"ro": false
},
"DFM1.png": {
"x": 2,
"y": 471,
"w": 369,
"h": 97,
"ox": 0,
"oy": 0,
"sw": 369,
"sh": 97,
"ro": false
}
}
}, },
{ {
"keys": "DSM1.png,DSMB.png", "keys": "DSM1.png,DSMB.png",
"name": "DrawSucModal" "name": "DrawSucModal",
"atlas": {
"DSMB.png": {
"x": 2,
"y": 2,
"w": 576,
"h": 747,
"ox": 0,
"oy": 0,
"sw": 576,
"sh": 747,
"ro": false
},
"DSM1.png": {
"x": 580,
"y": 2,
"w": 369,
"h": 97,
"ox": 0,
"oy": 0,
"sw": 369,
"sh": 97,
"ro": true
}
}
}, },
{ {
"keys": "FGM1.png,FGMB.png", "keys": "FGM1.png,FGMB.png",
"name": "FinalGiftModal" "name": "FinalGiftModal",
"atlas": {
"FGMB.png": {
"x": 2,
"y": 2,
"w": 503,
"h": 571,
"ox": 0,
"oy": 0,
"sw": 503,
"sh": 571,
"ro": false
},
"FGM1.png": {
"x": 507,
"y": 2,
"w": 369,
"h": 97,
"ox": 0,
"oy": 0,
"sw": 369,
"sh": 97,
"ro": true
}
}
}, },
{ {
"keys": "2b727ace1b5c959dbc6274cacb5b4e5f.png,3ed4431aad269ef7059929043bd45597.png,60377934f7cf618b52457273db65aace.png,9074d1305c0e7feb16037261986c7f4b.png,f3bde4659477f82338fcb2b134272321.png", "keys": "2b727ace1b5c959dbc6274cacb5b4e5f.png,3ed4431aad269ef7059929043bd45597.png,60377934f7cf618b52457273db65aace.png,9074d1305c0e7feb16037261986c7f4b.png,f3bde4659477f82338fcb2b134272321.png",
"name": "GameAtom" "name": "GameAtom",
"atlas": {
"f3bde4659477f82338fcb2b134272321.png": {
"x": 2,
"y": 2,
"w": 26,
"h": 26,
"ox": 0,
"oy": 0,
"sw": 26,
"sh": 26,
"ro": false
},
"3ed4431aad269ef7059929043bd45597.png": {
"x": 30,
"y": 2,
"w": 19,
"h": 19,
"ox": 0,
"oy": 0,
"sw": 19,
"sh": 19,
"ro": false
},
"60377934f7cf618b52457273db65aace.png": {
"x": 30,
"y": 23,
"w": 19,
"h": 18,
"ox": 0,
"oy": 0,
"sw": 19,
"sh": 18,
"ro": false
},
"2b727ace1b5c959dbc6274cacb5b4e5f.png": {
"x": 2,
"y": 30,
"w": 12,
"h": 11,
"ox": 0,
"oy": 0,
"sw": 12,
"sh": 11,
"ro": true
},
"9074d1305c0e7feb16037261986c7f4b.png": {
"x": 15,
"y": 30,
"w": 7,
"h": 7,
"ox": 0,
"oy": 0,
"sw": 7,
"sh": 7,
"ro": false
}
}
}, },
{ {
"keys": "GOM0.png,GOM1.png,GameOverModalBack.png", "keys": "GOM0.png,GOM1.png,GameOverModalBack.png",
"name": "GameOverModal" "name": "GameOverModal",
"atlas": {
"GameOverModalBack.png": {
"x": 2,
"y": 2,
"w": 576,
"h": 739,
"ox": 0,
"oy": 0,
"sw": 576,
"sh": 739,
"ro": false
},
"GOM1.png": {
"x": 580,
"y": 2,
"w": 369,
"h": 97,
"ox": 0,
"oy": 0,
"sw": 369,
"sh": 97,
"ro": true
},
"GOM0.png": {
"x": 580,
"y": 373,
"w": 163,
"h": 50,
"ox": 0,
"oy": 0,
"sw": 163,
"sh": 50,
"ro": true
}
}
}, },
{ {
"keys": "GQM0.png,GQM1.png,GQMB.png", "keys": "GQM0.png,GQM1.png,GQMB.png",
"name": "GameQuitModal" "name": "GameQuitModal",
"atlas": {
"GQMB.png": {
"x": 2,
"y": 2,
"w": 601,
"h": 467,
"ox": 0,
"oy": 0,
"sw": 601,
"sh": 467,
"ro": false
},
"GQM1.png": {
"x": 2,
"y": 471,
"w": 249,
"h": 97,
"ox": 0,
"oy": 0,
"sw": 249,
"sh": 97,
"ro": false
},
"GQM0.png": {
"x": 253,
"y": 471,
"w": 231,
"h": 91,
"ox": 0,
"oy": 0,
"sw": 231,
"sh": 91,
"ro": false
}
}
}, },
{ {
"keys": "GameResumeModalBack.png,cancelBtn.png,useRightNowBtn.png", "keys": "GameResumeModalBack.png,cancelBtn.png,useRightNowBtn.png",
"name": "GameResumeModal" "name": "GameResumeModal",
"atlas": {
"GameResumeModalBack.png": {
"x": 2,
"y": 2,
"w": 601,
"h": 547,
"ox": 0,
"oy": 0,
"sw": 601,
"sh": 547,
"ro": false
},
"useRightNowBtn.png": {
"x": 2,
"y": 551,
"w": 369,
"h": 97,
"ox": 0,
"oy": 0,
"sw": 369,
"sh": 97,
"ro": false
},
"cancelBtn.png": {
"x": 373,
"y": 551,
"w": 230,
"h": 66,
"ox": 0,
"oy": 0,
"sw": 230,
"sh": 66,
"ro": false
}
}
}, },
{ {
"keys": "back.png,bottomAtom.png,gele1.png,goBackBtn.png,player.png,scoreboard-t.png", "keys": "back.png,bottomAtom.png,gele1.png,goBackBtn.png,player.png,progressBack.png,scoreboard-t.png",
"name": "GameScene" "name": "GameScene",
"atlas": {
"back.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1624,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1624,
"ro": false
},
"bottomAtom.png": {
"x": 754,
"y": 2,
"w": 750,
"h": 340,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 340,
"ro": true
},
"progressBack.png": {
"x": 754,
"y": 754,
"w": 33,
"h": 359,
"ox": 0,
"oy": 0,
"sw": 33,
"sh": 359,
"ro": false
},
"gele1.png": {
"x": 789,
"y": 754,
"w": 279,
"h": 204,
"ox": 0,
"oy": 0,
"sw": 279,
"sh": 204,
"ro": false
},
"player.png": {
"x": 789,
"y": 960,
"w": 132,
"h": 201,
"ox": 0,
"oy": 0,
"sw": 132,
"sh": 201,
"ro": true
},
"goBackBtn.png": {
"x": 992,
"y": 960,
"w": 138,
"h": 68,
"ox": 0,
"oy": 0,
"sw": 138,
"sh": 68,
"ro": true
},
"scoreboard-t.png": {
"x": 789,
"y": 1094,
"w": 86,
"h": 38,
"ox": 0,
"oy": 0,
"sw": 86,
"sh": 38,
"ro": false
}
}
}, },
{ {
"keys": "2120075482341d7d94d8164b1a0f6d43.png,3ed4431aad269ef7059929043bd45597.png,4f4612689c9fde32a8c28c129e9f6e7d.png,60377934f7cf618b52457273db65aace.png,63b0a84f0f9b10842b5f83fa5e923534.png,f3bde4659477f82338fcb2b134272321.png", "keys": "2120075482341d7d94d8164b1a0f6d43.png,3ed4431aad269ef7059929043bd45597.png,4f4612689c9fde32a8c28c129e9f6e7d.png,60377934f7cf618b52457273db65aace.png,63b0a84f0f9b10842b5f83fa5e923534.png,f3bde4659477f82338fcb2b134272321.png",
"name": "JumpEnd" "name": "JumpEnd",
"atlas": {
"2120075482341d7d94d8164b1a0f6d43.png": {
"x": 2,
"y": 2,
"w": 274,
"h": 294,
"ox": 25,
"oy": 21,
"sw": 323,
"sh": 323,
"ro": false
},
"f3bde4659477f82338fcb2b134272321.png": {
"x": 278,
"y": 2,
"w": 26,
"h": 26,
"ox": 0,
"oy": 0,
"sw": 26,
"sh": 26,
"ro": false
},
"4f4612689c9fde32a8c28c129e9f6e7d.png": {
"x": 278,
"y": 30,
"w": 25,
"h": 25,
"ox": 0,
"oy": 0,
"sw": 25,
"sh": 25,
"ro": false
},
"63b0a84f0f9b10842b5f83fa5e923534.png": {
"x": 278,
"y": 57,
"w": 25,
"h": 25,
"ox": 0,
"oy": 0,
"sw": 25,
"sh": 25,
"ro": false
},
"3ed4431aad269ef7059929043bd45597.png": {
"x": 278,
"y": 84,
"w": 19,
"h": 19,
"ox": 0,
"oy": 0,
"sw": 19,
"sh": 19,
"ro": false
},
"60377934f7cf618b52457273db65aace.png": {
"x": 278,
"y": 105,
"w": 19,
"h": 18,
"ox": 0,
"oy": 0,
"sw": 19,
"sh": 18,
"ro": false
}
}
}, },
{ {
"keys": "Guide1.png,NGSB.jpg,nextStep.png,startGameBtn.png", "keys": "Guide1.png,NGSB.jpg,nextStep.png,startGameBtn.png",
"name": "NewGuyScene" "name": "NewGuyScene",
"atlas": {
"Guide1.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1624,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1624,
"ro": false
},
"nextStep.png": {
"x": 754,
"y": 2,
"w": 203,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 203,
"sh": 60,
"ro": true
},
"startGameBtn.png": {
"x": 754,
"y": 207,
"w": 203,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 203,
"sh": 60,
"ro": true
}
}
}, },
{ {
"keys": "2120075482341d7d94d8164b1a0f6d43.png", "keys": "2120075482341d7d94d8164b1a0f6d43.png",
"name": "PerfectJumpEnd" "name": "PerfectJumpEnd",
"atlas": {
"2120075482341d7d94d8164b1a0f6d43.png": {
"x": 2,
"y": 2,
"w": 274,
"h": 294,
"ox": 25,
"oy": 21,
"sw": 323,
"sh": 323,
"ro": false
}
}
}, },
{ {
"keys": "closebtn.png,giftBoxIcon.png,waitingBg.png,waitingRot.png", "keys": "closebtn.png,giftBoxIcon.png,waitingBg.png,waitingRot.png",
"name": "common" "name": "common",
"atlas": {
"waitingBg.png": {
"x": 2,
"y": 2,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": false
},
"giftBoxIcon.png": {
"x": 164,
"y": 2,
"w": 127,
"h": 125,
"ox": 0,
"oy": 0,
"sw": 127,
"sh": 125,
"ro": true
},
"waitingRot.png": {
"x": 2,
"y": 184,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
},
"closebtn.png": {
"x": 60,
"y": 184,
"w": 52,
"h": 52,
"ox": 0,
"oy": 0,
"sw": 52,
"sh": 52,
"ro": false
}
}
}, },
{ {
"keys": "786bf3500cf0986c9678f6b8a8cf24f6.png,b5d5c1070b13deb0230b0efe5c58ee9d.png,ca7b2a497afc6147cc076d55600154bd.png,d64a974a921d32ed81463c918bae137e.png,f49a78c8287be1a92ee75ce3a2b7a512.png", "keys": "786bf3500cf0986c9678f6b8a8cf24f6.png,b5d5c1070b13deb0230b0efe5c58ee9d.png,ca7b2a497afc6147cc076d55600154bd.png,d64a974a921d32ed81463c918bae137e.png,f49a78c8287be1a92ee75ce3a2b7a512.png",
"name": "countDown" "name": "countDown",
"atlas": {
"ca7b2a497afc6147cc076d55600154bd.png": {
"x": 2,
"y": 2,
"w": 109,
"h": 175,
"ox": 0,
"oy": 0,
"sw": 109,
"sh": 175,
"ro": false
},
"786bf3500cf0986c9678f6b8a8cf24f6.png": {
"x": 113,
"y": 2,
"w": 98,
"h": 172,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 172,
"ro": false
},
"d64a974a921d32ed81463c918bae137e.png": {
"x": 2,
"y": 179,
"w": 110,
"h": 172,
"ox": 0,
"oy": 0,
"sw": 110,
"sh": 172,
"ro": true
},
"f49a78c8287be1a92ee75ce3a2b7a512.png": {
"x": 213,
"y": 2,
"w": 104,
"h": 105,
"ox": 0,
"oy": 0,
"sw": 104,
"sh": 105,
"ro": false
},
"b5d5c1070b13deb0230b0efe5c58ee9d.png": {
"x": 213,
"y": 109,
"w": 53,
"h": 53,
"ox": 0,
"oy": 0,
"sw": 53,
"sh": 53,
"ro": false
}
}
}, },
{ {
"keys": "548342251013e2f832a40380d1855bf5.png,af75d547153d9118b05d4dd8fbcfe022.png,fd0f936244fb973bddf520819997f5ba.png", "keys": "548342251013e2f832a40380d1855bf5.png,af75d547153d9118b05d4dd8fbcfe022.png,fd0f936244fb973bddf520819997f5ba.png",
"name": "handLottie" "name": "handLottie",
"atlas": {
"fd0f936244fb973bddf520819997f5ba.png": {
"x": 2,
"y": 2,
"w": 120,
"h": 87,
"ox": 0,
"oy": 0,
"sw": 120,
"sh": 87,
"ro": false
},
"af75d547153d9118b05d4dd8fbcfe022.png": {
"x": 2,
"y": 91,
"w": 92,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 92,
"sh": 92,
"ro": false
},
"548342251013e2f832a40380d1855bf5.png": {
"x": 124,
"y": 2,
"w": 46,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 46,
"sh": 46,
"ro": false
}
}
}, },
{ {
"keys": "nx1.jpg,ny1.jpg,nz1.jpg,px1.jpg,py1.jpg,pz1.jpg", "keys": "nx1.jpg,ny1.jpg,nz1.jpg,px1.jpg,py1.jpg,pz1.jpg",
...@@ -69,5 +726,6 @@ export const ResJson = { ...@@ -69,5 +726,6 @@ export const ResJson = {
"name": "spine" "name": "spine"
} }
], ],
"path": "./resource/" // eslint-disable-next-line
"path": "https://yun.duiba.com.cn/db_games/activity/template/1671169480/resource/"
} }
\ No newline at end of file
...@@ -29,6 +29,54 @@ import { GameEle } from "./GameEle"; ...@@ -29,6 +29,54 @@ import { GameEle } from "./GameEle";
import { Player, PlayerIns } from "./Player"; import { Player, PlayerIns } from "./Player";
import { Stack } from "./Stack"; import { Stack } from "./Stack";
class ProgressBar extends Dream.RenderContainer {
_value: number = 0
progressWrap: FYGE.Container
progressbar: FYGE.Shape
maxLen: number
get value() {
return this._value
}
set value(v) {
this._value = v
this.progressbar.y = (1 - v) * this.maxLen
}
didRendered(): void {
const roleCont = RES.getRes('progressBack.png')
this.maxLen = roleCont.height
const shape = this.progressbar = new FYGE.Shape()
shape.beginFill('#fff5dc')
shape.drawRoundedRect(0,0,roleCont.width, roleCont.height, 50)
shape.endFill()
this.progressWrap.addChild(shape)
shape.mask = shape.parent.addChild(new FYGE.Graphics())
.beginFill(0xf8c862)
.drawRoundedRect(0, 0, roleCont.width, roleCont.height, 111)
.endFill()
this.value = 0
}
render() {
return (
<DreamContainer>
<DreamSprite src={RES.getRes('progressBack.png')} />
<DreamContainer ref={el => {
this.progressWrap = el
}}>
</DreamContainer>
</DreamContainer>
)
}
}
/** /**
* 获取 n-m之间的 随机数 * 获取 n-m之间的 随机数
* @param {Number} m * @param {Number} m
...@@ -124,6 +172,7 @@ export class GameScene extends Dream.RenderContainer { ...@@ -124,6 +172,7 @@ export class GameScene extends Dream.RenderContainer {
isOver: boolean = false isOver: boolean = false
isCouldHaveGift: boolean = true isCouldHaveGift: boolean = true
isWithGift: boolean = false isWithGift: boolean = false
ProgressBarIns: ProgressBar
private _dir: 1 | -1 private _dir: 1 | -1
get dir() { get dir() {
...@@ -193,7 +242,11 @@ export class GameScene extends Dream.RenderContainer { ...@@ -193,7 +242,11 @@ export class GameScene extends Dream.RenderContainer {
const touchPushObj = this.touchPushObj = { const touchPushObj = this.touchPushObj = {
tl: 0 tl: 0
} }
FYGE.Tween.get(touchPushObj) FYGE.Tween.get(touchPushObj, {
onChange: () => {
this.ProgressBarIns.value = touchPushObj.tl / GameConfig.maxLen
}
})
.to({ .to({
tl: GameConfig.maxLen tl: GameConfig.maxLen
}, 1600) }, 1600)
...@@ -269,11 +322,18 @@ export class GameScene extends Dream.RenderContainer { ...@@ -269,11 +322,18 @@ export class GameScene extends Dream.RenderContainer {
onJumpSuc() { onJumpSuc() {
console.log('onJumpSuc') console.log('onJumpSuc')
PlayAudio()
if (this.isWithGift) { if (this.isWithGift) {
this.DecisionConfig.geleIns.onGetGift() this.DecisionConfig.geleIns.onGetGift()
this.isDrawed = true this.isDrawed = true
// @ts-ignore
if (my) {
// @ts-ignore
my.showToast({
content: '恭喜获得惊喜抽奖机会'
})
}
} else { } else {
PlayAudio()
this.onAddScore() this.onAddScore()
} }
this.onGenerateBox() this.onGenerateBox()
...@@ -406,7 +466,6 @@ export class GameScene extends Dream.RenderContainer { ...@@ -406,7 +466,6 @@ export class GameScene extends Dream.RenderContainer {
.to({ .to({
y: config.offsetY y: config.offsetY
}, 200, FYGE.Ease.quadIn) }, 200, FYGE.Ease.quadIn)
.wait(300)
.call(() => { .call(() => {
this.isPaused = false this.isPaused = false
PlayerTarget._index = 0 // 初始化一下 PlayerTarget._index = 0 // 初始化一下
...@@ -645,6 +704,13 @@ export class GameScene extends Dream.RenderContainer { ...@@ -645,6 +704,13 @@ export class GameScene extends Dream.RenderContainer {
) )
} }
<DreamContainer inlineProps={{
x: 680,
y: 500
}}>
<ProgressBar ref={(el: ProgressBar) => this.ProgressBarIns = el} />
</DreamContainer>
<FYGE.Container inlineProps={{ <FYGE.Container inlineProps={{
y: 1624 - bottomAtomRes.height y: 1624 - bottomAtomRes.height
}}> }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment