mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2024-11-22 15:40:52 +01:00
Add stuff skelly missed
This commit is contained in:
parent
3127b33eb5
commit
e6a7f3dde5
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -6,6 +6,7 @@
|
|||||||
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
|
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": true,
|
"source.fixAll": true,
|
||||||
|
"source.fixAll.sortJSON": false,
|
||||||
"source.organizeImports": true,
|
"source.organizeImports": true,
|
||||||
},
|
},
|
||||||
"emmet.showExpandedAbbreviation": "never",
|
"emmet.showExpandedAbbreviation": "never",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
export interface IFigureDataColor
|
export interface IFigureDataColor
|
||||||
{
|
{
|
||||||
id?: number;
|
id?: number;
|
||||||
index?: number;
|
index?: number;
|
||||||
club?: number;
|
club?: number;
|
||||||
selectable?: boolean;
|
selectable?: boolean;
|
||||||
hexCode?: string;
|
hexCode?: string;
|
||||||
}
|
}
|
||||||
|
4
src/mapping/json/figuredata/IFigureDataHiddenLayer.ts
Normal file
4
src/mapping/json/figuredata/IFigureDataHiddenLayer.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export interface IFigureDataHiddenLayer
|
||||||
|
{
|
||||||
|
partType?: string;
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
export interface IFigureDataPart
|
export interface IFigureDataPart
|
||||||
{
|
{
|
||||||
id?: number;
|
id?: number;
|
||||||
type?: string;
|
type?: string;
|
||||||
colorable?: boolean;
|
colorable?: boolean;
|
||||||
index?: number;
|
index?: number;
|
||||||
colorindex?: number;
|
colorindex?: number;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
|
import { IFigureDataHiddenLayer } from './IFigureDataHiddenLayer';
|
||||||
import { IFigureDataPart } from './IFigureDataPart';
|
import { IFigureDataPart } from './IFigureDataPart';
|
||||||
|
|
||||||
export interface IFigureDataSet
|
export interface IFigureDataSet
|
||||||
{
|
{
|
||||||
id?: number;
|
id?: number;
|
||||||
gender?: string;
|
gender?: string;
|
||||||
club?: boolean;
|
club?: number;
|
||||||
colorable?: boolean;
|
colorable?: boolean;
|
||||||
selectable?: boolean;
|
selectable?: boolean;
|
||||||
preselectable?: boolean;
|
preselectable?: boolean;
|
||||||
parts?: IFigureDataPart[];
|
sellable?: boolean;
|
||||||
|
parts?: IFigureDataPart[];
|
||||||
|
hiddenLayers?: IFigureDataHiddenLayer[];
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@ import { IFigureDataSet } from './IFigureDataSet';
|
|||||||
|
|
||||||
export interface IFigureDataSetType
|
export interface IFigureDataSetType
|
||||||
{
|
{
|
||||||
type?: string;
|
type?: string;
|
||||||
paletteId?: number;
|
paletteId?: number;
|
||||||
mandatory_m_0?: boolean;
|
mandatory_m_0?: boolean;
|
||||||
mandatory_f_0?: boolean;
|
mandatory_f_0?: boolean;
|
||||||
mandatory_m_1?: boolean;
|
mandatory_m_1?: boolean;
|
||||||
mandatory_f_1?: boolean;
|
mandatory_f_1?: boolean;
|
||||||
sets?: IFigureDataSet[];
|
sets?: IFigureDataSet[];
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export * from './IFigureData';
|
export * from './IFigureData';
|
||||||
export * from './IFigureDataColor';
|
export * from './IFigureDataColor';
|
||||||
|
export * from './IFigureDataHiddenLayer';
|
||||||
export * from './IFigureDataPalette';
|
export * from './IFigureDataPalette';
|
||||||
export * from './IFigureDataPart';
|
export * from './IFigureDataPart';
|
||||||
export * from './IFigureDataSet';
|
export * from './IFigureDataSet';
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
import { IFigureDataHiddenLayer } from '../json';
|
||||||
import { IFigureDataPalette } from '../json/figuredata/IFigureDataPalette';
|
import { IFigureDataPalette } from '../json/figuredata/IFigureDataPalette';
|
||||||
import { IFigureDataSet } from '../json/figuredata/IFigureDataSet';
|
import { IFigureDataSet } from '../json/figuredata/IFigureDataSet';
|
||||||
|
import { FigureDataHiddenLayerXML } from '../xml';
|
||||||
import { FigureDataColorXML } from '../xml/figuredata/FigureDataColorXML';
|
import { FigureDataColorXML } from '../xml/figuredata/FigureDataColorXML';
|
||||||
import { FigureDataPaletteXML } from '../xml/figuredata/FigureDataPaletteXML';
|
import { FigureDataPaletteXML } from '../xml/figuredata/FigureDataPaletteXML';
|
||||||
import { FigureDataXML } from '../xml/figuredata/FigureDataXML';
|
import { FigureDataXML } from '../xml/figuredata/FigureDataXML';
|
||||||
@ -131,6 +133,7 @@ export class FigureDataMapper extends Mapper
|
|||||||
if(setXML.colorable !== undefined) setType.colorable = setXML.colorable;
|
if(setXML.colorable !== undefined) setType.colorable = setXML.colorable;
|
||||||
if(setXML.selectable !== undefined) setType.selectable = setXML.selectable;
|
if(setXML.selectable !== undefined) setType.selectable = setXML.selectable;
|
||||||
if(setXML.preselectable !== undefined) setType.preselectable = setXML.preselectable;
|
if(setXML.preselectable !== undefined) setType.preselectable = setXML.preselectable;
|
||||||
|
if(setXML.sellable !== undefined) setType.sellable = setXML.sellable;
|
||||||
|
|
||||||
if(setXML.parts !== undefined)
|
if(setXML.parts !== undefined)
|
||||||
{
|
{
|
||||||
@ -142,6 +145,16 @@ export class FigureDataMapper extends Mapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(setXML.hiddenLayers !== undefined)
|
||||||
|
{
|
||||||
|
if(setXML.hiddenLayers.length)
|
||||||
|
{
|
||||||
|
setType.hiddenLayers = [];
|
||||||
|
|
||||||
|
FigureDataMapper.mapFigureDataHiddenLayers(setXML.hiddenLayers, setType.hiddenLayers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
output.push(setType);
|
output.push(setType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,4 +176,18 @@ export class FigureDataMapper extends Mapper
|
|||||||
output.push(part);
|
output.push(part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static mapFigureDataHiddenLayers(xml: FigureDataHiddenLayerXML[], output: IFigureDataHiddenLayer[]): void
|
||||||
|
{
|
||||||
|
if(!xml || !xml.length || !output) return;
|
||||||
|
|
||||||
|
for(const hiddenLayerXML of xml)
|
||||||
|
{
|
||||||
|
const hiddenLayer: IFigureDataHiddenLayer = {};
|
||||||
|
|
||||||
|
if(hiddenLayerXML.partType !== undefined) hiddenLayer.partType = hiddenLayerXML.partType;
|
||||||
|
|
||||||
|
output.push(hiddenLayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
16
src/mapping/xml/figuredata/FigureDataHiddenLayerXML.ts
Normal file
16
src/mapping/xml/figuredata/FigureDataHiddenLayerXML.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
export class FigureDataHiddenLayerXML
|
||||||
|
{
|
||||||
|
private _partType: string;
|
||||||
|
|
||||||
|
constructor(xml: any)
|
||||||
|
{
|
||||||
|
const attributes = xml.$;
|
||||||
|
|
||||||
|
this._partType = ((attributes && attributes.parttype) || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
public get partType(): string
|
||||||
|
{
|
||||||
|
return this._partType;
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,17 @@
|
|||||||
|
import { FigureDataHiddenLayerXML } from './FigureDataHiddenLayerXML';
|
||||||
import { FigureDataPartXML } from './FigureDataPartXML';
|
import { FigureDataPartXML } from './FigureDataPartXML';
|
||||||
|
|
||||||
export class FigureDataSetXML
|
export class FigureDataSetXML
|
||||||
{
|
{
|
||||||
private _id: number;
|
private _id: number;
|
||||||
private _gender: string;
|
private _gender: string;
|
||||||
private _club: boolean;
|
private _club: number;
|
||||||
private _colorable: boolean;
|
private _colorable: boolean;
|
||||||
private _selectable: boolean;
|
private _selectable: boolean;
|
||||||
private _preselectable: boolean;
|
private _preselectable: boolean;
|
||||||
|
private _sellable: boolean;
|
||||||
private _parts: FigureDataPartXML[];
|
private _parts: FigureDataPartXML[];
|
||||||
|
private _hiddenLayers: FigureDataHiddenLayerXML[];
|
||||||
|
|
||||||
constructor(xml: any)
|
constructor(xml: any)
|
||||||
{
|
{
|
||||||
@ -16,10 +19,11 @@ export class FigureDataSetXML
|
|||||||
|
|
||||||
this._id = ((attributes && parseInt(attributes.id)) || 0);
|
this._id = ((attributes && parseInt(attributes.id)) || 0);
|
||||||
this._gender = ((attributes && attributes.gender) || '');
|
this._gender = ((attributes && attributes.gender) || '');
|
||||||
this._club = ((attributes && parseInt(attributes.club) === 1) || false);
|
this._club = ((attributes && parseInt(attributes.club)) || 0);
|
||||||
this._colorable = ((attributes && parseInt(attributes.colorable) === 1) || false);
|
this._colorable = ((attributes && parseInt(attributes.colorable) === 1) || false);
|
||||||
this._selectable = ((attributes && parseInt(attributes.selectable) === 1) || false);
|
this._selectable = ((attributes && parseInt(attributes.selectable) === 1) || false);
|
||||||
this._preselectable = ((attributes && parseInt(attributes.preselectable) === 1) || false);
|
this._preselectable = ((attributes && parseInt(attributes.preselectable) === 1) || false);
|
||||||
|
this._sellable = ((attributes && parseInt(attributes.sellable) === 1) || false);
|
||||||
|
|
||||||
if(xml.part !== undefined)
|
if(xml.part !== undefined)
|
||||||
{
|
{
|
||||||
@ -35,6 +39,21 @@ export class FigureDataSetXML
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xml.hiddenlayers !== undefined)
|
||||||
|
{
|
||||||
|
this._hiddenLayers = [];
|
||||||
|
|
||||||
|
for(const hiddenLayer of xml.hiddenlayers)
|
||||||
|
{
|
||||||
|
const layers = hiddenLayer.layer;
|
||||||
|
|
||||||
|
if(layers !== undefined)
|
||||||
|
{
|
||||||
|
if(Array.isArray(layers)) for(const layer of layers) this._hiddenLayers.push(new FigureDataHiddenLayerXML(layer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get id(): number
|
public get id(): number
|
||||||
@ -47,7 +66,7 @@ export class FigureDataSetXML
|
|||||||
return this._gender;
|
return this._gender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get club(): boolean
|
public get club(): number
|
||||||
{
|
{
|
||||||
return this._club;
|
return this._club;
|
||||||
}
|
}
|
||||||
@ -67,8 +86,18 @@ export class FigureDataSetXML
|
|||||||
return this._preselectable;
|
return this._preselectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get sellable(): boolean
|
||||||
|
{
|
||||||
|
return this._sellable;
|
||||||
|
}
|
||||||
|
|
||||||
public get parts(): FigureDataPartXML[]
|
public get parts(): FigureDataPartXML[]
|
||||||
{
|
{
|
||||||
return this._parts;
|
return this._parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get hiddenLayers(): FigureDataHiddenLayerXML[]
|
||||||
|
{
|
||||||
|
return this._hiddenLayers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export * from './FigureDataColorXML';
|
export * from './FigureDataColorXML';
|
||||||
|
export * from './FigureDataHiddenLayerXML';
|
||||||
export * from './FigureDataPaletteXML';
|
export * from './FigureDataPaletteXML';
|
||||||
export * from './FigureDataPartXML';
|
export * from './FigureDataPartXML';
|
||||||
export * from './FigureDataSetTypeXML';
|
export * from './FigureDataSetTypeXML';
|
||||||
|
Loading…
Reference in New Issue
Block a user