car_info_get_suipian.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { base_ui } from '../../fw/base_ui';
  3. import { dataManager } from '../../manager/dataManager';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('car_info_get_suipian')
  6. export class car_info_get_suipian extends base_ui {
  7. @property(Node) btn_look_video:Node = null
  8. @property(Node) btn_share:Node = null
  9. @property(Node) lab_look_video_count:Node = null
  10. @property(Node) lab_share_count:Node = null
  11. private m_look_video_cb = null
  12. private m_share_cb = null
  13. start() {
  14. this.onButtonListen(this.btn_look_video, ()=>{
  15. this.m_look_video_cb && this.m_look_video_cb(this)
  16. })
  17. this.onButtonListen(this.btn_share, ()=>{
  18. this.m_share_cb && this.m_share_cb(this)
  19. })
  20. }
  21. initView(look_video_cb, share_cb) {
  22. this.m_look_video_cb = look_video_cb
  23. this.m_share_cb = share_cb
  24. }
  25. setData() {
  26. let look_video_count = dataManager.getCarDebrisLookVideoTotalCount() - dataManager.getCarDebrisUserLookVideoCount()
  27. if(look_video_count<0){ look_video_count=0 }
  28. this.lab_look_video_count.getComponent(Label).string = `今日剩余${look_video_count}次`
  29. let share_count = dataManager.getCarDebrisShareTotalCount() - dataManager.getCarDebrisUserShareCount()
  30. if(share_count<0){ share_count=0 }
  31. this.lab_share_count.getComponent(Label).string = `今日剩余${share_count}次`
  32. }
  33. }