| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /*
- * @Author: mojunshou 1637302775@qq.com
- * @Date: 2025-04-15 20:16:16
- * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-23 16:32:13
- * @Description: 继续二倍速
- */
- import { _decorator, Component, Node } from 'cc';
- import { oops } from 'db://oops-framework/core/Oops';
- import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
- import { AD_TYPE } from '../common/config/GameDefine';
- import { UIID } from '../common/config/GameUIConfig';
- import { ADHandler } from '../common/manager/ADHandler';
- import { smc } from '../common/SingletonModuleComp';
- import { Label } from 'cc';
- import { DCHandler } from '../common/manager/DCHandler';
- const { ccclass, property } = _decorator;
- @ccclass('keepDoubleSpeedView')
- export class keepDoubleSpeedView extends GameComponent {
- private isAuto: boolean = false;
- @property(Label)
- private lab_time: Label = null!;
- private time: number = 3;
- private autoFunction: Function | null = null;
- start() {
- this.setButton();
- //设置3秒自启动
- this.isAuto = true;
- this.time = 3;
- this.lab_time.string = `${this.time}秒后自启动`;
- this.autoFunction = () => {
- this.time--
- this.lab_time.string = `${this.time}秒后自启动`;
- if (this.isAuto && this.time <= 0) {
- if (this.autoFunction) {
- this.unschedule(this.autoFunction);
- this.isAuto = false;
- this.openAd();
- oops.gui.remove(UIID.KeepSpeed);
- DCHandler.inst.reportData(3000304);
- }
- }
- }
- this.schedule(this.autoFunction, 1);
- }
- private btn_open() {
- this.isAuto = false;
- this.openAd();
- oops.gui.remove(UIID.KeepSpeed);
- DCHandler.inst.reportData(3000303);
- }
- //打开广告
- private openAd() {
- smc.game.GameModel.viewType = "speed_reward";
- ADHandler.inst.showAd(AD_TYPE.Double_Speed_Receive);
- }
- private btn_no() {
- this.isAuto = false;
- oops.gui.remove(UIID.KeepSpeed);
- ADHandler.inst.showAd("107");
- }
- private btn_close() {
- this.isAuto = false;
- oops.gui.remove(UIID.KeepSpeed);
- //播放插屏广告
- ADHandler.inst.showAd("107");
- DCHandler.inst.reportData(3000305);
- }
- protected onDisable(): void {
- this.isAuto = false;
- if (this.autoFunction) {
- this.unschedule(this.autoFunction);
- }
- }
- }
|