var manager = cc.Class({
extends: cc.Component,
properties: {
layerNum: {
type: cc.Integer, //使用整型定义
default: 0,
//使用notify函数监听属性变化
notify(oldValue) {
//减少无效赋值
if (oldValue === this.layerNum) {
return;
}
// this.node.index = this.layerNum;
this.index = this.layerNum;
}
}
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
// this.node.index = this.layerNum
this.index = this.layerNum
var self = this
// cc.log(this)
// cc.log(this.node)
// this.node.index = 0
// cc.log(children)
this.children = this.node.getChildren();
// cc.log(this.children)
this.children.forEach(function(item, index){
// cc.log(self.node.index)
// cc.log(index)
if(self.index === index){
item.active = true
}else{
item.active = false
}
})
},
next () {
var children = this.children
// cc.log(children)
// cc.log(this.index, children.length)
// cc.log(this.index < children.length)
if(this.index < children.length - 1){
// children[this.index].active = false
// children[this.index+1].active = true
children[this.index].runAction(cc.fadeOut(0.8))
children[this.index+1].opacity = 0
children[this.index+1].active = true
children[this.index+1].runAction(cc.fadeIn(0.8))
this.index++
}else{
cc.log('finish')
}
}
// update (dt) {},
});
我的manager,这里是淡入淡出效果,可以扩展其他效果
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 掐指一算,在v实习时间已经有足足10个月了。感谢这十个月,好人好事是一定要记录下来的。所以我打算以一个intern...
- 参考:http://blog.csdn.net/xushuai0616/article/details/55802725
- License Manager 对于每一个用Vuforia开发的AR程序来说,都有一个唯一的license key...