Files
18xchat/.svn/pristine/ee/ee87afb3afabda0b4e0d20c283d85317f514ff95.svn-base
T
2025-07-17 17:18:21 +08:00

98 lines
2.8 KiB
Plaintext

import { _decorator, Node, Sprite, view } from 'cc';
import { GButton } from '../../Main/Common/GButton';
import Utils from '../../Main/Common/Utils';
import li_BaseView from '../../Main/Common/li_BaseView';
import HttpUnit from '../../Main/Common/HttpUnit';
import SubManager from '../SubManager';
const { ccclass, property } = _decorator;
/**广告、分享的用途类型 */
export enum E_AD_TARGET {
/**加相亲次数 */
xiangqin = 1,
/**加聊天次数 */
liaotian = 2,
}
//关卡内看广告弹窗界面
@ccclass('TalkAdDialog')
export class TalkAdDialog extends li_BaseView {
private _nodeTab: any = {};
private _data;
//----重写父类接口---------------------------------------
onLoadCT() {
this.registerListenner();
Utils.parseNode(this.node, this._nodeTab)
}
openUIDataCT(data: any): void {
this._data = data || {};
}
registerListenner() {
// Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
}
start() {
GButton.BandClick(this._nodeTab.mask, ()=>{
if (this._data.closeCallback) {
this._data.closeCallback();
}
this.onClose();
}, this, 0, null, null, false);
GButton.BandClick(this._nodeTab.btnClose, ()=>{
if (this._data.closeCallback) {
this._data.closeCallback();
}
this.onClose();
}, this);
GButton.BandClick(this._nodeTab.btnShare, ()=>{
if (this._data.type == E_AD_TARGET.liaotian && HttpUnit.GetTalkShareNum() <= 0) {
SubManager.ShowPrompt("今日分享次数已用完");
return;
}
if (this._data.type == E_AD_TARGET.xiangqin && HttpUnit.GetXiangqinShareNum() <= 0) {
SubManager.ShowPrompt("今日分享次数已用完");
return;
}
if (this._data.shareCallback) {
this._data.shareCallback();
}
this.onClose();
}, this);
GButton.BandClick(this._nodeTab.btnAD, ()=>{
if (this._data.type == E_AD_TARGET.liaotian && HttpUnit.GetTalkAdNum() <= 0) {
SubManager.ShowPrompt("今日广告次数已用完");
return;
}
if (this._data.type == E_AD_TARGET.xiangqin && HttpUnit.GetXiangqinAdNum() <= 0) {
SubManager.ShowPrompt("今日广告次数已用完");
return;
}
if (this._data.adCallback) {
this._data.adCallback();
}
this.onClose();
}, this);
Utils.setString(this._nodeTab.labContent, this._data.content);
}
update(deltaTime: number) {
}
}