Sound samples

This commit is contained in:
SpreedBLood 2021-03-09 13:31:17 +01:00
parent f37a028fc1
commit fe3c695156
5 changed files with 35 additions and 0 deletions

View File

@ -13,6 +13,7 @@ export interface IAssetData {
logicType?: string;
maskType?: string;
credits?: string;
soundSample: number;
action?: { link?: string, startState?: number };
spritesheet?: ISpritesheetData;
dimensions?: IAssetDimension;

View File

@ -63,5 +63,7 @@ export class LogicMapper extends Mapper
if(xml.mask !== undefined) output.maskType = xml.mask.type;
if(xml.credits !== undefined) output.credits = xml.credits.value;
if(xml.soundSample !== undefined) output.soundSample = xml.soundSample.id;
}
}

View File

@ -2,6 +2,7 @@ import { ActionXML } from './ActionXML';
import { CreditsXML } from './CreditsXML';
import { MaskXML } from './MaskXML';
import { ModelXML } from './model/ModelXML';
import {SoundSampleXML} from "./SoundSampleXML";
export class LogicXML
{
@ -10,6 +11,7 @@ export class LogicXML
private readonly _action: ActionXML;
private readonly _mask: MaskXML;
private readonly _credits: CreditsXML;
private readonly _soundSample: SoundSampleXML;
constructor(xml: any)
{
@ -39,6 +41,11 @@ export class LogicXML
{
if(xml.credits[0] !== undefined) this._credits = new CreditsXML(xml.credits[0]);
}
if(xml.sound !== undefined)
{
if(xml.sound[0] !== undefined) this._soundSample = new SoundSampleXML(xml.sound[0].sample);
}
}
public get type(): string
@ -65,4 +72,9 @@ export class LogicXML
{
return this._credits;
}
public get soundSample(): SoundSampleXML | undefined
{
return this._soundSample;
}
}

View File

@ -0,0 +1,19 @@
export class SoundSampleXML
{
private readonly _id: number;
constructor(xml: any)
{
const attributes = xml[0].$;
if(attributes !== undefined)
{
if(attributes.id !== undefined) this._id = parseInt(attributes.id);
}
}
public get id(): number
{
return this._id;
}
}

View File

@ -3,3 +3,4 @@ export * from './CreditsXML';
export * from './LogicXML';
export * from './MaskXML';
export * from './model';
export * from './SoundSampleXML';