CashRebateView.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-03-21 11:45:43
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-16 14:44:54
  6. * @Description: 提现必返
  7. */
  8. import { _decorator, Label } from 'cc';
  9. import { oops } from 'db://oops-framework/core/Oops';
  10. import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
  11. import { GameComponent } from "db://oops-framework/module/common/GameComponent";
  12. import { UIID } from '../common/config/GameUIConfig';
  13. import { CocosHandler } from '../common/manager/CocosHandler';
  14. import { ADHandler } from '../common/manager/ADHandler';
  15. import { smc } from '../common/SingletonModuleComp';
  16. import { GameEvent } from '../common/config/GameEvent';
  17. import { ServerHandler } from '../common/manager/ServerHandler';
  18. const { ccclass, property } = _decorator;
  19. /** 显示对象控制 */
  20. @ccclass('CashRebateView')
  21. export class CashRebateView extends GameComponent {
  22. @property(Label)
  23. lab_num: Label = null!;
  24. protected start() {
  25. this.setButton();
  26. this.setData();
  27. }
  28. setData() {
  29. if (this.lab_num) {
  30. this.lab_num.string = smc.game.GameModel.cashNum + "";
  31. }
  32. }
  33. private btn_ok() {
  34. //看广告
  35. if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
  36. oops.gui.remove(UIID.CashRebate);
  37. ADHandler.inst.showAd("105");
  38. oops.message.dispatchEvent(GameEvent.showCoinAnimation, "showCoin");
  39. //下一关
  40. ServerHandler.inst.getNextLevel();
  41. } else {
  42. oops.gui.remove(UIID.CashRebate);
  43. }
  44. }
  45. }