@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
47 lines (42 loc) • 920 B
JavaScript
import AssetLevel from "./AssetLevel.js";
/**
* Definition of a single asset to be loaded
*/
export class AssetLoadSpec {
/**
* Path to the asset
* @type {String}
*/
uri = null;
/**
* Type of the asset
* @type {String}
*/
type = null;
/**
*
* @type {number|AssetLevel}
*/
level = AssetLevel.OPTIONAL;
/**
* Priority within the level group (see {@link level})
* @type {number}
*/
priority = 0;
fromJSON({ uri, type, level = AssetLevel.OPTIONAL, priority = 0 }) {
this.uri = uri;
this.type = type;
this.level = level;
this.priority = priority;
}
/**
*
* @param data
* @return {AssetLoadSpec}
*/
static fromJSON(data) {
const r = new AssetLoadSpec();
r.fromJSON(data);
return r;
}
}