|
@@ -226,12 +226,12 @@ cc.Class({
|
|
gameOverNode.getChildByName("EndNode").active = true;
|
|
gameOverNode.getChildByName("EndNode").active = true;
|
|
|
|
|
|
this.gameOver();
|
|
this.gameOver();
|
|
-
|
|
|
|
- if (CC_QQPLAY) {
|
|
|
|
- this.rankScene.status = 3;
|
|
|
|
- this.showRank();
|
|
|
|
- this.updateXYXScore('showMyRank', null);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if (CC_QQPLAY) {
|
|
|
|
+ this.rankScene.status = 3;
|
|
|
|
+ this.showRank();
|
|
|
|
+ this.updateXYXScore('showMyRank', null);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
countDown--;
|
|
countDown--;
|
|
countDownLabel.getComponent("cc.Label").string = countDown;
|
|
countDownLabel.getComponent("cc.Label").string = countDown;
|
|
@@ -244,30 +244,30 @@ cc.Class({
|
|
gameOver: function () {
|
|
gameOver: function () {
|
|
var gameOverNode = this.node.getChildByName("GameOver");
|
|
var gameOverNode = this.node.getChildByName("GameOver");
|
|
var historyScoreLabel = gameOverNode.getChildByName("EndNode").getChildByName("HistoryScoreLabel");
|
|
var historyScoreLabel = gameOverNode.getChildByName("EndNode").getChildByName("HistoryScoreLabel");
|
|
- var newRecordSp = gameOverNode.getChildByName("EndNode").getChildByName("NewRecordSp");
|
|
|
|
-
|
|
|
|
- UserInfo.getUserGameData((data) => {
|
|
|
|
- var maxScore = data.maxScore || 0;
|
|
|
|
-
|
|
|
|
- if (this.sumScore > maxScore) {
|
|
|
|
- maxScore = this.sumScore;
|
|
|
|
- newRecordSp.active = true;
|
|
|
|
- UserInfo.setUserGameData(this.sumScore);
|
|
|
|
-
|
|
|
|
- cc.audioEngine.playEffect(this.newRecordAudio);
|
|
|
|
- newRecordSp.runAction(cc.repeatForever(cc.sequence(cc.scaleTo(0.5, 1.5), cc.scaleTo(0.5, 1))));
|
|
|
|
- } else {
|
|
|
|
- newRecordSp.active = false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (this.sumScore > UserInfo.getScore()) {
|
|
|
|
- UserInfo.setScore(this.sumScore);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- historyScoreLabel.getComponent("cc.Label").string = "历史最高分:" + maxScore;
|
|
|
|
-
|
|
|
|
- UserInfo.addGold(this.sumScore);
|
|
|
|
- })
|
|
|
|
|
|
+ var newRecordSp = gameOverNode.getChildByName("EndNode").getChildByName("NewRecordSp");
|
|
|
|
+
|
|
|
|
+ UserInfo.getUserGameData((data) => {
|
|
|
|
+ var maxScore = data.maxScore || 0;
|
|
|
|
+
|
|
|
|
+ if (this.sumScore > maxScore) {
|
|
|
|
+ maxScore = this.sumScore;
|
|
|
|
+ newRecordSp.active = true;
|
|
|
|
+ UserInfo.setUserGameData(this.sumScore);
|
|
|
|
+
|
|
|
|
+ cc.audioEngine.playEffect(this.newRecordAudio);
|
|
|
|
+ newRecordSp.runAction(cc.repeatForever(cc.sequence(cc.scaleTo(0.5, 1.5), cc.scaleTo(0.5, 1))));
|
|
|
|
+ } else {
|
|
|
|
+ newRecordSp.active = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (this.sumScore > UserInfo.getScore()) {
|
|
|
|
+ UserInfo.setScore(this.sumScore);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ historyScoreLabel.getComponent("cc.Label").string = "历史最高分:" + maxScore;
|
|
|
|
+
|
|
|
|
+ UserInfo.addGold(this.sumScore);
|
|
|
|
+ })
|
|
|
|
|
|
// window.deadBanner.hide();
|
|
// window.deadBanner.hide();
|
|
// window.accountBanner.show();
|
|
// window.accountBanner.show();
|
|
@@ -299,7 +299,7 @@ cc.Class({
|
|
this.node.runAction(cc.sequence(cc.delayTime(1), cc.callFunc(this.createObstacle, this), cc.delayTime(1), cc.callFunc(this.createObstacle, this)));
|
|
this.node.runAction(cc.sequence(cc.delayTime(1), cc.callFunc(this.createObstacle, this), cc.delayTime(1), cc.callFunc(this.createObstacle, this)));
|
|
},
|
|
},
|
|
|
|
|
|
- // 创建障碍物
|
|
|
|
|
|
+ // 创建障碍物
|
|
createObstacle: function () {
|
|
createObstacle: function () {
|
|
var obstacleType = this.randomObstacleType();
|
|
var obstacleType = this.randomObstacleType();
|
|
//根据当前分数控制障碍物之间的高度
|
|
//根据当前分数控制障碍物之间的高度
|
|
@@ -404,7 +404,7 @@ cc.Class({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- // 随机生成障碍物类型
|
|
|
|
|
|
+ // 随机生成障碍物类型
|
|
randomObstacleType: function () {
|
|
randomObstacleType: function () {
|
|
var obstacleType = 0;
|
|
var obstacleType = 0;
|
|
this.obstacleNum++;
|
|
this.obstacleNum++;
|
|
@@ -455,7 +455,7 @@ cc.Class({
|
|
return obstacleType;
|
|
return obstacleType;
|
|
},
|
|
},
|
|
|
|
|
|
- // 销毁障碍物
|
|
|
|
|
|
+ // 销毁障碍物
|
|
destroyObstacle: function () {
|
|
destroyObstacle: function () {
|
|
let obstacle1 = this.obstacleNode.getChildByName("obstacle1"),
|
|
let obstacle1 = this.obstacleNode.getChildByName("obstacle1"),
|
|
obstacle2 = this.obstacleNode.getChildByName("obstacle2"),
|
|
obstacle2 = this.obstacleNode.getChildByName("obstacle2"),
|
|
@@ -723,15 +723,15 @@ cc.Class({
|
|
imgurlData: UserInfo.shareUrl,
|
|
imgurlData: UserInfo.shareUrl,
|
|
queryData: 'pp=pp'
|
|
queryData: 'pp=pp'
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
QQCommon.ShareAppMessage(data, () => {
|
|
QQCommon.ShareAppMessage(data, () => {
|
|
- var gameOverNode = this.node.getChildByName("GameOver");
|
|
|
|
- var countDownLabel = gameOverNode.getChildByName("ShareNode").getChildByName("EndCountDownLabel");
|
|
|
|
- countDownLabel.stopAllActions();
|
|
|
|
- this.continueGame();
|
|
|
|
|
|
+ var gameOverNode = this.node.getChildByName("GameOver");
|
|
|
|
+ var countDownLabel = gameOverNode.getChildByName("ShareNode").getChildByName("EndCountDownLabel");
|
|
|
|
+ countDownLabel.stopAllActions();
|
|
|
|
+ this.continueGame();
|
|
|
|
|
|
- cc.audioEngine.playMusic(this.gamebgMusic, true);
|
|
|
|
- });
|
|
|
|
|
|
+ cc.audioEngine.playMusic(this.gamebgMusic, true);
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
var gameOverNode = this.node.getChildByName("GameOver");
|
|
var gameOverNode = this.node.getChildByName("GameOver");
|
|
var countDownLabel = gameOverNode.getChildByName("ShareNode").getChildByName("EndCountDownLabel");
|
|
var countDownLabel = gameOverNode.getChildByName("ShareNode").getChildByName("EndCountDownLabel");
|
|
@@ -853,13 +853,13 @@ cc.Class({
|
|
gameOverNode.getChildByName("EndNode").active = true;
|
|
gameOverNode.getChildByName("EndNode").active = true;
|
|
|
|
|
|
this.gameOver();
|
|
this.gameOver();
|
|
-
|
|
|
|
- if (CC_QQPLAY) {
|
|
|
|
|
|
+
|
|
|
|
+ if (CC_QQPLAY) {
|
|
// window.deadBanner.hide();
|
|
// window.deadBanner.hide();
|
|
- this.rankScene.status = 3;
|
|
|
|
|
|
+ this.rankScene.status = 3;
|
|
this.showRank();
|
|
this.showRank();
|
|
this.updateXYXScore('showMyRank', null);
|
|
this.updateXYXScore('showMyRank', null);
|
|
- }
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
onRestartBtn: function () {
|
|
onRestartBtn: function () {
|
|
@@ -901,31 +901,33 @@ cc.Class({
|
|
},
|
|
},
|
|
|
|
|
|
updateXYXScore(strFun, data) {
|
|
updateXYXScore(strFun, data) {
|
|
- var data = {
|
|
|
|
- userData: [{
|
|
|
|
- openId: GameStatusInfo.openId,
|
|
|
|
- startMs: GameStatusInfo.startMs,
|
|
|
|
- endMs: ((new Date()).getTime()).toString(),
|
|
|
|
- scoreInfo: {
|
|
|
|
- score: parseInt(UserInfo.getScore()), //分数,类型必须是整型数
|
|
|
|
- }
|
|
|
|
- }],
|
|
|
|
- attr: {
|
|
|
|
- score: {
|
|
|
|
- type: 'rank',
|
|
|
|
- order: 1,
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- BK.QQ.uploadScoreWithoutRoom(1, data, function(errCode, cmd, data) {
|
|
|
|
- // 返回错误码信息
|
|
|
|
- if (errCode !== 0) {
|
|
|
|
- BK.Script.log(1,1,'上传分数失败!错误码:' + errCode);
|
|
|
|
- } else {
|
|
|
|
- BK.Script.log(1,1,'上传分数成功' + JSON.stringify(data));
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ var data = {
|
|
|
|
+ userData: [{
|
|
|
|
+ openId: GameStatusInfo.openId,
|
|
|
|
+ startMs: GameStatusInfo.startMs,
|
|
|
|
+ endMs: ((new Date()).getTime()).toString(),
|
|
|
|
+ scoreInfo: {
|
|
|
|
+ score: parseInt(UserInfo.getScore()), //分数,类型必须是整型数
|
|
|
|
+ }
|
|
|
|
+ }],
|
|
|
|
+ attr: {
|
|
|
|
+ score: {
|
|
|
|
+ type: 'rank',
|
|
|
|
+ order: 1,
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if (CC_QQPLAY) {
|
|
|
|
+ BK.QQ.uploadScoreWithoutRoom(1, data, function (errCode, cmd, data) {
|
|
|
|
+ // 返回错误码信息
|
|
|
|
+ if (errCode !== 0) {
|
|
|
|
+ BK.Script.log(1, 1, '上传分数失败!错误码:' + errCode);
|
|
|
|
+ } else {
|
|
|
|
+ BK.Script.log(1, 1, '上传分数成功' + JSON.stringify(data));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
showRank() {
|
|
showRank() {
|
|
@@ -1006,4 +1008,4 @@ cc.Class({
|
|
// }
|
|
// }
|
|
|
|
|
|
},
|
|
},
|
|
-});
|
|
|
|
|
|
+});
|