123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import { _decorator, Component, Node } from 'cc';
- import { zhuang_ban_type } from '../constant';
- import { UIButton } from '../gcommon/UIButton';
- import { shop_type_btn } from './shop_type_btn';
- import { shop_zhuang_ban_manager } from './shop_zhuang_ban_manager';
- const { ccclass, property } = _decorator;
- @ccclass('zhuangban_node')
- export class zhuangban_node extends Component {
- @property(Node) btn_qipan:Node = null
- @property(Node) btn_qizi:Node = null
- @property(Node) btn_touxiangkuang:Node = null
- @property(Node) btn_jishiqi:Node = null
- @property(Node) btn_qipao:Node = null
- @property(Node) view_manager:Node = null
- private curSelect:number = zhuang_ban_type.qi_pan;
- start() {
- UIButton.BindClick(this.btn_qipan,()=>{
- if(this.curSelect===zhuang_ban_type.qi_pan){
- }else{
- this.curSelect = zhuang_ban_type.qi_pan;
- this.updateSelectStatus()
- }
- },this)
- UIButton.BindClick(this.btn_qizi,()=>{
- if(this.curSelect===zhuang_ban_type.qi_zi){
- }else{
- this.curSelect = zhuang_ban_type.qi_zi;
- this.updateSelectStatus()
- }
- },this)
- 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_qipan.getComponent(shop_type_btn).unSelect()
- this.btn_qizi.getComponent(shop_type_btn).unSelect()
- 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.qi_pan:
- {
- this.btn_qipan.getComponent(shop_type_btn).onSelect()
- }
- break;
- case zhuang_ban_type.qi_zi:
- {
- this.btn_qizi.getComponent(shop_type_btn).onSelect()
- }
- break;
- 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.view_manager.getComponent(shop_zhuang_ban_manager).show(this.curSelect)
- }
- update(deltaTime: number) {
-
- }
- }
|