|
@@ -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();
|
|
|
- // }
|
|
|
-
|
|
|
- },
|
|
|
});
|