瀏覽代碼

Allow printing the name of classes

Reddo 5 年之前
父節點
當前提交
c6387fe5a5
共有 1 個文件被更改,包括 13 次插入8 次删除
  1. 13 8
      app/Elements/Classes/Say.ts

+ 13 - 8
app/Elements/Classes/Say.ts

@@ -230,16 +230,21 @@ class Say {
             } else if (seq == Say.RUN_PARAGRAPH_OFF) {
                 this.skipbreaks = false;
             } else if (typeof seq == "function") {
-                let fObj = (<(s: Say) => any> seq)(this);
-                if (Array.isArray(fObj)) {
-                    for (let k = fObj.length - 1; k >= 0; k--) {
-                        this.sequence.splice(this.sequenceRunner + 1, 0, fObj[k]);
+                // not a function, but a class
+                if (seq.prototype != undefined) {
+                    this.currentParagraph.push(document.createTextNode(seq.name));
+                } else {
+                    let fObj = (<(s: Say) => any>seq)(this);
+                    if (Array.isArray(fObj)) {
+                        for (let k = fObj.length - 1; k >= 0; k--) {
+                            this.sequence.splice(this.sequenceRunner + 1, 0, fObj[k]);
+                        }
+                    } else if (fObj != undefined) {
+                        this.sequence.splice(this.sequenceRunner + 1, 0, fObj);
                     }
-                } else if (fObj != undefined) {
-                    this.sequence.splice(this.sequenceRunner + 1, 0, fObj);
+                    this.sequence.splice(this.sequenceRunner, 1);
+                    this.sequenceRunner--;
                 }
-                this.sequence.splice(this.sequenceRunner, 1);
-                this.sequenceRunner--;
             } else if (seq.constructor == this.constructor) {
                 for (let k = (<Say> seq).sequence.length - 1; k >= 0; k--) {
                     this.sequence.splice(this.sequenceRunner + 1, 0, (<Say> seq).sequence[k]);