Files
18xchat/.svn/pristine/97/975f4708a065987f9914dddbdd20dfe1df1a383a.svn-base
T
2025-07-17 17:18:21 +08:00

80 lines
2.1 KiB
Plaintext

import { _decorator, Component, Node, Sprite } from 'cc';
import { GButton } from '../../Main/Common/GButton';
import Utils from '../../Main/Common/Utils';
const { ccclass, property } = _decorator;
//确认框弹窗
@ccclass('ConfirmDialog')
export class ConfirmDialog extends Component {
private _nodeTab: any = {};
private _data;
private inited: boolean = false;
onLoad() {
Utils.parseNode(this.node, this._nodeTab)
}
start() {
// GButton.BandClick(this._nodeTab.mask, ()=>{
// }, this, 0, null, null, false);
//关闭
GButton.BandClick(this._nodeTab.btnClose, ()=>{
if (this._data && this._data.closeCallback) {
this._data.closeCallback();
}
this.node.removeFromParent()
}, this);
//取消
GButton.BandClick(this._nodeTab.btnNo, ()=>{
if (this._data && this._data.noCallback) {
this._data.noCallback();
}
this.node.removeFromParent()
}, this);
//确定
GButton.BandClick(this._nodeTab.btnYes, ()=>{
if (this._data && this._data.yesCallback) {
this._data.yesCallback();
}
this.node.removeFromParent()
}, this);
this.inited = true;
this.refreshUI();
}
update(deltaTime: number) {
}
/**设置显示参数 */
setParam(data: any) {
this._data = data;
this.refreshUI();
}
private refreshUI() {
if (!this.inited || !this._data) return;
//内容
Utils.setString(this._nodeTab.labContent, this._data.content);
//确认按钮文本
if (this._data.strYes) {
Utils.setString(this._nodeTab.labYes, this._data.strYes);
}
//取消按钮文本
if (this._data.strNo) {
Utils.setString(this._nodeTab.labNo, this._data.strNo);
}
//隐藏取消按钮
if (this._data.hideNo == true) {
this._nodeTab.btnNo.active = false;
}
}
}