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 { ISpritesheetData } from './spritesheet';
import { IAssetVisualizationData } from './visualization';
import {ISoundSample} from "./ISoundSample";
export interface IAssetData {
type?: string;
@ -13,7 +14,7 @@ export interface IAssetData {
logicType?: string;
maskType?: string;
credits?: string;
soundSample?: number;
soundSample?: ISoundSample;
action?: { link?: string, startState?: number };
spritesheet?: ISpritesheetData;
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 { LogicXML } from '../../xml';
import { Mapper } from './Mapper';
import {IAssetData} from '../../json';
import {LogicXML} from '../../xml';
import {Mapper} from './Mapper';
import {ISoundSample} from "../../json/asset/ISoundSample";
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.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
{
private readonly _id: number;
private readonly _noPitch: boolean;
constructor(xml: any)
{
@ -9,6 +10,7 @@ export class SoundSampleXML
if(attributes !== undefined)
{
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;
}
get noPitch(): boolean
{
return this._noPitch;
}
}