当所有图片都点亮后,显示隐藏角色已开启

This commit is contained in:
zhl 2019-02-27 21:20:48 +08:00
parent 69c16702f6
commit b380c70725
2 changed files with 25 additions and 5 deletions

View File

@ -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('隐藏角色已开启');
}
}
});

View File

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