UNPKG

@bscotch/stitch

Version:

Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.

87 lines 3.55 kB
import { YyBase, YypResource } from '@bscotch/yy'; import type { StitchProjectComms } from '../../StitchProject.js'; import type { StitchStorage } from '../../StitchStorage.js'; import type { Gms2ResourceType } from '../Gms2ResourceArray.js'; export type Gms2ResourceBaseParameters = [ data: YypResource | string, io: StitchProjectComms ]; export declare class Gms2ResourceBase<YyData extends YyBase = YyBase> { protected resourceRoot: Gms2ResourceType; protected io: StitchProjectComms; protected data: YypResource; protected storage: StitchStorage; protected _yyData?: YyData; /** * Create a resource using either the direct YYP-sourced object * -or- the name of the resource */ constructor(resourceRoot: Gms2ResourceType, data: YypResource | string, io: StitchProjectComms); get yyData(): YyData; get id(): { path: string; name: string; }; get name(): string; /** The type, named by the root folder containing the resource type's .yy files. */ get type(): "animcurves" | "extensions" | "fonts" | "notes" | "objects" | "particles" | "paths" | "rooms" | "scripts" | "sequences" | "shaders" | "sounds" | "sprites" | "tilesets" | "timelines"; /** The folder containing this resource (as viewed via the IDE) */ get folder(): string; /** * Set the parent folder for this resource. Note that you may * run into errors if this folder doesn't already exist. */ set folder(folderName: string); get resourceType(): string; get yyDirRelative(): string; get yyDirAbsolute(): string; get yyPathRelative(): string; get yyPathAbsolute(): string; /** The list of configurations that apply to this resource in some way. */ get configNames(): string[]; /** * Return the paths of all files that collectively make up this * resource. In *all cases* that inclues a .yy file. The rest is * resourceType-specific. */ get filePathsAbsolute(): string[]; get filePathsRelative(): string[]; /** * Check the name of this Resource against a known name. * **Important**: The check is *case-insensitive*, returning * `false` if the name is a complete mismatch and an object * with the type of match if it at least matches insensitively. * * In other words, if the result is *truthy* it's at least a * case-insensitive match. */ isNamed(name: string): false | { isMatch: true; isExactMatch: boolean; }; /** * Check to see if this resource is in a given folder (recursively). * For example, for sprite 'sprites/menu/title/logo' both * 'sprites' and 'sprites/menu' would return `true`. */ isInFolder(folderPath: string, recursive?: boolean): boolean; /** Resources typically have one or more companion files * alongside their .yy file. They often have the same name * as the resource, but generally have different extension. * @param name If not provided, defaults to the resource's name */ dataFilePathAbsolute(extension: string, name?: string): string; /** * Save any changes made to this resource to disk * in its `.yy` file. * * If `result` is passed in, the `changed` field will * be updated to reflect whether any changes were made. */ save(result?: { changed?: boolean; }): this; replaceYyFile(yyData: Partial<YyData>): Promise<this>; toJSON(): YypResource; } //# sourceMappingURL=Gms2ResourceBase.d.ts.map