4 次代碼提交 dc0d9cc4dd ... 0ebdcfe7a4

作者 SHA1 備註 提交日期
  Roy 0ebdcfe7a4 Merge branch 'qqplay-1.0' of http://svn.ouj.com:3000/DWG/budingGame into qqplay-1.0 6 年之前
  Roy 5e0234744f 游戏结束我的分数同步 6 年之前
  Roy 4746fd0514 Merge branch 'qqplay-1.0' of http://svn.ouj.com:3000/DWG/budingGame into qqplay-1.0 6 年之前
  Roy f99c6a2c2d 排行榜数据修改 6 年之前
共有 3 個文件被更改,包括 42 次插入12 次删除
  1. 2 1
      assets/Scene/GameSence.fire
  2. 26 0
      assets/Script/Game/GameOverRank.js
  3. 14 11
      assets/Script/Game/GameSence.js

+ 2 - 1
assets/Scene/GameSence.fire

@@ -8037,7 +8037,8 @@
       {
         "__id__": 199
       }
-    ]
+    ],
+    "myScore": -1
   },
   {
     "__type__": "cc.Node",

+ 26 - 0
assets/Script/Game/GameOverRank.js

@@ -3,6 +3,7 @@ cc.Class({
 
     properties: {
         itemList: [cc.Node],
+        myScore: -1,
     },
 
     // onLoad () {},
@@ -89,6 +90,28 @@ cc.Class({
 
 
     bindRank(rankList) {
+
+        if (this.myScore >= 0) {
+            for (var i = 0; i < rankList.length; i++) {
+                var rd = rankList[i];
+                if (rd.selfFlag && this.myScore > rd.score) {
+                    rd.score = this.myScore;
+                }
+            }
+            rankList.sort((a, b) => {
+                if (a.length == 0 && b.length == 0) {
+                    return 0;
+                }
+                if (a.length == 0) {
+                    return 1;
+                }
+                if (b.length == 0) {
+                    return -1;
+                }
+                return b.score - a.score;
+            });
+        }
+
         for (var i = 0; i < rankList.length; ++i) {
             var rd = rankList[i]
             // rd 的字段如下:
@@ -128,6 +151,9 @@ cc.Class({
     },
 
 
+    setMyScore(score) {
+        this.myScore = score;
+    },
 
     start() {},
 

+ 14 - 11
assets/Script/Game/GameSence.js

@@ -191,6 +191,7 @@ cc.Class({
             }
             this.startFinishCount();
         } else {
+            gemeOverNode.getChildByName("OverBg").getComponent("GameOverRank").setMyScore(this.sumScore);
             gameOverNode.getChildByName("EndNode").active = true;
             gameOverNode.getChildByName("ShareNode").active = false;
 
@@ -235,6 +236,8 @@ cc.Class({
 
     gameOver: function () {
         var gameOverNode = this.node.getChildByName("GameOver");
+        var overBg = gameOverNode.getChildByName("EndNode").getChildByName("OverBg").getComponent("GameOverRank");
+        overBg.setMyScore(this.sumScore);
         var historyScoreLabel = gameOverNode.getChildByName("EndNode").getChildByName("HistoryScoreLabel");
         var newRecordSp = gameOverNode.getChildByName("EndNode").getChildByName("NewRecordSp");
 
@@ -576,27 +579,27 @@ cc.Class({
             var isFinish = false;
 
             countDownLabel.stopAllActions();
-            
+
             var videoAd = BK.Advertisement.createVideoAd();
 
             //加载成功
             videoAd.onLoad(() => {
-                BK.Script.log(1,1,"videoAd onLoad")
+                BK.Script.log(1, 1, "videoAd onLoad")
             });
 
             //开始播放
             videoAd.onPlayStart(() => {
-                BK.Script.log(1,1,"videoAd onPlayStart")
+                BK.Script.log(1, 1, "videoAd onPlayStart")
             });
 
             //播放结束
             videoAd.onPlayFinish(() => {
-                BK.Script.log(1,1,"videoAd onPlayFinish")
+                BK.Script.log(1, 1, "videoAd onPlayFinish")
                 isFinish = true;
             });
 
             videoAd.onClose(() => {
-                if(isFinish) {
+                if (isFinish) {
                     // 看完15秒视频广告
                     // 可以下发游戏奖励
                     this.getShield();
@@ -610,7 +613,7 @@ cc.Class({
 
             videoAd.onError(function (err) {
                 //加载失败
-                BK.Script.log(1,1,"videoAd onError code:"+err.code+" msg:"+err.msg);
+                BK.Script.log(1, 1, "videoAd onError code:" + err.code + " msg:" + err.msg);
 
                 this.onPlayBtn()
             });
@@ -758,22 +761,22 @@ cc.Class({
 
             //加载成功
             videoAd.onLoad(() => {
-                BK.Script.log(1,1,"videoAd onLoad")
+                BK.Script.log(1, 1, "videoAd onLoad")
             });
 
             //开始播放
             videoAd.onPlayStart(() => {
-                BK.Script.log(1,1,"videoAd onPlayStart")
+                BK.Script.log(1, 1, "videoAd onPlayStart")
             });
 
             //播放结束
             videoAd.onPlayFinish(() => {
-                BK.Script.log(1,1,"videoAd onPlayFinish")
+                BK.Script.log(1, 1, "videoAd onPlayFinish")
                 isFinish = true;
             });
 
             videoAd.onClose(() => {
-                if(isFinish) {
+                if (isFinish) {
                     // 看完15秒视频广告
                     // 可以下发游戏奖励
                     this.continueGame();
@@ -786,7 +789,7 @@ cc.Class({
 
             videoAd.onError(function (err) {
                 //加载失败
-                BK.Script.log(1,1,"videoAd onError code:"+err.code+" msg:"+err.msg);
+                BK.Script.log(1, 1, "videoAd onError code:" + err.code + " msg:" + err.msg);
             });
 
             videoAd.show();