zhuangban_node.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { _decorator, Component, Node } from 'cc';
  2. import { zhuang_ban_type } from '../constant';
  3. import { UIButton } from '../gcommon/UIButton';
  4. import { shop_type_btn } from './shop_type_btn';
  5. import { shop_zhuang_ban_manager } from './shop_zhuang_ban_manager';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('zhuangban_node')
  8. export class zhuangban_node extends Component {
  9. @property(Node) btn_qipan:Node = null
  10. @property(Node) btn_qizi:Node = null
  11. @property(Node) btn_touxiangkuang:Node = null
  12. @property(Node) btn_jishiqi:Node = null
  13. @property(Node) btn_qipao:Node = null
  14. @property(Node) view_manager:Node = null
  15. private curSelect:number = zhuang_ban_type.qi_pan;
  16. start() {
  17. UIButton.BindClick(this.btn_qipan,()=>{
  18. if(this.curSelect===zhuang_ban_type.qi_pan){
  19. }else{
  20. this.curSelect = zhuang_ban_type.qi_pan;
  21. this.updateSelectStatus()
  22. }
  23. },this)
  24. UIButton.BindClick(this.btn_qizi,()=>{
  25. if(this.curSelect===zhuang_ban_type.qi_zi){
  26. }else{
  27. this.curSelect = zhuang_ban_type.qi_zi;
  28. this.updateSelectStatus()
  29. }
  30. },this)
  31. UIButton.BindClick(this.btn_touxiangkuang,()=>{
  32. if(this.curSelect===zhuang_ban_type.tou_xiang_kuang){
  33. }else{
  34. this.curSelect = zhuang_ban_type.tou_xiang_kuang;
  35. this.updateSelectStatus()
  36. }
  37. },this)
  38. UIButton.BindClick(this.btn_jishiqi,()=>{
  39. if(this.curSelect===zhuang_ban_type.ji_shi_qi){
  40. }else{
  41. this.curSelect = zhuang_ban_type.ji_shi_qi;
  42. this.updateSelectStatus()
  43. }
  44. },this)
  45. UIButton.BindClick(this.btn_qipao,()=>{
  46. if(this.curSelect===zhuang_ban_type.qi_pao){
  47. }else{
  48. this.curSelect = zhuang_ban_type.qi_pao;
  49. this.updateSelectStatus()
  50. }
  51. },this)
  52. this.updateSelectStatus()
  53. }
  54. updateSelectStatus(){
  55. this.btn_qipan.getComponent(shop_type_btn).unSelect()
  56. this.btn_qizi.getComponent(shop_type_btn).unSelect()
  57. this.btn_touxiangkuang.getComponent(shop_type_btn).unSelect()
  58. this.btn_jishiqi.getComponent(shop_type_btn).unSelect()
  59. this.btn_qipao.getComponent(shop_type_btn).unSelect()
  60. switch (this.curSelect) {
  61. case zhuang_ban_type.qi_pan:
  62. {
  63. this.btn_qipan.getComponent(shop_type_btn).onSelect()
  64. }
  65. break;
  66. case zhuang_ban_type.qi_zi:
  67. {
  68. this.btn_qizi.getComponent(shop_type_btn).onSelect()
  69. }
  70. break;
  71. case zhuang_ban_type.tou_xiang_kuang:
  72. {
  73. this.btn_touxiangkuang.getComponent(shop_type_btn).onSelect()
  74. }
  75. break;
  76. case zhuang_ban_type.ji_shi_qi:
  77. {
  78. this.btn_jishiqi.getComponent(shop_type_btn).onSelect()
  79. }
  80. break;
  81. case zhuang_ban_type.qi_pao:
  82. {
  83. this.btn_qipao.getComponent(shop_type_btn).onSelect()
  84. }
  85. break;
  86. }
  87. this.updateView()
  88. }
  89. updateView(){
  90. this.view_manager.getComponent(shop_zhuang_ban_manager).show(this.curSelect)
  91. }
  92. update(deltaTime: number) {
  93. }
  94. }