RedCode.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import JsbSystem from "../../../mk/system/JsbSystem";
  2. /**
  3. * @description 公众号提现
  4. * @author kaka
  5. */
  6. const { ccclass, property } = cc._decorator;
  7. @ccclass
  8. export default class RedCode extends cc.Component {
  9. @property(cc.Label)
  10. labOfficial: cc.Label = null;
  11. @property(cc.Label)
  12. labRed: cc.Label = null;
  13. @property(cc.Label)
  14. labMoney: cc.Label = null;
  15. @property(cc.Label)
  16. labRedCode: cc.Label = null;
  17. @property(cc.Node)
  18. parNode: cc.Node = null;
  19. @property(cc.Prefab)
  20. videoPre: cc.Prefab = null;
  21. videoNode = null
  22. officialStr = "白羊游戏社"
  23. redCodeStr = "领红包"
  24. code = ""
  25. coolTime = false
  26. start() {
  27. mk.ad.showNative(4);
  28. this.coolTime = false
  29. this.labOfficial.string = `“${this.officialStr}”`
  30. this.labRed.string = `“${this.redCodeStr}”`
  31. }
  32. update() {
  33. if (gData.redCodeData.init_data) {
  34. this.init(gData.redCodeData.money, gData.redCodeData.code);
  35. gData.adData.checkShowFullInter(1);
  36. }
  37. }
  38. lateUpdate() {
  39. gData.redCodeData.init_data = false;
  40. }
  41. init(money, code) {
  42. this.labMoney.string = `${money.toFixed(2)}元`
  43. this.code = code
  44. this.labRedCode.string = `提现红包码:${this.code}`
  45. }
  46. /** 点击复制公众号 */
  47. clickCopyOfficial() {
  48. mk.audio.playEffect('button');
  49. JsbSystem.setClipboard(this.officialStr)
  50. }
  51. /** 点击教程 */
  52. clickTeach() {
  53. mk.audio.playEffect('button');
  54. if (this.coolTime) {
  55. return
  56. }
  57. this.coolTime = true
  58. gData.redCodeData.teachVideoType = 1;
  59. console.log('clickTeach')
  60. this.videoNode = cc.instantiate(this.videoPre)
  61. this.videoNode.getChildByName('video').on("completed", this.onCompleted, this)
  62. this.node.addChild(this.videoNode)
  63. }
  64. onCompleted() {
  65. this.videoNode.getChildByName('video').off("completed", this.onCompleted, this)
  66. this.videoNode.destroy()
  67. mk.audio.setResumeMusic();
  68. this.coolTime = false
  69. }
  70. /** 点击复制红包码 */
  71. clickCopyRedCode() {
  72. mk.audio.playEffect("button");
  73. JsbSystem.setClipboard(this.code)
  74. }
  75. /** 点击关闭 */
  76. closeCallBack() {
  77. mk.audio.playEffect("button");
  78. mk.audio.setResumeMusic();
  79. }
  80. onClickClose() {
  81. }
  82. onDisable() {
  83. mk.ad.destroyNativeAd();
  84. }
  85. }