delay and text macros

This commit is contained in:
Sam Rang
2016-04-17 23:34:21 -05:00
parent 4dc3c4f6c3
commit 176f94e919
5 changed files with 83 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
class TextMacroAction extends MacroAction {
text: string;
_fromJsObject(jsObject: any): TextMacroAction {
this.assertMacroActionType(jsObject);
this.text = jsObject.text;
return this;
}
_fromBinary(buffer: UhkBuffer): TextMacroAction {
this.readAndAssertMacroActionId(buffer);
this.text = buffer.readString();
return this;
}
_toJsObject(): any {
return {
macroActionType: macroActionType.TextMacroAction,
text: this.text
};
}
_toBinary(buffer: UhkBuffer) {
buffer.writeUInt8(MacroActionId.TextMacroAction);
buffer.writeString(this.text);
}
toString(): string {
return `<TextMacroAction text="${this.text}">`;
}
}