activity_view.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { _decorator, Component, Node } from 'cc';
  2. import GBaseUI from '../../gcommon/GBaseUI';
  3. import { UIButton } from '../../gcommon/UIButton';
  4. import { shop_type_btn } from './../shop_type_btn';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('activity_view')
  7. export class activity_view extends GBaseUI {
  8. @property(Node) btn_close:Node = null
  9. @property(Node) btn_select_huodong:Node = null
  10. @property(Node) btn_select_gonggao:Node = null
  11. @property(Node) node_select_huodong:Node = null
  12. @property(Node) node_select_gonggao:Node = null
  13. private curSelect:number = 0;
  14. start() {
  15. UIButton.BindClick(this.btn_close,()=>{
  16. this.closeUI()
  17. },this)
  18. // this.initSelectView()
  19. }
  20. initSelectView(){
  21. UIButton.BindClick(this.btn_select_huodong,()=>{
  22. if(this.curSelect===0){
  23. }else{
  24. this.curSelect = 0;
  25. this.updateSelectStatus()
  26. }
  27. },this)
  28. UIButton.BindClick(this.btn_select_gonggao,()=>{
  29. if(this.curSelect===1){
  30. }else{
  31. this.curSelect = 1;
  32. this.updateSelectStatus()
  33. }
  34. },this)
  35. this.updateSelectStatus()
  36. }
  37. updateSelectStatus(){
  38. this.btn_select_huodong.getComponent(shop_type_btn).unSelect()
  39. this.btn_select_gonggao.getComponent(shop_type_btn).unSelect()
  40. switch (this.curSelect) {
  41. case 0:
  42. {
  43. this.btn_select_huodong.getComponent(shop_type_btn).onSelect()
  44. }
  45. break;
  46. case 1:
  47. {
  48. this.btn_select_gonggao.getComponent(shop_type_btn).onSelect()
  49. }
  50. break;
  51. }
  52. this.updateView()
  53. }
  54. updateView(){
  55. this.node_select_huodong.active = false;
  56. this.node_select_gonggao.active = false;
  57. switch (this.curSelect) {
  58. case 0:
  59. {
  60. this.node_select_huodong.active = true;
  61. }
  62. break;
  63. case 1:
  64. {
  65. this.node_select_gonggao.active = true;
  66. }
  67. break;
  68. }
  69. }
  70. update(deltaTime: number) {
  71. }
  72. }