mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2024-11-27 01:40:52 +01:00
More updates
This commit is contained in:
parent
b116ebd029
commit
e2cad3b9fe
@ -0,0 +1,8 @@
|
||||
import { IAssetPlaneVisualization } from './IAssetPlaneVisualization';
|
||||
|
||||
export interface IAssetPlane
|
||||
{
|
||||
id?: string;
|
||||
visualizations?: IAssetPlaneVisualization[];
|
||||
animatedVisualization?: IAssetPlaneVisualization[];
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import { IAssetPlaneMaskVisualization } from './IAssetPlaneMaskVisualization';
|
||||
|
||||
export interface IAssetPlaneMask
|
||||
{
|
||||
id?: string;
|
||||
visualizations?: IAssetPlaneMaskVisualization[];
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
import { IAssetPlaneMask } from './IAssetPlaneMask';
|
||||
|
||||
export interface IAssetPlaneMaskData
|
||||
{
|
||||
masks?: IAssetPlaneMask[];
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import { IAssetPlaneTextureBitmap } from './IAssetPlaneTextureBitmap';
|
||||
|
||||
export interface IAssetPlaneMaskVisualization
|
||||
{
|
||||
size?: number;
|
||||
bitmaps?: IAssetPlaneTextureBitmap[];
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import { IAssetPlaneMaterialCellMatrix } from './IAssetPlaneMaterialCellMatrix';
|
||||
|
||||
export interface IAssetPlaneMaterial
|
||||
{
|
||||
id?: string;
|
||||
matrices?: IAssetPlaneMaterialCellMatrix[];
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import { IAssetPlaneMaterialCellExtraItemData } from './IAssetPlaneMaterialCellExtraItemData';
|
||||
|
||||
export interface IAssetPlaneMaterialCell
|
||||
{
|
||||
textureId?: string;
|
||||
extraData?: IAssetPlaneMaterialCellExtraItemData;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import { IAssetPlaneMaterialCell } from './IAssetPlaneMaterialCell';
|
||||
|
||||
export interface IAssetPlaneMaterialCellColumn
|
||||
{
|
||||
repeatMode?: string;
|
||||
width?: number;
|
||||
cells?: IAssetPlaneMaterialCell[];
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
export interface IAssetPlaneMaterialCellExtraItemData
|
||||
{
|
||||
limitMax?: number;
|
||||
extraItemTypes?: string[];
|
||||
offsets?: [number, number][];
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import { IAssetPlaneMaterialCellColumn } from './IAssetPlaneMaterialCellColumn';
|
||||
|
||||
export interface IAssetPlaneMaterialCellMatrix
|
||||
{
|
||||
repeatMode?: string;
|
||||
align?: string;
|
||||
normalMinX?: number;
|
||||
normalMaxX?: number;
|
||||
normalMinY?: number;
|
||||
normalMaxY?: number;
|
||||
columns?: IAssetPlaneMaterialCellColumn[];
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import { IAssetPlaneTextureBitmap } from './IAssetPlaneTextureBitmap';
|
||||
|
||||
export interface IAssetPlaneTexture
|
||||
{
|
||||
id?: string;
|
||||
bitmaps?: IAssetPlaneTextureBitmap[];
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
export interface IAssetPlaneTextureBitmap
|
||||
{
|
||||
assetName?: string;
|
||||
normalMinX?: number;
|
||||
normalMaxX?: number;
|
||||
normalMinY?: number;
|
||||
normalMaxY?: number;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
import { IAssetPlaneVisualizationAnimatedLayer } from './IAssetPlaneVisualizationAnimatedLayer';
|
||||
import { IAssetPlaneVisualizationLayer } from './IAssetPlaneVisualizationLayer';
|
||||
|
||||
export interface IAssetPlaneVisualization
|
||||
{
|
||||
size?: number;
|
||||
horizontalAngle?: number;
|
||||
verticalAngle?: number;
|
||||
layers?: IAssetPlaneVisualizationLayer[];
|
||||
animatedLayers?: IAssetPlaneVisualizationAnimatedLayer[];
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
import { IAssetPlaneVisualizationAnimatedLayerItem } from './IAssetPlaneVisualizationAnimatedLayerItem';
|
||||
|
||||
export interface IAssetPlaneVisualizationAnimatedLayer
|
||||
{
|
||||
items?: IAssetPlaneVisualizationAnimatedLayerItem[];
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
export interface IAssetPlaneVisualizationAnimatedLayerItem
|
||||
{
|
||||
id?: number;
|
||||
assetId?: string;
|
||||
x?: string;
|
||||
y?: string;
|
||||
randomX?: string;
|
||||
randomY?: string;
|
||||
speedX?: number;
|
||||
speedY?: number;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { IAssetPlane } from './IAssetPlane';
|
||||
import { IAssetPlaneMaterial } from './IAssetPlaneMaterial';
|
||||
import { IAssetPlaneTexture } from './IAssetPlaneTexture';
|
||||
|
||||
export interface IAssetPlaneVisualizationData
|
||||
{
|
||||
planes?: IAssetPlane[];
|
||||
materials?: IAssetPlaneMaterial[];
|
||||
textures?: IAssetPlaneTexture[];
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
export interface IAssetPlaneVisualizationLayer
|
||||
{
|
||||
materialId?: string;
|
||||
color?: number;
|
||||
offset?: number;
|
||||
align?: string;
|
||||
}
|
@ -1,4 +1,10 @@
|
||||
import { IAssetPlaneMaskData } from './IAssetPlaneMaskData';
|
||||
import { IAssetPlaneVisualizationData } from './IAssetPlaneVisualizationData';
|
||||
|
||||
export interface IAssetRoomVisualizationData
|
||||
{
|
||||
|
||||
floorData?: IAssetPlaneVisualizationData;
|
||||
wallData?: IAssetPlaneVisualizationData;
|
||||
landscapeData?: IAssetPlaneVisualizationData;
|
||||
maskData?: IAssetPlaneMaskData;
|
||||
}
|
||||
|
@ -1 +1,17 @@
|
||||
export * from './IAssetPlane';
|
||||
export * from './IAssetPlaneMask';
|
||||
export * from './IAssetPlaneMaskData';
|
||||
export * from './IAssetPlaneMaskVisualization';
|
||||
export * from './IAssetPlaneMaterial';
|
||||
export * from './IAssetPlaneMaterialCell';
|
||||
export * from './IAssetPlaneMaterialCellColumn';
|
||||
export * from './IAssetPlaneMaterialCellExtraItemData';
|
||||
export * from './IAssetPlaneMaterialCellMatrix';
|
||||
export * from './IAssetPlaneTexture';
|
||||
export * from './IAssetPlaneTextureBitmap';
|
||||
export * from './IAssetPlaneVisualization';
|
||||
export * from './IAssetPlaneVisualizationAnimatedLayer';
|
||||
export * from './IAssetPlaneVisualizationAnimatedLayerItem';
|
||||
export * from './IAssetPlaneVisualizationData';
|
||||
export * from './IAssetPlaneVisualizationLayer';
|
||||
export * from './IAssetRoomVisualizationData';
|
||||
|
@ -7,18 +7,18 @@ export class AssetMapper extends Mapper
|
||||
{
|
||||
public static mapXML(assets: any, output: IAssetData): void
|
||||
{
|
||||
if(!assets || !output) return;
|
||||
if (!assets || !output) return;
|
||||
|
||||
AssetMapper.mapAssetsXML(new AssetsXML(assets.assets), output);
|
||||
}
|
||||
|
||||
private static mapAssetsXML(xml: AssetsXML, output: IAssetData): void
|
||||
{
|
||||
if(!xml || !output) return;
|
||||
if (!xml || !output) return;
|
||||
|
||||
if(xml.assets !== undefined)
|
||||
if (xml.assets !== undefined)
|
||||
{
|
||||
if(xml.assets.length)
|
||||
if (xml.assets.length)
|
||||
{
|
||||
output.assets = {};
|
||||
|
||||
@ -26,9 +26,9 @@ export class AssetMapper extends Mapper
|
||||
}
|
||||
}
|
||||
|
||||
if(xml.palettes !== undefined)
|
||||
if (xml.palettes !== undefined)
|
||||
{
|
||||
if(xml.palettes.length)
|
||||
if (xml.palettes.length)
|
||||
{
|
||||
output.palettes = {};
|
||||
|
||||
@ -39,35 +39,35 @@ export class AssetMapper extends Mapper
|
||||
|
||||
private static mapAssetsAssetXML(xml: AssetXML[], output: { [index: string]: IAsset }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const assetXML of xml)
|
||||
for (const assetXML of xml)
|
||||
{
|
||||
const asset: IAsset = {};
|
||||
|
||||
if(assetXML.name !== undefined)
|
||||
if (assetXML.name !== undefined)
|
||||
{
|
||||
if(assetXML.name.startsWith('sh_')) continue;
|
||||
if (assetXML.name.startsWith('sh_')) continue;
|
||||
|
||||
if(assetXML.name.indexOf('_32_') >= 0) continue;
|
||||
if (assetXML.name.indexOf('_32_') >= 0) continue;
|
||||
|
||||
if(assetXML.source !== undefined)
|
||||
if (assetXML.source !== undefined)
|
||||
{
|
||||
asset.source = assetXML.source;
|
||||
|
||||
if(IMAGE_SOURCES.has(assetXML.source)) asset.source = IMAGE_SOURCES.get(assetXML.source) as string;
|
||||
if (IMAGE_SOURCES.has(assetXML.source)) asset.source = IMAGE_SOURCES.get(assetXML.source) as string;
|
||||
}
|
||||
|
||||
if(assetXML.name !== undefined)
|
||||
if (assetXML.name !== undefined)
|
||||
{
|
||||
if(IMAGE_SOURCES.has(assetXML.name)) asset.source = IMAGE_SOURCES.get(assetXML.name) as string;
|
||||
if (IMAGE_SOURCES.has(assetXML.name)) asset.source = IMAGE_SOURCES.get(assetXML.name) as string;
|
||||
}
|
||||
|
||||
if(assetXML.x !== undefined) asset.x = assetXML.x;
|
||||
if(assetXML.y !== undefined) asset.y = assetXML.y;
|
||||
if(assetXML.flipH !== undefined) asset.flipH = assetXML.flipH;
|
||||
if(assetXML.flipV !== undefined) asset.flipV = assetXML.flipV;
|
||||
if(assetXML.usesPalette !== undefined) asset.usesPalette = assetXML.usesPalette;
|
||||
asset.x = assetXML.x ?? 0;
|
||||
asset.y = assetXML.y ?? 0;
|
||||
if (assetXML.flipH !== undefined) asset.flipH = assetXML.flipH;
|
||||
if (assetXML.flipV !== undefined) asset.flipV = assetXML.flipV;
|
||||
if (assetXML.usesPalette !== undefined) asset.usesPalette = assetXML.usesPalette;
|
||||
|
||||
output[assetXML.name] = asset;
|
||||
}
|
||||
@ -76,20 +76,20 @@ export class AssetMapper extends Mapper
|
||||
|
||||
private static mapAssetsPaletteXML(xml: PaletteXML[], output: { [index: string]: IAssetPalette }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const paletteXML of xml)
|
||||
for (const paletteXML of xml)
|
||||
{
|
||||
const palette: IAssetPalette = {};
|
||||
|
||||
if(paletteXML.id !== undefined) palette.id = paletteXML.id;
|
||||
if(paletteXML.source !== undefined) palette.source = paletteXML.source;
|
||||
if(paletteXML.master !== undefined) palette.master = paletteXML.master;
|
||||
if(paletteXML.tags !== undefined) palette.tags = paletteXML.tags;
|
||||
if(paletteXML.breed !== undefined) palette.breed = paletteXML.breed;
|
||||
if(paletteXML.colorTag !== undefined) palette.colorTag = paletteXML.colorTag;
|
||||
if(paletteXML.color1 !== undefined) palette.color1 = paletteXML.color1;
|
||||
if(paletteXML.color2 !== undefined) palette.color2 = paletteXML.color2;
|
||||
if (paletteXML.id !== undefined) palette.id = paletteXML.id;
|
||||
if (paletteXML.source !== undefined) palette.source = paletteXML.source;
|
||||
if (paletteXML.master !== undefined) palette.master = paletteXML.master;
|
||||
if (paletteXML.tags !== undefined) palette.tags = paletteXML.tags;
|
||||
if (paletteXML.breed !== undefined) palette.breed = paletteXML.breed;
|
||||
if (paletteXML.colorTag !== undefined) palette.colorTag = paletteXML.colorTag;
|
||||
if (paletteXML.color1 !== undefined) palette.color1 = paletteXML.color1;
|
||||
if (paletteXML.color2 !== undefined) palette.color2 = paletteXML.color2;
|
||||
|
||||
output[paletteXML.id.toString()] = palette;
|
||||
}
|
||||
|
@ -1,5 +1,17 @@
|
||||
import { IAssetData } from '../../json';
|
||||
import { RoomVisualizationXML } from '../../xml';
|
||||
import { IAssetData, IAssetPlane, IAssetPlaneMaskVisualization, IAssetPlaneVisualizationData } from '../../json';
|
||||
import { IAssetPlaneMask } from '../../json/asset/room-visualization/IAssetPlaneMask';
|
||||
import { IAssetPlaneMaskData } from '../../json/asset/room-visualization/IAssetPlaneMaskData';
|
||||
import { IAssetPlaneMaterial } from '../../json/asset/room-visualization/IAssetPlaneMaterial';
|
||||
import { IAssetPlaneMaterialCell } from '../../json/asset/room-visualization/IAssetPlaneMaterialCell';
|
||||
import { IAssetPlaneMaterialCellColumn } from '../../json/asset/room-visualization/IAssetPlaneMaterialCellColumn';
|
||||
import { IAssetPlaneMaterialCellMatrix } from '../../json/asset/room-visualization/IAssetPlaneMaterialCellMatrix';
|
||||
import { IAssetPlaneTexture } from '../../json/asset/room-visualization/IAssetPlaneTexture';
|
||||
import { IAssetPlaneTextureBitmap } from '../../json/asset/room-visualization/IAssetPlaneTextureBitmap';
|
||||
import { IAssetPlaneVisualization } from '../../json/asset/room-visualization/IAssetPlaneVisualization';
|
||||
import { IAssetPlaneVisualizationAnimatedLayer } from '../../json/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayer';
|
||||
import { IAssetPlaneVisualizationAnimatedLayerItem } from '../../json/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayerItem';
|
||||
import { IAssetPlaneVisualizationLayer } from '../../json/asset/room-visualization/IAssetPlaneVisualizationLayer';
|
||||
import { PlaneMaskVisualizationDataXML, PlaneMaterialCellColumnXML, PlaneMaterialCellMatrixXML, PlaneMaterialCellXML, PlaneMaterialXML, PlaneTextureBitmapXML, PlaneTextureXML, PlaneVisualizationAnimatedLayerItemXML, PlaneVisualizationAnimatedLayerXML, PlaneVisualizationDataXML, PlaneVisualizationLayerXML, PlaneVisualizationXML, PlaneXML, RoomVisualizationXML } from '../../xml';
|
||||
import { Mapper } from './Mapper';
|
||||
|
||||
export class RoomVisualizationMapper extends Mapper
|
||||
@ -8,13 +20,412 @@ export class RoomVisualizationMapper extends Mapper
|
||||
{
|
||||
if (!visualization || !output) return;
|
||||
|
||||
RoomVisualizationMapper.mapVisualizationXML(new RoomVisualizationXML(visualization.visualizationData), output);
|
||||
RoomVisualizationMapper.mapVisualizationXML(new RoomVisualizationXML(visualization.visualizationData), output)
|
||||
}
|
||||
|
||||
private static mapVisualizationXML(xml: RoomVisualizationXML, output: IAssetData): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
console.log(xml);
|
||||
output.roomVisualization = {};
|
||||
|
||||
if (xml.floorData !== undefined)
|
||||
{
|
||||
if (xml.floorData)
|
||||
{
|
||||
output.roomVisualization.floorData = {};
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationDataXML(xml.floorData, output.roomVisualization.floorData);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml.wallData !== undefined)
|
||||
{
|
||||
if (xml.wallData)
|
||||
{
|
||||
output.roomVisualization.wallData = {};
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationDataXML(xml.wallData, output.roomVisualization.wallData);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml.landscapeData !== undefined)
|
||||
{
|
||||
if (xml.landscapeData)
|
||||
{
|
||||
output.roomVisualization.landscapeData = {};
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationDataXML(xml.landscapeData, output.roomVisualization.landscapeData);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml.landscapeData !== undefined)
|
||||
{
|
||||
if (xml.landscapeData)
|
||||
{
|
||||
output.roomVisualization.landscapeData = {};
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationDataXML(xml.landscapeData, output.roomVisualization.landscapeData);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml.maskData !== undefined)
|
||||
{
|
||||
if (xml.maskData)
|
||||
{
|
||||
output.roomVisualization.maskData = {};
|
||||
|
||||
RoomVisualizationMapper.mapPlaneMaskData(xml.maskData, output.roomVisualization.maskData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static mapPlaneVisualizationDataXML(xml: PlaneVisualizationDataXML, output: IAssetPlaneVisualizationData): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
if (xml.planes !== undefined)
|
||||
{
|
||||
if (xml.planes.length)
|
||||
{
|
||||
output.planes = [];
|
||||
|
||||
RoomVisualizationMapper.mapPlanes(xml.planes, output.planes);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml.materials !== undefined)
|
||||
{
|
||||
if (xml.materials.length)
|
||||
{
|
||||
output.materials = [];
|
||||
|
||||
RoomVisualizationMapper.mapMaterials(xml.materials, output.materials);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml.textures !== undefined)
|
||||
{
|
||||
if (xml.textures.length)
|
||||
{
|
||||
output.textures = [];
|
||||
|
||||
RoomVisualizationMapper.mapTextures(xml.textures, output.textures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static mapPlanes(xml: PlaneXML[], output: IAssetPlane[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeXML of xml)
|
||||
{
|
||||
const plane: IAssetPlane = {};
|
||||
|
||||
if (planeXML.id !== undefined) plane.id = planeXML.id;
|
||||
|
||||
if (planeXML.visualizations !== undefined)
|
||||
{
|
||||
if (planeXML.visualizations.length)
|
||||
{
|
||||
plane.visualizations = [];
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationsXML(planeXML.visualizations, plane.visualizations);
|
||||
}
|
||||
}
|
||||
|
||||
if (planeXML.animatedVisualization !== undefined)
|
||||
{
|
||||
if (planeXML.animatedVisualization.length)
|
||||
{
|
||||
plane.animatedVisualization = [];
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationsXML(planeXML.animatedVisualization, plane.animatedVisualization);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(plane);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapPlaneVisualizationsXML(xml: PlaneVisualizationXML[], output: IAssetPlaneVisualization[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeVisualizationXML of xml)
|
||||
{
|
||||
const visualization: IAssetPlaneVisualization = {};
|
||||
|
||||
if (planeVisualizationXML.size !== undefined) visualization.size = planeVisualizationXML.size;
|
||||
|
||||
if (planeVisualizationXML.horizontalAngle !== undefined) visualization.horizontalAngle = planeVisualizationXML.horizontalAngle;
|
||||
if (planeVisualizationXML.verticalAngle !== undefined) visualization.verticalAngle = planeVisualizationXML.verticalAngle;
|
||||
|
||||
if (planeVisualizationXML.layers !== undefined)
|
||||
{
|
||||
if (planeVisualizationXML.layers.length)
|
||||
{
|
||||
visualization.layers = [];
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationLayers(planeVisualizationXML.layers, visualization.layers);
|
||||
}
|
||||
}
|
||||
|
||||
if (planeVisualizationXML.animatedLayers !== undefined)
|
||||
{
|
||||
if (planeVisualizationXML.animatedLayers.length)
|
||||
{
|
||||
visualization.animatedLayers = [];
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationAnimatedLayers(planeVisualizationXML.animatedLayers, visualization.animatedLayers);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(visualization);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapPlaneVisualizationLayers(xml: PlaneVisualizationLayerXML[], output: IAssetPlaneVisualizationLayer[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeVisualizationLayerXML of xml)
|
||||
{
|
||||
const layer: IAssetPlaneVisualizationLayer = {};
|
||||
|
||||
if (planeVisualizationLayerXML.materialId !== undefined) layer.materialId = planeVisualizationLayerXML.materialId;
|
||||
if (planeVisualizationLayerXML.color !== undefined) layer.color = planeVisualizationLayerXML.color;
|
||||
if (planeVisualizationLayerXML.offset !== undefined) layer.offset = planeVisualizationLayerXML.offset;
|
||||
if (planeVisualizationLayerXML.align !== undefined) layer.align = planeVisualizationLayerXML.align;
|
||||
|
||||
output.push(layer);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapPlaneVisualizationAnimatedLayers(xml: PlaneVisualizationAnimatedLayerXML[], output: IAssetPlaneVisualizationAnimatedLayer[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeVisualizationAnimatedLayerXML of xml)
|
||||
{
|
||||
const animatedLayer: IAssetPlaneVisualizationAnimatedLayer = {};
|
||||
|
||||
if (planeVisualizationAnimatedLayerXML.items !== undefined)
|
||||
{
|
||||
if (planeVisualizationAnimatedLayerXML.items.length)
|
||||
{
|
||||
animatedLayer.items = [];
|
||||
|
||||
RoomVisualizationMapper.mapPlaneVisualizationAnimatedLayerItems(planeVisualizationAnimatedLayerXML.items, animatedLayer.items);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(animatedLayer);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapPlaneVisualizationAnimatedLayerItems(xml: PlaneVisualizationAnimatedLayerItemXML[], output: IAssetPlaneVisualizationAnimatedLayerItem[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeVisualizationAnimatedLayerItemXML of xml)
|
||||
{
|
||||
const layerItem: IAssetPlaneVisualizationAnimatedLayerItem = {};
|
||||
|
||||
if (planeVisualizationAnimatedLayerItemXML.id !== undefined) layerItem.id = planeVisualizationAnimatedLayerItemXML.id;
|
||||
if (planeVisualizationAnimatedLayerItemXML.assetId !== undefined) layerItem.assetId = planeVisualizationAnimatedLayerItemXML.assetId;
|
||||
if (planeVisualizationAnimatedLayerItemXML.x !== undefined) layerItem.x = planeVisualizationAnimatedLayerItemXML.x;
|
||||
if (planeVisualizationAnimatedLayerItemXML.y !== undefined) layerItem.y = planeVisualizationAnimatedLayerItemXML.y;
|
||||
if (planeVisualizationAnimatedLayerItemXML.randomX !== undefined) layerItem.randomX = planeVisualizationAnimatedLayerItemXML.randomX;
|
||||
if (planeVisualizationAnimatedLayerItemXML.randomY !== undefined) layerItem.randomY = planeVisualizationAnimatedLayerItemXML.randomY;
|
||||
if (planeVisualizationAnimatedLayerItemXML.speedX !== undefined) layerItem.speedX = planeVisualizationAnimatedLayerItemXML.speedX;
|
||||
if (planeVisualizationAnimatedLayerItemXML.speedY !== undefined) layerItem.speedY = planeVisualizationAnimatedLayerItemXML.speedY;
|
||||
|
||||
output.push(layerItem);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapMaterials(xml: PlaneMaterialXML[], output: IAssetPlaneMaterial[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeMaterialXML of xml)
|
||||
{
|
||||
const planeMaterial: IAssetPlaneMaterial = {};
|
||||
|
||||
if (planeMaterialXML.id !== undefined) planeMaterial.id = planeMaterialXML.id;
|
||||
|
||||
if (planeMaterialXML.matrices !== undefined)
|
||||
{
|
||||
if (planeMaterialXML.matrices.length)
|
||||
{
|
||||
planeMaterial.matrices = [];
|
||||
|
||||
RoomVisualizationMapper.mapMaterialCellMatrices(planeMaterialXML.matrices, planeMaterial.matrices);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(planeMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapMaterialCellMatrices(xml: PlaneMaterialCellMatrixXML[], output: IAssetPlaneMaterialCellMatrix[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeMaterialCellMatrixXML of xml)
|
||||
{
|
||||
const planeMaterialCellMatrix: IAssetPlaneMaterialCellMatrix = {};
|
||||
|
||||
if (planeMaterialCellMatrixXML.repeatMode !== undefined) planeMaterialCellMatrix.repeatMode = planeMaterialCellMatrixXML.repeatMode;
|
||||
if (planeMaterialCellMatrixXML.align !== undefined) planeMaterialCellMatrix.align = planeMaterialCellMatrixXML.align;
|
||||
if (planeMaterialCellMatrixXML.normalMinX !== undefined) planeMaterialCellMatrix.normalMinX = planeMaterialCellMatrixXML.normalMinX;
|
||||
if (planeMaterialCellMatrixXML.normalMaxX !== undefined) planeMaterialCellMatrix.normalMaxX = planeMaterialCellMatrixXML.normalMaxX;
|
||||
if (planeMaterialCellMatrixXML.normalMinY !== undefined) planeMaterialCellMatrix.normalMinY = planeMaterialCellMatrixXML.normalMinY;
|
||||
if (planeMaterialCellMatrixXML.normalMaxY !== undefined) planeMaterialCellMatrix.normalMaxY = planeMaterialCellMatrixXML.normalMaxY;
|
||||
|
||||
if (planeMaterialCellMatrixXML.columns !== undefined)
|
||||
{
|
||||
if (planeMaterialCellMatrixXML.columns.length)
|
||||
{
|
||||
planeMaterialCellMatrix.columns = [];
|
||||
|
||||
RoomVisualizationMapper.mapMaterialCellColumns(planeMaterialCellMatrixXML.columns, planeMaterialCellMatrix.columns);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(planeMaterialCellMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapMaterialCellColumns(xml: PlaneMaterialCellColumnXML[], output: IAssetPlaneMaterialCellColumn[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeMaterialCellColumnXML of xml)
|
||||
{
|
||||
const planeMaterialCellColumn: IAssetPlaneMaterialCellColumn = {};
|
||||
|
||||
if (planeMaterialCellColumnXML.repeatMode !== undefined) planeMaterialCellColumn.repeatMode = planeMaterialCellColumnXML.repeatMode;
|
||||
if (planeMaterialCellColumnXML.width !== undefined) planeMaterialCellColumn.width = planeMaterialCellColumnXML.width;
|
||||
|
||||
if (planeMaterialCellColumnXML.cells !== undefined)
|
||||
{
|
||||
if (planeMaterialCellColumnXML.cells.length)
|
||||
{
|
||||
planeMaterialCellColumn.cells = [];
|
||||
|
||||
RoomVisualizationMapper.mapMaterialCells(planeMaterialCellColumnXML.cells, planeMaterialCellColumn.cells);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(planeMaterialCellColumn);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapMaterialCells(xml: PlaneMaterialCellXML[], output: IAssetPlaneMaterialCell[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeMaterialCellXML of xml)
|
||||
{
|
||||
const planeMaterialCell: IAssetPlaneMaterialCell = {};
|
||||
|
||||
if (planeMaterialCellXML.textureId !== undefined) planeMaterialCell.textureId = planeMaterialCellXML.textureId;
|
||||
|
||||
if (planeMaterialCellXML.extraData !== undefined)
|
||||
{
|
||||
planeMaterialCell.extraData = {};
|
||||
|
||||
if (planeMaterialCellXML.extraData.limitMax !== undefined) planeMaterialCell.extraData.limitMax = planeMaterialCellXML.extraData.limitMax;
|
||||
if (planeMaterialCellXML.extraData.extraItemTypes !== undefined) planeMaterialCell.extraData.extraItemTypes = planeMaterialCellXML.extraData.extraItemTypes;
|
||||
if (planeMaterialCellXML.extraData.offsets !== undefined) planeMaterialCell.extraData.offsets = planeMaterialCellXML.extraData.offsets;
|
||||
}
|
||||
|
||||
output.push(planeMaterialCell);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapTextures(xml: PlaneTextureXML[], output: IAssetPlaneTexture[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeTextureXML of xml)
|
||||
{
|
||||
const planeTexture: IAssetPlaneTexture = {};
|
||||
|
||||
if (planeTextureXML.id !== undefined) planeTexture.id = planeTextureXML.id;
|
||||
|
||||
if (planeTextureXML.bitmaps !== undefined)
|
||||
{
|
||||
if (planeTextureXML.bitmaps.length)
|
||||
{
|
||||
planeTexture.bitmaps = [];
|
||||
|
||||
RoomVisualizationMapper.mapTextureBitmaps(planeTextureXML.bitmaps, planeTexture.bitmaps);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(planeTexture);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapTextureBitmaps(xml: PlaneTextureBitmapXML[], output: IAssetPlaneTextureBitmap[]): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
for (const planeTextureBitmapXML of xml)
|
||||
{
|
||||
const planeTextureBitmap: IAssetPlaneTextureBitmap = {};
|
||||
|
||||
if (planeTextureBitmapXML.assetName !== undefined) planeTextureBitmap.assetName = planeTextureBitmapXML.assetName;
|
||||
if (planeTextureBitmapXML.normalMinX !== undefined) planeTextureBitmap.normalMinX = planeTextureBitmapXML.normalMinX;
|
||||
if (planeTextureBitmapXML.normalMaxX !== undefined) planeTextureBitmap.normalMaxX = planeTextureBitmapXML.normalMaxX;
|
||||
if (planeTextureBitmapXML.normalMinY !== undefined) planeTextureBitmap.normalMinY = planeTextureBitmapXML.normalMinY;
|
||||
if (planeTextureBitmapXML.normalMaxY !== undefined) planeTextureBitmap.normalMaxY = planeTextureBitmapXML.normalMaxY;
|
||||
|
||||
output.push(planeTextureBitmap);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapPlaneMaskData(xml: PlaneMaskVisualizationDataXML, output: IAssetPlaneMaskData): void
|
||||
{
|
||||
if (!xml || !output) return;
|
||||
|
||||
if ((xml.masks !== undefined) && Array.isArray(xml.masks))
|
||||
{
|
||||
output.masks = [];
|
||||
|
||||
for (const planeMaskXML of xml.masks)
|
||||
{
|
||||
const planeMask: IAssetPlaneMask = {};
|
||||
|
||||
if (planeMaskXML.id !== undefined) planeMask.id = planeMaskXML.id;
|
||||
|
||||
if ((planeMaskXML.visualizations !== undefined) && planeMaskXML.visualizations.length)
|
||||
{
|
||||
planeMask.visualizations = [];
|
||||
|
||||
for (const planeMaskVisualizationXML of planeMaskXML.visualizations)
|
||||
{
|
||||
const planeMaskVisualization: IAssetPlaneMaskVisualization = {};
|
||||
|
||||
if (planeMaskVisualizationXML.size !== undefined) planeMaskVisualization.size = planeMaskVisualizationXML.size;
|
||||
|
||||
if ((planeMaskVisualizationXML.bitmaps !== undefined) && planeMaskVisualizationXML.bitmaps.length)
|
||||
{
|
||||
planeMaskVisualization.bitmaps = [];
|
||||
|
||||
RoomVisualizationMapper.mapTextureBitmaps(planeMaskVisualizationXML.bitmaps, planeMaskVisualization.bitmaps);
|
||||
}
|
||||
|
||||
planeMask.visualizations.push(planeMaskVisualization);
|
||||
}
|
||||
}
|
||||
|
||||
output.masks.push(planeMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,18 +6,18 @@ export class VisualizationMapper extends Mapper
|
||||
{
|
||||
public static mapXML(visualization: any, output: IAssetData): void
|
||||
{
|
||||
if(!visualization || !output) return;
|
||||
if (!visualization || !output) return;
|
||||
|
||||
VisualizationMapper.mapVisualizationXML(new VisualizationXML(visualization.visualizationData), output);
|
||||
}
|
||||
|
||||
private static mapVisualizationXML(xml: VisualizationXML, output: IAssetData): void
|
||||
{
|
||||
if(!xml || !output) return;
|
||||
if (!xml || !output) return;
|
||||
|
||||
if(xml.visualizations !== undefined)
|
||||
if (xml.visualizations !== undefined)
|
||||
{
|
||||
if(xml.visualizations.length)
|
||||
if (xml.visualizations.length)
|
||||
{
|
||||
output.visualizations = [];
|
||||
|
||||
@ -28,24 +28,24 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationDataXML(xml: VisualizationDataXML[], output: IAssetVisualizationData[]): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const visualizationDataXML of xml)
|
||||
for (const visualizationDataXML of xml)
|
||||
{
|
||||
if(visualizationDataXML.size !== undefined)
|
||||
if (visualizationDataXML.size !== undefined)
|
||||
{
|
||||
if([ 32 ].indexOf(visualizationDataXML.size) >= 0) continue;
|
||||
if ([32].indexOf(visualizationDataXML.size) >= 0) continue;
|
||||
}
|
||||
|
||||
const visualizationData: IAssetVisualizationData = {};
|
||||
|
||||
if(visualizationDataXML.angle !== undefined) visualizationData.angle = visualizationDataXML.angle;
|
||||
if(visualizationDataXML.layerCount !== undefined) visualizationData.layerCount = visualizationDataXML.layerCount;
|
||||
if(visualizationDataXML.size !== undefined) visualizationData.size = visualizationDataXML.size;
|
||||
if (visualizationDataXML.angle !== undefined) visualizationData.angle = visualizationDataXML.angle;
|
||||
if (visualizationDataXML.layerCount !== undefined) visualizationData.layerCount = visualizationDataXML.layerCount;
|
||||
if (visualizationDataXML.size !== undefined) visualizationData.size = visualizationDataXML.size;
|
||||
|
||||
if(visualizationDataXML.layers !== undefined)
|
||||
if (visualizationDataXML.layers !== undefined)
|
||||
{
|
||||
if(visualizationDataXML.layers.length)
|
||||
if (visualizationDataXML.layers.length)
|
||||
{
|
||||
visualizationData.layers = {};
|
||||
|
||||
@ -53,9 +53,9 @@ export class VisualizationMapper extends Mapper
|
||||
}
|
||||
}
|
||||
|
||||
if(visualizationDataXML.directions !== undefined)
|
||||
if (visualizationDataXML.directions !== undefined)
|
||||
{
|
||||
if(visualizationDataXML.directions.length)
|
||||
if (visualizationDataXML.directions.length)
|
||||
{
|
||||
visualizationData.directions = {};
|
||||
|
||||
@ -63,9 +63,9 @@ export class VisualizationMapper extends Mapper
|
||||
}
|
||||
}
|
||||
|
||||
if(visualizationDataXML.colors !== undefined)
|
||||
if (visualizationDataXML.colors !== undefined)
|
||||
{
|
||||
if(visualizationDataXML.colors.length)
|
||||
if (visualizationDataXML.colors.length)
|
||||
{
|
||||
visualizationData.colors = {};
|
||||
|
||||
@ -73,9 +73,9 @@ export class VisualizationMapper extends Mapper
|
||||
}
|
||||
}
|
||||
|
||||
if(visualizationDataXML.animations !== undefined)
|
||||
if (visualizationDataXML.animations !== undefined)
|
||||
{
|
||||
if(visualizationDataXML.animations.length)
|
||||
if (visualizationDataXML.animations.length)
|
||||
{
|
||||
visualizationData.animations = {};
|
||||
|
||||
@ -83,13 +83,13 @@ export class VisualizationMapper extends Mapper
|
||||
}
|
||||
}
|
||||
|
||||
if(visualizationDataXML.postures !== undefined)
|
||||
if (visualizationDataXML.postures !== undefined)
|
||||
{
|
||||
visualizationData.postures = {};
|
||||
|
||||
if(visualizationDataXML.defaultPosture !== undefined) visualizationData.postures.defaultPosture = visualizationDataXML.defaultPosture;
|
||||
if (visualizationDataXML.defaultPosture !== undefined) visualizationData.postures.defaultPosture = visualizationDataXML.defaultPosture;
|
||||
|
||||
if(visualizationDataXML.postures.length)
|
||||
if (visualizationDataXML.postures.length)
|
||||
{
|
||||
visualizationData.postures.postures = [];
|
||||
|
||||
@ -97,9 +97,9 @@ export class VisualizationMapper extends Mapper
|
||||
}
|
||||
}
|
||||
|
||||
if(visualizationDataXML.gestures !== undefined)
|
||||
if (visualizationDataXML.gestures !== undefined)
|
||||
{
|
||||
if(visualizationDataXML.gestures.length)
|
||||
if (visualizationDataXML.gestures.length)
|
||||
{
|
||||
visualizationData.gestures = [];
|
||||
|
||||
@ -113,19 +113,19 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationLayerXML(xml: LayerXML[], output: { [index: string]: IAssetVisualizationLayer }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const layerXML of xml)
|
||||
for (const layerXML of xml)
|
||||
{
|
||||
const layer: IAssetVisualizationLayer = {};
|
||||
|
||||
if(layerXML.x !== undefined) layer.x = layerXML.x;
|
||||
if(layerXML.y !== undefined) layer.y = layerXML.y;
|
||||
if(layerXML.z !== undefined) layer.z = layerXML.z;
|
||||
if(layerXML.alpha !== undefined) layer.alpha = layerXML.alpha;
|
||||
if(layerXML.ink !== undefined) layer.ink = layerXML.ink;
|
||||
if(layerXML.tag !== undefined) layer.tag = layerXML.tag;
|
||||
if(layerXML.ignoreMouse !== undefined) layer.ignoreMouse = layerXML.ignoreMouse;
|
||||
if (layerXML.x !== undefined) layer.x = layerXML.x;
|
||||
if (layerXML.y !== undefined) layer.y = layerXML.y;
|
||||
if (layerXML.z !== undefined) layer.z = layerXML.z;
|
||||
if (layerXML.alpha !== undefined) layer.alpha = layerXML.alpha;
|
||||
if (layerXML.ink !== undefined) layer.ink = layerXML.ink;
|
||||
if (layerXML.tag !== undefined) layer.tag = layerXML.tag;
|
||||
if (layerXML.ignoreMouse !== undefined) layer.ignoreMouse = layerXML.ignoreMouse;
|
||||
|
||||
output[layerXML.id.toString()] = layer;
|
||||
}
|
||||
@ -133,15 +133,15 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationDirectionXML(xml: VisualDirectionXML[], output: { [index: string]: IAssetVisualizationDirection }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const directionXML of xml)
|
||||
for (const directionXML of xml)
|
||||
{
|
||||
const direction: IAssetVisualizationDirection = {};
|
||||
|
||||
if(directionXML.layers !== undefined)
|
||||
if (directionXML.layers !== undefined)
|
||||
{
|
||||
if(directionXML.layers.length)
|
||||
if (directionXML.layers.length)
|
||||
{
|
||||
direction.layers = {};
|
||||
|
||||
@ -155,15 +155,15 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationColorXML(xml: ColorXML[], output: { [index: string]: IAssetColor }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const colorXML of xml)
|
||||
for (const colorXML of xml)
|
||||
{
|
||||
const color: IAssetColor = {};
|
||||
|
||||
if(colorXML.layers !== undefined)
|
||||
if (colorXML.layers !== undefined)
|
||||
{
|
||||
if(colorXML.layers.length)
|
||||
if (colorXML.layers.length)
|
||||
{
|
||||
color.layers = {};
|
||||
|
||||
@ -177,13 +177,13 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationColorLayerXML(xml: ColorLayerXML[], output: { [index: string]: IAssetColorLayer }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const colorLayerXML of xml)
|
||||
for (const colorLayerXML of xml)
|
||||
{
|
||||
const colorLayer: IAssetColorLayer = {};
|
||||
|
||||
if(colorLayerXML.color !== undefined) colorLayer.color = parseInt(colorLayerXML.color, 16);
|
||||
if (colorLayerXML.color !== undefined) colorLayer.color = parseInt(colorLayerXML.color, 16);
|
||||
|
||||
output[colorLayerXML.id.toString()] = colorLayer;
|
||||
}
|
||||
@ -193,15 +193,15 @@ export class VisualizationMapper extends Mapper
|
||||
{
|
||||
let id = requestId.toString();
|
||||
|
||||
if(!output[id]) return id;
|
||||
if (!output[id]) return id;
|
||||
|
||||
let i = 1;
|
||||
|
||||
while(i < 6)
|
||||
while (i < 6)
|
||||
{
|
||||
id += '_' + i;
|
||||
|
||||
if(!output[id]) return id;
|
||||
if (!output[id]) return id;
|
||||
|
||||
i++;
|
||||
}
|
||||
@ -211,20 +211,20 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationAnimationXML(xml: AnimationXML[], output: { [index: string]: IAssetVisualAnimation }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const animationXML of xml)
|
||||
for (const animationXML of xml)
|
||||
{
|
||||
const animation: IAssetVisualAnimation = {};
|
||||
|
||||
if(animationXML.transitionTo !== undefined) animation.transitionTo = animationXML.transitionTo;
|
||||
if(animationXML.transitionFrom !== undefined) animation.transitionFrom = animationXML.transitionFrom;
|
||||
if(animationXML.immediateChangeFrom !== undefined) animation.immediateChangeFrom = animationXML.immediateChangeFrom;
|
||||
if(animationXML.randomStart !== undefined) animation.randomStart = animationXML.randomStart;
|
||||
if (animationXML.transitionTo !== undefined) animation.transitionTo = animationXML.transitionTo;
|
||||
if (animationXML.transitionFrom !== undefined) animation.transitionFrom = animationXML.transitionFrom;
|
||||
if (animationXML.immediateChangeFrom !== undefined) animation.immediateChangeFrom = animationXML.immediateChangeFrom;
|
||||
if (animationXML.randomStart !== undefined) animation.randomStart = animationXML.randomStart;
|
||||
|
||||
if(animationXML.layers !== undefined)
|
||||
if (animationXML.layers !== undefined)
|
||||
{
|
||||
if(animationXML.layers.length)
|
||||
if (animationXML.layers.length)
|
||||
{
|
||||
animation.layers = {};
|
||||
|
||||
@ -234,7 +234,7 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
const id = this.requestNextInsertId(animationXML.id, output);
|
||||
|
||||
if(!id) continue;
|
||||
if (!id) continue;
|
||||
|
||||
output[id] = animation;
|
||||
}
|
||||
@ -242,19 +242,19 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationAnimationLayerXML(xml: AnimationLayerXML[], output: { [index: string]: IAssetVisualAnimationLayer }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const animationLayerXML of xml)
|
||||
for (const animationLayerXML of xml)
|
||||
{
|
||||
const animationLayer: IAssetVisualAnimationLayer = {};
|
||||
|
||||
if(animationLayerXML.frameRepeat !== undefined) animationLayer.frameRepeat = animationLayerXML.frameRepeat;
|
||||
if(animationLayerXML.loopCount !== undefined) animationLayer.loopCount = animationLayerXML.loopCount;
|
||||
if(animationLayerXML.random !== undefined) animationLayer.random = animationLayerXML.random;
|
||||
if (animationLayerXML.frameRepeat !== undefined) animationLayer.frameRepeat = animationLayerXML.frameRepeat;
|
||||
if (animationLayerXML.loopCount !== undefined) animationLayer.loopCount = animationLayerXML.loopCount;
|
||||
if (animationLayerXML.random !== undefined) animationLayer.random = animationLayerXML.random;
|
||||
|
||||
if(animationLayerXML.frameSequences !== undefined)
|
||||
if (animationLayerXML.frameSequences !== undefined)
|
||||
{
|
||||
if(animationLayerXML.frameSequences.length)
|
||||
if (animationLayerXML.frameSequences.length)
|
||||
{
|
||||
animationLayer.frameSequences = {};
|
||||
|
||||
@ -268,20 +268,20 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationFrameSequenceXML(xml: FrameSequenceXML[], output: { [index: string]: IAssetVisualAnimationSequence }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
let i = 0;
|
||||
|
||||
for(const frameSequenceXML of xml)
|
||||
for (const frameSequenceXML of xml)
|
||||
{
|
||||
const frameSequence: IAssetVisualAnimationSequence = {};
|
||||
|
||||
if(frameSequenceXML.loopCount !== undefined) frameSequence.loopCount = frameSequenceXML.loopCount;
|
||||
if(frameSequenceXML.random !== undefined) frameSequence.random = frameSequenceXML.random;
|
||||
if (frameSequenceXML.loopCount !== undefined) frameSequence.loopCount = frameSequenceXML.loopCount;
|
||||
if (frameSequenceXML.random !== undefined) frameSequence.random = frameSequenceXML.random;
|
||||
|
||||
if(frameSequenceXML.frames !== undefined)
|
||||
if (frameSequenceXML.frames !== undefined)
|
||||
{
|
||||
if(frameSequenceXML.frames.length)
|
||||
if (frameSequenceXML.frames.length)
|
||||
{
|
||||
frameSequence.frames = {};
|
||||
|
||||
@ -297,25 +297,25 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationFrameSequenceFrameXML(xml: FrameXML[], output: { [index: string]: IAssetVisualAnimationSequenceFrame }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
let i = 0;
|
||||
|
||||
for(const frameXML of xml)
|
||||
for (const frameXML of xml)
|
||||
{
|
||||
const frame: IAssetVisualAnimationSequenceFrame = {};
|
||||
|
||||
if((frameXML.id === undefined) || (frameXML.id === 'NaN')) frame.id = 0;
|
||||
if ((frameXML.id === undefined) || (frameXML.id === 'NaN')) frame.id = 0;
|
||||
else frame.id = parseInt(frameXML.id);
|
||||
|
||||
if(frameXML.x !== undefined) frame.x = frameXML.x;
|
||||
if(frameXML.y !== undefined) frame.y = frameXML.y;
|
||||
if(frameXML.randomX !== undefined) frame.randomX = frameXML.randomX;
|
||||
if(frameXML.randomY !== undefined) frame.randomY = frameXML.randomY;
|
||||
if (frameXML.x !== undefined) frame.x = frameXML.x;
|
||||
if (frameXML.y !== undefined) frame.y = frameXML.y;
|
||||
if (frameXML.randomX !== undefined) frame.randomX = frameXML.randomX;
|
||||
if (frameXML.randomY !== undefined) frame.randomY = frameXML.randomY;
|
||||
|
||||
if(frameXML.offsets !== undefined)
|
||||
if (frameXML.offsets !== undefined)
|
||||
{
|
||||
if(frameXML.offsets.length)
|
||||
if (frameXML.offsets.length)
|
||||
{
|
||||
frame.offsets = {};
|
||||
|
||||
@ -331,17 +331,17 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationFrameSequenceFrameOffsetXML(xml: FrameOffsetXML[], output: { [index: string]: IAssetVisualAnimationSequenceFrameOffset }): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
let i = 0;
|
||||
|
||||
for(const offsetXML of xml)
|
||||
for (const offsetXML of xml)
|
||||
{
|
||||
const offset: IAssetVisualAnimationSequenceFrameOffset = {};
|
||||
|
||||
if(offsetXML.direction !== undefined) offset.direction = offsetXML.direction;
|
||||
if(offsetXML.x !== undefined) offset.x = offsetXML.x;
|
||||
if(offsetXML.y !== undefined) offset.y = offsetXML.y;
|
||||
if (offsetXML.direction !== undefined) offset.direction = offsetXML.direction;
|
||||
if (offsetXML.x !== undefined) offset.x = offsetXML.x;
|
||||
if (offsetXML.y !== undefined) offset.y = offsetXML.y;
|
||||
|
||||
output[i.toString()] = offset;
|
||||
|
||||
@ -351,14 +351,14 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationPostureXML(xml: PostureXML[], output: IAssetPosture[]): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const postureXML of xml)
|
||||
for (const postureXML of xml)
|
||||
{
|
||||
const posture: IAssetPosture = {};
|
||||
|
||||
if(postureXML.id !== undefined) posture.id = postureXML.id;
|
||||
if(postureXML.animationId !== undefined) posture.animationId = postureXML.animationId;
|
||||
if (postureXML.id !== undefined) posture.id = postureXML.id;
|
||||
if (postureXML.animationId !== undefined) posture.animationId = postureXML.animationId;
|
||||
|
||||
output.push(posture);
|
||||
}
|
||||
@ -366,14 +366,14 @@ export class VisualizationMapper extends Mapper
|
||||
|
||||
private static mapVisualizationGestureXML(xml: GestureXML[], output: IAssetGesture[]): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
if (!xml || !xml.length || !output) return;
|
||||
|
||||
for(const gestureXML of xml)
|
||||
for (const gestureXML of xml)
|
||||
{
|
||||
const gesture: IAssetGesture = {};
|
||||
|
||||
if(gestureXML.id !== undefined) gesture.id = gestureXML.id;
|
||||
if(gestureXML.animationId !== undefined) gesture.animationId = gestureXML.animationId;
|
||||
if (gestureXML.id !== undefined) gesture.id = gestureXML.id;
|
||||
if (gestureXML.animationId !== undefined) gesture.animationId = gestureXML.animationId;
|
||||
|
||||
output.push(gesture);
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
import { PlaneAnimationLayerItemXML } from './PlaneAnimationLayerItemXML';
|
||||
|
||||
export class PlaneAnimationLayerXML
|
||||
{
|
||||
private readonly _items: PlaneAnimationLayerItemXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
const attributes = xml.$;
|
||||
|
||||
if ((xml.animationItem !== undefined) && Array.isArray(xml.animationItem))
|
||||
{
|
||||
this._items = [];
|
||||
|
||||
for (const item of xml.animationItem) this._items.push(new PlaneAnimationLayerItemXML(item));
|
||||
}
|
||||
}
|
||||
|
||||
public get items(): PlaneAnimationLayerItemXML[]
|
||||
{
|
||||
return this._items;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import { RoomPlaneMaskXML } from './RoomPlaneMaskXML';
|
||||
|
||||
export class PlaneMaskVisualizationDataXML
|
||||
{
|
||||
private readonly _masks: RoomPlaneMaskXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
const attributes = xml.$;
|
||||
|
||||
if ((xml.mask !== undefined) && Array.isArray(xml.mask))
|
||||
{
|
||||
this._masks = [];
|
||||
|
||||
for (const mask of xml.mask) this._masks.push(new RoomPlaneMaskXML(mask));
|
||||
}
|
||||
}
|
||||
|
||||
public get masks(): RoomPlaneMaskXML[]
|
||||
{
|
||||
return this._masks;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
import { PlaneTextureBitmapXML } from './texture';
|
||||
|
||||
export class PlaneMaskVisualizationXML
|
||||
{
|
||||
private readonly _size: number;
|
||||
private readonly _bitmaps: PlaneTextureBitmapXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
const attributes = xml.$;
|
||||
|
||||
if (attributes !== undefined)
|
||||
{
|
||||
if (attributes.size !== undefined) this._size = parseInt(attributes.size);
|
||||
}
|
||||
|
||||
if ((xml.bitmap !== undefined) && Array.isArray(xml.bitmap))
|
||||
{
|
||||
this._bitmaps = [];
|
||||
|
||||
for (const bitmap of xml.bitmap) this._bitmaps.push(new PlaneTextureBitmapXML(bitmap));
|
||||
}
|
||||
}
|
||||
|
||||
public get size(): number
|
||||
{
|
||||
return this._size;
|
||||
}
|
||||
|
||||
public get bitmaps(): PlaneTextureBitmapXML[]
|
||||
{
|
||||
return this._bitmaps;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
export class PlaneAnimationLayerItemXML
|
||||
export class PlaneVisualizationAnimatedLayerItemXML
|
||||
{
|
||||
private readonly _id: number;
|
||||
private readonly _assetId: string;
|
@ -0,0 +1,23 @@
|
||||
import { PlaneVisualizationAnimatedLayerItemXML } from './PlaneVisualizationAnimatedLayerItemXML';
|
||||
|
||||
export class PlaneVisualizationAnimatedLayerXML
|
||||
{
|
||||
private readonly _items: PlaneVisualizationAnimatedLayerItemXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
const attributes = xml.$;
|
||||
|
||||
if ((xml.animationItem !== undefined) && Array.isArray(xml.animationItem))
|
||||
{
|
||||
this._items = [];
|
||||
|
||||
for (const item of xml.animationItem) this._items.push(new PlaneVisualizationAnimatedLayerItemXML(item));
|
||||
}
|
||||
}
|
||||
|
||||
public get items(): PlaneVisualizationAnimatedLayerItemXML[]
|
||||
{
|
||||
return this._items;
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
import { PlaneMaterialXML } from './PlaneMaterialXML';
|
||||
import { PlaneTextureXML } from './PlaneTextureXML';
|
||||
import { PlaneVisualizationXML } from './PlaneVisualizationXML';
|
||||
import { PlaneMaterialXML } from './material';
|
||||
import { PlaneXML } from './PlaneXML';
|
||||
import { PlaneTextureXML } from './texture';
|
||||
|
||||
export class PlaneVisualizationDataXML
|
||||
{
|
||||
private readonly _planes: PlaneVisualizationXML[];
|
||||
private readonly _planes: PlaneXML[];
|
||||
private readonly _materials: PlaneMaterialXML[];
|
||||
private readonly _textures: PlaneTextureXML[];
|
||||
|
||||
@ -18,7 +18,7 @@ export class PlaneVisualizationDataXML
|
||||
|
||||
for (const wallParent of xml.walls)
|
||||
{
|
||||
if (Array.isArray(wallParent.wall)) for (const wall of wallParent.wall) this._planes.push(new PlaneVisualizationXML(wall));
|
||||
if (Array.isArray(wallParent.wall)) for (const wall of wallParent.wall) this._planes.push(new PlaneXML(wall));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ export class PlaneVisualizationDataXML
|
||||
|
||||
for (const floorParent of xml.floors)
|
||||
{
|
||||
if (Array.isArray(floorParent.floor)) for (const floor of floorParent.floor) this._planes.push(new PlaneVisualizationXML(floor));
|
||||
if (Array.isArray(floorParent.floor)) for (const floor of floorParent.floor) this._planes.push(new PlaneXML(floor));
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ export class PlaneVisualizationDataXML
|
||||
|
||||
for (const landscapeParent of xml.landscapes)
|
||||
{
|
||||
if (Array.isArray(landscapeParent.landscape)) for (const landscape of landscapeParent.landscape) this._planes.push(new PlaneVisualizationXML(landscape));
|
||||
if (Array.isArray(landscapeParent.landscape)) for (const landscape of landscapeParent.landscape) this._planes.push(new PlaneXML(landscape));
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ export class PlaneVisualizationDataXML
|
||||
}
|
||||
}
|
||||
|
||||
public get planes(): PlaneVisualizationXML[]
|
||||
public get planes(): PlaneXML[]
|
||||
{
|
||||
return this._planes;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class PlaneLayerXML
|
||||
export class PlaneVisualizationLayerXML
|
||||
{
|
||||
private readonly _materialId: string;
|
||||
private readonly _color: number;
|
@ -1,10 +1,13 @@
|
||||
import { PlaneXML } from './PlaneXML';
|
||||
import { PlaneVisualizationAnimatedLayerXML } from './PlaneVisualizationAnimatedLayerXML';
|
||||
import { PlaneVisualizationLayerXML } from './PlaneVisualizationLayerXML';
|
||||
|
||||
export class PlaneVisualizationXML
|
||||
{
|
||||
private readonly _id: string;
|
||||
private readonly _visualizations: PlaneXML[];
|
||||
private readonly _animatedVisualization: PlaneXML[];
|
||||
private readonly _size: number;
|
||||
private readonly _horizontalAngle: number;
|
||||
private readonly _verticalAngle: number;
|
||||
private readonly _layers: PlaneVisualizationLayerXML[];
|
||||
private readonly _animatedLayers: PlaneVisualizationAnimatedLayerXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
@ -12,36 +15,48 @@ export class PlaneVisualizationXML
|
||||
|
||||
if (attributes !== undefined)
|
||||
{
|
||||
if (attributes.id !== undefined) this._id = attributes.id;
|
||||
if (attributes.size !== undefined) this._size = parseInt(attributes.size);
|
||||
if (attributes.horizontalAngle !== undefined) this._horizontalAngle = parseFloat(attributes.horizontalAngle);
|
||||
if (attributes.verticalAngle !== undefined) this._verticalAngle = parseFloat(attributes.verticalAngle);
|
||||
}
|
||||
|
||||
if ((xml.visualization !== undefined) && Array.isArray(xml.visualization))
|
||||
if ((xml.visualizationLayer !== undefined) && Array.isArray(xml.visualizationLayer))
|
||||
{
|
||||
this._visualizations = [];
|
||||
this._layers = [];
|
||||
|
||||
for (const visualization of xml.visualization) this._visualizations.push(new PlaneXML(visualization));
|
||||
for (const layer of xml.visualizationLayer) this._layers.push(new PlaneVisualizationLayerXML(layer));
|
||||
}
|
||||
|
||||
if ((xml.animatedVisualization !== undefined) && Array.isArray(xml.animatedVisualization))
|
||||
if ((xml.animationLayer !== undefined) && Array.isArray(xml.animationLayer))
|
||||
{
|
||||
this._animatedVisualization = [];
|
||||
this._animatedLayers = [];
|
||||
|
||||
for (const visualization of xml.animatedVisualization) this._animatedVisualization.push(new PlaneXML(visualization));
|
||||
for (const layer of xml.animationLayer) this._animatedLayers.push(new PlaneVisualizationAnimatedLayerXML(layer));
|
||||
}
|
||||
}
|
||||
|
||||
public get id(): string
|
||||
public get size(): number
|
||||
{
|
||||
return this._id;
|
||||
return this._size;
|
||||
}
|
||||
|
||||
public get visualizations(): PlaneXML[]
|
||||
public get horizontalAngle(): number
|
||||
{
|
||||
return this._visualizations;
|
||||
return this._horizontalAngle;
|
||||
}
|
||||
|
||||
public get animatedVisualization(): PlaneXML[]
|
||||
public get verticalAngle(): number
|
||||
{
|
||||
return this._animatedVisualization;
|
||||
return this._verticalAngle;
|
||||
}
|
||||
|
||||
public get layers(): PlaneVisualizationLayerXML[]
|
||||
{
|
||||
return this._layers;
|
||||
}
|
||||
|
||||
public get animatedLayers(): PlaneVisualizationAnimatedLayerXML[]
|
||||
{
|
||||
return this._animatedLayers;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { PlaneAnimationLayerXML } from './PlaneAnimationLayerXML';
|
||||
import { PlaneLayerXML } from './PlaneLayerXML';
|
||||
import { PlaneVisualizationXML } from './PlaneVisualizationXML';
|
||||
|
||||
export class PlaneXML
|
||||
{
|
||||
private readonly _size: number;
|
||||
private readonly _horizontalAngle: number;
|
||||
private readonly _verticalAngle: number;
|
||||
private readonly _layers: PlaneLayerXML[];
|
||||
private readonly _animatedLayers: PlaneAnimationLayerXML[];
|
||||
private readonly _id: string;
|
||||
private readonly _visualizations: PlaneVisualizationXML[];
|
||||
private readonly _animatedVisualization: PlaneVisualizationXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
@ -15,48 +12,36 @@ export class PlaneXML
|
||||
|
||||
if (attributes !== undefined)
|
||||
{
|
||||
if (attributes.size !== undefined) this._size = parseInt(attributes.size);
|
||||
if (attributes.horizontalAngle !== undefined) this._horizontalAngle = parseFloat(attributes.horizontalAngle);
|
||||
if (attributes.verticalAngle !== undefined) this._verticalAngle = parseFloat(attributes.verticalAngle);
|
||||
if (attributes.id !== undefined) this._id = attributes.id;
|
||||
}
|
||||
|
||||
if ((xml.visualizationLayer !== undefined) && Array.isArray(xml.visualizationLayer))
|
||||
if ((xml.visualization !== undefined) && Array.isArray(xml.visualization))
|
||||
{
|
||||
this._layers = [];
|
||||
this._visualizations = [];
|
||||
|
||||
for (const layer of xml.visualizationLayer) this._layers.push(new PlaneLayerXML(layer));
|
||||
for (const visualization of xml.visualization) this._visualizations.push(new PlaneVisualizationXML(visualization));
|
||||
}
|
||||
|
||||
if ((xml.animationLayer !== undefined) && Array.isArray(xml.animationLayer))
|
||||
if ((xml.animatedVisualization !== undefined) && Array.isArray(xml.animatedVisualization))
|
||||
{
|
||||
this._animatedLayers = [];
|
||||
this._animatedVisualization = [];
|
||||
|
||||
for (const layer of xml.animationLayer) this._animatedLayers.push(new PlaneAnimationLayerXML(layer));
|
||||
for (const visualization of xml.animatedVisualization) this._animatedVisualization.push(new PlaneVisualizationXML(visualization));
|
||||
}
|
||||
}
|
||||
|
||||
public get size(): number
|
||||
public get id(): string
|
||||
{
|
||||
return this._size;
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get horizontalAngle(): number
|
||||
public get visualizations(): PlaneVisualizationXML[]
|
||||
{
|
||||
return this._horizontalAngle;
|
||||
return this._visualizations;
|
||||
}
|
||||
|
||||
public get verticalAngle(): number
|
||||
public get animatedVisualization(): PlaneVisualizationXML[]
|
||||
{
|
||||
return this._verticalAngle;
|
||||
}
|
||||
|
||||
public get layers(): PlaneLayerXML[]
|
||||
{
|
||||
return this._layers;
|
||||
}
|
||||
|
||||
public get animatedLayers(): PlaneAnimationLayerXML[]
|
||||
{
|
||||
return this._animatedLayers;
|
||||
return this._animatedVisualization;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
import { PlaneMaskVisualizationXML } from './PlaneMaskVisualizationXML';
|
||||
|
||||
export class RoomPlaneMaskXML
|
||||
{
|
||||
private readonly _id: string;
|
||||
private readonly _visualizations: PlaneMaskVisualizationXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
const attributes = xml.$;
|
||||
|
||||
if (attributes !== undefined)
|
||||
{
|
||||
if (attributes.id !== undefined) this._id = attributes.id;
|
||||
}
|
||||
|
||||
if ((xml.maskVisualization !== undefined) && Array.isArray(xml.maskVisualization))
|
||||
{
|
||||
this._visualizations = [];
|
||||
|
||||
for (const visualization of xml.maskVisualization) this._visualizations.push(new PlaneMaskVisualizationXML(visualization));
|
||||
}
|
||||
}
|
||||
|
||||
public get id(): string
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get visualizations(): PlaneMaskVisualizationXML[]
|
||||
{
|
||||
return this._visualizations;
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { PlaneMaskVisualizationDataXML } from './PlaneMaskVisualizationDataXML';
|
||||
import { PlaneVisualizationDataXML } from './PlaneVisualizationDataXML';
|
||||
|
||||
export class RoomVisualizationXML
|
||||
@ -5,6 +6,7 @@ export class RoomVisualizationXML
|
||||
private readonly _wallData: PlaneVisualizationDataXML;
|
||||
private readonly _floorData: PlaneVisualizationDataXML;
|
||||
private readonly _landscapeData: PlaneVisualizationDataXML;
|
||||
private readonly _maskData: PlaneMaskVisualizationDataXML;
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
@ -24,6 +26,11 @@ export class RoomVisualizationXML
|
||||
{
|
||||
this._landscapeData = new PlaneVisualizationDataXML(xml.landscapeData[0]);
|
||||
}
|
||||
|
||||
if ((xml.maskData !== undefined) && Array.isArray(xml.maskData))
|
||||
{
|
||||
this._maskData = new PlaneMaskVisualizationDataXML(xml.maskData[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public get wallData(): PlaneVisualizationDataXML
|
||||
@ -40,4 +47,9 @@ export class RoomVisualizationXML
|
||||
{
|
||||
return this._landscapeData;
|
||||
}
|
||||
|
||||
public get maskData(): PlaneMaskVisualizationDataXML
|
||||
{
|
||||
return this._maskData;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,10 @@
|
||||
export * from './material';
|
||||
export * from './PlaneMaskVisualizationDataXML';
|
||||
export * from './PlaneVisualizationAnimatedLayerItemXML';
|
||||
export * from './PlaneVisualizationAnimatedLayerXML';
|
||||
export * from './PlaneVisualizationDataXML';
|
||||
export * from './PlaneVisualizationLayerXML';
|
||||
export * from './PlaneVisualizationXML';
|
||||
export * from './PlaneXML';
|
||||
export * from './RoomVisualizationXML';
|
||||
export * from './texture';
|
||||
|
@ -0,0 +1,5 @@
|
||||
export * from './PlaneMaterialCellColumnXML';
|
||||
export * from './PlaneMaterialCellExtraItemDataXML';
|
||||
export * from './PlaneMaterialCellMatrixXML';
|
||||
export * from './PlaneMaterialCellXML';
|
||||
export * from './PlaneMaterialXML';
|
@ -0,0 +1,2 @@
|
||||
export * from './PlaneTextureBitmapXML';
|
||||
export * from './PlaneTextureXML';
|
@ -4,12 +4,16 @@ import { SWFUtilities } from './SWFUtilities';
|
||||
|
||||
export const GenerateNitroBundleFromSwf = async (habboAssetSWF: HabboAssetSWF, assetType: string = null) =>
|
||||
{
|
||||
if(!habboAssetSWF) return null;
|
||||
if (!habboAssetSWF) return null;
|
||||
|
||||
const spriteBundle = await GenerateSpriteSheet(habboAssetSWF);
|
||||
const assetData = await SWFUtilities.mapXML2JSON(habboAssetSWF, assetType);
|
||||
|
||||
if(assetData) assetData.name = habboAssetSWF.getDocumentClass();
|
||||
let assetName = habboAssetSWF.getDocumentClass();
|
||||
|
||||
return SWFUtilities.createNitroBundle(assetData.name, assetData, spriteBundle);
|
||||
if (assetName === 'HabboRoomContent') assetName = 'room';
|
||||
|
||||
assetData.name = assetName;
|
||||
|
||||
return SWFUtilities.createNitroBundle(assetName, assetData, spriteBundle);
|
||||
};
|
||||
|
@ -12,9 +12,11 @@ export const GenerateSpriteSheet = async (habboAssetSWF: HabboAssetSWF, convertC
|
||||
|
||||
let documentClass = habboAssetSWF.getDocumentClass();
|
||||
|
||||
if(convertCase) documentClass = (documentClass.replace(/(?:^|\.?)([A-Z])/g, (x,y) => ('_' + y.toLowerCase().replace(/^_/, ''))));
|
||||
if (documentClass === 'HabboRoomContent') documentClass = 'room';
|
||||
|
||||
for(const tag of tagList)
|
||||
if (convertCase) documentClass = (documentClass.replace(/(?:^|\.?)([A-Z])/g, (x, y) => ('_' + y.toLowerCase().replace(/^_/, ''))));
|
||||
|
||||
for (const tag of tagList)
|
||||
{
|
||||
names.push(...tag.names);
|
||||
tags.push(...tag.tags);
|
||||
@ -24,36 +26,38 @@ export const GenerateSpriteSheet = async (habboAssetSWF: HabboAssetSWF, convertC
|
||||
|
||||
const imageTags = habboAssetSWF.imageTags();
|
||||
|
||||
for(const imageTag of imageTags)
|
||||
for (const imageTag of imageTags)
|
||||
{
|
||||
if(tags.includes(imageTag.characterId))
|
||||
if (tags.includes(imageTag.characterId))
|
||||
{
|
||||
for(let i = 0; i < tags.length; i++)
|
||||
for (let i = 0; i < tags.length; i++)
|
||||
{
|
||||
if(tags[i] != imageTag.characterId) continue;
|
||||
if (tags[i] != imageTag.characterId) continue;
|
||||
|
||||
if(names[i] == imageTag.className) continue;
|
||||
if (names[i] == imageTag.className) continue;
|
||||
|
||||
if(imageTag.className.startsWith('sh_')) continue;
|
||||
if (imageTag.className.startsWith('sh_')) continue;
|
||||
|
||||
if(imageTag.className.indexOf('_32_') >= 0) continue;
|
||||
if (imageTag.className.indexOf('_32_') >= 0) continue;
|
||||
|
||||
IMAGE_SOURCES.set(names[i].substring(documentClass.length + 1), imageTag.className.substring(documentClass.length + 1));
|
||||
}
|
||||
}
|
||||
|
||||
if(imageTag.className.startsWith('sh_')) continue;
|
||||
if (imageTag.className.startsWith('sh_')) continue;
|
||||
|
||||
if(imageTag.className.indexOf('_32_') >= 0) continue;
|
||||
if (imageTag.className.indexOf('_32_') >= 0) continue;
|
||||
|
||||
let className = imageTag.className;
|
||||
|
||||
if(convertCase) className = ((className.replace(/(?:^|\.?)([A-Z])/g, (x,y) => ('_' + y.toLowerCase().replace(/^_/, '')))).substring(1));
|
||||
if (convertCase) className = ((className.replace(/(?:^|\.?)([A-Z])/g, (x, y) => ('_' + y.toLowerCase().replace(/^_/, '')))).substring(1));
|
||||
|
||||
if (className.startsWith('HabboRoomContent')) className = className.replace('HabboRoomContent', 'room');
|
||||
|
||||
imageBundle.addImage(className, imageTag.imgData);
|
||||
}
|
||||
|
||||
if(!imageBundle.images.length) return null;
|
||||
if (!imageBundle.images.length) return null;
|
||||
|
||||
return await PackImages(documentClass, imageBundle, convertCase);
|
||||
};
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { wrap } from 'bytebuffer';
|
||||
import { writeFile } from 'fs/promises';
|
||||
import { parseStringPromise } from 'xml2js';
|
||||
import { AnimationMapper, AssetMapper, IAssetData, IndexMapper, LogicMapper, ManifestMapper, NitroBundle, RoomVisualizationMapper, SpriteBundle, VisualizationMapper } from '../common';
|
||||
import { HabboAssetSWF } from './HabboAssetSWF';
|
||||
@ -15,6 +16,8 @@ export class SWFUtilities
|
||||
{
|
||||
if (spriteBundle && (spriteBundle.spritesheet !== undefined)) assetData.spritesheet = spriteBundle.spritesheet;
|
||||
|
||||
writeFile('room.json', JSON.stringify(assetData), 'utf8');
|
||||
|
||||
const nitroBundle = new NitroBundle();
|
||||
|
||||
nitroBundle.addFile((className + '.json'), Buffer.from(JSON.stringify(assetData)));
|
||||
@ -87,8 +90,6 @@ export class SWFUtilities
|
||||
{
|
||||
const binaryData = SWFUtilities.getBinaryData(habboAssetSWF, 'visualization', true, snakeCase);
|
||||
|
||||
console.log(binaryData);
|
||||
|
||||
if (!binaryData) return null;
|
||||
|
||||
return await parseStringPromise(this.removeComments(binaryData.binaryData));
|
||||
@ -164,7 +165,9 @@ export class SWFUtilities
|
||||
|
||||
if (manifestXML) ManifestMapper.mapXML(manifestXML, output);
|
||||
|
||||
const assetXML = await this.getAssetsXML(habboAssetSWF, snakeCase);
|
||||
let assetXML = await this.getAssetsXML(habboAssetSWF, snakeCase);
|
||||
|
||||
if (!assetXML) assetXML = await this.getRoomAssetsXML(habboAssetSWF, snakeCase);
|
||||
|
||||
if (assetXML)
|
||||
{
|
||||
@ -194,10 +197,6 @@ export class SWFUtilities
|
||||
}
|
||||
}
|
||||
|
||||
const roomAssetXML = await this.getRoomAssetsXML(habboAssetSWF, snakeCase);
|
||||
|
||||
if (assetXML) AssetMapper.mapXML(roomAssetXML, output);
|
||||
|
||||
const animationXML = await this.getAnimationXML(habboAssetSWF, snakeCase);
|
||||
|
||||
if (animationXML) AnimationMapper.mapXML(animationXML, output);
|
||||
@ -209,10 +208,12 @@ export class SWFUtilities
|
||||
const visualizationXML = await this.getVisualizationXML(habboAssetSWF, snakeCase);
|
||||
|
||||
if (visualizationXML) VisualizationMapper.mapXML(visualizationXML, output);
|
||||
else
|
||||
{
|
||||
const visualizationXML = await this.getRoomVisualizationXML(habboAssetSWF, snakeCase);
|
||||
|
||||
const roomVisualizationXML = await this.getRoomVisualizationXML(habboAssetSWF, snakeCase);
|
||||
|
||||
if (roomVisualizationXML) RoomVisualizationMapper.mapXML(roomVisualizationXML, output);
|
||||
if (visualizationXML) RoomVisualizationMapper.mapXML(visualizationXML, output);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user