bag_view.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import { _decorator, Component, Node } from 'cc';
  2. import GBaseUI from '../gcommon/GBaseUI';
  3. import { UIButton } from '../gcommon/UIButton';
  4. import { shop_page } from './shop_page';
  5. import { shop_type_btn } from './shop_type_btn';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('bag_view')
  8. export class bag_view extends GBaseUI {
  9. @property(Node) btn_close:Node = null
  10. @property(Node) btn_select_daoju:Node = null
  11. @property(Node) btn_select_qipan:Node = null
  12. @property(Node) btn_select_qizi:Node = null
  13. @property(Node) btn_select_zhuangban:Node = null
  14. @property(Node) node_select_daoju:Node = null
  15. @property(Node) node_select_qipan:Node = null
  16. @property(Node) node_select_qizi:Node = null
  17. @property(Node) node_select_zhuangban:Node = null
  18. private curSelect:number = 0;
  19. start() {
  20. UIButton.BindClick(this.btn_close,()=>{
  21. this.closeUI()
  22. },this)
  23. this.initSelectView()
  24. }
  25. initSelectView(){
  26. UIButton.BindClick(this.btn_select_daoju,()=>{
  27. if(this.curSelect===0){
  28. }else{
  29. this.curSelect = 0;
  30. this.updateSelectStatus()
  31. }
  32. },this)
  33. UIButton.BindClick(this.btn_select_qipan,()=>{
  34. if(this.curSelect===1){
  35. }else{
  36. this.curSelect = 1;
  37. this.updateSelectStatus()
  38. }
  39. },this)
  40. UIButton.BindClick(this.btn_select_qizi,()=>{
  41. if(this.curSelect===2){
  42. }else{
  43. this.curSelect = 2;
  44. this.updateSelectStatus()
  45. }
  46. },this)
  47. UIButton.BindClick(this.btn_select_zhuangban,()=>{
  48. if(this.curSelect===3){
  49. }else{
  50. this.curSelect = 3;
  51. this.updateSelectStatus()
  52. }
  53. },this)
  54. this.updateSelectStatus()
  55. }
  56. updateSelectStatus(){
  57. this.btn_select_daoju.getComponent(shop_type_btn).unSelect()
  58. this.btn_select_qipan.getComponent(shop_type_btn).unSelect()
  59. this.btn_select_qizi.getComponent(shop_type_btn).unSelect()
  60. this.btn_select_zhuangban.getComponent(shop_type_btn).unSelect()
  61. switch (this.curSelect) {
  62. case 0:
  63. {
  64. this.btn_select_daoju.getComponent(shop_type_btn).onSelect()
  65. }
  66. break;
  67. case 1:
  68. {
  69. this.btn_select_qipan.getComponent(shop_type_btn).onSelect()
  70. }
  71. break;
  72. case 2:
  73. {
  74. this.btn_select_qizi.getComponent(shop_type_btn).onSelect()
  75. }
  76. break;
  77. case 3:
  78. {
  79. this.btn_select_zhuangban.getComponent(shop_type_btn).onSelect()
  80. }
  81. break;
  82. }
  83. this.updateView()
  84. }
  85. updateView(){
  86. this.node_select_daoju.active = false;
  87. this.node_select_qipan.active = false;
  88. this.node_select_qizi.active = false;
  89. this.node_select_zhuangban.active = false;
  90. switch (this.curSelect) {
  91. case 0:
  92. {
  93. this.node_select_daoju.active = true;
  94. }
  95. break;
  96. case 1:
  97. {
  98. this.node_select_qipan.active = true;
  99. }
  100. break;
  101. case 2:
  102. {
  103. this.node_select_qizi.active = true;
  104. }
  105. break;
  106. case 3:
  107. {
  108. this.node_select_zhuangban.active = true;
  109. }
  110. break;
  111. }
  112. }
  113. update(deltaTime: number) {
  114. }
  115. }