NewNotice.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { GameProp } from "../../data/GameData";
  2. const { ccclass, property } = cc._decorator;
  3. @ccclass
  4. export default class NewNotice extends cc.Component {
  5. @property({ displayName: '提现金额', type: cc.Label })
  6. private lbl_reward_value: cc.Label = null;
  7. @property({ displayName: '提现时间', type: cc.Label })
  8. private lbl_time: cc.Label = null;
  9. onLoad() {
  10. }
  11. start() {
  12. //mk.audio.playEffect("receiptNotice");
  13. let times = gData.gameData.getProp(GameProp.cashTimes);
  14. if (!times) {
  15. times = 0;
  16. }
  17. gData.gameData.setProp(GameProp.cashTimes, ++times);
  18. if(gData.gameData.taskRedBagAutoShowLimit == times && gData.gameData.funOpenData[4] == "1"){
  19. mk.event.emit("showTaskRedBagAction");
  20. }
  21. }
  22. onEnable()
  23. {
  24. mk.ad.showNative();
  25. }
  26. update(dt) {
  27. if (gData.receiptNotice.init_style) {
  28. gData.receiptNotice.init_style = false;
  29. this.initUI();
  30. }
  31. }
  32. private initUI() {
  33. this.lbl_reward_value.string = (gData.receiptNotice.receip_rmb / 100).toFixed(2);
  34. this.lbl_time.string = mk.time.getNowDayStringExtend();
  35. }
  36. private clickCloseBtn() {
  37. mk.audio.playEffect('button');
  38. gData.cashPro.openCashPro(gData.receiptNotice.receip_rmb);
  39. gData.cashPro.init_success = true;
  40. mk.ad.destroyNativeAd();
  41. }
  42. }