DoubleSpeedViewComp.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-03-21 11:17:22
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-22 16:27:55
  6. * @Description: 二倍速弹窗
  7. */
  8. import { _decorator } from "cc";
  9. import { oops } from "db://oops-framework/core/Oops";
  10. import VMParent from "db://oops-framework/libs/model-view/VMParent";
  11. import { AD_TYPE } from "../common/config/GameDefine";
  12. import { UIID } from "../common/config/GameUIConfig";
  13. import { ADHandler } from "../common/manager/ADHandler";
  14. import { smc } from "../common/SingletonModuleComp";
  15. const { ccclass, property } = _decorator;
  16. /** 视图层对象 */
  17. @ccclass('DoubleSpeedViewComp')
  18. export class DoubleSpeedViewComp extends VMParent {
  19. /** 视图层逻辑代码分离演示 */
  20. data: any = {
  21. time: 0,
  22. }
  23. start() {
  24. // const entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
  25. this.setButton();
  26. this.data.time = smc.game.GameModel.doubleSpeedTime / 60;
  27. }
  28. private btn_open() {
  29. this.openAd();
  30. oops.gui.remove(UIID.DoubleSpeed);
  31. }
  32. //打开广告
  33. private openAd() {
  34. smc.game.GameModel.viewType = "speed_reward";
  35. ADHandler.inst.showAd(AD_TYPE.Double_Speed_Receive);
  36. }
  37. private btn_no() {
  38. oops.gui.remove(UIID.DoubleSpeed);
  39. ADHandler.inst.showAd("107");
  40. }
  41. private btn_close() {
  42. oops.gui.remove(UIID.DoubleSpeed);
  43. //播放插屏广告
  44. ADHandler.inst.showAd("107");
  45. }
  46. }