NewCashUI.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. console.log('clickTeach')
  24. this.videoNode = cc.instantiate(this.videoPre)
  25. this.videoNode.getChildByName('video').on("completed", this.onCompleted, this)
  26. this.node.addChild(this.videoNode)
  27. }
  28. private onCompleted(){
  29. this.videoNode.getChildByName('video').off("completed", this.onCompleted, this)
  30. this.videoNode.destroy()
  31. mk.audio.setResumeMusic();
  32. this.coolTime = false
  33. }
  34. private clickCopyBtn() {
  35. mk.audio.playEffect('button');
  36. JsbSystem.setClipboard(this.lbl_redeem_code.string)
  37. mk.tip.pop("复制成功");
  38. }
  39. private clickCloseBtn(){
  40. mk.audio.playEffect('button');
  41. mk.audio.setResumeMusic();
  42. // gData.gameData.init_redBagTask = true;
  43. // gData.gameData.init_productTask = true;
  44. }
  45. onDestroy(){
  46. }
  47. }