Commit 4e40fc96 authored by spc's avatar spc

modified: output.js

parent c3eaf564
......@@ -1925,7 +1925,7 @@ var Main = (function () {
return [4, this.loadImageTexturesCsd02(resCanvasList)];
case 2:
_a.sent();
ctrls_1.changeScene(XxlScene_1.XxlScene);
ctrls_1.changeScene(MainScene_2.OpenAni);
return [2];
}
});
......@@ -2546,6 +2546,7 @@ var Root = (function (_super) {
this.goodsContainer.startGoods();
Main_1.GDispatcher.removeEventListener('MatchCompelete', this.gameStart, this);
this.gameStartFlag = true;
this.touchArea.mouseEnable = true;
};
Root.prototype.gameOver = function () {
return __awaiter(this, void 0, void 0, function () {
......@@ -2555,6 +2556,7 @@ var Root = (function (_super) {
case 0:
this.time = 60;
this.gameStartFlag = false;
this.touchArea.mouseEnable = false;
if (!this.userInfo.win)
this.scoreBoard.scoreRight += 3;
this.goodsContainer.removeAllGoods();
......@@ -2569,7 +2571,7 @@ var Root = (function (_super) {
prizeInfo = _a.sent();
prize = prizeInfo.data;
console.log('user win --- CSD-GAME over data:', prizeInfo.data);
if (prize.type > 3) {
if (prize.type <= 3) {
ctrls_1.showPanel(SuccessPanel_1.SuccessPanel, prize);
}
else {
......@@ -2589,10 +2591,10 @@ var Root = (function (_super) {
this.scoreBoard.updateScore(score);
};
Root.prototype.createTouchRect = function () {
this.touchArea = Tools_1.Tools.getRect(750, 574, 0xff22ff, 0);
this.touchArea = Tools_1.Tools.getRect(750, 874, 0xff22ff, 0);
this.touchArea.x = 0;
this.touchArea.y = 1050;
this.touchArea.mouseEnable = true;
this.touchArea.y = 750;
this.touchArea.mouseEnable = false;
this.addChild(this.touchArea);
this.touchArea.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onMouseDownArea, this);
this.touchArea.addEventListener(FYGE.MouseEvent.MOUSE_UP, this.onMouseUpArea, this);
......@@ -2626,6 +2628,7 @@ var Root = (function (_super) {
this.guide.visible = false;
setTimeout(function () {
ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, _this.userInfo);
_this.guide.removeEventListener(FYGE.MouseEvent.CLICK, _this.guideFunc, _this);
}, 200);
}
else {
......@@ -2681,6 +2684,9 @@ var Catecher = (function (_super) {
__extends(Catecher, _super);
function Catecher(root, dataInfo) {
var _this = _super.call(this) || this;
_this.timerNumer = 60;
_this.lt = 0;
_this.tt = 0;
_this.sum = function (m, n) {
var num = Math.floor(Math.random() * (m - n) + n);
return num;
......@@ -2732,8 +2738,7 @@ var Catecher = (function (_super) {
.to({ x: 424, alpha: 1 }, 100);
};
Catecher.prototype.destroy = function () {
clearInterval(this.timerFunc);
this.timerFunc = null;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
};
Catecher.prototype.updateScore = function (score) {
var scoreNow = score + this.scoreLeft;
......@@ -2784,26 +2789,39 @@ var Catecher = (function (_super) {
this.userScore_right.updateScore(this.scoreRight);
};
Catecher.prototype.stopTime = function () {
clearInterval(this.timerFunc);
this.timerFunc = null;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
};
Catecher.prototype.start = function (time) {
var _this = this;
this.scoreLeft = 0;
this.scoreRight = 0;
this.timerNumer = time;
this.updateTime(this.timerNumer);
this.timerFunc = setInterval(function () {
if (_this.timerNumer <= 0) {
_this._root.gameOver();
clearInterval(_this.timerFunc);
_this.timerFunc = null;
_this.updateTime(0);
}
else {
_this.updateTime(--_this.timerNumer);
this.addEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
};
Catecher.prototype.timerFunc = function () {
if (!this._root.gameStartFlag)
return;
if (this.timerNumer <= 0) {
this._root.gameOver();
this.updateTime(0);
this.lt = this.tt = 0;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
return;
}
if (this.lt) {
var nt = new Date().getTime();
var dt = nt - this.lt;
this.tt += dt / 1000 >> 0;
var ntt = 60 - this.tt;
if (ntt != this.timerNumer) {
this.timerNumer = ntt;
this.updateTime(this.timerNumer);
this.lt = nt;
}
}, 1000);
}
else {
this.lt = new Date().getTime();
}
};
Catecher.prototype.updateTime = function (time) {
this.timeText.text = time.toString() + 'S';
......@@ -2837,7 +2855,8 @@ var Catecher = (function (_super) {
c.width = 120;
c.height = 120;
var a = Tools_1.Tools.getCircle(60, 0x000000, 1, 60, 60);
var p = Tools_1.Tools.getSprite(avatar, 0, 0);
var p = FYGE.Sprite.fromUrl(avatar);
p.x = p.y = 0;
p.width = 120;
p.height = 120;
c['updateAvatar'] = function (avatar) { p.texture = RES_1.RES.getRes(avatar); };
......@@ -15103,10 +15122,10 @@ var Robot = (function () {
else {
if (gameLeftTime > XxlConfig_1.config.time / 2) {
if (this._score > userScore) {
this._score += (Math.floor(Math.random() * 6) + 2) * 10;
this._score += (Math.floor(Math.random() * 6) + 3) * 10;
}
else {
this._score = userScore + (Math.floor(Math.random() * 3) + 2) * 10;
this._score = userScore + (Math.floor(Math.random() * 6) + 8) * 10;
}
}
else {
......@@ -15226,7 +15245,7 @@ exports.Star = Star;
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = void 0;
exports.config = {
time: 12,
time: 120,
first: 1000,
second: 2000,
third: 3000,
......@@ -16101,6 +16120,7 @@ var XxlScene = (function (_super) {
return;
}
if (this.isGameEnd) {
this.updateFakeScore(this.robot.getScore(this.userScore, this.timeNum));
this.gameOver();
return;
}
......
This diff is collapsed.
......@@ -1927,7 +1927,7 @@ var Main = (function () {
return [4, this.loadImageTexturesCsd02(resCanvasList)];
case 2:
_a.sent();
ctrls_1.changeScene(XxlScene_1.XxlScene);
ctrls_1.changeScene(MainScene_2.OpenAni);
return [2];
}
});
......@@ -2548,6 +2548,7 @@ var Root = (function (_super) {
this.goodsContainer.startGoods();
Main_1.GDispatcher.removeEventListener('MatchCompelete', this.gameStart, this);
this.gameStartFlag = true;
this.touchArea.mouseEnable = true;
};
Root.prototype.gameOver = function () {
return __awaiter(this, void 0, void 0, function () {
......@@ -2557,6 +2558,7 @@ var Root = (function (_super) {
case 0:
this.time = 60;
this.gameStartFlag = false;
this.touchArea.mouseEnable = false;
if (!this.userInfo.win)
this.scoreBoard.scoreRight += 3;
this.goodsContainer.removeAllGoods();
......@@ -2571,7 +2573,7 @@ var Root = (function (_super) {
prizeInfo = _a.sent();
prize = prizeInfo.data;
console.log('user win --- CSD-GAME over data:', prizeInfo.data);
if (prize.type > 3) {
if (prize.type <= 3) {
ctrls_1.showPanel(SuccessPanel_1.SuccessPanel, prize);
}
else {
......@@ -2591,10 +2593,10 @@ var Root = (function (_super) {
this.scoreBoard.updateScore(score);
};
Root.prototype.createTouchRect = function () {
this.touchArea = Tools_1.Tools.getRect(750, 574, 0xff22ff, 0);
this.touchArea = Tools_1.Tools.getRect(750, 874, 0xff22ff, 0);
this.touchArea.x = 0;
this.touchArea.y = 1050;
this.touchArea.mouseEnable = true;
this.touchArea.y = 750;
this.touchArea.mouseEnable = false;
this.addChild(this.touchArea);
this.touchArea.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onMouseDownArea, this);
this.touchArea.addEventListener(FYGE.MouseEvent.MOUSE_UP, this.onMouseUpArea, this);
......@@ -2628,6 +2630,7 @@ var Root = (function (_super) {
this.guide.visible = false;
setTimeout(function () {
ctrls_1.showPanel(MatchingPanel_1.MatchingPanel, _this.userInfo);
_this.guide.removeEventListener(FYGE.MouseEvent.CLICK, _this.guideFunc, _this);
}, 200);
}
else {
......@@ -2683,6 +2686,9 @@ var Catecher = (function (_super) {
__extends(Catecher, _super);
function Catecher(root, dataInfo) {
var _this = _super.call(this) || this;
_this.timerNumer = 60;
_this.lt = 0;
_this.tt = 0;
_this.sum = function (m, n) {
var num = Math.floor(Math.random() * (m - n) + n);
return num;
......@@ -2734,8 +2740,7 @@ var Catecher = (function (_super) {
.to({ x: 424, alpha: 1 }, 100);
};
Catecher.prototype.destroy = function () {
clearInterval(this.timerFunc);
this.timerFunc = null;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
};
Catecher.prototype.updateScore = function (score) {
var scoreNow = score + this.scoreLeft;
......@@ -2786,26 +2791,39 @@ var Catecher = (function (_super) {
this.userScore_right.updateScore(this.scoreRight);
};
Catecher.prototype.stopTime = function () {
clearInterval(this.timerFunc);
this.timerFunc = null;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
};
Catecher.prototype.start = function (time) {
var _this = this;
this.scoreLeft = 0;
this.scoreRight = 0;
this.timerNumer = time;
this.updateTime(this.timerNumer);
this.timerFunc = setInterval(function () {
if (_this.timerNumer <= 0) {
_this._root.gameOver();
clearInterval(_this.timerFunc);
_this.timerFunc = null;
_this.updateTime(0);
}
else {
_this.updateTime(--_this.timerNumer);
this.addEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
};
Catecher.prototype.timerFunc = function () {
if (!this._root.gameStartFlag)
return;
if (this.timerNumer <= 0) {
this._root.gameOver();
this.updateTime(0);
this.lt = this.tt = 0;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.timerFunc, this);
return;
}
if (this.lt) {
var nt = new Date().getTime();
var dt = nt - this.lt;
this.tt += dt / 1000 >> 0;
var ntt = 60 - this.tt;
if (ntt != this.timerNumer) {
this.timerNumer = ntt;
this.updateTime(this.timerNumer);
this.lt = nt;
}
}, 1000);
}
else {
this.lt = new Date().getTime();
}
};
Catecher.prototype.updateTime = function (time) {
this.timeText.text = time.toString() + 'S';
......@@ -2839,7 +2857,8 @@ var Catecher = (function (_super) {
c.width = 120;
c.height = 120;
var a = Tools_1.Tools.getCircle(60, 0x000000, 1, 60, 60);
var p = Tools_1.Tools.getSprite(avatar, 0, 0);
var p = FYGE.Sprite.fromUrl(avatar);
p.x = p.y = 0;
p.width = 120;
p.height = 120;
c['updateAvatar'] = function (avatar) { p.texture = RES_1.RES.getRes(avatar); };
......@@ -15105,10 +15124,10 @@ var Robot = (function () {
else {
if (gameLeftTime > XxlConfig_1.config.time / 2) {
if (this._score > userScore) {
this._score += (Math.floor(Math.random() * 6) + 2) * 10;
this._score += (Math.floor(Math.random() * 6) + 3) * 10;
}
else {
this._score = userScore + (Math.floor(Math.random() * 3) + 2) * 10;
this._score = userScore + (Math.floor(Math.random() * 6) + 8) * 10;
}
}
else {
......@@ -15228,7 +15247,7 @@ exports.Star = Star;
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = void 0;
exports.config = {
time: 12,
time: 120,
first: 1000,
second: 2000,
third: 3000,
......@@ -16103,6 +16122,7 @@ var XxlScene = (function (_super) {
return;
}
if (this.isGameEnd) {
this.updateFakeScore(this.robot.getScore(this.userScore, this.timeNum));
this.gameOver();
return;
}
......
......@@ -142,7 +142,7 @@ export default class Root extends FYGE.Container {
const prizeInfo = await sendTbNet(TbNetName.getPrizeInfo)
const prize = prizeInfo.data
console.log('user win --- CSD-GAME over data:', prizeInfo.data)
if (prize.type > 3) {
if (prize.type <= 3) {
showPanel(SuccessPanel, prize)
} else {
showPanel(SuccessNoAwardPanel, prize)
......
......@@ -19,9 +19,9 @@ export class Robot {
} else {
if (gameLeftTime > config.time / 2) {
if (this._score > userScore) {
this._score += (Math.floor(Math.random() * 6) + 2) * 10
this._score += (Math.floor(Math.random() * 6) + 3) * 10
} else {
this._score = userScore + (Math.floor(Math.random() * 3) + 2) * 10
this._score = userScore + (Math.floor(Math.random() * 6) + 8) * 10
}
} else {
if (this._score > userScore) {
......
export const config = {
//倒计时时间s
time: 12,
time: 120,
//3关分数
first: 1000,
second: 2000,
......
......@@ -1103,6 +1103,7 @@ export class XxlScene extends Scene {
return
}
if (this.isGameEnd) {
this.updateFakeScore(this.robot.getScore(this.userScore, this.timeNum))
this.gameOver()
// console.log("游戏结束")
return
......
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