|
@@ -244,23 +244,30 @@ cc.Class({
|
|
|
gameOver: function () {
|
|
|
var gameOverNode = this.node.getChildByName("GameOver");
|
|
|
var historyScoreLabel = gameOverNode.getChildByName("EndNode").getChildByName("HistoryScoreLabel");
|
|
|
- var newRecordSp = gameOverNode.getChildByName("EndNode").getChildByName("NewRecordSp");
|
|
|
- if (this.sumScore > UserInfo.getHistoryScore()) {
|
|
|
- newRecordSp.active = true;
|
|
|
- UserInfo.setString("historyScore", 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 = "历史最高分:" + UserInfo.getHistoryScore();
|
|
|
-
|
|
|
- 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.accountBanner.show();
|
|
@@ -292,6 +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)));
|
|
|
},
|
|
|
|
|
|
+ // 创建障碍物
|
|
|
createObstacle: function () {
|
|
|
var obstacleType = this.randomObstacleType();
|
|
|
//根据当前分数控制障碍物之间的高度
|
|
@@ -396,6 +404,7 @@ cc.Class({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ // 随机生成障碍物类型
|
|
|
randomObstacleType: function () {
|
|
|
var obstacleType = 0;
|
|
|
this.obstacleNum++;
|
|
@@ -446,6 +455,7 @@ cc.Class({
|
|
|
return obstacleType;
|
|
|
},
|
|
|
|
|
|
+ // 销毁障碍物
|
|
|
destroyObstacle: function () {
|
|
|
let obstacle1 = this.obstacleNode.getChildByName("obstacle1"),
|
|
|
obstacle2 = this.obstacleNode.getChildByName("obstacle2"),
|
|
@@ -707,7 +717,7 @@ cc.Class({
|
|
|
|
|
|
onShareBtn: function () {
|
|
|
//接分享
|
|
|
- if (CC_WECHATGAME && cc.vv.isRank) {
|
|
|
+ if (CC_QQPLAY) {
|
|
|
var data = {
|
|
|
titleData: UserInfo.shareDesc,
|
|
|
imgurlData: UserInfo.shareUrl,
|
|
@@ -907,7 +917,7 @@ cc.Class({
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
BK.QQ.uploadScoreWithoutRoom(1, data, function(errCode, cmd, data) {
|
|
|
// 返回错误码信息
|
|
|
if (errCode !== 0) {
|