Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
plugins: Update schema type
Browse files Browse the repository at this point in the history
  • Loading branch information
elisee committed Jan 13, 2016
1 parent 7ac686a commit ca8cfec
Show file tree
Hide file tree
Showing 40 changed files with 45 additions and 47 deletions.
2 changes: 1 addition & 1 deletion plugins/common
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ConfigPub {

export default class ArcadeBody2DConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
type: { type: "enum", items: ["box", "tileMap"], mutable: true },

// Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface CubicModelRendererConfigPub {

export default class CubicModelRendererConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
cubicModelAssetId: { type: "string?", min: 0, mutable: true },
// animationId: { type: "string?", min: 0, mutable: true },
// horizontalFlip: { type: "boolean", mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/cubicModel/data/CubicModelAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface TextureEdit {

export default class CubicModelAsset extends SupCore.Data.Base.Asset {

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
pixelsPerUnit: { type: "integer", min: 1, mutable: true },
nodes: { type: "array" },

Expand Down
2 changes: 1 addition & 1 deletion plugins/default/cubicModel/data/CubicModelNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function getShapeTextureFaceSize(shape: Shape, faceName: string) {

export default class CubicModelNodes extends SupCore.Data.Base.TreeById {

static schema = {
static schema: SupCore.Data.Schema = {
name: { type: "string", minLength: 1, maxLength: 80, mutable: true },
children: { type: "array" },

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class CubicModelSettingsResource extends SupCore.Data.Base.Resource {

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
pixelsPerUnit: { type: "integer", min: 1, mutable: true }
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class TextRendererConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
fontAssetId: { type: "string?", min: 0, mutable: true },
text: { type: "string", min: 0, mutable: true },
alignment: { type: "enum", items: [ "left", "center", "right" ], mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/font/data/FontAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface FontPub {
export default class FontAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

isBitmap: { type: "boolean", mutable: true},
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/gameSettings/data/GameSettingsResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface GameSettingsResourcePub {
export default class GameSettingsResource extends SupCore.Data.Base.Resource {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

startupSceneId: { type: "string?", mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/light/componentConfigs/LightConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface LightConfigPub {

export default class LightConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
type: { type: "enum", items: ["ambient", "point", "spot", "directional"], mutable: true },
color: { type: "string", length: 6, mutable: true },
intensity: { type: "number", min: 0, mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/light/data/LightSettingsResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from "fs";

export default class LightSettingsResource extends SupCore.Data.Base.Resource {

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
shadowMapType: { type: "enum", items: [ "basic", "pcf", "pcfSoft" ], mutable: true },
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ModelRendererConfigPub {

export default class ModelRendererConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
modelAssetId: { type: "string?", min: 0, mutable: true },
animationId: { type: "string?", min: 0, mutable: true },
castShadow: { type: "boolean", mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/model/data/ModelAnimations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class ModelAnimations extends SupCore.Data.Base.ListById {

static schema = {
static schema: SupCore.Data.Schema = {
name: { type: "string", minLength: 1, maxLength: 80, mutable: true },
duration: { type: "number" }, // seconds
keyFrames: {
Expand Down
6 changes: 3 additions & 3 deletions plugins/default/model/data/ModelAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface ModelAssetPub {
export default class ModelAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 2;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

unitRatio: { type: "number", minExcluded: 0, mutable: true },
Expand Down Expand Up @@ -583,10 +583,10 @@ export default class ModelAsset extends SupCore.Data.Base.Asset {
}

server_setAnimation(client: any, id: string, duration: number, keyFrames: any, callback: (err: string, id?: string, duration?: number, keyFrames?: any) => any) {
let violation = SupCore.Data.Base.getRuleViolation(duration, ModelAnimations.schema.duration, true);
let violation = SupCore.Data.Base.getRuleViolation(duration, ModelAnimations.schema["duration"], true);
if (violation != null) { callback(`Invalid duration: ${SupCore.Data.Base.formatRuleViolation(violation)}`); return; }

violation = SupCore.Data.Base.getRuleViolation(keyFrames, ModelAnimations.schema.keyFrames, true);
violation = SupCore.Data.Base.getRuleViolation(keyFrames, ModelAnimations.schema["keyFrames"], true);
if (violation != null) { callback(`Invalid duration: ${SupCore.Data.Base.formatRuleViolation(violation)}`); return; }

let animation = this.animations.byId[id];
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/scene/ComponentConfig.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare namespace SupCore {

namespace Base {
class ComponentConfig extends Hash {
constructor(pub: any, schema: any);
constructor(pub: any, schema: SupCore.Data.Schema);

// OVERRIDE: Called when loading a scene
// Check for any error/warning/info and this.emit("setBadge", ...) as required
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ComponentConfig extends SupCore.Data.Base.Hash {
constructor(pub: any, schema: any) {
constructor(pub: any, schema: SupCore.Data.Schema) {
super(pub, schema);
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/default/scene/componentConfigs/CameraConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class CameraConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
mode: { type: "enum", items: [ "perspective", "orthographic" ], mutable: true },
fov: { type: "number", min: 0.1, max: 179.9, mutable: true },
orthographicScale: { type: "number", min: 0.1, mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/scene/data/SceneAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface ScenePub {
export default class SceneAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
nodes: { type: "array" },
};

Expand Down
2 changes: 1 addition & 1 deletion plugins/default/scene/data/SceneComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Component {

export default class SceneComponents extends SupCore.Data.Base.ListById {

static schema = {
static schema: SupCore.Data.Schema = {
type: { type: "string" },
config: { type: "any" },
};
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/scene/data/SceneNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Node extends SupCore.Data.Base.TreeNode {

export default class SceneNodes extends SupCore.Data.Base.TreeById {

static schema = {
static schema: SupCore.Data.Schema = {
name: { type: "string", minLength: 1, maxLength: 80, mutable: true },
children: { type: "array" },

Expand Down
2 changes: 1 addition & 1 deletion plugins/default/scene/data/SceneSettingsResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface SceneSettingsResourcePub {
export default class SceneSettingsResource extends SupCore.Data.Base.Resource {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

defaultCameraMode: { type: "enum", items: [ "3D", "2D" ], mutable: true },
Expand Down
5 changes: 2 additions & 3 deletions plugins/default/shader/data/Attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ export interface AttributePub {
}

export default class Attributes extends SupCore.Data.Base.ListById {

static schema = {
static schema: SupCore.Data.Schema = {
name: { type: "string", minLength: 1, maxLength: 80, mutable: true },
type: { type: "enum", items: ["f", "c", "v2", "v3", "v4"], mutable: true }
};

pub: AttributePub[];
byId: { [id: string]: AttributePub};
byId: { [id: string]: AttributePub };

constructor(pub: any) {
super(pub, Attributes.schema);
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/shader/data/ShaderAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface ShaderAssetPub {
export default class ShaderAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

uniforms: { type: "array" },
Expand Down
5 changes: 2 additions & 3 deletions plugins/default/shader/data/Uniforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ export interface UniformPub {
}

export default class Uniforms extends SupCore.Data.Base.ListById {

static schema = {
static schema: SupCore.Data.Schema = {
name: { type: "string", minLength: 1, maxLength: 80, mutable: true },
type: { type: "enum", items: ["f", "c", "v2", "v3", "v4", "t"], mutable: true },
value: { type: "any", mutable: true }
};

pub: UniformPub[];
byId: { [id: string]: UniformPub};
byId: { [id: string]: UniformPub };

constructor(pub: any) {
super(pub, Uniforms.schema);
Expand Down
4 changes: 2 additions & 2 deletions plugins/default/shader/editors/shader/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function setupUniform(uniform: UniformPub) {

let typeElt = document.createElement("td");
let selectTypeElt = document.createElement("select");
for (let type of Uniforms.schema.type.items) {
for (let type of Uniforms.schema["type"].items as string[]) {
let optionElt = document.createElement("option");
optionElt.textContent = type;
selectTypeElt.appendChild(optionElt);
Expand Down Expand Up @@ -151,7 +151,7 @@ export function setupAttribute(attribute: AttributePub) {

let typeElt = document.createElement("td");
let selectTypeElt = document.createElement("select");
for (let type of Attributes.schema.type.items) {
for (let type of Attributes.schema["type"].items as string[]) {
let optionElt = document.createElement("option");
optionElt.textContent = type;
selectTypeElt.appendChild(optionElt);
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/sound/data/SoundAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface SoundAssetPub {
export default class SoundAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

sound: { type: "buffer" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface SpriteRendererConfigPub {

export default class SpriteRendererConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
spriteAssetId: { type: "string?", min: 0, mutable: true },
animationId: { type: "string?", min: 0, mutable: true },
horizontalFlip: { type: "boolean", mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/sprite/data/SpriteAnimations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface SpriteAnimationPub {

export default class SpriteAnimations extends SupCore.Data.Base.ListById {

static schema = {
static schema: SupCore.Data.Schema = {
name: { type: "string", minLength: 1, maxLength: 80, mutable: true },
startFrameIndex: { type: "number", min: 0, mutable: true },
endFrameIndex: { type: "number", min: 0, mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/sprite/data/SpriteAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface SpriteAssetPub {
export default class SpriteAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 3;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

maps: {
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/sprite/data/SpriteSettingsResource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class SpriteSettingsResource extends SupCore.Data.Base.Resource {

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
filtering: { type: "enum", items: [ "pixelated", "smooth" ], mutable: true },
pixelsPerUnit: { type: "number", minExcluded: 0, mutable: true },
framesPerSecond: { type: "number", minExcluded: 0, mutable: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface TileMapRendererConfigPub {

export default class TileMapRendererConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
tileMapAssetId: { type: "string?", min: 0, mutable: true },
tileSetAssetId: { type: "string?", min: 0, mutable: true },
castShadow: { type: "boolean", mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/tileMap/data/TileMapAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface TileMapAssetPub {
export default class TileMapAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

tileSetId: { type: "string?" },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/tileMap/data/TileMapLayers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface TileMapLayerPub {

export default class TileMapLayers extends SupCore.Data.Base.ListById {

static schema = {
static schema: SupCore.Data.Schema = {
name: { type: "string", minLength: 1, maxLength: 80, mutable: true },
data: { type: "array" }
};
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/tileMap/data/TileMapSettingsResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface TileMapSettingsResourcePub {
export default class TileMapSettingsResource extends SupCore.Data.Base.Resource {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

pixelsPerUnit: { type: "integer", minExcluded: 0, mutable: true },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/tileMap/data/TileSetAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface TileSetAssetPub {
export default class TileSetAsset extends SupCore.Data.Base.Asset {
static currentFormatVersion = 1;

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
formatVersion: { type: "integer" },

image: { type: "buffer" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Pub {

export default class BehaviorConfig extends SupCore.Data.Base.ComponentConfig {

static schema = {
static schema: SupCore.Data.Schema = {
behaviorName: { type: "string", mutable: true },
propertyValues: {
type: "hash",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface BehaviorPropertiesResourcePub {

export default class BehaviorPropertiesResource extends SupCore.Data.Base.Resource {

static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
behaviors: {
type: "hash",
keys: { minLength: 1 },
Expand Down
2 changes: 1 addition & 1 deletion plugins/default/typescript/data/ScriptAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface ScriptAssetPub {
}

export default class ScriptAsset extends SupCore.Data.Base.Asset {
static schema: SupCore.Data.Base.Schema = {
static schema: SupCore.Data.Schema = {
text: { type: "string" },
draft: { type: "string" },
revisionId: { type: "integer" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default class CannonBodyConfig extends SupCore.Data.Base.ComponentConfig {
static schema = {
static schema: SupCore.Data.Schema = {
mass: { type: "number", min: 0, mutable: true },
fixedRotation: { type: "boolean", mutable: true },
offset: {
Expand Down
2 changes: 1 addition & 1 deletion plugins/extra/p2js/componentConfigs/P2BodyConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default class P2BodyConfig extends SupCore.Data.Base.ComponentConfig {
static schema = {
static schema: SupCore.Data.Schema = {
mass: { type: "number", min: 0, mutable: true },
fixedRotation: { type: "boolean", mutable: true },
offsetX: { type: "number", mutable: true },
Expand Down

0 comments on commit ca8cfec

Please sign in to comment.