[add] Speak

This commit is contained in:
建喵 2022-01-24 09:11:23 +08:00
parent 587caaa9b4
commit a19c092ea1
2 changed files with 10 additions and 11 deletions

View File

@ -254,7 +254,7 @@
} }
], ],
"_prefab": null, "_prefab": null,
"_opacity": 0, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 255,

View File

@ -29,7 +29,7 @@ export default class Manager extends cc.Component {
let data: any = e.data; let data: any = e.data;
let method: string = data.method; let method: string = data.method;
let value: any = data.value; let value: any = data.value;
self.Birdge(method, value) self.Birdge(method, ...value)
}, false); }, false);
if (!window["Bridge"]) { if (!window["Bridge"]) {
@ -47,6 +47,10 @@ export default class Manager extends cc.Component {
this._resize(); this._resize();
} }
/**
* @example
* CallParent('Speak', '我愛豬涵')
*/
public Birdge(method: string, value: string = ""): void { public Birdge(method: string, value: string = ""): void {
let self: this = this; let self: this = this;
if (method && self[method]) { if (method && self[method]) {
@ -61,16 +65,11 @@ export default class Manager extends cc.Component {
console.log(`not function: ${method}, value: ${value}`); console.log(`not function: ${method}, value: ${value}`);
} }
private _closeBG(): void { public CloseBG(): void {
if (this.webview.node.opacity === 0) { this.BG.destroy();
this.BG.destroy();
this.webview.node.opacity = 255;
this.webview.node.active = false;
this.webview.node.active = true;
}
} }
private _log(msg: string): void { public Log(msg: string): void {
console.log(msg); console.log(msg);
} }
@ -78,7 +77,7 @@ export default class Manager extends cc.Component {
this._text_to_Speech.speak(msg); this._text_to_Speech.speak(msg);
} }
private _alert(msg: string): void { public Alert(msg: string): void {
alert(msg); alert(msg);
} }