Keymap data layer (#95)

This commit is contained in:
Nejc Zdovc
2016-09-18 12:38:42 +02:00
committed by József Farkas
parent fb8cd163ec
commit b78bc5850f
40 changed files with 748 additions and 195 deletions

View File

@@ -5,9 +5,6 @@ import { Layers } from './Layers';
export class Keymap extends Serializable<Keymap> {
@assertUInt8
id: number;
name: string;
description: string;
@@ -23,7 +20,7 @@ export class Keymap extends Serializable<Keymap> {
if (!keymap) {
return;
}
this.id = keymap.id;
this.name = keymap.name;
this.description = keymap.description;
this.abbreviation = keymap.abbreviation;
@@ -32,7 +29,6 @@ export class Keymap extends Serializable<Keymap> {
}
_fromJsObject(jsObject: any): Keymap {
this.id = jsObject.id;
this.isDefault = jsObject.isDefault;
this.abbreviation = jsObject.abbreviation;
this.name = jsObject.name;
@@ -42,7 +38,6 @@ export class Keymap extends Serializable<Keymap> {
}
_fromBinary(buffer: UhkBuffer): Keymap {
this.id = buffer.readUInt8();
this.isDefault = buffer.readBoolean();
this.abbreviation = buffer.readString();
this.name = buffer.readString();
@@ -53,7 +48,6 @@ export class Keymap extends Serializable<Keymap> {
_toJsObject(): any {
return {
id: this.id,
isDefault: this.isDefault,
abbreviation: this.abbreviation,
name: this.name,
@@ -63,7 +57,6 @@ export class Keymap extends Serializable<Keymap> {
}
_toBinary(buffer: UhkBuffer): void {
buffer.writeUInt8(this.id);
buffer.writeBoolean(this.isDefault);
buffer.writeString(this.abbreviation);
buffer.writeString(this.name);
@@ -72,6 +65,6 @@ export class Keymap extends Serializable<Keymap> {
}
toString(): string {
return `<Keymap id="${this.id}" name="${this.name}">`;
return `<Keymap abbreviation="${this.abbreviation}" name="${this.name}">`;
}
}