大侠
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

84 lines
3.5 KiB

//#region 文件引入
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, ProgressBar } from "cc";
import BaseUIForm from "../../Mgr_UI/BaseUIForm";
import SceneDataMgr from "../../Mgr_LocalData/SceneDataMgr";
import { Global } from "../../Global";
import { EVideoType, TXVideoMapping } from "../../const/GameEnum";
import MesMgr from "../../MesEvent/MesMgr";
import { EGlobalEvent } from "../../MesEvent/EGlobalEvent";
import SoulDataMgr from "../../Mgr_LocalData/SoulDataMgr";
import MathUtils from "../../ExUtils/MathUtils";
import PlatformManager from "../../Platform/PlatformManager";
import { TXSDKMgr } from "../../Mgr_Ge/TXSDKMgr";
//#endregion 文件引入
const {ccclass, property,menu} = _decorator;
@ccclass("ImperialWeaponsUI_Proxy")
export default class ImperialWeaponsUI_Proxy extends BaseUIForm{
//#region 节点自动生成
@property(ProgressBar)
pro_exp: ProgressBar = null;
@property(Label)
lab_exp: Label = null;
@property(Label)
lab_Lv: Label = null;
@property(Label)
lab_AttackSpeed: Label = null;
@property(Node)
n_Active: Node = null;
@property(Label)
lab_attack_Time: Label = null;
@property(Node)
n_ADActive: Node = null;
@property(Button)
btn_adBoom: Button = null;
@property(Node)
n_dropdesc: Node = null;
//#endregion 节点自动生成
onButtonClick(button:Button){
/**点击事件触发*/
switch (button) {
case this.btn_adBoom:
this.CloseUI();
Global.showvideo({name: EVideoType.CritSoul, gamelv: this.mDataMgr.Scene.getRealLevel()},()=>{
SceneDataMgr.Ins.onSoulCrit();
});
break;
default:
ConsoleEx.Log(button);
break;
}
}
addEvent(): void {
MesMgr.on(EGlobalEvent.CHANGE_SOUL, this.refreshSoulState, this)
}
protected start(): void {
CNodeUtils.switchText(this.lab_Lv, "Lv." + this.mDataMgr.Game.data.level);
CNodeUtils.switchText(this.lab_exp, SoulDataMgr.Ins.exp + "/" + SoulDataMgr.Ins.nextExp);
this.pro_exp.progress = SoulDataMgr.Ins.exp / SoulDataMgr.Ins.nextExp;
this.refreshSoulState();
const drop = (PlatformManager.instance.platData.ABTest.crit_drop_tj && PlatformManager.instance.platData.ABTest.crit_drop_tj.v > 0)?1 : Global.CsvMgr.getDropTJRate();
CNodeUtils.setActive(this.n_dropdesc, drop > 0);
TXSDKMgr.ins.AD_UI_SHOW(TXVideoMapping[EVideoType.CritSoul]);
}
refreshSoulState(){
CNodeUtils.setActive(this.n_Active, SoulDataMgr.Ins.crit);
CNodeUtils.setActive(this.n_ADActive, !SoulDataMgr.Ins.crit);
CNodeUtils.switchText(this.lab_AttackSpeed, MathUtils.fixedDecimal(SceneDataMgr.Ins.realSpeed, 1) + "次/秒");
}
// refreshAttackSpeed(){
// CNodeUtils.switchText(this.lab_AttackSpeed, MathUtils.fixedDecimal(SceneDataMgr.Ins.realSpeed, 1) + "次/秒");
// }
protected update(dt: number): void {
if(SoulDataMgr.Ins.crit){
CNodeUtils.switchText(this.lab_attack_Time, MathUtils.fixedDecimal(SoulDataMgr.Ins.critleftMs / 1000, 2));
}
}
}