123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- import { _decorator, Component, Node, Prefab } from 'cc';
- import { ContentType } from '../adapter/define/enum';
- import { shop_type } from '../constant';
- import GBaseUI from '../gcommon/GBaseUI';
- import { UIButton } from '../gcommon/UIButton';
- import { shop_type_btn } from './shop_type_btn';
- const { ccclass, property } = _decorator;
- @ccclass('shop_view')
- export class shop_view extends GBaseUI {
- @property(Node) btn_close:Node = null
- @property(Node) btn_select_daoju:Node = null
- @property(Node) btn_select_zhuangban:Node = null
- @property(Node) btn_select_yuanbao:Node = null
-
- @property(Node) node_select_daoju:Node = null
- @property(Node) node_select_zhuangban:Node = null
- @property(Node) node_select_yuanbao:Node = null
- private curSelect:number = shop_type.dao_ju;
- initSelectView(){
- UIButton.BindClick(this.btn_select_daoju,()=>{
- if(this.curSelect===shop_type.dao_ju){
- }else{
- this.curSelect = shop_type.dao_ju;
- this.updateSelectStatus()
- }
- },this)
- UIButton.BindClick(this.btn_select_zhuangban,()=>{
- if(this.curSelect===shop_type.zhuang_ban){
- }else{
- this.curSelect = shop_type.zhuang_ban;
- this.updateSelectStatus()
- }
- },this)
- UIButton.BindClick(this.btn_select_yuanbao,()=>{
- if(this.curSelect===shop_type.huo_bi){
- }else{
- this.curSelect = shop_type.huo_bi;
- this.updateSelectStatus()
- }
- },this)
- this.updateSelectStatus()
- }
- updateSelectStatus(){
- this.btn_select_daoju.getComponent(shop_type_btn).unSelect()
- this.btn_select_zhuangban.getComponent(shop_type_btn).unSelect()
- this.btn_select_yuanbao.getComponent(shop_type_btn).unSelect()
- switch (this.curSelect) {
- case shop_type.dao_ju:
- {
- this.btn_select_daoju.getComponent(shop_type_btn).onSelect()
- }
- break;
- case shop_type.zhuang_ban:
- {
- this.btn_select_zhuangban.getComponent(shop_type_btn).onSelect()
- }
- break;
- case shop_type.huo_bi:
- {
- this.btn_select_yuanbao.getComponent(shop_type_btn).onSelect()
- }
- break;
- }
- this.updateView()
- }
- updateView(){
- this.node_select_daoju.active = false;
- this.node_select_zhuangban.active = false;
- this.node_select_yuanbao.active = false;
- switch (this.curSelect) {
- case shop_type.dao_ju:
- {
- this.node_select_daoju.active = true;
- }
- break;
- case shop_type.zhuang_ban:
- {
- this.node_select_zhuangban.active = true;
- }
- break;
- case shop_type.huo_bi:
- {
- this.node_select_yuanbao.active = true;
- }
- break;
- }
- }
- start() {
- UIButton.BindClick(this.btn_close,()=>{
- this.closeUI()
- },this)
- this.initSelectView()
- }
- update(deltaTime: number) {
-
- }
- }
|