Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit f427932

Browse files
FallenhhEYHN
authored andcommitted
add dialog list
1 parent 4c9d7db commit f427932

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dialog/script.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ScriptEngine extends EventEmitter {
77
this.emitters = [];
88
this.variables = [];
99
}
10-
10+
1111
/**
1212
* @param {string} name
1313
* @param {(...args:string[], cb: () => void, engine: ScriptEngine) => void} func
@@ -50,6 +50,9 @@ class ScriptEngine extends EventEmitter {
5050
* @param {string} text
5151
*/
5252
injectVariable(sourceText) {
53+
if (Array.isArray(sourceText)) {
54+
sourceText = sourceText[Math.floor(Math.random() * sourceText.length)];
55+
}
5356
const re = /\$(\w+)\$/g;
5457
let text = sourceText;
5558
let match = null;

0 commit comments

Comments
 (0)