//#region 文件引入 import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText } from "cc"; import BaseUIForm from "../../Mgr_UI/BaseUIForm"; import RoleDataMgr from "../../Mgr_LocalData/RoleDataMgr"; import { AD_DOUBLE_TYPE, OFFLINE_PARAMS } from "../../const/GGameData"; import { TokenDataProxy } from "../../Mgr_LocalData/DataTypeProxy/TokenDataProxy"; import { EVideoType, PropType, TXVideoMapping } from "../../const/GameEnum"; import { DateDataProxy } from "../../Mgr_LocalData/DataTypeProxy/DateDataProxy"; import { Global } from "../../Global"; import MesMgr from "../../MesEvent/MesMgr"; import { EGlobalEvent } from "../../MesEvent/EGlobalEvent"; import StringUtils from "../../ExUtils/StringUtils"; import { TXSDKMgr } from "../../Mgr_Ge/TXSDKMgr"; import UIMgr from "../../Mgr_UI/UIMgr"; import { EUIForms } from "../../const/UIFormCnf"; import PlatformManager from "../../Platform/PlatformManager"; //#endregion 文件引入 const {ccclass, property,menu} = _decorator; @ccclass("OfflineRewardUI_Proxy") export default class OfflineRewardUI_Proxy extends BaseUIForm{ //#region 节点自动生成 @property(Label) lab_offline_time: Label = null; @property(Label) lab_industry_coin: Label = null; @property(Label) lab_Imperial_weapons_coin: Label = null; @property(Label) lab_shopNum: Label = null; @property(Button) btn_rewardGet: Button = null; //#endregion 节点自动生成 onButtonClick(button:Button){ /**点击事件触发*/ switch (button) { case this.btn_rewardGet: const reallv = this.mDataMgr.Scene.getRealLevel(); Global.showvideo({name: EVideoType.OffLine, gamelv: reallv},()=>{ const Count = RoleDataMgr.Ins.offlineTimes; const AllCoin = RoleDataMgr.Ins.offlineEarn + RoleDataMgr.Ins.offlineFight; RoleDataMgr.Ins.offlineSeconds = 0; this.mDataMgr.Date.setOfflinetime(); const ab_double = PlatformManager.instance.platData.ABTest.ad_double; const abtest = (ab_double && (ab_double.v == 2 || ab_double.v == 3)) if(reallv < OFFLINE_PARAMS.DOUBLE_REWARD_LEVEL && abtest){ UIMgr.Ins.ShowUI(EUIForms.LookAdGetDouleUI,{param:{type:AD_DOUBLE_TYPE.AD_OFFLINE, coin:AllCoin, shopNum:Count}}); }else{ if(AllCoin > 0){ this.mDataMgr.Token.addToken(PropType.eGold, AllCoin); UIMgr.Ins.ShowTipsUI(`离线奖励: 铜钱+${AllCoin}`); } if(Count > 0){ this.mDataMgr.Shop.addTimes(Count); UIMgr.Ins.ShowTipsUI(`离线奖励: 商店刷新次数+${Count}`); } MesMgr.event(EGlobalEvent.OUTLINE_UPDATE, false); } this.onClick_closeBtn(); }); break; default: ConsoleEx.Log(button); break; } } onClick_closeBtn(){ this.mDataMgr.Signin.autoOpen(); super.onClick_closeBtn(); } protected start(): void { this.refreshInfo(); TXSDKMgr.ins.AD_UI_SHOW(TXVideoMapping[EVideoType.OffLine]); } refreshInfo(){ CNodeUtils.switchText(this.lab_offline_time, Math.floor(RoleDataMgr.Ins.offlineSeconds / 60) + "分钟/" + Math.floor(this.mDataMgr.Date.MaxOfflineTime / 60) + "分钟") CNodeUtils.switchText(this.lab_industry_coin, "+" + StringUtils.formatLargeNumber(RoleDataMgr.Ins.offlineEarn)) CNodeUtils.switchText(this.lab_Imperial_weapons_coin, "+" + StringUtils.formatLargeNumber(RoleDataMgr.Ins.offlineFight)) CNodeUtils.switchText(this.lab_shopNum, "+" + RoleDataMgr.Ins.offlineTimes + "次") } }