NewCashUI.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import JsbSystem from "../../../mk/system/JsbSystem";
  2. const { ccclass, property } = cc._decorator;
  3. @ccclass
  4. export default class NewCashUI extends cc.Component {
  5. @property({ displayName: '兑换码', type: cc.Label })
  6. private lbl_redeem_code: cc.Label = null;
  7. @property(cc.Prefab)
  8. private videoPre: cc.Prefab = null;
  9. private coolTime = false;
  10. private videoNode = null
  11. onLoad(){
  12. }
  13. start(){
  14. this.coolTime = false;
  15. this.lbl_redeem_code.string = "";
  16. }
  17. private clickVideoBtn(){
  18. mk.audio.playEffect('button');
  19. if(this.coolTime)
  20. return;
  21. this.coolTime = true;
  22. console.log('clickTeach')
  23. this.videoNode = cc.instantiate(this.videoPre)
  24. this.videoNode.getChildByName('video').on("completed", this.onCompleted, this)
  25. this.node.addChild(this.videoNode)
  26. }
  27. private onCompleted(){
  28. this.videoNode.getChildByName('video').off("completed", this.onCompleted, this)
  29. this.videoNode.destroy()
  30. mk.audio.setResumeMusic();
  31. this.coolTime = false
  32. }
  33. private clickCopyBtn() {
  34. mk.audio.playEffect('button');
  35. JsbSystem.setClipboard(this.lbl_redeem_code.string)
  36. mk.tip.pop("复制成功");
  37. }
  38. private clickCloseBtn(){
  39. mk.audio.playEffect('closeButton');
  40. mk.audio.setResumeMusic();
  41. }
  42. onDestroy(){
  43. }
  44. }