Commit 50d67c3b authored by AU-Pro-mac's avatar AU-Pro-mac

add new code --05

parent 5100ac8e
...@@ -9,6 +9,9 @@ import { MatchingPanel } from "../com/MatchingPanel"; ...@@ -9,6 +9,9 @@ import { MatchingPanel } from "../com/MatchingPanel";
import GoodsContainer from './game/goodsContainer' import GoodsContainer from './game/goodsContainer'
import { Tools } from "../Tools" import { Tools } from "../Tools"
import { destroyNetData, sendTbNet, TbNetName } from "../TaoBaoNet"; import { destroyNetData, sendTbNet, TbNetName } from "../TaoBaoNet";
import { FailedPanel } from "../com/FailedPanel";
import { SuccessNoAwardPanel } from "../com/SuccessNoAwardPanel";
import { SuccessPanel } from "../com/SuccessPanel";
export default class Root extends FYGE.Container { export default class Root extends FYGE.Container {
GDispatcher GDispatcher
...@@ -39,8 +42,11 @@ export default class Root extends FYGE.Container { ...@@ -39,8 +42,11 @@ export default class Root extends FYGE.Container {
//引导页 //引导页
guideRes = ["828f6676-7956-473a-a951-bc2f5f1ba8a3", "bc6aa86d-7cd8-4a11-9bd1-931040af3c6e", "0668f8d0-6fb3-46f9-a5e4-952aef42f05c"] guideRes = ["828f6676-7956-473a-a951-bc2f5f1ba8a3", "bc6aa86d-7cd8-4a11-9bd1-931040af3c6e", "0668f8d0-6fb3-46f9-a5e4-952aef42f05c"]
guide
time: number = 0 // 游戏时间 倒计时 时长 time: number = 0 // 游戏时间 倒计时 时长
guideIndex = 0
// 比拼的用户信息 和 自己的信息 // 比拼的用户信息 和 自己的信息
userInfo userInfo
...@@ -77,19 +83,9 @@ export default class Root extends FYGE.Container { ...@@ -77,19 +83,9 @@ export default class Root extends FYGE.Container {
console.log('CSD-GAME this.userInfo:', userInfoRes.data) console.log('CSD-GAME this.userInfo:', userInfoRes.data)
if (this.userInfo.isNewUser) { if (this.userInfo.isNewUser) {
let i = 0 this.guideIndex = 0
let guide = Ins.initSprite(this.guideRes[i]) let guide = Ins.initSprite(this.guideRes[this.guideIndex])
guide.addEventListener(FYGE.MouseEvent.CLICK, () => { guide.addEventListener(FYGE.MouseEvent.CLICK, this.guideFunc, this)
i++
if (i > this.guideRes.length - 1) {
guide.visible = false
setTimeout(() => {
showPanel(MatchingPanel, this.userInfo)
}, 200)
} else {
guide.texture = Ins.getRes(this.guideRes[i])
}
}, this)
this.addChild(guide) this.addChild(guide)
} else { } else {
showPanel(MatchingPanel, this.userInfo) showPanel(MatchingPanel, this.userInfo)
...@@ -194,6 +190,19 @@ export default class Root extends FYGE.Container { ...@@ -194,6 +190,19 @@ export default class Root extends FYGE.Container {
} }
} }
guideFunc () {
let i = this.guideIndex
i++
if (i > this.guideRes.length - 1) {
this.guide.visible = false
setTimeout(() => {
showPanel(MatchingPanel, this.userInfo)
}, 200)
} else {
this.guide.texture = Ins.getRes(this.guideRes[i])
}
}
onAddToStage () { onAddToStage () {
this.stageHeight = this.stage.viewRect.height this.stageHeight = this.stage.viewRect.height
this.x = 0 this.x = 0
......
...@@ -357,11 +357,16 @@ Page({ ...@@ -357,11 +357,16 @@ Page({
}, },
// 从游戏 返回 到 主页 // 从游戏 返回 到 主页
backToPage () { backToPage (msg = '') {
console.log(1) console.log('%c ------------ ' + msg + ' ------------', ConsoleStyle)
this.getGameInfo() this.getGameInfo()
this.setData({ gameShow_timeout: false, gameType: 0 }) this.setData({ gameShow_timeout: false, gameType: 0 })
setTimeout(() => { this.setData({ gameShow: false }) }, 350) setTimeout(() => { this.setData({ gameShow: false }) }, 350)
if (msg === 'openMyPrize') {
setTimeout (() => {
this.gotoMyPrizePage ()
}, 500)
}
}, },
// 去转盘 // 去转盘
......
...@@ -119,6 +119,10 @@ Component({ ...@@ -119,6 +119,10 @@ Component({
// 游戏结束开奖 -- 提前 // 游戏结束开奖 -- 提前
this.getGameOverPrize() this.getGameOverPrize()
break; break;
case 'mine.seePrize':
// 游戏结束开奖 -- 提前
this.seePrize()
break;
default: default:
console.warn('监听时间名 没有对应处理函数') console.warn('监听时间名 没有对应处理函数')
break; break;
...@@ -133,25 +137,20 @@ Component({ ...@@ -133,25 +137,20 @@ Component({
this.setData({gameType: 0}) this.setData({gameType: 0})
}, },
// 查看奖品 - 返回而已 没差
seePrize () {
console.log('%c 接收到 See Prize', ConsoleStyle)
this.props.onBackPage('openMyPrize')
this.gameData = null
this.gamePrize = null
this.setData({gameType: 0})
},
// 游戏开始 获取用户信息 // 游戏开始 获取用户信息
gameStartInfo () { gameStartInfo () {
// -- test code -- // -- test code --
let win = this.countWinRange(this.data.gameType) // this.gameStartInfo_test()
this.isWin = win // return
let fname = this.getFakeUserName()
let favatar = this.getFakeAvatar()
this.gameData = {
win: win,
fakeUserName: fname,
fakeUserImgUrl: '//yun.duiba.com.cn/spark/assets/43081f4ee9aed1c4d89d9e0882b2b5210a93ef17.png',
userName: app.nickName,
userImgUrl: app.avatar,
isNewUser: this.data.gameType === 1 ? app.isNewUser_csd : app.isNewUser_xxl
}
console.log('%cgameData:', ConsoleStyle, this.gameData)
this.postMessage('mine.getUserInfo', {data: this.gameData})
return
// -- test code -- // -- test code --
API.doJoin({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline'}) API.doJoin({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline'})
...@@ -185,15 +184,8 @@ Component({ ...@@ -185,15 +184,8 @@ Component({
// 游戏结束 获取开奖 // 游戏结束 获取开奖
getGameOverPrize () { getGameOverPrize () {
// -- test code -- // -- test code --
this.gamePrize = { // this.getGameOverPrize_test()
name: '一碗热翔', // return
image: '//yun.duiba.com.cn/spark/assets/43081f4ee9aed1c4d89d9e0882b2b5210a93ef17.png',
type: 2
}
console.log('%cgamePrize:', ConsoleStyle, this.gamePrize)
this.postMessage('mine.getPrizeInfo', {data:this.gamePrize})
return
// -- test code -- // -- test code --
API.gameOver({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline', isWin: this.isWin}) API.gameOver({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline', isWin: this.isWin})
...@@ -314,8 +306,39 @@ Component({ ...@@ -314,8 +306,39 @@ Component({
sum (m, n) { sum (m, n) {
var num = Math.floor(Math.random() * (m - n) + n) var num = Math.floor(Math.random() * (m - n) + n)
return num return num
},
gameStartInfo_test (){
let win = this.countWinRange(this.data.gameType)
this.isWin = win
let fname = this.getFakeUserName()
let favatar = this.getFakeAvatar()
this.gameData = {
win: win,
fakeUserName: fname,
fakeUserImgUrl: favatar,
userName: app.nickName,
userImgUrl: app.avatar,
isNewUser: this.data.gameType === 1 ? app.isNewUser_csd : app.isNewUser_xxl
} }
console.log('%cgameData:', ConsoleStyle, this.gameData)
this.postMessage('mine.getUserInfo', {data: this.gameData})
return
},
getGameOverPrize_test (){
this.gamePrize = {
name: '一碗热翔',
image: '//yun.duiba.com.cn/spark/assets/43081f4ee9aed1c4d89d9e0882b2b5210a93ef17.png',
type: 2
}
console.log('%cgamePrize:', ConsoleStyle, this.gamePrize)
this.postMessage('mine.getPrizeInfo', {data:this.gamePrize})
}
} }
}); });
\ No newline at end of file
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