diff --git a/config-serializer/Serializable.ts b/config-serializer/Serializable.ts index ac056fc9..40dc942c 100644 --- a/config-serializer/Serializable.ts +++ b/config-serializer/Serializable.ts @@ -8,11 +8,14 @@ abstract class Serializable { fromJsObject(jsObject: any): T { let identation = new Array(Serializable.depth + 1).join(' '); - process.stdout.write(`${identation}* ${this.constructor.name}.fromJsObject(${JSON.stringify(jsObject)}) => `); + let isArray = this instanceof UhkArray; + process.stdout.write(`${identation}* ${this.constructor.name}.fromJsObject(${JSON.stringify(jsObject)}) ` + (isArray ? ':\n' : `=> `)); Serializable.depth++; let value = this._fromJsObject(jsObject); Serializable.depth--; - process.stdout.write(`${value.toString()}\n`); + if (!isArray) { + process.stdout.write(`${value.toString()}\n`); + } return value; } diff --git a/config-serializer/UhkArray.ts b/config-serializer/UhkArray.ts new file mode 100644 index 00000000..1cc92318 --- /dev/null +++ b/config-serializer/UhkArray.ts @@ -0,0 +1,6 @@ +abstract class UhkArray extends Serializable { + abstract _fromJsObject(jsObject: any): T; + abstract _fromBinary(buffer: UhkBuffer): T; + abstract _toJsObject(): any; + abstract _toBinary(buffer: UhkBuffer): void; +} diff --git a/config-serializer/config-items/KeyActions.ts b/config-serializer/config-items/KeyActions.ts index 8b4bc640..e2516e5f 100644 --- a/config-serializer/config-items/KeyActions.ts +++ b/config-serializer/config-items/KeyActions.ts @@ -1,4 +1,4 @@ -class KeyActions extends Serializable { +class KeyActions extends UhkArray { keyActions: Serializable[] = []; diff --git a/config-serializer/test-serializer.ts b/config-serializer/test-serializer.ts index a69977de..759100b0 100644 --- a/config-serializer/test-serializer.ts +++ b/config-serializer/test-serializer.ts @@ -1,6 +1,7 @@ /// /// /// +/// /// ///