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); } });