Commit d45075c8 authored by spc's avatar spc

modified: src/chuansongdai/Root.ts

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