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";
import GoodsContainer from './game/goodsContainer'
import { Tools } from "../Tools"
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 {
GDispatcher
......@@ -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"]
guide
time: number = 0 // 游戏时间 倒计时 时长
guideIndex = 0
// 比拼的用户信息 和 自己的信息
userInfo
......@@ -77,19 +83,9 @@ export default class Root extends FYGE.Container {
console.log('CSD-GAME this.userInfo:', userInfoRes.data)
if (this.userInfo.isNewUser) {
let i = 0
let guide = Ins.initSprite(this.guideRes[i])
guide.addEventListener(FYGE.MouseEvent.CLICK, () => {
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.guideIndex = 0
let guide = Ins.initSprite(this.guideRes[this.guideIndex])
guide.addEventListener(FYGE.MouseEvent.CLICK, this.guideFunc, this)
this.addChild(guide)
} else {
showPanel(MatchingPanel, this.userInfo)
......@@ -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 () {
this.stageHeight = this.stage.viewRect.height
this.x = 0
......
......@@ -357,11 +357,16 @@ Page({
},
// 从游戏 返回 到 主页
backToPage () {
console.log(1)
backToPage (msg = '') {
console.log('%c ------------ ' + msg + ' ------------', ConsoleStyle)
this.getGameInfo()
this.setData({ gameShow_timeout: false, gameType: 0 })
setTimeout(() => { this.setData({ gameShow: false }) }, 350)
if (msg === 'openMyPrize') {
setTimeout (() => {
this.gotoMyPrizePage ()
}, 500)
}
},
// 去转盘
......
......@@ -119,6 +119,10 @@ Component({
// 游戏结束开奖 -- 提前
this.getGameOverPrize()
break;
case 'mine.seePrize':
// 游戏结束开奖 -- 提前
this.seePrize()
break;
default:
console.warn('监听时间名 没有对应处理函数')
break;
......@@ -133,25 +137,20 @@ Component({
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 () {
// -- test code --
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: '//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
// this.gameStartInfo_test()
// return
// -- test code --
API.doJoin({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline'})
......@@ -185,15 +184,8 @@ Component({
// 游戏结束 获取开奖
getGameOverPrize () {
// -- test code --
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})
return
// this.getGameOverPrize_test()
// return
// -- test code --
API.gameOver({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline', isWin: this.isWin})
......@@ -314,8 +306,39 @@ Component({
sum (m, n) {
var num = Math.floor(Math.random() * (m - n) + n)
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