Commit d45075c8 authored by spc's avatar spc

modified: src/chuansongdai/Root.ts

parent 9d86b3b6
......@@ -2558,9 +2558,6 @@ var Root = (function (_super) {
switch (_a.label) {
case 0:
Main_1.GDispatcher.removeEventListener('gameReset', this.gameAgain, this);
this.removeChild(this.scoreBoard);
this.scoreBoard = null;
this.goodsContainer.stopGoods();
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getUserInfo, {})];
case 1:
userInfoRes = _a.sent();
......@@ -2570,11 +2567,12 @@ var Root = (function (_super) {
Main_1.GDispatcher.addEventListener("outCallBackToPage", this.backOutCall, this);
return [2];
}
else {
this.removeChild(this.scoreBoard);
this.scoreBoard = null;
this.goodsContainer.stopGoods();
Main_1.GDispatcher.addEventListener('MatchCompelete', this.gameStart, this);
this.goodsContainer.createGoodsContainer();
ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, this.userInfo);
}
return [2];
}
});
......
This diff is collapsed.
......@@ -2560,9 +2560,6 @@ var Root = (function (_super) {
switch (_a.label) {
case 0:
Main_1.GDispatcher.removeEventListener('gameReset', this.gameAgain, this);
this.removeChild(this.scoreBoard);
this.scoreBoard = null;
this.goodsContainer.stopGoods();
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getUserInfo, {})];
case 1:
userInfoRes = _a.sent();
......@@ -2572,11 +2569,12 @@ var Root = (function (_super) {
Main_1.GDispatcher.addEventListener("outCallBackToPage", this.backOutCall, this);
return [2];
}
else {
this.removeChild(this.scoreBoard);
this.scoreBoard = null;
this.goodsContainer.stopGoods();
Main_1.GDispatcher.addEventListener('MatchCompelete', this.gameStart, this);
this.goodsContainer.createGoodsContainer();
ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, this.userInfo);
}
return [2];
}
});
......
......@@ -6,8 +6,8 @@ var fs = require("fs");
// fs.readFileSync("./output.js")
// )
// var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/';
// var endPath = "C:/Users/Duiba/Desktop/work/雅顿/new/new_taobao/taobao_mini/client/pages/pagecanvas/"
var endPath = '/Applications/DUIBA-TAOBAO/YD/new_taobao/taobao_mini/client/pages/pagecanvas/'
var endPath = "C:/Users/Duiba/Desktop/work/雅顿/new/new_taobao/taobao_mini/client/pages/pagecanvas/"
// var endPath = '/Applications/DUIBA-TAOBAO/YD/new_taobao/taobao_mini/client/pages/pagecanvas/'
var version = Math.round(new Date().getTime() / 1000);
......
......@@ -60,7 +60,7 @@ export default class Root extends FYGE.Container {
this.once(FYGE.Event.ADDED_TO_STAGE, this.onAddToStage, this)
}
async initUi () {
async initUi() {
this.backGround = new FYGE.Sprite()
this.backGround.x = 0
this.backGround.y = 0
......@@ -110,7 +110,7 @@ export default class Root extends FYGE.Container {
}
// 开始游戏
gameStart () {
gameStart() {
this.scoreBoard = new ScoreBoard(this, this.userInfo)
this.addChild(this.scoreBoard)
this.scoreBoard.start(this.time)
......@@ -122,33 +122,33 @@ export default class Root extends FYGE.Container {
}
// 再来一局
async gameAgain () {
async gameAgain() {
// 取消监听再来一局
GDispatcher.removeEventListener('gameReset', this.gameAgain, this)
this.removeChild(this.scoreBoard)
this.scoreBoard = null
this.goodsContainer.stopGoods()
const userInfoRes = await sendTbNet(TbNetName.getUserInfo, {})
this.userInfo = userInfoRes.data
console.log('CSD-GAME this.userInfo:', userInfoRes.data)
// 若返回信息中 显示没有游戏次数
if (this.userInfo.noGameTime && this.userInfo.noGameTime == 1) {
GDispatcher.addEventListener("outCallBackToPage", this.backOutCall, this)
return
// 否则 执行正常开始逻辑
} else {
}
this.removeChild(this.scoreBoard)
this.scoreBoard = null
this.goodsContainer.stopGoods()
// 若返回信息中 显示没有游戏次数
GDispatcher.addEventListener('MatchCompelete', this.gameStart, this)
this.goodsContainer.createGoodsContainer()
showPanel(MatchingPanel, this.userInfo)
}
}
// 结束游戏
async gameOver (type = '') {
async gameOver(type = '') {
this.time = 60
this.gameStartFlag = false
......@@ -190,19 +190,19 @@ export default class Root extends FYGE.Container {
// GDispatcher.dispatchEvent('gameOver-csd', {score: score})
}
backOutCall () {
backOutCall() {
GDispatcher.removeEventListener('gameReset', this.gameAgain, this)
GDispatcher.removeEventListener('outCallBackToPage', this.backOutCall, this)
sendTbNet(TbNetName.backToPage, {}, (s, res) => { console.log('back_To_Page') })
}
// 分数变动
gameScoreChange (score) {
gameScoreChange(score) {
this.scoreBoard.updateScore(score)
}
// 创建 触摸层
createTouchRect () {
createTouchRect() {
this.touchArea = Tools.getRect(750, 874, 0xff22ff, 0)
this.touchArea.x = 0
this.touchArea.y = 750
......@@ -214,15 +214,15 @@ export default class Root extends FYGE.Container {
}
// 退出游戏 返回主页
backToPage () {
backToPage() {
sendTbNet(TbNetName.backToPage, {}, (s, res) => { console.log('back_To_Page') })
}
onMouseDownArea (e) {
onMouseDownArea(e) {
if (this.gameStartFlag) { this.touchXStart = e.localX }
}
onMouseUpArea (e) {
onMouseUpArea(e) {
let direction = ''
if (this.gameStartFlag) {
this.touchXEnd = e.localX
......@@ -235,7 +235,7 @@ export default class Root extends FYGE.Container {
}
}
guideFunc () {
guideFunc() {
let i = ++this.guideIndex
if (i > this.guideRes.length - 1) {
this.guide.visible = false
......@@ -248,7 +248,7 @@ export default class Root extends FYGE.Container {
}
}
onAddToStage () {
onAddToStage() {
this.stageHeight = this.stage.viewRect.height
this.x = 0
this.y = this.stage.viewRect.height / 2 - 1624 / 2
......
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