Commit 51378a10 authored by AU-Pro-mac's avatar AU-Pro-mac

hy code

parent ff7ae849
...@@ -2517,7 +2517,7 @@ var Root = (function (_super) { ...@@ -2517,7 +2517,7 @@ var Root = (function (_super) {
this.addChild(leftCsd); this.addChild(leftCsd);
this.goodsContainer = new goodsContainer_1.default(this); this.goodsContainer = new goodsContainer_1.default(this);
this.addChild(this.goodsContainer); this.addChild(this.goodsContainer);
this.backBtn = Tools_1.Tools.getSprite(resCanvasList_1.default['334aff33-1a9e-4277-aafe-3d9f22eab3d5'].url, 0, 40 + 1624 / 2 - this.stage.viewRect.height / 2); this.backBtn = Tools_1.Tools.getSprite(resCanvasList_1.default['334aff33-1a9e-4277-aafe-3d9f22eab3d5'].url, 0, 20 + 1624 / 2 - this.stage.viewRect.height / 2);
this.backBtn.mouseEnable = true; this.backBtn.mouseEnable = true;
this.backBtn.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, function () { _this.gameOver('back'); }, this); this.backBtn.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, function () { _this.gameOver('back'); }, this);
this.addChild(this.backBtn); this.addChild(this.backBtn);
...@@ -2558,6 +2558,9 @@ var Root = (function (_super) { ...@@ -2558,6 +2558,9 @@ 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();
...@@ -2568,9 +2571,7 @@ var Root = (function (_super) { ...@@ -2568,9 +2571,7 @@ var Root = (function (_super) {
} }
else { else {
Main_1.GDispatcher.addEventListener('MatchCompelete', this.gameStart, this); Main_1.GDispatcher.addEventListener('MatchCompelete', this.gameStart, this);
this.time = 60; this.goodsContainer.createGoodsContainer();
this.scoreBoard.scoreRight = 0;
this.scoreBoard.scoreRight = 0;
ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, this.userInfo); ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, this.userInfo);
} }
return [2]; return [2];
...@@ -2596,7 +2597,6 @@ var Root = (function (_super) { ...@@ -2596,7 +2597,6 @@ var Root = (function (_super) {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.backToPage, {}, function (s, res) { console.log('backToPage'); }); TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.backToPage, {}, function (s, res) { console.log('backToPage'); });
return [2]; return [2];
} }
Main_1.GDispatcher.addEventListener('gameReset', this.gameAgain, this);
if (!(this.userInfo.win && this.scoreBoard.scoreLeft)) return [3, 2]; if (!(this.userInfo.win && this.scoreBoard.scoreLeft)) return [3, 2];
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getPrizeInfo)]; return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getPrizeInfo)];
case 1: case 1:
...@@ -2609,10 +2609,12 @@ var Root = (function (_super) { ...@@ -2609,10 +2609,12 @@ var Root = (function (_super) {
else { else {
ctrls_1.showPanel(SuccessNoAwardPanel_1.SuccessNoAwardPanel, prize); ctrls_1.showPanel(SuccessNoAwardPanel_1.SuccessNoAwardPanel, prize);
} }
Main_1.GDispatcher.addEventListener('gameReset', this.gameAgain, this);
return [3, 3]; return [3, 3];
case 2: case 2:
console.log('user fail --- CSD-GAME over data:'); console.log('user fail --- CSD-GAME over data:');
ctrls_1.showPanel(FailedPanel_1.FailedPanel); ctrls_1.showPanel(FailedPanel_1.FailedPanel);
Main_1.GDispatcher.addEventListener('gameReset', this.gameAgain, this);
_a.label = 3; _a.label = 3;
case 3: return [2]; case 3: return [2];
} }
...@@ -2973,7 +2975,6 @@ var GoodsContainer = (function (_super) { ...@@ -2973,7 +2975,6 @@ var GoodsContainer = (function (_super) {
return num; return num;
}; };
_this._root = root; _this._root = root;
_this.goodsDeepIndex = 1000;
_this.goodsTextures = [ _this.goodsTextures = [
{ texture: resCanvasList_1.default['d1379fca-f21e-40f0-b0f0-06c188d4b4dc'].url, score: 3, dir: 'left', wrong: -2, width: 92, height: 220, aX: -4, lot: 'light' }, { texture: resCanvasList_1.default['d1379fca-f21e-40f0-b0f0-06c188d4b4dc'].url, score: 3, dir: 'left', wrong: -2, width: 92, height: 220, aX: -4, lot: 'light' },
{ texture: resCanvasList_1.default['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 3, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2, lot: 'light' }, { texture: resCanvasList_1.default['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 3, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2, lot: 'light' },
...@@ -3033,6 +3034,9 @@ var GoodsContainer = (function (_super) { ...@@ -3033,6 +3034,9 @@ var GoodsContainer = (function (_super) {
this.lineContainer.mask = maskRect; this.lineContainer.mask = maskRect;
this.addChild(this.lineContainer); this.addChild(this.lineContainer);
this.startLine(); this.startLine();
this.createGoodsContainer();
};
GoodsContainer.prototype.createGoodsContainer = function () {
this.goodsContainer = new FYGE.Container(); this.goodsContainer = new FYGE.Container();
this.goodsContainer.width = 750; this.goodsContainer.width = 750;
this.goodsContainer.height = 988; this.goodsContainer.height = 988;
...@@ -3090,6 +3094,14 @@ var GoodsContainer = (function (_super) { ...@@ -3090,6 +3094,14 @@ var GoodsContainer = (function (_super) {
clearInterval(this.createGoodTimeOut); clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null; this.createGoodTimeOut = null;
}; };
GoodsContainer.prototype.stopGoods = function () {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.intoGoods = [];
this.goodsArr = [];
this.removeChild(this.goodsContainer);
this.goodsContainer = null;
};
GoodsContainer.prototype.startGoods = function () { GoodsContainer.prototype.startGoods = function () {
var _this = this; var _this = this;
this.createGoodTimeOut = setInterval(function () { this.createGoodTimeOut = setInterval(function () {
...@@ -15985,7 +15997,8 @@ var XxlScene = (function (_super) { ...@@ -15985,7 +15997,8 @@ var XxlScene = (function (_super) {
that.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that); that.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that);
that.addEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that); that.addEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that);
that.addEventListener(FYGE.Event.ENTER_FRAME, that.updateFrame, that); that.addEventListener(FYGE.Event.ENTER_FRAME, that.updateFrame, that);
Main_1.GDispatcher.addEventListener("MatchCompelete", this.gameStart, that); Main_1.GDispatcher.addEventListener("MatchCompelete", that.gameStart, that);
Main_1.GDispatcher.addEventListener("outCallBackToPage", that.backToPage, that);
}; };
XxlScene.prototype.gameStart = function () { XxlScene.prototype.gameStart = function () {
this.rightUserContainer.visible = true; this.rightUserContainer.visible = true;
...@@ -16049,6 +16062,9 @@ var XxlScene = (function (_super) { ...@@ -16049,6 +16062,9 @@ var XxlScene = (function (_super) {
}); });
}); });
}; };
XxlScene.prototype.backToPage = function () {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.backToPage, {}, function (s, res) { console.log('backToPage'); });
};
XxlScene.prototype.updateFrame = function () { XxlScene.prototype.updateFrame = function () {
if (!this.isGameStart) { if (!this.isGameStart) {
return; return;
...@@ -16106,6 +16122,7 @@ var XxlScene = (function (_super) { ...@@ -16106,6 +16122,7 @@ var XxlScene = (function (_super) {
that.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that); that.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that);
that.removeEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that); that.removeEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that);
Main_1.GDispatcher.removeEventListener("gameReset", this.reset); Main_1.GDispatcher.removeEventListener("gameReset", this.reset);
Main_1.GDispatcher.removeEventListener("outCallBackToPage", that.backToPage);
}; };
return XxlScene; return XxlScene;
}(Scene_1.Scene)); }(Scene_1.Scene));
......
This diff is collapsed.
...@@ -2519,7 +2519,7 @@ var Root = (function (_super) { ...@@ -2519,7 +2519,7 @@ var Root = (function (_super) {
this.addChild(leftCsd); this.addChild(leftCsd);
this.goodsContainer = new goodsContainer_1.default(this); this.goodsContainer = new goodsContainer_1.default(this);
this.addChild(this.goodsContainer); this.addChild(this.goodsContainer);
this.backBtn = Tools_1.Tools.getSprite(resCanvasList_1.default['334aff33-1a9e-4277-aafe-3d9f22eab3d5'].url, 0, 40 + 1624 / 2 - this.stage.viewRect.height / 2); this.backBtn = Tools_1.Tools.getSprite(resCanvasList_1.default['334aff33-1a9e-4277-aafe-3d9f22eab3d5'].url, 0, 20 + 1624 / 2 - this.stage.viewRect.height / 2);
this.backBtn.mouseEnable = true; this.backBtn.mouseEnable = true;
this.backBtn.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, function () { _this.gameOver('back'); }, this); this.backBtn.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, function () { _this.gameOver('back'); }, this);
this.addChild(this.backBtn); this.addChild(this.backBtn);
...@@ -2560,6 +2560,9 @@ var Root = (function (_super) { ...@@ -2560,6 +2560,9 @@ 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,9 +2573,7 @@ var Root = (function (_super) { ...@@ -2570,9 +2573,7 @@ var Root = (function (_super) {
} }
else { else {
Main_1.GDispatcher.addEventListener('MatchCompelete', this.gameStart, this); Main_1.GDispatcher.addEventListener('MatchCompelete', this.gameStart, this);
this.time = 60; this.goodsContainer.createGoodsContainer();
this.scoreBoard.scoreRight = 0;
this.scoreBoard.scoreRight = 0;
ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, this.userInfo); ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, this.userInfo);
} }
return [2]; return [2];
...@@ -2598,7 +2599,6 @@ var Root = (function (_super) { ...@@ -2598,7 +2599,6 @@ var Root = (function (_super) {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.backToPage, {}, function (s, res) { console.log('backToPage'); }); TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.backToPage, {}, function (s, res) { console.log('backToPage'); });
return [2]; return [2];
} }
Main_1.GDispatcher.addEventListener('gameReset', this.gameAgain, this);
if (!(this.userInfo.win && this.scoreBoard.scoreLeft)) return [3, 2]; if (!(this.userInfo.win && this.scoreBoard.scoreLeft)) return [3, 2];
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getPrizeInfo)]; return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getPrizeInfo)];
case 1: case 1:
...@@ -2611,10 +2611,12 @@ var Root = (function (_super) { ...@@ -2611,10 +2611,12 @@ var Root = (function (_super) {
else { else {
ctrls_1.showPanel(SuccessNoAwardPanel_1.SuccessNoAwardPanel, prize); ctrls_1.showPanel(SuccessNoAwardPanel_1.SuccessNoAwardPanel, prize);
} }
Main_1.GDispatcher.addEventListener('gameReset', this.gameAgain, this);
return [3, 3]; return [3, 3];
case 2: case 2:
console.log('user fail --- CSD-GAME over data:'); console.log('user fail --- CSD-GAME over data:');
ctrls_1.showPanel(FailedPanel_1.FailedPanel); ctrls_1.showPanel(FailedPanel_1.FailedPanel);
Main_1.GDispatcher.addEventListener('gameReset', this.gameAgain, this);
_a.label = 3; _a.label = 3;
case 3: return [2]; case 3: return [2];
} }
...@@ -2975,7 +2977,6 @@ var GoodsContainer = (function (_super) { ...@@ -2975,7 +2977,6 @@ var GoodsContainer = (function (_super) {
return num; return num;
}; };
_this._root = root; _this._root = root;
_this.goodsDeepIndex = 1000;
_this.goodsTextures = [ _this.goodsTextures = [
{ texture: resCanvasList_1.default['d1379fca-f21e-40f0-b0f0-06c188d4b4dc'].url, score: 3, dir: 'left', wrong: -2, width: 92, height: 220, aX: -4, lot: 'light' }, { texture: resCanvasList_1.default['d1379fca-f21e-40f0-b0f0-06c188d4b4dc'].url, score: 3, dir: 'left', wrong: -2, width: 92, height: 220, aX: -4, lot: 'light' },
{ texture: resCanvasList_1.default['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 3, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2, lot: 'light' }, { texture: resCanvasList_1.default['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 3, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2, lot: 'light' },
...@@ -3035,6 +3036,9 @@ var GoodsContainer = (function (_super) { ...@@ -3035,6 +3036,9 @@ var GoodsContainer = (function (_super) {
this.lineContainer.mask = maskRect; this.lineContainer.mask = maskRect;
this.addChild(this.lineContainer); this.addChild(this.lineContainer);
this.startLine(); this.startLine();
this.createGoodsContainer();
};
GoodsContainer.prototype.createGoodsContainer = function () {
this.goodsContainer = new FYGE.Container(); this.goodsContainer = new FYGE.Container();
this.goodsContainer.width = 750; this.goodsContainer.width = 750;
this.goodsContainer.height = 988; this.goodsContainer.height = 988;
...@@ -3092,6 +3096,14 @@ var GoodsContainer = (function (_super) { ...@@ -3092,6 +3096,14 @@ var GoodsContainer = (function (_super) {
clearInterval(this.createGoodTimeOut); clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null; this.createGoodTimeOut = null;
}; };
GoodsContainer.prototype.stopGoods = function () {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.intoGoods = [];
this.goodsArr = [];
this.removeChild(this.goodsContainer);
this.goodsContainer = null;
};
GoodsContainer.prototype.startGoods = function () { GoodsContainer.prototype.startGoods = function () {
var _this = this; var _this = this;
this.createGoodTimeOut = setInterval(function () { this.createGoodTimeOut = setInterval(function () {
...@@ -15987,7 +15999,8 @@ var XxlScene = (function (_super) { ...@@ -15987,7 +15999,8 @@ var XxlScene = (function (_super) {
that.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that); that.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that);
that.addEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that); that.addEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that);
that.addEventListener(FYGE.Event.ENTER_FRAME, that.updateFrame, that); that.addEventListener(FYGE.Event.ENTER_FRAME, that.updateFrame, that);
Main_1.GDispatcher.addEventListener("MatchCompelete", this.gameStart, that); Main_1.GDispatcher.addEventListener("MatchCompelete", that.gameStart, that);
Main_1.GDispatcher.addEventListener("outCallBackToPage", that.backToPage, that);
}; };
XxlScene.prototype.gameStart = function () { XxlScene.prototype.gameStart = function () {
this.rightUserContainer.visible = true; this.rightUserContainer.visible = true;
...@@ -16051,6 +16064,9 @@ var XxlScene = (function (_super) { ...@@ -16051,6 +16064,9 @@ var XxlScene = (function (_super) {
}); });
}); });
}; };
XxlScene.prototype.backToPage = function () {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.backToPage, {}, function (s, res) { console.log('backToPage'); });
};
XxlScene.prototype.updateFrame = function () { XxlScene.prototype.updateFrame = function () {
if (!this.isGameStart) { if (!this.isGameStart) {
return; return;
...@@ -16108,6 +16124,7 @@ var XxlScene = (function (_super) { ...@@ -16108,6 +16124,7 @@ var XxlScene = (function (_super) {
that.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that); that.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, that.mouseDown, that);
that.removeEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that); that.removeEventListener(FYGE.MouseEvent.MOUSE_UP, that.mouseUp, that);
Main_1.GDispatcher.removeEventListener("gameReset", this.reset); Main_1.GDispatcher.removeEventListener("gameReset", this.reset);
Main_1.GDispatcher.removeEventListener("outCallBackToPage", that.backToPage);
}; };
return XxlScene; return XxlScene;
}(Scene_1.Scene)); }(Scene_1.Scene));
......
...@@ -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);
......
...@@ -79,7 +79,7 @@ export default class Root extends FYGE.Container { ...@@ -79,7 +79,7 @@ export default class Root extends FYGE.Container {
// --  返回 // --  返回
this.backBtn = Tools.getSprite(resCanvasList['334aff33-1a9e-4277-aafe-3d9f22eab3d5'].url, 0, 40 + 1624 / 2 - this.stage.viewRect.height / 2) this.backBtn = Tools.getSprite(resCanvasList['334aff33-1a9e-4277-aafe-3d9f22eab3d5'].url, 0, 20 + 1624 / 2 - this.stage.viewRect.height / 2)
this.backBtn.mouseEnable = true this.backBtn.mouseEnable = true
this.backBtn.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, () => { this.gameOver('back') }, this) this.backBtn.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, () => { this.gameOver('back') }, this)
this.addChild(this.backBtn) this.addChild(this.backBtn)
...@@ -127,6 +127,10 @@ export default class Root extends FYGE.Container { ...@@ -127,6 +127,10 @@ export default class Root extends FYGE.Container {
// 取消监听再来一局 // 取消监听再来一局
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)
...@@ -137,9 +141,7 @@ export default class Root extends FYGE.Container { ...@@ -137,9 +141,7 @@ export default class Root extends FYGE.Container {
// 否则 执行正常开始逻辑 // 否则 执行正常开始逻辑
} else { } else {
GDispatcher.addEventListener('MatchCompelete', this.gameStart, this) GDispatcher.addEventListener('MatchCompelete', this.gameStart, this)
this.time = 60 this.goodsContainer.createGoodsContainer()
this.scoreBoard.scoreRight = 0
this.scoreBoard.scoreRight = 0
showPanel(MatchingPanel, this.userInfo) showPanel(MatchingPanel, this.userInfo)
} }
...@@ -163,10 +165,6 @@ export default class Root extends FYGE.Container { ...@@ -163,10 +165,6 @@ export default class Root extends FYGE.Container {
} }
// 正常结束 - 由子组件调用 // 正常结束 - 由子组件调用
// 监听再来一局
GDispatcher.addEventListener('gameReset', this.gameAgain, this)
if (this.userInfo.win && this.scoreBoard.scoreLeft) { if (this.userInfo.win && this.scoreBoard.scoreLeft) {
//胜利 //胜利
const prizeInfo = await sendTbNet(TbNetName.getPrizeInfo) const prizeInfo = await sendTbNet(TbNetName.getPrizeInfo)
...@@ -177,11 +175,16 @@ export default class Root extends FYGE.Container { ...@@ -177,11 +175,16 @@ export default class Root extends FYGE.Container {
} else { } else {
showPanel(SuccessNoAwardPanel, prize) showPanel(SuccessNoAwardPanel, prize)
} }
// 监听再来一局
GDispatcher.addEventListener('gameReset', this.gameAgain, this)
} else { } else {
//失败 //失败
console.log('user fail --- CSD-GAME over data:') console.log('user fail --- CSD-GAME over data:')
showPanel(FailedPanel) showPanel(FailedPanel)
// 监听再来一局
GDispatcher.addEventListener('gameReset', this.gameAgain, this)
} }
// GDispatcher.dispatchEvent('gameOver-csd', {score: score}) // GDispatcher.dispatchEvent('gameOver-csd', {score: score})
} }
......
...@@ -29,8 +29,6 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -29,8 +29,6 @@ export default class GoodsContainer extends FYGE.Container {
goodsTextures; goodsTextures;
// 产生掉落物 的 interval函数 // 产生掉落物 的 interval函数
createGoodTimeOut = null createGoodTimeOut = null
// 掉落物 深度总数
goodsDeepIndex;
// 进入可被滑动的 掉落物 // 进入可被滑动的 掉落物
intoGoods = []; intoGoods = [];
...@@ -40,7 +38,6 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -40,7 +38,6 @@ export default class GoodsContainer extends FYGE.Container {
constructor (root) { constructor (root) {
super() super()
this._root = root this._root = root
this.goodsDeepIndex = 1000
this.goodsTextures = [ this.goodsTextures = [
{ texture: resCanvasList['d1379fca-f21e-40f0-b0f0-06c188d4b4dc'].url, score: 3, dir: 'left', wrong: -2, width: 92, height: 220, aX: -4, lot: 'light' }, { texture: resCanvasList['d1379fca-f21e-40f0-b0f0-06c188d4b4dc'].url, score: 3, dir: 'left', wrong: -2, width: 92, height: 220, aX: -4, lot: 'light' },
{ texture: resCanvasList['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 3, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2, lot: 'light' }, { texture: resCanvasList['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 3, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2, lot: 'light' },
...@@ -110,6 +107,10 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -110,6 +107,10 @@ export default class GoodsContainer extends FYGE.Container {
this.addChild(this.lineContainer) this.addChild(this.lineContainer)
this.startLine() this.startLine()
this.createGoodsContainer()
}
createGoodsContainer () {
this.goodsContainer = new FYGE.Container() this.goodsContainer = new FYGE.Container()
this.goodsContainer.width = 750 this.goodsContainer.width = 750
this.goodsContainer.height = 988 this.goodsContainer.height = 988
...@@ -176,7 +177,16 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -176,7 +177,16 @@ export default class GoodsContainer extends FYGE.Container {
this.createLineTimeOut = null this.createLineTimeOut = null
clearInterval(this.createGoodTimeOut) clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = null this.createGoodTimeOut = null
}
stopGoods () {
clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = null
this.intoGoods = []
this.goodsArr = []
this.removeChild(this.goodsContainer)
this.goodsContainer = null
} }
// 掉落物开始掉落 // 掉落物开始掉落
...@@ -185,7 +195,6 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -185,7 +195,6 @@ export default class GoodsContainer extends FYGE.Container {
let g = this.createGoods() let g = this.createGoods()
this.goodsArr.unshift(g) this.goodsArr.unshift(g)
this.goodsContainer.addChildAt(g, -1) this.goodsContainer.addChildAt(g, -1)
// g.zIndex = --this.goodsDeepIndex
}, 1000) }, 1000)
} }
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<pagecanvas <pagecanvas
class="homepage_pagecanvas" class="homepage_pagecanvas"
onBackPage="backToPage" onBackPage="backToPage"
gameType="{{ gameType }}" gameType="{{gameType}}"
onAnimationLoadOver="onAnimationLoadOver" onAnimationLoadOver="onAnimationLoadOver"
> >
</pagecanvas> </pagecanvas>
......
...@@ -17,29 +17,30 @@ const checkSystem = async () => { ...@@ -17,29 +17,30 @@ const checkSystem = async () => {
Component({ Component({
data: { data: {
// 当前正在进行的游戏 // 当前正在进行的游戏
gameType: 0,
// 规则弹窗 // 规则弹窗
ruleModalVisible: false, ruleModalVisible: false,
// 消息弹窗 // 消息弹窗
messageMadalData: {}, messageMadalData: {},
messageMadalVisble: false, messageMadalVisble: false,
back: false back: false,
commonModalVisibleT1: false,
}, },
isWin: false, isWin: false,
commonModalVisibleT1: false,
gamePrize: null, gamePrize: null,
gameData: null, gameData: null,
gameStartTime: 0, gameStartTime: 0,
gameType: 0,
didMount() { didMount() {
this.setData({ gameType: this.props.gameType }) this.gameStartTime = 0
this.gameType = this.props.gameType
// this.getFakeAvatar() // this.getFakeAvatar()
}, },
didUpdate(prevProps, prevData) { didUpdate(prevProps, prevData) {
console.warn('gameType', this.props.gameType) console.warn('gameType', this.props.gameType)
if (this.props.gameType !== prevProps.gameType) { if (this.props.gameType != this.gameType) {
this.setData({ gameType: this.props.gameType }) this.gameType = this.props.gameType
// 存储本地 用户玩游戏的信息 // 存储本地 用户玩游戏的信息
if (this.props.gameType == 1) { if (this.props.gameType == 1) {
// 切换游戏场景 // 切换游戏场景
...@@ -141,8 +142,8 @@ Component({ ...@@ -141,8 +142,8 @@ Component({
this.props.onBackPage() this.props.onBackPage()
this.gameData = null this.gameData = null
this.gamePrize = null this.gamePrize = null
this.gameType = 0
this.gameStartTime = 0 this.gameStartTime = 0
this.setData({gameType: 0})
}, },
// 查看奖品 - 返回而已 没差 // 查看奖品 - 返回而已 没差
...@@ -151,7 +152,8 @@ Component({ ...@@ -151,7 +152,8 @@ Component({
this.props.onBackPage('openMyPrize') this.props.onBackPage('openMyPrize')
this.gameData = null this.gameData = null
this.gamePrize = null this.gamePrize = null
this.setData({gameType: 0}) this.gameType = 0
this.gameStartTime = 0
}, },
// 游戏开始 获取用户信息 // 游戏开始 获取用户信息
...@@ -186,14 +188,14 @@ Component({ ...@@ -186,14 +188,14 @@ Component({
} }
// 请求后端 开始游戏 // 请求后端 开始游戏
API.doJoin({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline'}) API.doJoin({activityId: app.activityId, type: this.gameType == 1 ? 'slide' : 'timeline'})
.then(res => { .then(res => {
this.gameStartTime += 1 this.gameStartTime += 1
const { data, success } = res const { data, success } = res
console.log('%c-----开始游戏\n' + '-----yd.doJoin\n', ConsoleStyle, data) console.log('%c-----开始游戏\n' + '-----yd.doJoin\n', ConsoleStyle, data)
if (success) { if (success) {
// 计算胜负 // 计算胜负
let win = this.countWinRange(this.data.gameType) let win = this.countWinRange(this.gameType)
this.isWin = win this.isWin = win
let fname = this.getFakeUserName() let fname = this.getFakeUserName()
let favatar = this.getFakeAvatar() let favatar = this.getFakeAvatar()
...@@ -220,12 +222,12 @@ Component({ ...@@ -220,12 +222,12 @@ Component({
}, },
saveStorage () { saveStorage () {
if (this.data.gameType == 1) { if (this.gameType == 1) {
my.setStorage({ my.setStorage({
key: `YD11_firstInGameCsd_${app.activityId}_${app.openId}`, key: `YD11_firstInGameCsd_${app.activityId}_${app.openId}`,
data: 1 data: 1
}); });
} else if (this.data.gameType == 2) { } else if (this.gameType == 2) {
my.setStorage({ my.setStorage({
key: `YD11_firstInGameXxl_${app.activityId}_${app.openId}`, key: `YD11_firstInGameXxl_${app.activityId}_${app.openId}`,
data: 1 data: 1
...@@ -234,12 +236,12 @@ Component({ ...@@ -234,12 +236,12 @@ Component({
}, },
checkFirstInFromStorage () { checkFirstInFromStorage () {
if (this.data.gameType == 1) { if (this.gameType == 1) {
let resCsd = my.getStorageSync({ key: `YD11_firstInGameCsd_${app.activityId}_${app.openId}` }) let resCsd = my.getStorageSync({ key: `YD11_firstInGameCsd_${app.activityId}_${app.openId}` })
console.warn('resCsd', resCsd) console.warn('resCsd', resCsd)
if (resCsd.data && resCsd.data == 1) return false if (resCsd.data && resCsd.data == 1) return false
else return true else return true
} else if (this.data.gameType == 2) { } else if (this.gameType == 2) {
let resXxl = my.getStorageSync({key: `YD11_firstInGameXxl_${app.activityId}_${app.openId}` }) let resXxl = my.getStorageSync({key: `YD11_firstInGameXxl_${app.activityId}_${app.openId}` })
console.warn('resXxl', resXxl) console.warn('resXxl', resXxl)
if (resXxl.data && resXxl.data == 1) return false if (resXxl.data && resXxl.data == 1) return false
...@@ -253,7 +255,7 @@ Component({ ...@@ -253,7 +255,7 @@ Component({
this.getGameOverPrize_test() this.getGameOverPrize_test()
return return
API.gameOver({activityId: app.activityId, type: this.data.gameType === 1 ? 'slide' : 'timeline', isWin: this.isWin}) API.gameOver({activityId: app.activityId, type: this.gameType == 1 ? 'slide' : 'timeline', isWin: this.isWin})
.then(res => { .then(res => {
const { data, success} = res const { data, success} = res
console.log('%c-----游戏结束 获取开奖\n' + '-----yd.gameOver\n', ConsoleStyle, data) console.log('%c-----游戏结束 获取开奖\n' + '-----yd.gameOver\n', ConsoleStyle, data)
...@@ -296,10 +298,10 @@ Component({ ...@@ -296,10 +298,10 @@ Component({
console.log('csdWinRate: ', parseInt(app.csdWinRate)) console.log('csdWinRate: ', parseInt(app.csdWinRate))
let num = Math.floor(Math.random() * (100 - 1) + 1) let num = Math.floor(Math.random() * (100 - 1) + 1)
console.log('num: ', num) console.log('num: ', num)
if (type === 1) { if (type == 1) {
if (num <= parseInt(app.csdWinRate)) win = true if (num <= parseInt(app.csdWinRate)) win = true
else win = false else win = false
} else if (type === 2) { } else if (type == 2) {
if (num <= parseInt(app.xxlWinRate)) win = true if (num <= parseInt(app.xxlWinRate)) win = true
else win = false else win = false
} }
...@@ -371,21 +373,24 @@ Component({ ...@@ -371,21 +373,24 @@ Component({
}) })
}, },
confirmCommonModalT1 () { this.data.confirmCommonModalT1() },
// 通用弹层 - 关闭 - T1 // 通用弹层 - 关闭 - T1
closeCommonModalT1() { closeCommonModalT1() {
this.setData({ commonModalVisibleT1: false }); console.log('%ccloseCommonModal function inside', ConsoleStyle)
this.back() this.postMessage('mine.outCallBackToPage')
this.setData({ commonModalVisibleT1: false })
}, },
gameStartInfo_test (){ gameStartInfo_test (){
// console.log('%c------------gameStartTime: ', ConsoleStyle, this.gameStartTime)
// 游戏重新开始 获取游戏次数 // 游戏重新开始 获取游戏次数
let gt = true let gt = true
if (this.gameStartTime !== 0) { if (this.gameStartTime !== 0) {
// 设置没有次数 // 设置没有次数
gt = false gt = false
// 设置有次数 // // 设置有次数
gt = true // gt = true
} }
// 没有游戏次数 // 没有游戏次数
...@@ -395,13 +400,14 @@ Component({ ...@@ -395,13 +400,14 @@ Component({
title: '门票不足', title: '门票不足',
content: '门票消耗完了!\n快去做任务吧~', content: '门票消耗完了!\n快去做任务吧~',
confirmCallback: () => { confirmCallback: () => {
console.log('%ccloseCommonModal agument function', ConsoleStyle)
this.closeCommonModalT1() this.closeCommonModalT1()
}, },
btnImg: '//yun.duiba.com.cn/spark/assets/好的按钮.948e42751245099e12fef8ad2617d746f6370863.png' }) btnImg: '//yun.duiba.com.cn/spark/assets/好的按钮.948e42751245099e12fef8ad2617d746f6370863.png' })
return return
} }
let win = this.countWinRange(this.data.gameType) let win = this.countWinRange(this.gameType)
this.isWin = win this.isWin = win
let fname = this.getFakeUserName() let fname = this.getFakeUserName()
let favatar = this.getFakeAvatar() let favatar = this.getFakeAvatar()
...@@ -411,7 +417,7 @@ Component({ ...@@ -411,7 +417,7 @@ Component({
fakeUserImgUrl: favatar, fakeUserImgUrl: favatar,
userName: app.nickName, userName: app.nickName,
userImgUrl: app.avatar, userImgUrl: app.avatar,
isNewUser: this.data.gameType === 1 ? app.isNewUser_csd : app.isNewUser_xxl isNewUser: this.gameType == 1 ? app.isNewUser_csd : app.isNewUser_xxl
} }
console.log('%cgameData:', ConsoleStyle, this.gameData) console.log('%cgameData:', ConsoleStyle, this.gameData)
this.postMessage('mine.getUserInfo', {data: this.gameData}) this.postMessage('mine.getUserInfo', {data: this.gameData})
......
...@@ -18,11 +18,11 @@ Page({ ...@@ -18,11 +18,11 @@ Page({
prizesModalVisible: false, prizesModalVisible: false,
missionModalVisible: false, missionModalVisible: false,
prizeInfo: `一等奖:清空购物车大奖,上限5000元,每日1个名额 prizeInfo: `一等奖:清空购物车大奖,上限5000元,每日1个名额
二等奖:时空焕活透亮润泽胶囊精华液约30粒(VC胶囊),共8件; 二等奖:时空焕活透亮润泽胶囊精华液约30粒(VC胶囊)
三等奖:时空焕活胶囊精华液约30粒(金胶),共8件; 三等奖:时空焕活胶囊精华液约30粒(金胶)
四等奖:时空焕活透亮润泽胶囊精华液约7粒(VC胶囊7粒),共1724份; 四等奖:时空焕活透亮润泽胶囊精华液约7粒(VC胶囊7粒)
五等奖:面额为1100-150的雅顿店铺优惠券,共14000份;`, 五等奖:面额为1100-150的雅顿店铺优惠券`,
prizeInfoTitle: '奖品介绍', prizeInfoTitle: '奖品介绍',
......
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