import { RpgClientEngine } from './RpgClientEngine'; /** * RpgResource class * * Provides a unified API to access resource file links (images and sounds) in the game. * Resources are stored as Maps of resource IDs to file paths/URLs. * * ## Design * * RpgResource acts as a facade over the engine's resource storage, providing * easy access to resource file links. It maintains Maps that are synchronized * with the engine's internal storage, but only stores the file paths/URLs, * not the full resource objects. * * @example * ```ts * import { RpgResource } from '@rpgjs/client' * * // Get spritesheet image link * const imageLink = RpgResource.spritesheets.get('hero') * * // Get sound file link * const soundLink = RpgResource.sounds.get('town-music') * * // Set a new resource link * RpgResource.spritesheets.set('new-sprite', './assets/new-sprite.png') * ``` */ export declare class RpgResource { private static engine; private static _spritesheets; private static _sounds; /** * Initialize RpgResource with the engine instance * * This is called automatically by the engine during initialization. * It synchronizes the resource Maps with the engine's internal storage. * * @param engine - The RpgClientEngine instance */ static init(engine: RpgClientEngine): void; /** * Synchronize resource Maps with the engine's internal storage * * Extracts file links from spritesheets and sounds stored in the engine * and updates the Maps accordingly. * * @private */ private static syncResources; /** * Get/Set image links for spritesheets * * Map of spritesheet IDs to their image file paths/URLs. * This Map is synchronized with the engine's spritesheet storage. * * @type {Map} * * @example * ```ts * // Get an image link * const imageLink = RpgResource.spritesheets.get('hero') * * // Set a new image link * RpgResource.spritesheets.set('new-sprite', './assets/new-sprite.png') * * // Check if a spritesheet exists * if (RpgResource.spritesheets.has('monster')) { * const link = RpgResource.spritesheets.get('monster') * } * ``` */ static get spritesheets(): Map; /** * Get/Set sound file links * * Map of sound IDs to their audio file paths/URLs. * This Map is synchronized with the engine's sound storage. * * @type {Map} * * @example * ```ts * // Get a sound link * const soundLink = RpgResource.sounds.get('town-music') * * // Set a new sound link * RpgResource.sounds.set('new-sound', './assets/new-sound.ogg') * * // Iterate over all sounds * RpgResource.sounds.forEach((link, id) => { * console.log(`Sound ${id}: ${link}`) * }) * ``` */ static get sounds(): Map; }