Options
All
  • Public
  • Public/Protected
  • All
Menu

Module prefab

Creates a DIY component based on a common layout with a minimum of coding. For an explanation of how to use prefab components, refer to the relevant Developer Manual section.

Include this library by adding useLibrary("prefab") to your script, then define the relevant values (at a minimum pfBaseKey). See the plug-in authoring kit for examples that use this library.

Index

Variables

pfBaseKey

pfBaseKey: string

This must be set to the base setting key for the component.

pfContentBox

pfContentBox: MarkupBox

This variable holds the markup box used to lay out the content text, or null if there is no content text. It is set during createFrontPainter.

pfDIY

This variable holds the DIY component instance.

pfSettings

pfSettings: Settings

This variable will hold the component's private settings.

pfTitleBox

pfTitleBox: MarkupBox

This variable holds the markup box used to lay out the card title, or null if there is no title. It is set during createFrontPainter.

Functions

pfInit

  • Called to set up global variables once the DIY instance is known.

    Parameters

    Returns void

pfKey

  • pfKey(suffix: string): string
  • Composes a full key name from the base name (pfBaseKey) and a suffix.

    Parameters

    • suffix: string

      the suffix to append to the key base

    Returns string

    the complete key name

pfPaintOverlay

  • Called from the standard prefab painting function to paint an overlay overtop of the background and portrait. Replace to customize behaviour.

    Parameters

    Returns void

pfString

  • pfString(key: string, defaultValue: string): string
  • Returns a string looked up from the DIY's settings based on the base key (pfFrontKey). If the value starts with #, @, or $, the true value is looked up as if the value were a global variable (i.e., as a game string, interface string, or setting).

    Parameters

    • key: string
    • defaultValue: string

    Returns string