/* * @Author: mojunshou 1637302775@qq.com * @Date: 2025-03-21 14:43:24 * @LastEditors: mojunshou 1637302775@qq.com * @LastEditTime: 2025-04-10 14:37:08 * @Description: 游戏通关弹窗 */ import { Label, Node } from 'cc'; import { _decorator } from 'cc'; import { oops } from 'db://oops-framework/core/Oops'; import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil'; import { GameComponent } from "db://oops-framework/module/common/GameComponent"; import { AD_TYPE } from '../common/config/GameDefine'; import { UIID } from '../common/config/GameUIConfig'; import { CocosHandler } from '../common/manager/CocosHandler'; const { ccclass, property } = _decorator; /** 显示对象控制 */ @ccclass('GamePassView') export class GamePassView extends GameComponent { //提示Node @property(Label) private lab_tips: Label = null!; @property(Node) private receiveNode: Node = null!; //十倍领取 //引导小手 @property(Node) private guildNode: Node = null!; @property([Label]) private lab_list: Label[] = []; private time: number = 3; //倒数时间 private isAuto: boolean = true; //服务器传是否展示按钮 callback: Function = null!; protected start() { this.isAuto = true; } private setData() { this.receiveNode.active = this.isAuto; if (this.isAuto) { this.setAutoReceive(); } } //开心收下正常领取 private btn_none() { //是否展示广告 } //十倍领取 private btn_more() { this.isAuto = false; if (DeviceUtil.isNative && DeviceUtil.isAndroid) { CocosHandler.inst.show_ad(AD_TYPE.Pass_Receive); } else { oops.gui.remove(UIID.GamePass); } } //设置自动领取 setAutoReceive() { let time = this.time; this.callback = function () { if (time <= 0 && this.isAuto) { this.unschedule(this.callback) // CocosHandler.inst.show_ad(AD_TYPE.Pass_Receive); } this.lab_tips.string = `${time}秒后自动领取`; time--; } this.schedule(this.callback, 1, this.time); } }