@bscotch/stitch
Version:
Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.
93 lines • 5.45 kB
TypeScript
import { YypResource } from '@bscotch/yy';
import type { StitchProject, StitchProjectComms } from '../StitchProject.js';
import { Gms2Animation } from './resources/Gms2Animation.js';
import { Gms2Extension } from './resources/Gms2Extension.js';
import { Gms2Font } from './resources/Gms2Font.js';
import { Gms2Note } from './resources/Gms2Note.js';
import { Gms2Object } from './resources/Gms2Object.js';
import { Gms2Particle } from './resources/Gms2Particle.js';
import { Gms2Path } from './resources/Gms2Path.js';
import { Gms2ResourceBase } from './resources/Gms2ResourceBase.js';
import { Gms2Room } from './resources/Gms2Room.js';
import { Gms2Script } from './resources/Gms2Script.js';
import { Gms2Sequence } from './resources/Gms2Sequence.js';
import { Gms2Shader } from './resources/Gms2Shader.js';
import { Gms2Sound } from './resources/Gms2Sound.js';
import { Gms2Sprite } from './resources/Gms2Sprite.js';
import { Gms2Tileset } from './resources/Gms2Tileset.js';
import { Gms2Timeline } from './resources/Gms2Timeline.js';
export declare class Gms2ResourceArray {
readonly project: StitchProject;
private items;
constructor(project: StitchProject, data: YypResource[]);
toJSON(): YypResource[];
get sprites(): Gms2Sprite[];
get sounds(): Gms2Sound[];
get scripts(): Gms2Script[];
get objects(): Gms2Object[];
get rooms(): Gms2Room[];
get all(): Gms2ResourceSubclass[];
filterByClass<subclass extends Gms2ResourceSubclassType>(resourceClass: subclass): InstanceType<subclass>[];
filter(matchFunction: (item: Gms2ResourceBase) => any): Gms2ResourceSubclass[];
forEach(doSomething: (item: Gms2ResourceBase) => any): this;
find(matchFunction: (item: Gms2ResourceSubclass) => any): Gms2ResourceSubclass | undefined;
findByClass<subclass extends Gms2ResourceSubclassType>(matchFunction: (item: Gms2ResourceSubclass) => any, resourceClass: subclass): InstanceType<subclass> | undefined;
findByName<subclass extends Gms2ResourceSubclassType>(name: string, resourceClass: subclass): InstanceType<subclass> | undefined;
findByName<subclass extends Gms2ResourceSubclassType>(name: string): InstanceType<subclass> | undefined;
findByName(name: any): Gms2ResourceSubclass | undefined;
findByField<subclass extends Gms2ResourceSubclassType>(field: keyof Gms2ResourceSubclass, value: any, resourceClass: subclass): InstanceType<subclass> | undefined;
/** Find all resources in a given folder */
filterByFolder(folder: string, recursive?: boolean): Gms2ResourceSubclass[];
/** Find all resources of a given type within a folder */
filterByClassAndFolder<subclass extends Gms2ResourceSubclassType>(resourceClass: subclass, folder: string, recursive?: boolean): InstanceType<subclass>[];
addSound(source: string, comms: StitchProjectComms): Promise<this>;
addScript(name: string, code: string, comms: StitchProjectComms): Promise<this>;
addSprite(sourceFolder: string, comms: StitchProjectComms, nameOverride?: string): Promise<this>;
addSpineSprite(_jsonSourcePath: string, comms: StitchProjectComms, nameOverride?: string): Promise<this>;
addObject(name: string, comms: StitchProjectComms): Promise<Gms2Object>;
addRoom(name: string, comms: StitchProjectComms): Promise<Gms2Room>;
/**
* Delete a resource, if it exists. **NOTE:** if other
* resources depend on this one you'll be creating errors
* by deleting it!
*/
deleteByName(name: string): this;
/**
* Given Yyp data for a resource that **is not listed in the yyp file**
* but that **does have .yy and associated files**, add hydrate the object
* and add it to the Yyp.
*/
register(data: YypResource, comms: StitchProjectComms): void;
private push;
static get resourceClassMap(): {
readonly animcurves: typeof Gms2Animation;
readonly extensions: typeof Gms2Extension;
readonly fonts: typeof Gms2Font;
readonly notes: typeof Gms2Note;
readonly objects: typeof Gms2Object;
readonly particles: typeof Gms2Particle;
readonly paths: typeof Gms2Path;
readonly rooms: typeof Gms2Room;
readonly scripts: typeof Gms2Script;
readonly sequences: typeof Gms2Sequence;
readonly shaders: typeof Gms2Shader;
readonly sounds: typeof Gms2Sound;
readonly sprites: typeof Gms2Sprite;
readonly tilesets: typeof Gms2Tileset;
readonly timelines: typeof Gms2Timeline;
};
/**
* Get a new array listing the names of all resource types.
*/
static get resourceTypeNames(): ("animcurves" | "extensions" | "fonts" | "notes" | "objects" | "particles" | "paths" | "rooms" | "scripts" | "sequences" | "shaders" | "sounds" | "sprites" | "tilesets" | "timelines")[];
/**
* Get all global functions defined across all Scripts
* (does not include built-ins).
*/
getGlobalFunctions(): import("../parser/GmlToken.js").GmlToken[];
static hydrateResource(data: YypResource, comms: StitchProjectComms): Gms2ResourceSubclass;
}
export type Gms2ResourceSubclassType = (typeof Gms2ResourceArray.resourceClassMap)[keyof typeof Gms2ResourceArray.resourceClassMap] | typeof Gms2ResourceBase;
export type Gms2ResourceSubclass = InstanceType<Gms2ResourceSubclassType>;
export type Gms2ResourceType = keyof typeof Gms2ResourceArray.resourceClassMap;
//# sourceMappingURL=Gms2ResourceArray.d.ts.map