restart_view.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { _decorator, Component, Node } from 'cc';
  2. import { base_ui } from '../fw/base_ui';
  3. import { userDataManager } from '../manager/userDataManager';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('restart_view')
  6. export class restart_view extends base_ui {
  7. @property(Node) btn_close:Node = null
  8. @property(Node) btn_look_video:Node = null
  9. @property(Node) btn_share:Node = null
  10. private m_look_video_cb = null
  11. private m_share_cb = null
  12. start() {
  13. this.onButtonListen(this.btn_close, ()=>{
  14. this.close()
  15. })
  16. this.onButtonListen(this.btn_look_video, ()=>{
  17. if(this.m_look_video_cb){
  18. this.m_look_video_cb(this)
  19. }
  20. })
  21. this.onButtonListen(this.btn_share, ()=>{
  22. if(this.m_share_cb) {
  23. this.m_share_cb(this)
  24. }
  25. })
  26. }
  27. public closeSelf() {
  28. this.close()
  29. }
  30. initView(look_video_cb,share_cb) {
  31. this.m_look_video_cb = look_video_cb
  32. this.m_share_cb = share_cb
  33. if(userDataManager.isTodayCanShare()) {
  34. this.btn_share.active = true
  35. } else {
  36. this.btn_share.active = false
  37. this.btn_look_video.setPosition(0, this.btn_look_video.getPosition().y)
  38. }
  39. }
  40. }