Files
agent/config-serializer/config-items/PlayMacroAction.ts
Sam Rang 6e218387fc changing how assertions access instance variables to make them non-static-like (#37)
Changing how assertions access instance variables
2016-05-09 19:17:54 +02:00

38 lines
959 B
TypeScript

import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
import {UhkBuffer} from '../UhkBuffer';
import {assertUInt8} from '../assert';
export class PlayMacroAction extends KeyAction {
@assertUInt8
macroId: number;
_fromJsObject(jsObject: any): PlayMacroAction {
this.assertKeyActionType(jsObject);
this.macroId = jsObject.macroId;
return this;
}
_fromBinary(buffer: UhkBuffer): PlayMacroAction {
this.readAndAssertKeyActionId(buffer);
this.macroId = buffer.readUInt8();
return this;
}
_toJsObject(): any {
return {
keyActionType: keyActionType.PlayMacroAction,
macroId: this.macroId
};
}
_toBinary(buffer: UhkBuffer) {
buffer.writeUInt8(KeyActionId.PlayMacroAction);
buffer.writeUInt8(this.macroId);
}
toString(): string {
return `<PlayMacroAction macroId="${this.macroId}">`;
}
}