import { _decorator, Component, Node } from 'cc'; import { zhuang_ban_type } from '../constant'; import { UIButton } from '../gcommon/UIButton'; import { bag_zhuang_ban_manager } from './bag_zhuang_ban_manager'; import { shop_type_btn } from './shop_type_btn'; const { ccclass, property } = _decorator; @ccclass('bag_zhuangban_node') export class bag_zhuangban_node extends Component { @property(Node) btn_touxiangkuang:Node = null @property(Node) btn_jishiqi:Node = null @property(Node) btn_qipao:Node = null @property(Node) m_bag_zhuangban_node:Node = null private curSelect:number = zhuang_ban_type.tou_xiang_kuang; start() { UIButton.BindClick(this.btn_touxiangkuang,()=>{ if(this.curSelect===zhuang_ban_type.tou_xiang_kuang){ }else{ this.curSelect = zhuang_ban_type.tou_xiang_kuang; this.updateSelectStatus() } },this) UIButton.BindClick(this.btn_jishiqi,()=>{ if(this.curSelect===zhuang_ban_type.ji_shi_qi){ }else{ this.curSelect = zhuang_ban_type.ji_shi_qi; this.updateSelectStatus() } },this) UIButton.BindClick(this.btn_qipao,()=>{ if(this.curSelect===zhuang_ban_type.qi_pao){ }else{ this.curSelect = zhuang_ban_type.qi_pao; this.updateSelectStatus() } },this) this.updateSelectStatus() } updateSelectStatus(){ this.btn_touxiangkuang.getComponent(shop_type_btn).unSelect() this.btn_jishiqi.getComponent(shop_type_btn).unSelect() this.btn_qipao.getComponent(shop_type_btn).unSelect() switch (this.curSelect) { case zhuang_ban_type.tou_xiang_kuang: { this.btn_touxiangkuang.getComponent(shop_type_btn).onSelect() } break; case zhuang_ban_type.ji_shi_qi: { this.btn_jishiqi.getComponent(shop_type_btn).onSelect() } break; case zhuang_ban_type.qi_pao: { this.btn_qipao.getComponent(shop_type_btn).onSelect() } break; } this.updateView() } updateView(){ this.m_bag_zhuangban_node.getComponent(bag_zhuang_ban_manager).show(this.curSelect) } update(deltaTime: number) { } }