/*
 * @Author: mojunshou 1637302775@qq.com
 * @Date: 2025-03-21 11:45:43
 * @LastEditors: mojunshou 1637302775@qq.com
 * @LastEditTime: 2025-04-29 18:11:07
 * @Description: 提现必返
 */
import { _decorator, Label } 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 { UIID } from '../common/config/GameUIConfig';
import { ADHandler } from '../common/manager/ADHandler';
import { smc } from '../common/SingletonModuleComp';
import { GameEvent } from '../common/config/GameEvent';
import { ServerHandler } from '../common/manager/ServerHandler';
import { Format } from '../utils/Format';
import { DCHandler } from '../common/manager/DCHandler';


const { ccclass, property } = _decorator;

/** 显示对象控制 */
@ccclass('CashRebateView')
export class CashRebateView extends GameComponent {
    @property(Label)
    lab_num: Label = null!;
    protected start() {
        DCHandler.inst.reportData(3000702);
        this.setButton();
        this.setData();
    }
    setData() {
        if (this.lab_num) {
            this.lab_num.string = Format.formatRedPacketCoin(smc.game.GameModel.changeHbCoin);
        }
    }
    private btn_ok() {
        //看广告
        if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
            oops.gui.remove(UIID.CashRebate);
            ADHandler.inst.showAd("105");
            oops.message.dispatchEvent(GameEvent.showCoinAnimation, "showCoin");
            //下一关
            ServerHandler.inst.getNextLevel();
            DCHandler.inst.reportData(3000704);

        } else {
            oops.gui.remove(UIID.CashRebate);
        }
    }
}