NewCashUI.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { Data } from "../../../mk/data/Data";
  2. import JsbSystem from "../../../mk/system/JsbSystem";
  3. const { ccclass, property } = cc._decorator;
  4. @ccclass
  5. export default class NewCashUI extends cc.Component {
  6. @property({ displayName: '兑换码', type: cc.Label })
  7. private lbl_redeem_code: cc.Label = null;
  8. @property(cc.Prefab)
  9. private videoPre: cc.Prefab = null;
  10. private coolTime = false;
  11. private videoNode = null
  12. onLoad(){
  13. }
  14. start(){
  15. this.coolTime = false;
  16. this.lbl_redeem_code.string = "";
  17. }
  18. private clickVideoBtn(){
  19. mk.audio.playEffect('button');
  20. if(this.coolTime)
  21. return;
  22. this.coolTime = true;
  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('button');
  40. mk.audio.setResumeMusic();
  41. // gData.gameData.init_redBagTask = true;
  42. // gData.gameData.init_productTask = true;
  43. }
  44. onDestroy(){
  45. }
  46. }