Преглед на файлове

游戏结束界面跳转完整排行榜

Roy преди 5 години
родител
ревизия
8a17ad6538

+ 16 - 6
assets/Scene/GameSence.fire

@@ -7210,6 +7210,9 @@
     },
     "rankLabel": {
       "__id__": 185
+    },
+    "defaultSpriteFrame": {
+      "__uuid__": "2129ae0b-25e0-4aeb-9e20-f7c161b64088"
     }
   },
   {
@@ -7596,6 +7599,9 @@
     },
     "rankLabel": {
       "__id__": 195
+    },
+    "defaultSpriteFrame": {
+      "__uuid__": "2129ae0b-25e0-4aeb-9e20-f7c161b64088"
     }
   },
   {
@@ -7982,6 +7988,9 @@
     },
     "rankLabel": {
       "__id__": 205
+    },
+    "defaultSpriteFrame": {
+      "__uuid__": "2129ae0b-25e0-4aeb-9e20-f7c161b64088"
     }
   },
   {
@@ -13849,9 +13858,7 @@
       "__id__": 358
     },
     "_enabled": true,
-    "_spriteFrame": {
-      "__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
-    },
+    "_spriteFrame": null,
     "_type": 0,
     "_sizeMode": 0,
     "_fillType": 0,
@@ -14181,7 +14188,10 @@
       {
         "__uuid__": "5e0d7a9f-927a-4907-987c-98f8f547aa85"
       }
-    ]
+    ],
+    "defaultSpriteFrame": {
+      "__uuid__": "2129ae0b-25e0-4aeb-9e20-f7c161b64088"
+    }
   },
   {
     "__type__": "cc.Sprite",
@@ -15449,7 +15459,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 0,
+      "width": 131.6,
       "height": 45.6
     },
     "_rotationX": 0,
@@ -15486,7 +15496,7 @@
     },
     "_isSystemFontUsed": false,
     "_spacingX": -2,
-    "_N$string": "",
+    "_N$string": "9999",
     "_N$horizontalAlign": 1,
     "_N$verticalAlign": 1,
     "_N$fontFamily": "Arial",

+ 6 - 2
assets/Script/Game/GameOverItem.js

@@ -6,6 +6,7 @@ cc.Class({
         scoreLabel: cc.Label,
         nickLabel: cc.Label,
         rankLabel: cc.Label,
+        defaultSpriteFrame: cc.SpriteFrame,
     },
 
     // onLoad () {},
@@ -21,10 +22,13 @@ cc.Class({
             url: data.url,
             type: 'jpg'
         }, (err, texture) => {
-            if (err === undefined || err === null) {
+            if (texture) {
                 this.avatar.spriteFrame = new cc.SpriteFrame(texture);
             } else {
-                console.log(err);
+                cc.loader.loadRes("./textures/default_avatar", cc.SpriteFrame, (err, spriteFrame) => {
+                    this.avatar.spriteFrame = spriteFrame;
+                });
+                console.log('load avatar err:', err);
             }
         });
     },

+ 1 - 1
assets/Script/Game/GameOverRank.js

@@ -83,7 +83,7 @@ cc.Class({
                     }
                 }
             }
-            self.bindRank(reponse.data.data.ranking_list);
+            this.bindRank(reponse.data.data.ranking_list);
         }
     },
 

+ 30 - 67
assets/Script/Game/GameSence.js

@@ -865,30 +865,21 @@ cc.Class({
 
     },
 
-    onRankBtn: function (event, optData) {
-        if (CC_WECHATGAME && cc.vv.isRank) {
-            wx.postMessage({
-                method: 'showFriendRank',
-                data: optData
-            });
-
-            this.node.parent.getChildByName("PHB").getChildByName("BtnPHBClose").active = (optData == "true");
-            this.node.parent.getChildByName("PHB").getChildByName("emptyBtn").active = (optData == "true");
-            this.node.parent.getChildByName("PHB").getChildByName("bg").active = (optData == "true");
+    onRankBtn: function (event, openData) {
+        cc.find("Canvas/PHB").getChildByName("BtnPHBClose").active = (openData == "true");
+        cc.find("Canvas/PHB").getChildByName("emptyBtn").active = (openData == "true");
+        cc.find("Canvas/PHB").getChildByName("bg").active = (openData == "true");
 
-            if ("true" == optData) {
+        if (this.node.active) {
+            if ("true" == openData) {
                 this.rankScene.status = 1;
-                // window.accountBanner.hide();
                 this.showRank();
             }
-            if ("false" == optData) {
-                wx.postMessage({
-                    method: 'hideRank',
-                    data: optData
-                });
-                this.PHB.active = false;
-                // window.accountBanner.show();
+            if ("false" == openData) {
+                cc.find("Canvas/PHB").active = false;
             }
+        } else {
+            this.rankScene.status = 3;
         }
     },
 
@@ -924,42 +915,27 @@ cc.Class({
 
     showRank() {
         console.log('this.rankScene.status:', this.rankScene.status)
-        if (UserInfo.platform == 1 && cc.vv.isRank) {
-            var slotNode;
-            switch (this.rankScene.status) {
-                case 2:
-                    this.rankNode.active = true;
-                    this.myRankNode.active = false;
-                    break;
-                case 1:
-                    this.rankNode.active = true;
-                    this.myRankNode.active = false;
-
-                    slotNode = this.friendContentNode;
-                    renderSharedCanvas.call(this);
-                    break;
-                case 3:
-                    this.rankNode.active = false;
-                    this.myRankNode.active = true;
-                    slotNode = this.myRankNode;
-                    renderSharedCanvas.call(this);
-                    break;
-            }
-
-            this.PHB.active = true;
-            this.node.getChildByName("Pass").active = false;
-
-            function renderSharedCanvas() {
-                let openDataContext = wx.getOpenDataContext();
-                let sharedCanvas = openDataContext.canvas;
-                this.feiendtex.initWithElement(sharedCanvas);
-                this.feiendtex.handleLoadedTexture();
-
-                slotNode.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.feiendtex);
-                var scale = Math.min(750 / this.feiendtex.width, 1334 / this.feiendtex.height);
-                slotNode.setContentSize(this.feiendtex.width * scale, this.feiendtex.height * scale);
-            }
+        var slotNode;
+        switch (this.rankScene.status) {
+            case 2:
+                this.rankNode.active = true;
+                this.myRankNode.active = false;
+                break;
+            case 1:
+                this.rankNode.active = true;
+                this.myRankNode.active = false;
+
+                slotNode = this.friendContentNode;
+                break;
+            case 3:
+                this.rankNode.active = false;
+                this.myRankNode.active = true;
+                slotNode = this.myRankNode;
+                break;
         }
+
+        this.PHB.active = true;
+        this.node.getChildByName("Pass").active = false;
     },
 
     onHonourBtn: function () {
@@ -987,17 +963,4 @@ cc.Class({
     onBtnAudio: function () {
         cc.audioEngine.playEffect(this.buttonAudio);
     },
-
-    update: function (dt) {
-        if (this.PHB.active) {
-            this.showRank();
-            // console.log("显示排行榜");
-        }
-
-        // if (this.node.getChildByName("Pass").active) 
-        // {
-        //     this.showPass();
-        // }
-
-    },
 });

+ 1 - 0
assets/Script/Home/HomeSence.js

@@ -156,6 +156,7 @@ cc.Class({
             }
         } else {
             this.rankScene.status = 3;
+            cc.find("Canvas/PHB").active = false;
             // window.accountBanner.show();
         }
 

+ 6 - 2
assets/Script/Rank/RankItem.js

@@ -8,6 +8,7 @@ cc.Class({
         nameLabel: cc.Label,
         scoreLabel: cc.Label,
         rankSpriteList: [cc.SpriteFrame],
+        defaultSpriteFrame: cc.SpriteFrame,
     },
 
     onLoad() {
@@ -38,10 +39,13 @@ cc.Class({
             url: data.url,
             type: 'jpg'
         }, (err, texture) => {
-            if (err === undefined || err === null) {
+            if (texture) {
                 this.avatar.spriteFrame = new cc.SpriteFrame(texture);
             } else {
-                console.log(err);
+                cc.loader.loadRes("./textures/default_avatar", cc.SpriteFrame, (err, spriteFrame) => {
+                    this.avatar.spriteFrame = spriteFrame;
+                });
+                console.log('load avatar err:', err);
             }
         });
     }

BIN
assets/resources/textures/default_avatar.png


+ 30 - 0
assets/resources/textures/default_avatar.png.meta

@@ -0,0 +1,30 @@
+{
+  "ver": "2.0.0",
+  "uuid": "bfebcebe-6525-4fd2-9793-f29ffab8b1d0",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "subMetas": {
+    "default_avatar": {
+      "ver": "1.0.3",
+      "uuid": "2129ae0b-25e0-4aeb-9e20-f7c161b64088",
+      "rawTextureUuid": "bfebcebe-6525-4fd2-9793-f29ffab8b1d0",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 96,
+      "height": 96,
+      "rawWidth": 96,
+      "rawHeight": 96,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}