import { Constructor, RpgCommonPlayer } from '@rpgjs/common'; import { ComponentInput, ComponentLayout } from './Components'; type ComponentPosition = 'top' | 'center' | 'bottom' | 'left' | 'right'; type GraphicInput = string | number | (string | number)[]; /** * Component Manager Mixin * * Provides graphic and component management capabilities to any class. This mixin allows * setting single or multiple graphics for player representation, enabling * dynamic visual changes and animation sequences. It also provides methods to * display UI components around the player graphic (top, bottom, center, left, right). * * Components are stored as JSON strings for efficient synchronization. * * @param Base - The base class to extend with component management * @returns Extended class with component management methods * * @example * ```ts * class MyPlayer extends WithComponentManager(BasePlayer) { * constructor() { * super(); * this.setGraphic("hero"); * } * } * * const player = new MyPlayer(); * player.setGraphic(["hero_idle", "hero_walk"]); * player.setComponentsTop(Components.text('{name}')); * ``` */ export declare function WithComponentManager>(Base: TBase): new (...args: ConstructorParameters) => InstanceType & IComponentManager; /** * Interface for component management capabilities * Defines the method signatures that will be available on the player */ export interface IComponentManager { /** * Set the graphic(s) for this player * * Allows setting either a single graphic or multiple graphics for the player. * When multiple graphics are provided, they are used for animation sequences. * The graphics system provides flexible visual representation that can be * dynamically changed during gameplay for different states, equipment, or animations. * * @param graphic - Single graphic name, legacy tile id, or array of graphic names/tile ids for animation sequences * @returns void * * @example * ```ts * // Set a single graphic for static representation * player.setGraphic("hero"); * * // Set multiple graphics for animation sequences * player.setGraphic(["hero_idle", "hero_walk", "hero_run"]); * * // Set a legacy tile id * player.setGraphic(3); * * // Dynamic graphic changes based on equipment * if (player.hasArmor('platemail')) { * player.setGraphic("hero_armored"); * } * * // Animation sequences for different actions * player.setGraphic(["mage_cast_1", "mage_cast_2", "mage_cast_3"]); * ``` */ setGraphic(graphic: GraphicInput): void; /** * Set components to display above the player graphic * * @param layout - Component(s) to display, can be single, array, or 2D array * @param options - Optional layout options for positioning and sizing * @returns void */ setComponentsTop(layout: ComponentInput, options?: ComponentLayout): void; /** * Set components to display below the player graphic * * @param layout - Component(s) to display, can be single, array, or 2D array * @param options - Optional layout options for positioning and sizing * @returns void */ setComponentsBottom(layout: ComponentInput, options?: ComponentLayout): void; /** * Set components to display at the center of the player graphic * * @param layout - Component(s) to display, can be single, array, or 2D array * @param options - Optional layout options for positioning and sizing * @returns void */ setComponentsCenter(layout: ComponentInput, options?: ComponentLayout): void; /** * Set components to display to the left of the player graphic * * @param layout - Component(s) to display, can be single, array, or 2D array * @param options - Optional layout options for positioning and sizing * @returns void */ setComponentsLeft(layout: ComponentInput, options?: ComponentLayout): void; /** * Set components to display to the right of the player graphic * * @param layout - Component(s) to display, can be single, array, or 2D array * @param options - Optional layout options for positioning and sizing * @returns void */ setComponentsRight(layout: ComponentInput, options?: ComponentLayout): void; /** * Remove components from a specific position * * @param position - Position of the components: 'top', 'center', 'bottom', 'left', or 'right' * @returns void */ removeComponents(position: ComponentPosition): void; /** * Merge components with existing components at a specific position * * @param position - Position of the components: 'top', 'center', 'bottom', 'left', or 'right' * @param layout - Component(s) to merge, can be single, array, or 2D array * @param options - Optional layout options for positioning and sizing * @returns void */ mergeComponents(position: ComponentPosition, layout: ComponentInput, options?: ComponentLayout): void; } export {};