UICommonNotice.ts
1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import { WindowName } from "../../Global";
import { UIBase } from "../UIBase";
import { UIManager } from "../UIManager";
import { UICommonNoticeEnableParam } from "./UICommonNoticeEnableParam";
const { ccclass, property } = cc._decorator;
@ccclass
export default class UICommonNotice extends UIBase {
private _data: UICommonNoticeEnableParam;
private _txtDesc: cc.Label;
//#region LIFE-CYCLE CALLBACKS:
onLoad() {
this._txtDesc = this.node.getChildByName('descNode').getComponentInChildren(cc.Label);
}
protected onEnable(): void {
this._data = this.enableParam as UICommonNoticeEnableParam;
if (this._data) {
this._txtDesc.string = this._data.desc;
}
}
// update (dt) {}
//#endregion
//#region public method
//#endregion
//#region event
onBtnDoneClick() {
UIManager.ins.closeWindow(WindowName.COMMON_NOTICE);
if (this._data && this._data.doneCallBack && this._data.callBackThisObj) {
this._data.doneCallBack.call(this._data.callBackThisObj);
}
}
onBtnCancelClick() {
UIManager.ins.closeWindow(WindowName.COMMON_NOTICE);
if (this._data && this._data.cancelCallBack && this._data.callBackThisObj) {
this._data.cancelCallBack.call(this._data.callBackThisObj);
}
}
//#endregion
//#region private method
//#endregion
}