bepage/assets/components/p1/TopMenu.ts
2021-12-17 19:46:34 +08:00

29 lines
661 B
TypeScript

import TopBtn from '../top_btn/TopBtn'
const {ccclass, property} = cc._decorator;
@ccclass
export default class TopMenu extends cc.Component {
// @property({ type: cc.Node })
// snode: cc.Node = null
@property({type: cc.Node})
container: cc.Node = null
@property({type: [TopBtn]})
btns: TopBtn[] = []
start () {
// this.initBtns()
this.btns[0].setSelect(true)
cc.zevent.on('top_btn_change', (index: number) => {
for (let i = 0, l = this.btns.length; i < l; i++) {
if (index !== i) {
this.btns[i].setSelect(false)
}
}
})
}
}