DoubleSpeedViewComp.ts 1.6 KB

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