WalletCashOut.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import { AdFun } from "../../data/AdData";
  2. import { VideoAdType } from "../../data/GameData";
  3. import CheckButton from "./CheckButton";
  4. const { ccclass, property } = cc._decorator;
  5. @ccclass
  6. export default class WalletCashOut extends cc.Component {
  7. @property({displayName: '公告', type: cc.Label})
  8. private lbl_notice: cc.Label = null;
  9. @property({displayName: '进度条', type: cc.Sprite})
  10. private sp_progress: cc.Sprite = null;
  11. @property({displayName: '提示', type: cc.Label})
  12. private lbl_tip: cc.Label = null;
  13. @property({displayName: '6个选择按钮', type: CheckButton})
  14. private check_button: CheckButton[] = [];
  15. private curChooseIndex: number = 0;
  16. start(){
  17. mk.ad.showNative(4);
  18. let data = [{}, {}, {}, {}, {}, {}];
  19. for(let i = 0; i != this.check_button.length; ++i)
  20. {
  21. if(i < data.length)
  22. {
  23. this.check_button[i].setShowUI(data[i]);
  24. }else
  25. {
  26. this.check_button[i].setShowUI(null);
  27. }
  28. }
  29. }
  30. private clickChooseBtn(event, customEvenData)
  31. {
  32. mk.audio.playEffect('button');
  33. let id = parseInt(customEvenData);
  34. if(id == this.curChooseIndex)
  35. {
  36. return;
  37. }
  38. if(this.check_button[id].getIsCanNotChoose())
  39. {
  40. return;
  41. }
  42. this.curChooseIndex = id;
  43. for(let i = 0; i != this.check_button.length; ++i)
  44. {
  45. if(i == this.curChooseIndex)
  46. {
  47. this.check_button[i].setIsChoose(true);
  48. }else
  49. {
  50. this.check_button[i].setIsChoose(false);
  51. }
  52. }
  53. }
  54. private clickCashOutBtn()
  55. {
  56. mk.audio.playEffect("button");
  57. //this.check_button[this.curChooseIndex].setIsCanNotChoose();
  58. }
  59. private clickAddProgressBtn()
  60. {
  61. mk.audio.playEffect("button");
  62. mk.ad.videoAdType = VideoAdType.CashOutNoviceWelfare;
  63. // 看广告
  64. mk.ad.watchAd((success: boolean) => {
  65. mk.console.log("watchAD:" + success);
  66. if (success) {
  67. gData.adData.watchVideo(AdFun.cashOutNoviceWelfare);
  68. mk.ad.destroyNativeAd();
  69. }
  70. });
  71. }
  72. private clickAddCashBtn()
  73. {
  74. mk.audio.playEffect("button");
  75. mk.ad.videoAdType = VideoAdType.CashOutNoviceWelfare;
  76. // 看广告
  77. mk.ad.watchAd((success: boolean) => {
  78. mk.console.log("watchAD:" + success);
  79. if (success) {
  80. gData.adData.watchVideo(AdFun.cashOutAddCash);
  81. mk.ad.destroyNativeAd();
  82. }
  83. });
  84. }
  85. private clickEnoughCashOutBtn()
  86. {
  87. mk.audio.playEffect("button");
  88. }
  89. private clickCloseBtn()
  90. {
  91. mk.audio.playEffect("closeButton");
  92. }
  93. }