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.
81 lines
3.1 KiB
81 lines
3.1 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText } from "cc";
|
|
import BaseUIForm from "../../Mgr_UI/BaseUIForm";
|
|
import MesMgr from "../../MesEvent/MesMgr";
|
|
import { EGlobalEvent } from "../../MesEvent/EGlobalEvent";
|
|
import { EBundleName, PropType } from "../../const/GameEnum";
|
|
import UIMgr from "../../Mgr_UI/UIMgr";
|
|
import PlatformManager from "../../Platform/PlatformManager";
|
|
import { EResUrls } from "../../ResUrl/EResUrls";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("PopSideBarUI_Proxy")
|
|
export default class PopSideBarUI_Proxy extends BaseUIForm{
|
|
//#region 节点自动生成
|
|
@property(Node)
|
|
n_kstopbg: Node = null;
|
|
@property(Sprite)
|
|
spr_logo: Sprite = null;
|
|
@property(Label)
|
|
lab_name: Label = null;
|
|
@property(Button)
|
|
btn_goto: Button = null;
|
|
@property(Label)
|
|
lab_goto: Label = null;
|
|
@property(Label)
|
|
lab_geted: Label = null;
|
|
//#endregion 节点自动生成
|
|
|
|
onButtonClick(button:Button){
|
|
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
case this.btn_goto:
|
|
window["tt"] && window["tt"].navigateToScene({
|
|
scene: "sidebar",
|
|
success: (res) => {
|
|
console.log("navigate to scene success");
|
|
// 跳转成功回调逻辑
|
|
},
|
|
fail: (res) => {
|
|
console.log("navigate to scene fail: ", res);
|
|
// 跳转失败回调逻辑
|
|
},
|
|
});
|
|
break;
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
|
|
addEvent(): void {
|
|
MesMgr.on(EGlobalEvent.E_CHECK_CEBIAN_LAN, this.onButtonClick, this)
|
|
}
|
|
|
|
protected start(): void {
|
|
const platdata = PlatformManager.PlatformInstance.platformData;
|
|
const logo = platdata.logo;
|
|
CNodeUtils.SwitchTexture(EResUrls.Texture(`logo${logo}`), this.spr_logo, EBundleName.General);
|
|
CNodeUtils.switchText(this.lab_name, platdata.gameName);
|
|
CNodeUtils.setActive(this.n_kstopbg, window['ks'])
|
|
if(window['cebianlan'] && !this.mDataMgr.Game.data.isGetSideBar){
|
|
this.getReward();
|
|
}
|
|
this.refresh();
|
|
}
|
|
|
|
refresh(){
|
|
CNodeUtils.setActive(this.btn_goto, !this.mDataMgr.Game.data.isGetSideBar);
|
|
CNodeUtils.setActive(this.lab_geted, this.mDataMgr.Game.data.isGetSideBar);
|
|
}
|
|
|
|
getReward(){
|
|
if(window['cebianlan']){
|
|
this.mDataMgr.Game.data.isGetSideBar = true;
|
|
this.mDataMgr.Token.addToken(PropType.eGold, 10000);
|
|
UIMgr.Ins.ShowTipsUI("订阅奖励发放成功");
|
|
this.refresh();
|
|
}
|
|
}
|
|
}
|