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.
94 lines
3.9 KiB
94 lines
3.9 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText } from "cc";
|
|
import BaseUIForm from "../../Mgr_UI/BaseUIForm";
|
|
import PlatformManager from "../../Platform/PlatformManager";
|
|
import MesMgr from "../../MesEvent/MesMgr";
|
|
import { EGlobalEvent } from "../../MesEvent/EGlobalEvent";
|
|
import UIMgr from "../../Mgr_UI/UIMgr";
|
|
import { PropType } from "../../const/GameEnum";
|
|
import { Global } from "../../Global";
|
|
import GDUtils from "../../ExCUtils/GDUtils";
|
|
import { TDAnalyticsMgr } from "../../Mgr_Ge/TDAnalyticsMgr";
|
|
import { GEData } from "../../Mgr_Ge/GeDifine";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("AddShortCutUI_Proxy")
|
|
export default class AddShortCutUI_Proxy extends BaseUIForm{
|
|
//#region 节点自动生成
|
|
@property(Node)
|
|
n_add: Node = null;
|
|
@property(Button)
|
|
btn_Add: Button = null;
|
|
@property(Node)
|
|
n_get: Node = null;
|
|
//#endregion 节点自动生成
|
|
|
|
private openAnim: Animation = null;
|
|
private opening: boolean = false;
|
|
|
|
onButtonClick(button:Button){
|
|
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
case this.btn_Add:
|
|
this.opening = true;
|
|
// CNodeUtils.setActive(this.btn_closeBtn, false);
|
|
TDAnalyticsMgr.ins.TrySendtrack(GEData.GEeventName.addDesktop, {enter_level_id: this.mDataMgr.Scene.getRealLevel()});
|
|
PlatformManager.PlatformInstance.createShortcut((isOK:boolean)=>{
|
|
if(isOK){
|
|
PlatformManager.PlatformInstance.checkShortcut((isOK:boolean)=>{
|
|
if(isOK){
|
|
PlatformManager.PlatformInstance.isAddShortcut = true;
|
|
this.mDataMgr.Game.addShortCutNum();
|
|
MesMgr.event(EGlobalEvent.ADD_SHORTCUR);
|
|
this.mDataMgr.Token.addToken(PropType.eGold, 200000);
|
|
if(this.openAnim){
|
|
this.openAnim.play();
|
|
}
|
|
}else{
|
|
UIMgr.Ins.ShowTipsUI("添加桌面失败!");
|
|
this.opening = false;
|
|
}
|
|
});
|
|
}else{
|
|
UIMgr.Ins.ShowTipsUI("添加桌面失败!");
|
|
this.opening = false;
|
|
// CNodeUtils.setActive(this.btn_closeBtn, true);
|
|
}
|
|
});
|
|
break;
|
|
// case this.btn_closeBtn:
|
|
// this.CloseUI();
|
|
// break;
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
|
|
onClick_bgCloseBtn(btn?:Node){
|
|
!this.opening && this.CloseUI(btn);
|
|
}
|
|
|
|
protected start(): void {
|
|
this.openAnim = this.n_add.getComponent(Animation);
|
|
this.openAnim.on(Animation.EventType.FINISHED, this.openRedPacket, this)
|
|
this.reflash();
|
|
}
|
|
|
|
private openRedPacket(){
|
|
this.opening = false;
|
|
// CNodeUtils.setActive(this.btn_closeBtn, true);
|
|
UIMgr.Ins.ShowTipsUI("添加桌面成功!");
|
|
const config = Global.CsvMgr.base_res_csv[PropType.eGold];
|
|
const name = GDUtils.GetHEXByQualityForStr(`${config.name}x20万`, config.quality)
|
|
UIMgr.Ins.ShowTipsUI("获得" + name);
|
|
this.reflash();
|
|
}
|
|
|
|
private reflash(){
|
|
const isAdd = PlatformManager.PlatformInstance.isAddShortcut;
|
|
CNodeUtils.setActive(this.n_add, !isAdd);
|
|
CNodeUtils.setActive(this.n_get, isAdd);
|
|
}
|
|
}
|