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"
}, },
{ {
......
This diff is collapsed.
...@@ -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