zimporter-pixi - v1.0.80
    Preparing search index...

    Class ZScene

    Represents a scene in the application, managing its assets, layout, and lifecycle. Handles loading, resizing, and instantiation of scene elements using PIXI.js.

    • Supports both landscape and portrait orientations.
    • Manages scene assets, templates, and animation tracks.
    • Provides methods for loading assets, creating display objects, and handling responsive resizing.
    • Integrates with custom containers such as ZContainer, ZButton, ZState, and ZTimeline.
    Index

    Constructors

    • Constructs a new ZScene instance.

      Parameters

      • _sceneId: string

        The unique identifier for the scene.

      Returns ZScene

    Properties

    assetTypes: Map<AssetType, any> = ...

    Accessors

    • get sceneHeight(): number

      The logical height of the scene in scene units for the current orientation.

      Returns number

    • get sceneWidth(): number

      The logical width of the scene in scene units for the current orientation.

      Returns number

    Methods

    • Applies visual filters (such as drop shadow) to a PIXI container.

      Parameters

      • obj: any

        The object containing filter data.

      • tf: Container

        The PIXI container to apply filters to.

      Returns void

    • Recursively creates and adds child assets to a container based on template data.

      Parameters

      • mc: ZContainer

        The parent container.

      • baseNode: TemplateData

        The template data for the asset.

      Returns Promise<void>

    • Loads a bitmap font from XML and creates a bitmap text object.

      Parameters

      • xmlUrl: string

        The URL to the XML font data.

      • textToDisplay: string

        The text to display.

      • fontName: string

        The name of the font.

      • fontSize: number

        The size of the font.

      • callback: Function

        Callback to invoke when the font is loaded.

      Returns Promise<null>

      A promise that resolves when the font is loaded.

    • Creates a PIXI.Sprite for a given frame name from the loaded spritesheet.

      Parameters

      • itemName: string

        The name of the frame.

      Returns Sprite | null

      The created sprite, or null if not found.

    • Creates an animated sprite (movie clip) from frames with a given prefix.

      Parameters

      • _framePrefix: string

        The prefix for the frames.

      Returns AnimatedSprite

      The created animated sprite.

    • Converts degrees to radians.

      Parameters

      • degrees: number

        The angle in degrees.

      Returns number

      The angle in radians.

    • Destroys the scene and its assets, freeing resources.

      Returns Promise<void>

    • Recursively collects all asset nodes from a given object.

      Parameters

      • o: any

        The object to search.

      • allAssets: any

        The accumulator for found assets.

      Returns any

      The map of all found assets.

    • Retrieves animation frames for all children of a template.

      Parameters

      • _templateName: string

        The name of the template.

      Returns Record<string, AnimTrackData[]>

      A record mapping child instance names to their animation tracks.

    • Returns the logical (un-scaled) inner dimensions of the scene, swapping width and height when in portrait orientation.

      Returns { height: number; width: number }

      An object with width and height in scene units.

    • Gets the number of frames that match a given prefix in the spritesheet data.

      Parameters

      • _framePrefix: string

        The prefix to search for.

      Returns number

      The number of matching frames.

    • Initializes the scene with the given placements object.

      Parameters

      • _placementsObj: SceneData

        The scene data.

      Returns void

    • Loads the scene's placement and asset data asynchronously.

      Parameters

      • assetBasePath: string

        The base path for assets.

      • _loadCompleteFnctn: Function

        Callback function to invoke when loading is complete.

      Returns Promise<void>

    • Loads the scene's assets and fonts, then initializes the scene.

      Parameters

      • assetBasePath: string

        The base path for assets.

      • placemenisObj: SceneData

        The placements object describing the scene.

      • _loadCompleteFnctn: Function

        Callback function to invoke when loading is complete.

      Returns Promise<void>

    • Loads and initializes the scene's stage, adding its children to the global stage.

      Parameters

      • globalStage: Container

        The main PIXI.Container to which the scene will be added.

      • loadChildren: boolean = true

      Returns void

    • Loads a texture from a given URL.

      Parameters

      • textureUrl: string

        The URL of the texture.

      Returns Promise<Texture<Resource>>

      A promise that resolves to the loaded PIXI.Texture.

    • Resizes the scene and all registered containers to fit the given dimensions.

      Parameters

      • width: number

        The new width.

      • height: number

        The new height.

      Returns void

    • Sets the orientation property based on the current window dimensions.

      Returns void

    • Spawns a new container or timeline for a given template name.

      Parameters

      • tempName: string

        The template name.

      Returns ZContainer | undefined

      The created container or timeline, or undefined if not found.

    • Returns the constructor registered for the given AssetType string.

      Parameters

      • value: string

        An AssetType string key.

      Returns any

      The corresponding class constructor, or null if not registered.

    • Retrieves a scene instance by its ID.

      Parameters

      • sceneId: string

        The ID of the scene to retrieve.

      Returns ZScene | undefined

      The ZScene instance, or undefined if not found.

    • Type-guard that checks whether value is a known AssetType key.

      Parameters

      • value: string

        The string to test.

      Returns value is AssetType

      true if value is a registered AssetType.