Fix .gitignore

This commit is contained in:
Bill 2021-12-23 12:11:37 -05:00
parent cb3e27071e
commit cca7ac6a26
5 changed files with 174 additions and 1 deletions

2
.gitignore vendored
View File

@ -51,7 +51,7 @@ Thumbs.db
*.as *.as
*.bin *.bin
.env .env
assets/ /assets
# Nitro # Nitro
/src/configuration.json /src/configuration.json

View File

@ -0,0 +1,61 @@
export class AssetXML
{
private readonly _name: string;
private readonly _source: string;
private readonly _x: number;
private readonly _y: number;
private readonly _flipH: boolean;
private readonly _flipV: boolean;
private readonly _usesPalette: boolean;
constructor(asset: any)
{
const attributes = asset.$;
if(attributes !== undefined)
{
if(attributes.name !== undefined) this._name = attributes.name;
if(attributes.source !== undefined) this._source = attributes.source;
if(attributes.x !== undefined) this._x = parseInt(attributes.x);
if(attributes.x !== undefined) this._y = parseInt(attributes.y);
if(attributes.flipH !== undefined) this._flipH = (attributes.flipH === '1');
if(attributes.flipV !== undefined) this._flipV = (attributes.flipV === '1');
if(attributes.usesPalette !== undefined) this._usesPalette = (attributes.usesPalette === '1');
}
}
public get name(): string
{
return this._name;
}
public get source(): string
{
return this._source;
}
public get x(): number
{
return this._x;
}
public get y(): number
{
return this._y;
}
public get flipH(): boolean
{
return this._flipH;
}
public get flipV(): boolean
{
return this._flipV;
}
public get usesPalette(): boolean
{
return this._usesPalette;
}
}

View File

@ -0,0 +1,41 @@
import { AssetXML } from './AssetXML';
import { PaletteXML } from './PaletteXML';
export class AssetsXML
{
private readonly _assets: AssetXML[];
private readonly _palettes: PaletteXML[];
constructor(xml: any)
{
if(xml.asset !== undefined)
{
if(Array.isArray(xml.asset))
{
this._assets = [];
for(const asset of xml.asset) this._assets.push(new AssetXML(asset));
}
}
if(xml.palette !== undefined)
{
if(Array.isArray(xml.palette))
{
this._palettes = [];
for(const palette of xml.palette) this._palettes.push(new PaletteXML(palette));
}
}
}
public get assets(): AssetXML[]
{
return this._assets;
}
public get palettes(): PaletteXML[]
{
return this._palettes;
}
}

View File

@ -0,0 +1,68 @@
export class PaletteXML
{
private readonly _id: number;
private readonly _source: string;
private readonly _master: boolean;
private readonly _tags: string[];
private readonly _breed: number;
private readonly _colorTag: number;
private readonly _color1: string;
private readonly _color2: string;
constructor(xml: any)
{
const attributes = xml.$;
if(attributes)
{
if(attributes.id !== undefined) this._id = parseInt(attributes.id);
if(attributes.source !== undefined) this._source = attributes.source;
if(attributes.master !== undefined) this._master = (attributes.master === 'true') ? true : false;
if(attributes.tags !== undefined) this._tags = attributes.tags.split(',');
if(attributes.breed !== undefined) this._breed = parseInt(attributes.breed);
if(attributes.colortag !== undefined) this._colorTag = parseInt(attributes.colortag);
if(attributes.color1 !== undefined) this._color1 = attributes.color1;
if(attributes.color2 !== undefined) this._color2 = attributes.color2;
}
}
public get id(): number
{
return this._id;
}
public get source(): string
{
return this._source;
}
public get master(): boolean
{
return this._master;
}
public get tags(): string[]
{
return this._tags;
}
public get breed(): number
{
return this._breed;
}
public get colorTag(): number
{
return this._colorTag;
}
public get color1(): string
{
return this._color1;
}
public get color2(): string
{
return this._color2;
}
}

View File

@ -0,0 +1,3 @@
export * from './AssetsXML';
export * from './AssetXML';
export * from './PaletteXML';