Files
18xchat/assets/Scripts/Sub/UI/BDSidebar_UI.ts
T
2025-07-17 17:18:21 +08:00

87 lines
2.2 KiB
TypeScript

import { _decorator, Node } from 'cc';
import { GButton } from '../../Main/Common/GButton';
import Utils from '../../Main/Common/Utils';
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
import li_BaseView from '../../Main/Common/li_BaseView';
import { ByteDanceSDK } from '../../Main/Channel/bdSDK';
import SubManager from '../SubManager';
const { ccclass, property } = _decorator;
//抖音侧边栏弹窗
@ccclass('BDSidebar_UI')
export class BDSidebar_UI extends li_BaseView {
private _nodeTab: any = {};
private _data;
//----重写父类接口---------------------------------------
onLoadCT() {
this.registerListenner();
}
openUIDataCT(data: any): void {
this._data = data
}
registerListenner() {
Utils.addInnerEL(InnerMsgCode.UI_BD_Sidebar, this, this.resiveBDSidebar)
}
start() {
Utils.parseNode(this.node, this._nodeTab)
GButton.BandClick(this._nodeTab.bgmask, ()=>{
this.onClose()
}, this, null, null, null, false);
GButton.BandClick(this._nodeTab.btnClose, ()=>{
this.onClose()
}, this);
GButton.BandClick(this._nodeTab.btnGoto, ()=>{
this.onGotoClick()
}, this);
this.refreshState()
}
update(deltaTime: number) {
}
//侧边栏状态变化回调
resiveBDSidebar(data: any) {
let stage = ByteDanceSDK.SidebarState
if (stage >= 2) {
this.onClose()
}
}
//刷新状态
refreshState() {
// let stage = ByteDanceSDK.SidebarState
// if (stage == 2) {
// Utils.setString(this._nodeTab.labGoto, "领奖")
// } else {
// Utils.setString(this._nodeTab.labGoto, "前往侧边栏")
// }
}
//点击前往侧边栏按钮
onGotoClick() {
// let stage = ByteDanceSDK.SidebarState
// if (stage == 2) {
// SubManager.ShowPrompt("领取奖励")
// } else {
// ByteDanceSDK.GotoSidebar(()=>{
// this.onClose()
// })
// }
ByteDanceSDK.GotoSidebar(()=>{
this.onClose()
})
}
}