Added nopitch

This commit is contained in:
SpreedBLood 2021-03-14 01:59:00 +01:00
parent b817561a85
commit 7303e35076
4 changed files with 24 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import { IAssetDimension } from './IAssetDimension';
import { IAssetPalette } from './IAssetPalette'; import { IAssetPalette } from './IAssetPalette';
import { ISpritesheetData } from './spritesheet'; import { ISpritesheetData } from './spritesheet';
import { IAssetVisualizationData } from './visualization'; import { IAssetVisualizationData } from './visualization';
import {ISoundSample} from "./ISoundSample";
export interface IAssetData { export interface IAssetData {
type?: string; type?: string;
@ -13,7 +14,7 @@ export interface IAssetData {
logicType?: string; logicType?: string;
maskType?: string; maskType?: string;
credits?: string; credits?: string;
soundSample?: number; soundSample?: ISoundSample;
action?: { link?: string, startState?: number }; action?: { link?: string, startState?: number };
spritesheet?: ISpritesheetData; spritesheet?: ISpritesheetData;
dimensions?: IAssetDimension; dimensions?: IAssetDimension;

View File

@ -0,0 +1,4 @@
export interface ISoundSample {
id?: number,
noPitch?: boolean
}

View File

@ -1,6 +1,7 @@
import {IAssetData} from '../../json'; import {IAssetData} from '../../json';
import {LogicXML} from '../../xml'; import {LogicXML} from '../../xml';
import {Mapper} from './Mapper'; import {Mapper} from './Mapper';
import {ISoundSample} from "../../json/asset/ISoundSample";
export class LogicMapper extends Mapper export class LogicMapper extends Mapper
{ {
@ -64,6 +65,12 @@ export class LogicMapper extends Mapper
if(xml.credits !== undefined) output.credits = xml.credits.value; if(xml.credits !== undefined) output.credits = xml.credits.value;
if(xml.soundSample !== undefined) output.soundSample = xml.soundSample.id; if(xml.soundSample !== undefined)
{
output.soundSample = {
id: xml.soundSample.id,
noPitch: xml.soundSample.noPitch
};
}
} }
} }

View File

@ -1,6 +1,7 @@
export class SoundSampleXML export class SoundSampleXML
{ {
private readonly _id: number; private readonly _id: number;
private readonly _noPitch: boolean;
constructor(xml: any) constructor(xml: any)
{ {
@ -9,6 +10,7 @@ export class SoundSampleXML
if(attributes !== undefined) if(attributes !== undefined)
{ {
if(attributes.id !== undefined) this._id = parseInt(attributes.id); if(attributes.id !== undefined) this._id = parseInt(attributes.id);
if(attributes.nopitch !== undefined) this._noPitch = attributes.nopitch === 'true';
} }
} }
@ -16,4 +18,9 @@ export class SoundSampleXML
{ {
return this._id; return this._id;
} }
get noPitch(): boolean
{
return this._noPitch;
}
} }