bag_zhuangban_node.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { _decorator, Component, Node } from 'cc';
  2. import { zhuang_ban_type } from '../constant';
  3. import { UIButton } from '../gcommon/UIButton';
  4. import { bag_zhuang_ban_manager } from './bag_zhuang_ban_manager';
  5. import { shop_type_btn } from './shop_type_btn';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('bag_zhuangban_node')
  8. export class bag_zhuangban_node extends Component {
  9. @property(Node) btn_touxiangkuang:Node = null
  10. @property(Node) btn_jishiqi:Node = null
  11. @property(Node) btn_qipao:Node = null
  12. @property(Node) m_bag_zhuangban_node:Node = null
  13. private curSelect:number = zhuang_ban_type.tou_xiang_kuang;
  14. start() {
  15. UIButton.BindClick(this.btn_touxiangkuang,()=>{
  16. if(this.curSelect===zhuang_ban_type.tou_xiang_kuang){
  17. }else{
  18. this.curSelect = zhuang_ban_type.tou_xiang_kuang;
  19. this.updateSelectStatus()
  20. }
  21. },this)
  22. UIButton.BindClick(this.btn_jishiqi,()=>{
  23. if(this.curSelect===zhuang_ban_type.ji_shi_qi){
  24. }else{
  25. this.curSelect = zhuang_ban_type.ji_shi_qi;
  26. this.updateSelectStatus()
  27. }
  28. },this)
  29. UIButton.BindClick(this.btn_qipao,()=>{
  30. if(this.curSelect===zhuang_ban_type.qi_pao){
  31. }else{
  32. this.curSelect = zhuang_ban_type.qi_pao;
  33. this.updateSelectStatus()
  34. }
  35. },this)
  36. this.updateSelectStatus()
  37. }
  38. updateSelectStatus(){
  39. this.btn_touxiangkuang.getComponent(shop_type_btn).unSelect()
  40. this.btn_jishiqi.getComponent(shop_type_btn).unSelect()
  41. this.btn_qipao.getComponent(shop_type_btn).unSelect()
  42. switch (this.curSelect) {
  43. case zhuang_ban_type.tou_xiang_kuang:
  44. {
  45. this.btn_touxiangkuang.getComponent(shop_type_btn).onSelect()
  46. }
  47. break;
  48. case zhuang_ban_type.ji_shi_qi:
  49. {
  50. this.btn_jishiqi.getComponent(shop_type_btn).onSelect()
  51. }
  52. break;
  53. case zhuang_ban_type.qi_pao:
  54. {
  55. this.btn_qipao.getComponent(shop_type_btn).onSelect()
  56. }
  57. break;
  58. }
  59. this.updateView()
  60. }
  61. updateView(){
  62. this.m_bag_zhuangban_node.getComponent(bag_zhuang_ban_manager).show(this.curSelect)
  63. }
  64. update(deltaTime: number) {
  65. }
  66. }