RedBagCode.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. const { ccclass, property } = cc._decorator;
  2. /**
  3. * 红包码列表
  4. * @author 薛鸿潇
  5. */
  6. @ccclass
  7. export default class RedBagCode extends cc.Component {
  8. @property({ type: cc.ScrollView, displayName: '滚动视图' })
  9. private scroll_view: cc.ScrollView = null!;
  10. @property({ displayName: 'lbl暂无提现', type: cc.Label })
  11. private lbl_none: cc.Label = null;
  12. @property(cc.Prefab)
  13. videoPre: cc.Prefab = null;
  14. start() {
  15. this.initList();
  16. }
  17. /**
  18. * 初始化滚动列表
  19. */
  20. private initList() {
  21. let list_data = gData.cashNormal.getListDataHavCode();
  22. this.scroll_view.node.emit('srollview-init', list_data)
  23. this.initNoneItem(list_data);
  24. }
  25. /**
  26. * 初始化无条目时的提示
  27. */
  28. private initNoneItem(list_data) {
  29. const count = list_data.length;
  30. if (count) {
  31. this.lbl_none.node.active = false;
  32. } else {
  33. this.lbl_none.node.active = true;
  34. }
  35. }
  36. coolTime = false
  37. videoNode = null
  38. /** 点击教程 */
  39. clickTeach() {
  40. mk.audio.playEffect('button');
  41. if (this.coolTime) {
  42. return
  43. }
  44. this.coolTime = true
  45. gData.redCodeData.teachVideoType = 1;
  46. console.log('clickTeach')
  47. this.videoNode = cc.instantiate(this.videoPre)
  48. this.videoNode.getChildByName('video').on("completed", this.onCompleted, this)
  49. this.node.addChild(this.videoNode)
  50. }
  51. onCompleted() {
  52. this.videoNode.getChildByName('video').off("completed", this.onCompleted, this)
  53. this.videoNode.destroy()
  54. mk.audio.setResumeMusic();
  55. this.coolTime = false
  56. }
  57. }