home_tt_sidebar.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { _decorator, Component, Node } from 'cc';
  2. import { base_ui } from '../../fw/base_ui';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('home_tt_sidebar')
  5. export class home_tt_sidebar extends base_ui {
  6. @property(Node) btn_close:Node = null
  7. @property(Node) btn_lqjl:Node = null
  8. @property(Node) btn_go_sidebar:Node = null
  9. private m_go_sidebar_cb = null
  10. private m_lqjl_cb = null
  11. start() {
  12. this.onButtonListen(this.btn_close, ()=>{
  13. this.close()
  14. })
  15. this.onButtonListen(this.btn_go_sidebar, ()=>{
  16. if(this.m_go_sidebar_cb!=null) {
  17. this.m_go_sidebar_cb(this)
  18. }
  19. })
  20. this.onButtonListen(this.btn_lqjl,()=>{
  21. if(this.m_lqjl_cb!=null) {
  22. this.m_lqjl_cb(this)
  23. }
  24. })
  25. }
  26. show(isToEnterFromSidebar:boolean, go_sidebar_cb, lqjl_cb) {
  27. this.node.active = true
  28. this.m_go_sidebar_cb = go_sidebar_cb
  29. this.m_lqjl_cb = lqjl_cb
  30. if(isToEnterFromSidebar) {
  31. this.btn_lqjl.active = true
  32. this.btn_go_sidebar.active = false
  33. } else {
  34. this.btn_lqjl.active = false
  35. this.btn_go_sidebar.active = true
  36. }
  37. }
  38. close() {
  39. this.node.active = false
  40. }
  41. }