@mai3/phaser-sdk
Version:
A UI component library based on the Phaser game engine
50 lines • 1.79 kB
TypeScript
import { BaseConfig } from "./BaseConfig";
import { Container } from "../../ui/Container";
export interface ReDrawProtocol {
reDraw(config?: BaseConfig): void;
clear(): void;
}
/**
* Base container class that extends Phaser Container and implements ReDrawProtocol
* Provides basic container functionality with config management
*/
export declare abstract class BaseContainer<T extends BaseConfig = BaseConfig> extends Phaser.GameObjects.Container implements ReDrawProtocol {
/** The content container instance */
protected _content?: Container;
/** Configuration object for this container */
protected _config?: T;
/**
* Redraws the container with new config
* @param config - Optional new configuration
*/
abstract reDraw(config?: T): void;
/**
* Clears the container content
*/
abstract clear(): void;
/**
* Updates the container configuration
* @param config - New configuration to apply
*/
updateConfig(config?: T): void;
/**
* Adds a child container
* @param child - Child container to add
*/
abstract addChild(child: Container): void;
abstract setChildren(childConfigs?: BaseConfig[]): void;
setPosition(x?: number, y?: number, z?: number, w?: number): this;
/**
* Gets the current container config
* @returns The current config or empty object if none set
*/
get config(): T;
get content(): Container | undefined;
/**
* Gets the real child configurations by recursively traversing the container tree
* @returns Array of BaseConfig objects representing the current container hierarchy
*/
get realChildConfigs(): BaseConfig[];
destroy(fromScene?: boolean): void;
}
//# sourceMappingURL=BaseContainer.d.ts.map