From b380c7072597a489407ac2ab71e11ff096106a1d Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 27 Feb 2019 21:20:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E6=89=80=E6=9C=89=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=83=BD=E7=82=B9=E4=BA=AE=E5=90=8E=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E8=A7=92=E8=89=B2=E5=B7=B2=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scripts/main.js | 15 ++++++++++++++- assets/scripts/scrollContent.js | 15 +++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/assets/scripts/main.js b/assets/scripts/main.js index c108362..2a1194a 100644 --- a/assets/scripts/main.js +++ b/assets/scripts/main.js @@ -67,7 +67,8 @@ cc.Class({ logined: false, mobile: '', images: [], - uid: '' + uid: '', + allshow: false }, // LIFE-CYCLE CALLBACKS: @@ -92,6 +93,7 @@ cc.Class({ if (userRep.errcode === 0) { self.mobile = userRep.user.username; self.images = userRep.user.images; + self.checkAllShow(); self.uid = userRep.user.uid; self.mainScrollContent.getComponent('scrollContent').updateUserName(stringUtil.parseMobile(self.mobile)); self.mainScrollContent.getComponent('scrollContent').updatePuzzle(self.images); @@ -213,6 +215,7 @@ cc.Class({ self.logined = true; self.mobile = rep.user.username; self.images = rep.user.images; + self.checkAllShow(); self.uid = rep.user.uid; self.mainScrollContent.getComponent('scrollContent').updateUserName(stringUtil.parseMobile(self.mobile)); self.mainScrollContent.getComponent('scrollContent').updatePuzzle(self.images); @@ -246,5 +249,15 @@ cc.Class({ console.log(err); }) } + }, + checkAllShow() { + let result = 0; + for(let i of this.images) { + result += i; + } + this.allshow = result === 9; + if (this.allshow) { + this.mainScrollContent.getComponent('scrollContent').updateTipTxt('隐藏角色已开启'); + } } }); diff --git a/assets/scripts/scrollContent.js b/assets/scripts/scrollContent.js index 36615c6..fd925c1 100644 --- a/assets/scripts/scrollContent.js +++ b/assets/scripts/scrollContent.js @@ -71,7 +71,11 @@ cc.Class({ default: null, type: cc.Node }, - touchTarget: null + touchTarget: null, + tipLabel: { + default: null, + type: cc.Node + } }, // LIFE-CYCLE CALLBACKS: @@ -85,9 +89,9 @@ cc.Class({ processBar.getComponent('progressBar').updateShow(50000); this.puzzle = cc.instantiate(this.puzzlePrefab); this.part2.addChild(this.puzzle); - var tip = cc.instantiate(this.tipPrefab); - this.part2.addChild(tip); - tip.getComponent('inviteTip').setLabelTxt('xx接受了您的邀请'); + this.tipLabel = cc.instantiate(this.tipPrefab); + this.part2.addChild(this.tipLabel); + var imageSwiper = cc.instantiate(this.imageSwiperPrefab); this.part4.addChild(imageSwiper, 0); var bottomSwiper = cc.instantiate(this.bottomSwiperPrefab); @@ -137,5 +141,8 @@ cc.Class({ toggleLoginStatus(status) { this.loginStatusLabel.node.active = status; this.joinBtn.active = !status; + }, + updateTipTxt(str) { + this.tipLabel.getComponent('inviteTip').setLabelTxt(str); } });