This commit is contained in:
donggang
2024-02-29 10:12:28 +08:00
parent 52fcc36a08
commit a03a8408be
3 changed files with 10 additions and 6 deletions

View File

@@ -54,7 +54,7 @@ export class LayerNotify extends Node {
}
/**
* 显示toast
* 渐隐飘过提示
* @param content 文本表示
* @param useI18n 是否使用多语言
*/

View File

@@ -74,8 +74,10 @@ export class CommonPrompt extends Component {
}
private setBtnCancelLabel() {
this.lab_cancel!.dataID = this.config.cancelWord;
this.lab_cancel!.node!.parent!.active = this.config.needCancel || false;
if (this.lab_cancel) {
this.lab_cancel.dataID = this.config.cancelWord;
this.lab_cancel.node.parent!.active = this.config.needCancel || false;
}
}
private onOk() {

View File

@@ -234,7 +234,8 @@ export class GameComponent extends Component {
*/
protected setButton(...args: string[]) {
this.node.on(Node.EventType.TOUCH_END, (event: EventTouch) => {
var func = this[event.target.name];
var self: any = this;
var func = self[event.target.name];
if (func)
func(event);
else
@@ -251,10 +252,11 @@ export class GameComponent extends Component {
* onGlobal(event: string, args: any) { console.log(args) };
*/
protected setEvent(...args: string[]) {
var self: any = this;
for (const name of args) {
var func = this[name];
var func = self[name];
if (func)
this.on(name, this[name], this);
this.on(name, self[name], this);
else
console.error(`名为【${name}】的全局事方法不存在`);
}