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.
93 lines
2.4 KiB
93 lines
2.4 KiB
|
1 week ago
|
|
||
|
|
//*********************
|
||
|
|
// create by 流云
|
||
|
|
// time: Wed Apr 16 2025
|
||
|
|
// desc:
|
||
|
|
//*********************
|
||
|
|
import { _decorator, Component, Node, find } from 'cc';
|
||
|
|
|
||
|
|
import { ItemNumType, StatusType } from '../../game/GameData';
|
||
|
|
import { Auto_PanelSidebar } from './Auto_PanelSidebar';
|
||
|
|
import { ItemData } from '../../game/ConfigProjectData';
|
||
|
|
import { UIID } from '../../game/ConfigRes';
|
||
|
|
const { ccclass, property } = _decorator;
|
||
|
|
|
||
|
|
@ccclass('UIPanelSidebar')
|
||
|
|
export class UIPanelSidebar extends Auto_PanelSidebar {
|
||
|
|
|
||
|
|
onLoad(): void {
|
||
|
|
super.onLoad();
|
||
|
|
}
|
||
|
|
|
||
|
|
onEnable(): void {
|
||
|
|
super.onEnable();
|
||
|
|
// this.node.active = false;
|
||
|
|
// gg.sdk.checkSidebar((res) => {
|
||
|
|
// if (res) {
|
||
|
|
// this.node.active = true;
|
||
|
|
// }
|
||
|
|
// })
|
||
|
|
}
|
||
|
|
|
||
|
|
onDisable(): void {
|
||
|
|
super.onDisable();
|
||
|
|
}
|
||
|
|
|
||
|
|
onInit(): void {
|
||
|
|
this.showOpenCenterEff();
|
||
|
|
this.showOpenMaskEff(2);
|
||
|
|
this.btnEnter.active = gg.data.getStatus(StatusType.DayGiftCanGet) == 0;
|
||
|
|
this.btnGet.active = gg.data.getStatus(StatusType.DayGiftCanGet) == 1 && gg.data.getStatus(StatusType.DayGiftGetFinish) == 0;
|
||
|
|
this.btnFinish.active = gg.data.getStatus(StatusType.DayGiftGetFinish) == 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
click_btnClose(): void {
|
||
|
|
gg.audio.playEffect({ name: "点击音效"});
|
||
|
|
this.close(2);
|
||
|
|
}
|
||
|
|
|
||
|
|
click_btnEnter(): void {
|
||
|
|
gg.audio.playEffect({ name: "点击音效"});
|
||
|
|
gg.sdk.enterSidebar((res) => {
|
||
|
|
if (res) {
|
||
|
|
//gg.data.setStatus(StatusType.DayGiftCanGet, 1);
|
||
|
|
} else {
|
||
|
|
gg.ui.showToast("进入失败");
|
||
|
|
}
|
||
|
|
})
|
||
|
|
this.close(2);
|
||
|
|
}
|
||
|
|
|
||
|
|
click_btnFinish(): void {
|
||
|
|
gg.audio.playEffect({ name: "点击音效"});
|
||
|
|
this.close(2);
|
||
|
|
}
|
||
|
|
|
||
|
|
click_btnGet(): void {
|
||
|
|
gg.audio.playEffect({ name: "点击音效"});
|
||
|
|
//gg.data.setStatus(StatusType.DayGiftGetFinish, 1);
|
||
|
|
//gg.data.addItemNum(ItemNumType.money, 50000);
|
||
|
|
|
||
|
|
this.showGoldView(1000);
|
||
|
|
// gg.data.saveToServer();
|
||
|
|
this.close(2);
|
||
|
|
}
|
||
|
|
|
||
|
|
showGoldView(goldNum){
|
||
|
|
let itemsArray = []
|
||
|
|
let id = 1//jinbi
|
||
|
|
let item = new ItemData(id,goldNum)
|
||
|
|
item.num = goldNum
|
||
|
|
item.id = id
|
||
|
|
itemsArray.push(item)
|
||
|
|
|
||
|
|
|
||
|
|
gg.ui.openPanel(UIID.GetReward, {
|
||
|
|
data: itemsArray,onClose:()=>{
|
||
|
|
gg.data.setStatus(StatusType.DayGiftGetFinish, 1);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|