Add SwitchLayerAction.
This commit is contained in:
@@ -1,41 +1,41 @@
|
|||||||
class SwitchKeymapAction extends KeyAction implements Serializable<SwitchKeymapAction> {
|
class SwitchLayerAction extends KeyAction implements Serializable<SwitchLayerAction> {
|
||||||
|
|
||||||
static keyActionTypeString = 'switchKeymap';
|
static keyActionTypeString = 'switchLayer';
|
||||||
|
|
||||||
private _keymapId: number;
|
private _layer: number;
|
||||||
|
|
||||||
get keymapId(): number {
|
get layer(): number {
|
||||||
return this._keymapId;
|
return this._layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
set keymapId(value) {
|
set layer(value) {
|
||||||
if (!TypeChecker.isUInt8Valid(value)) {
|
if (!TypeChecker.isUInt8Valid(value)) {
|
||||||
throw 'Invalid SwitchKeymapAction.keymapId: ${value}';
|
throw 'Invalid SwitchLayerAction.layerId: ${value}';
|
||||||
}
|
}
|
||||||
this._keymapId = value;
|
this._layer = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
fromJsObject(jsObject: any): SwitchKeymapAction {
|
fromJsObject(jsObject: any): SwitchLayerAction {
|
||||||
this.assertKeyActionType(jsObject, SwitchKeymapAction.keyActionTypeString, 'SwitchKeymapAction');
|
this.assertKeyActionType(jsObject, SwitchLayerAction.keyActionTypeString, 'SwitchLayerAction');
|
||||||
this.keymapId = jsObject.keymapId;
|
this.layer = jsObject.keymapId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
fromBinary(buffer: UhkBuffer): SwitchKeymapAction {
|
fromBinary(buffer: UhkBuffer): SwitchLayerAction {
|
||||||
this.readAndAssertKeyActionId(buffer, KeyActionId.SwitchKeymapAction, 'SwitchKeymapAction');
|
this.readAndAssertKeyActionId(buffer, KeyActionId.SwitchLayerAction, 'SwitchLayerAction');
|
||||||
this.keymapId = buffer.readUInt8();
|
this.layer = buffer.readUInt8();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
toJsObject(): any {
|
toJsObject(): any {
|
||||||
return {
|
return {
|
||||||
keyActionType: SwitchKeymapAction.keyActionTypeString,
|
keyActionType: SwitchLayerAction.keyActionTypeString,
|
||||||
keymapId: this.keymapId
|
layer: this.layer
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
toBinary(buffer: UhkBuffer) {
|
toBinary(buffer: UhkBuffer) {
|
||||||
buffer.writeUInt8(KeyActionId.SwitchKeymapAction);
|
buffer.writeUInt8(KeyActionId.SwitchLayerAction);
|
||||||
buffer.writeUInt8(this.keymapId);
|
buffer.writeUInt8(this.layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
41
config-serializer/config-items/SwitchLayerAction.ts
Normal file
41
config-serializer/config-items/SwitchLayerAction.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
class SwitchKeymapAction extends KeyAction implements Serializable<SwitchKeymapAction> {
|
||||||
|
|
||||||
|
static keyActionTypeString = 'switchKeymap';
|
||||||
|
|
||||||
|
private _keymapId: number;
|
||||||
|
|
||||||
|
get keymapId(): number {
|
||||||
|
return this._keymapId;
|
||||||
|
}
|
||||||
|
|
||||||
|
set keymapId(value) {
|
||||||
|
if (!TypeChecker.isUInt8Valid(value)) {
|
||||||
|
throw 'Invalid SwitchKeymapAction.keymapId: ${value}';
|
||||||
|
}
|
||||||
|
this._keymapId = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
fromJsObject(jsObject: any): SwitchKeymapAction {
|
||||||
|
this.assertKeyActionType(jsObject, SwitchKeymapAction.keyActionTypeString, 'SwitchKeymapAction');
|
||||||
|
this.keymapId = jsObject.keymapId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
fromBinary(buffer: UhkBuffer): SwitchKeymapAction {
|
||||||
|
this.readAndAssertKeyActionId(buffer, KeyActionId.SwitchKeymapAction, 'SwitchKeymapAction');
|
||||||
|
this.keymapId = buffer.readUInt8();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
toJsObject(): any {
|
||||||
|
return {
|
||||||
|
keyActionType: SwitchKeymapAction.keyActionTypeString,
|
||||||
|
keymapId: this.keymapId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
toBinary(buffer: UhkBuffer) {
|
||||||
|
buffer.writeUInt8(KeyActionId.SwitchKeymapAction);
|
||||||
|
buffer.writeUInt8(this.keymapId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,5 +4,6 @@
|
|||||||
/// <reference path="DualRoleKeystrokeAction.ts" />
|
/// <reference path="DualRoleKeystrokeAction.ts" />
|
||||||
/// <reference path="MouseAction.ts" />
|
/// <reference path="MouseAction.ts" />
|
||||||
/// <reference path="PlayMacroAction.ts" />
|
/// <reference path="PlayMacroAction.ts" />
|
||||||
|
/// <reference path="SwitchLayerAction.ts" />
|
||||||
/// <reference path="SwitchKeymapAction.ts" />
|
/// <reference path="SwitchKeymapAction.ts" />
|
||||||
/// <reference path="NoneAction.ts" />
|
/// <reference path="NoneAction.ts" />
|
||||||
|
|||||||
Reference in New Issue
Block a user