Commit 8cb78db7 authored by Master Q's avatar Master Q

0905

parent e9a9bef4
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
"upload": "node scripts/upload", "upload": "node scripts/upload",
"build": "npm run handleRes && node scripts/mergeJson && npm run upload && npm run buildTS", "build": "npm run handleRes && node scripts/mergeJson && npm run upload && npm run buildTS",
"watch": "webpack --watch", "watch": "webpack --watch",
"dev": "node scripts/devServer -p 8099", "dev": "node scripts/devServer -p 9011",
"dev1": "webpack-dev-server --open --config webpack.dev.js --host 0.0.0.0", "dev1": "webpack-dev-server --open --config webpack.dev.js --host 0.0.0.0",
"buildTS": "webpack --config webpack.prod.js && node scripts/mergeJs", "buildTS": "webpack --config webpack.prod.js && node scripts/mergeJs",
"copyJs": "node scripts/copyJs", "copyJs": "node scripts/copyJs",
......
This diff is collapsed.
...@@ -120,6 +120,15 @@ export class GameOverPanel extends Panel { ...@@ -120,6 +120,15 @@ export class GameOverPanel extends Panel {
this.drawBtn.startAniRange(110, this.drawBtn.totalFrames, 1) this.drawBtn.startAniRange(110, this.drawBtn.totalFrames, 1)
await sleep(2000) await sleep(2000)
if (!this.data.isWinPrize) {
this.hidePanel()
// @ts-ignore
my && my.showToast({
content: '很遗憾,您未中奖'
})
changeScene(GameOverScene, this.data)
return
}
const {data, success} = await sendTbNet(TbNetName.drawLotteryPrize, { const {data, success} = await sendTbNet(TbNetName.drawLotteryPrize, {
id: Tools.globalData.startId id: Tools.globalData.startId
}) })
...@@ -138,6 +147,14 @@ export class GameOverPanel extends Panel { ...@@ -138,6 +147,14 @@ export class GameOverPanel extends Panel {
}) })
changeScene(GameOverScene, this.data) changeScene(GameOverScene, this.data)
} }
} else {
// 默认错误就 很遗憾吧
this.hidePanel()
// @ts-ignore
my && my.showToast({
content: '很遗憾,您未中奖'
})
changeScene(GameOverScene, this.data)
} }
}, 1), this) }, 1), this)
} }
......
...@@ -24,10 +24,10 @@ export class PrizeShowPanel extends Panel { ...@@ -24,10 +24,10 @@ export class PrizeShowPanel extends Panel {
preview.width = 300 preview.width = 300
preview.height = 300 preview.height = 300
preview.position.set(150, 236) preview.position.set(150, 236)
// preview.mask = panelCtn.addChild(new FYGE.Graphics()) preview.mask = panelCtn.addChild(new FYGE.Graphics())
// .beginFill() .beginFill()
// .drawRoundedRect(150, 236, 300, 300, 20) .drawRoundedRect(150, 236, 300, 300, 20)
// .endFill() .endFill()
UI.Btn(panelCtn, 'confirm-btn.png', function() { UI.Btn(panelCtn, 'confirm-btn.png', function() {
this.btnDelay(this) this.btnDelay(this)
......
...@@ -78,22 +78,26 @@ export class GameOverScene extends Scene { ...@@ -78,22 +78,26 @@ export class GameOverScene extends Scene {
}, this) }, this)
_s.anchorTexture.set(0.5, 0.5) _s.anchorTexture.set(0.5, 0.5)
var bottomCont = UI.Ctn(this) if (this.data.productLink) {
bottomCont.position.set(0, layers.stageOffsetY + layers.stageHeight - 130 + layers.stageOffsetY - 90) var bottomCont = UI.Ctn(this)
var isJordan = Tools.globalData.shopId == 10003 bottomCont.position.set(0, layers.stageOffsetY + layers.stageHeight - 130 + layers.stageOffsetY - 90)
UI.Rect(bottomCont, layers.stageWidth, 130, 0xffffff) var isJordan = Tools.globalData.shopId == 10003
UI.Sp(bottomCont, 'product-link__icon.png', 50, 25) UI.Rect(bottomCont, layers.stageWidth, 130, 0xffffff)
UI.Txt(bottomCont, `${isJordan ? 'Jordan女子商品': 'Nike瑜伽商品'}`, 24, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 40, true) UI.Sp(bottomCont, 'product-link__icon.png', 50, 25)
UI.Txt(bottomCont, `${isJordan ? '让你充满活力和灵感' : '让你的体态更加健康'}`, 22, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 70, true) UI.Txt(bottomCont, `${isJordan ? 'Jordan女子商品': 'Nike瑜伽商品'}`, 24, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 40, true)
UI.Sp(bottomCont, 'jump-icon.png', 600, 40) UI.Txt(bottomCont, `${isJordan ? '让你充满活力和灵感' : '让你的体态更加健康'}`, 22, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 70, true)
.addEventListener(FYGE.MouseEvent.CLICK, function() { UI.Sp(bottomCont, 'jump-icon.png', 600, 40)
this.btnDelay(this) .addEventListener(FYGE.MouseEvent.CLICK, function() {
addData(7) this.btnDelay(this)
// @ts-ignore addData(7)
sendTbNet(TbNetName.navigateToOutside, { // @ts-ignore
url: this.data.productLink sendTbNet(TbNetName.navigateToOutside, {
}) url: this.data.productLink
}, this) })
}, this)
}
} }
showNumberUp() { showNumberUp() {
......
...@@ -36,6 +36,7 @@ class DeviceMotion { ...@@ -36,6 +36,7 @@ class DeviceMotion {
if (my) { if (my) {
const { platform } = await getSystemInfo() const { platform } = await getSystemInfo()
this.platform = platform.toLowerCase() this.platform = platform.toLowerCase()
this._tmdremoveEvents()
//@ts-ignore //@ts-ignore
my.onDeviceMotionChange((res) => { my.onDeviceMotionChange((res) => {
// 通过 platform 进行判断当前是 弧度制还是 角度值 // 通过 platform 进行判断当前是 弧度制还是 角度值
...@@ -73,7 +74,6 @@ class DeviceMotion { ...@@ -73,7 +74,6 @@ class DeviceMotion {
} }
destory() { destory() {
this._tmdremoveEvents()
this.subs = [] this.subs = []
DeviceMotion._instance = null DeviceMotion._instance = null
} }
......
...@@ -102,10 +102,11 @@ class RandomArray { ...@@ -102,10 +102,11 @@ class RandomArray {
} }
getRandomValue() { getRandomValue() {
if (this.len == 0) { if (!this.arr.length) {
this.arr = this.iarr this.arr = [...this.iarr]
} }
var i = Math.floor(Math.random() * this.len) var len = this.arr.length
var i = Math.floor(Math.random() * len)
var value = this.arr[i] var value = this.arr[i]
this.arr.splice(i, 1) this.arr.splice(i, 1)
return value return value
...@@ -214,8 +215,8 @@ export class GameScene extends MotionInitScene { ...@@ -214,8 +215,8 @@ export class GameScene extends MotionInitScene {
async onSubmit(params) { async onSubmit(params) {
const {data, success, message} = await sendTbNet(TbNetName.submitGame, params) const {data, success, message} = await sendTbNet(TbNetName.submitGame, params)
if (success) { if (success) {
const {score, isNewRecord, productLink, isWinPrize,} = data const {score, isNewRecord, productLink, isWinPrize, level} = data
if (isWinPrize) { if (level != 0) {
//@ts-ignore //@ts-ignore
my && my.vibrateShort() my && my.vibrateShort()
...@@ -225,10 +226,17 @@ export class GameScene extends MotionInitScene { ...@@ -225,10 +226,17 @@ export class GameScene extends MotionInitScene {
} }
} else { } else {
//@ts-ignore //@ts-ignore
my && my.showToast({ var fakeData = {
content: message score: this.score,
}); level: [10, 20, 30].findIndex(i => this.score >= i),
sendTbNet(TbNetName.navigateBack) fake: true,
isWinPrize: false
}
if (fakeData.level != -1) {
showPanel(GameOverPanel, fakeData)
return
}
changeScene(GameOverScene, fakeData)
} }
} }
......
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