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.
115 lines
4.6 KiB
115 lines
4.6 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, SpriteFrame, CCString, Scene } from "cc";
|
|
import BaseUIForm from "../../Mgr_UI/BaseUIForm";
|
|
import FrameLayout from "../../CComEx/FrameLayout";
|
|
import SceneDataMgr from "../../Mgr_LocalData/SceneDataMgr";
|
|
import AudioUtils from "../../Mgr_Audio/AudioUtils";
|
|
import { ESounds } from "../../MesEvent/ESounds";
|
|
import UIMgr from "../../Mgr_UI/UIMgr";
|
|
import { EUIForms } from "../../const/UIFormCnf";
|
|
import { EVideoType, FIGHTING_TYPE, MainBtnType } from "../../const/GameEnum";
|
|
import { TDAnalyticsMgr } from "../../Mgr_Ge/TDAnalyticsMgr";
|
|
import { GEData, GEType } from "../../Mgr_Ge/GeDifine";
|
|
import { GEAnalyticsMgr } from "../../Mgr_Ge/GEAnalyticsMgr";
|
|
import MesMgr from "../../MesEvent/MesMgr";
|
|
import { EGlobalEvent } from "../../MesEvent/EGlobalEvent";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("DefeatUI_Proxy")
|
|
export default class DefeatUI_Proxy extends BaseUIForm{
|
|
//#region 节点自动生成
|
|
@property(Button)
|
|
btn_Continue: Button = null;
|
|
//#endregion 节点自动生成
|
|
@property(FrameLayout)
|
|
private mFrameLayout: FrameLayout;
|
|
@property({type:[SpriteFrame],visible:true})
|
|
protected mIcons: SpriteFrame[] = [];
|
|
@property([CCString])
|
|
protected mTips:string[]=[
|
|
"升级武学,提升战力!",
|
|
"购买强力秘籍,武器!",
|
|
"强化装备,提升战力!"
|
|
];
|
|
|
|
|
|
onButtonClick(button:Button){
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
case this.btn_Continue:
|
|
this.CloseUI();
|
|
break;
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
addEvent(): void {
|
|
this.mFrameLayout.m_ItemRendererFuntion = this.ItemRender.bind(this)
|
|
}
|
|
|
|
protected CloseUI(btn?: Node): void {
|
|
super.CloseUI(btn);
|
|
const fighttype = this.mDataMgr.Scene.fighting_type;
|
|
if(fighttype === FIGHTING_TYPE.PVE){
|
|
SceneDataMgr.Ins.onFightRetreat();
|
|
}else if(fighttype === FIGHTING_TYPE.MUTATEBOSS){
|
|
SceneDataMgr.Ins.onMutateBossDone(false);
|
|
}
|
|
}
|
|
|
|
ItemRender(idx:number,tNode:Node){
|
|
const icon: Sprite = tNode.getChildByName("icon").getComponent(Sprite);
|
|
const des: Node = tNode.getChildByName("des");
|
|
icon.spriteFrame = this.mIcons[idx];
|
|
CNodeUtils.switchText(des, this.mTips[idx]);
|
|
CNodeUtils.addBtnComponent(tNode,this.ItemClick.bind(this,idx),this);
|
|
const task = this.mDataMgr.Task.task;
|
|
switch(idx){
|
|
case 0:
|
|
CNodeUtils.setActive(tNode, Number(task.id) >= 2);
|
|
break;
|
|
case 1:
|
|
CNodeUtils.setActive(tNode, Number(task.id) >= 6);
|
|
break;
|
|
case 2:
|
|
CNodeUtils.setActive(tNode, Number(task.id) >= 3);
|
|
break;
|
|
}
|
|
}
|
|
|
|
ItemClick(idx:number){
|
|
ConsoleEx.Log("选择了",idx)
|
|
this.CloseUI();
|
|
switch(idx){
|
|
case 0:
|
|
MesMgr.event(EGlobalEvent.OPEN_MAINPAGE, MainBtnType.Gongfa);
|
|
break;
|
|
case 1:
|
|
MesMgr.event(EGlobalEvent.OPEN_MAINPAGE, MainBtnType.Shop);
|
|
break;
|
|
case 2:
|
|
MesMgr.event(EGlobalEvent.OPEN_MAINPAGE, MainBtnType.Bag);
|
|
break;
|
|
}
|
|
}
|
|
|
|
protected start(): void {
|
|
AudioUtils.ins.playEffect(ESounds.So_fail);
|
|
SceneDataMgr.Ins.onGamePause();
|
|
this.mFrameLayout.m_ItemCount = this.mTips.length;
|
|
|
|
// 失败或退出boss
|
|
if(this.mDataMgr.Scene.fighting_type === FIGHTING_TYPE.PVE){
|
|
const passtime = Math.floor((Date.now() - this.mDataMgr.Scene.boss_start_time) / 1000);
|
|
const data = {
|
|
ad_name: (this.mDataMgr.Scene.boss_ad_time? EVideoType.CritSoul : "无"),
|
|
adcnt: this.mDataMgr.Scene.boss_ad_time,
|
|
duration: passtime,
|
|
enter_level_id: this.mDataMgr.Scene.getRealLevel()
|
|
}
|
|
TDAnalyticsMgr.ins.TrySendtrack(GEData.GEeventName.level_lose, data);
|
|
GEAnalyticsMgr.ins.TrySendtrack(GEType.level_lose,{level_id:data.enter_level_id});
|
|
}
|
|
}
|
|
}
|