From a19c092ea128a7bca25df310c8f1e1c8b6be4b8e Mon Sep 17 00:00:00 2001 From: JianMiau Date: Mon, 24 Jan 2022 09:11:23 +0800 Subject: [PATCH] [add] Speak --- assets/Scene/Main.fire | 2 +- assets/Script/Manager.ts | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/assets/Scene/Main.fire b/assets/Scene/Main.fire index efb4fac..dac7a36 100644 --- a/assets/Scene/Main.fire +++ b/assets/Scene/Main.fire @@ -254,7 +254,7 @@ } ], "_prefab": null, - "_opacity": 0, + "_opacity": 255, "_color": { "__type__": "cc.Color", "r": 255, diff --git a/assets/Script/Manager.ts b/assets/Script/Manager.ts index 5aabd33..2ba996f 100644 --- a/assets/Script/Manager.ts +++ b/assets/Script/Manager.ts @@ -29,7 +29,7 @@ export default class Manager extends cc.Component { let data: any = e.data; let method: string = data.method; let value: any = data.value; - self.Birdge(method, value) + self.Birdge(method, ...value) }, false); if (!window["Bridge"]) { @@ -47,6 +47,10 @@ export default class Manager extends cc.Component { this._resize(); } + /** 跨版本溝通 + * @example + * CallParent('Speak', '我愛豬涵') + */ public Birdge(method: string, value: string = ""): void { let self: this = this; if (method && self[method]) { @@ -61,16 +65,11 @@ export default class Manager extends cc.Component { console.log(`not function: ${method}, value: ${value}`); } - private _closeBG(): void { - if (this.webview.node.opacity === 0) { - this.BG.destroy(); - this.webview.node.opacity = 255; - this.webview.node.active = false; - this.webview.node.active = true; - } + public CloseBG(): void { + this.BG.destroy(); } - private _log(msg: string): void { + public Log(msg: string): void { console.log(msg); } @@ -78,7 +77,7 @@ export default class Manager extends cc.Component { this._text_to_Speech.speak(msg); } - private _alert(msg: string): void { + public Alert(msg: string): void { alert(msg); }