import { _decorator, Component, Node } from 'cc'; import GBaseUI from '../gcommon/GBaseUI'; import { UIButton } from '../gcommon/UIButton'; import { shop_page } from './shop_page'; import { shop_type_btn } from './shop_type_btn'; const { ccclass, property } = _decorator; @ccclass('bag_view') export class bag_view extends GBaseUI { @property(Node) btn_close:Node = null @property(Node) btn_select_daoju:Node = null @property(Node) btn_select_qipan:Node = null @property(Node) btn_select_qizi:Node = null @property(Node) btn_select_zhuangban:Node = null @property(Node) node_select_daoju:Node = null @property(Node) node_select_qipan:Node = null @property(Node) node_select_qizi:Node = null @property(Node) node_select_zhuangban:Node = null private curSelect:number = 0; start() { UIButton.BindClick(this.btn_close,()=>{ this.closeUI() },this) this.initSelectView() } initSelectView(){ UIButton.BindClick(this.btn_select_daoju,()=>{ if(this.curSelect===0){ }else{ this.curSelect = 0; this.updateSelectStatus() } },this) UIButton.BindClick(this.btn_select_qipan,()=>{ if(this.curSelect===1){ }else{ this.curSelect = 1; this.updateSelectStatus() } },this) UIButton.BindClick(this.btn_select_qizi,()=>{ if(this.curSelect===2){ }else{ this.curSelect = 2; this.updateSelectStatus() } },this) UIButton.BindClick(this.btn_select_zhuangban,()=>{ if(this.curSelect===3){ }else{ this.curSelect = 3; this.updateSelectStatus() } },this) this.updateSelectStatus() } updateSelectStatus(){ this.btn_select_daoju.getComponent(shop_type_btn).unSelect() this.btn_select_qipan.getComponent(shop_type_btn).unSelect() this.btn_select_qizi.getComponent(shop_type_btn).unSelect() this.btn_select_zhuangban.getComponent(shop_type_btn).unSelect() switch (this.curSelect) { case 0: { this.btn_select_daoju.getComponent(shop_type_btn).onSelect() } break; case 1: { this.btn_select_qipan.getComponent(shop_type_btn).onSelect() } break; case 2: { this.btn_select_qizi.getComponent(shop_type_btn).onSelect() } break; case 3: { this.btn_select_zhuangban.getComponent(shop_type_btn).onSelect() } break; } this.updateView() } updateView(){ this.node_select_daoju.active = false; this.node_select_qipan.active = false; this.node_select_qizi.active = false; this.node_select_zhuangban.active = false; switch (this.curSelect) { case 0: { this.node_select_daoju.active = true; } break; case 1: { this.node_select_qipan.active = true; } break; case 2: { this.node_select_qizi.active = true; } break; case 3: { this.node_select_zhuangban.active = true; } break; } } update(deltaTime: number) { } }