Rewired Glyphs Docs Rewired Glyphs Docs
Rewired Glyphs Docs Rewired Glyphs Docs
Rewired Glyphs

Search Results for

    Class GlyphRichTextFormatter

    Adds support for inline input glyphs on a TMP_Text component.

    Inheritance
    object
    GlyphRichTextFormatter
    Namespace: LMirman.RewiredGlyphs.Components
    Assembly: .dll
    Syntax
    public class GlyphRichTextFormatter : MonoBehaviour
    Remarks

    The two main ways to use this component are the following:

    Director Pattern (Recommended): The text mesh's text is set exclusively via this component's SetFormattedText(string) method.

    • This pattern is achieved by disabling the automaticallyCheckForTextChanges field and never changing the text mesh component's text elsewhere.
    • This pattern is encouraged because it ensures that glyph tags are not lost in translation, which can especially happen if you are appending text.

      Observer Pattern: The text mesh's text is updated whenever it is changed externally.
    • This pattern is achieved by enabling the automaticallyCheckForTextChanges field.
    • This pattern is useful if you can't change text via the SetFormattedText(string). This pattern does however run the risk of losing preformatted text if not used carefully.

    Properties

    Name Description
    TextMesh

    The text mesh component attached to the same game object as this GlyphRichTextFormatter

    Methods

    Name Description
    OnDisable()
    OnEnable()
    ReplaceGlyphTagsWithSpriteTags(string, bool, string, string)

    Replace glyph rich text such as <glyph "Jump"> in the provided text with a sprite or description for its corresponding Glyph in the Rewired Glyph system.

    Syntax Rules:

    • The glyph tag begins with verbatim <glyph and ends at any > character.
    • The first argument must always represent the action to represent as either an integer for the action ID or a string for the action name if and only if it does not contain any spaces.
    • Following the action argument all arguments may appear in any order.
    • Arguments are delimited by any occurrence of the space character, even if the space is contained within quotes.
    • Additional arguments that are string based are case-insensitive such that "TYPE=JOYSTICK" and "type=joystick" are equivalent inputs.

      Additional Arguments:
      Following the action argument you may optionally include the following arguments to control the output glyph.

    • Player ID player={int} (Default: 0)
      Specify the player you'd like to show glyph for using player=2 where 2 can be any int. If an integer is alone without any specifier it is interpret as player id, such as <glyph Jump 2> where 2 is player id

    • Polarity pole={value} (Default: Positive)
      Specify the expected axis or pole input for the action such as positive for "Move Right" and negative for "Move Left" on a Move Horizontal action using pole=Positive, pole=Negative, or pole=FullAxis. You may exclude pole specifier from your input.

    • Controller Type type={type} (Default: Current)
      Specify the controller type to show symbols for using type=Joystick. Valid values are type=Current, type=Keyboard, type=Mouse, and type=Joystick.
      Warning: Specifying a controller that the runtime device doesn't have connected (such as Joystick) will show the UNBOUND symbol until they connect that controller type.
      Warning: Specifying a controller that does not have the specified action bound to that specific controller will show the UNBOUND symbol without falling back to another controller.

    • Symbol Preference symbol={type} (Default: PreferredSymbols)
      Specify the symbols to use for Joystick glyphs. Valid values are symbol=auto, symbol=xbox, symbol=ps, or symbol=switch.

    • Collection set={value} (Default: null, using default collection)
      Specify the collection to target for glyph queries using its Key. Only necessary when not using default collection. Example values are set=xelu, set=dark, or set=light.

    • Hide Keyboard and Mouse hideKBM (Default: false)
      When argument is provided will not show glyphs for the Keyboard and Mouse device. Valid value is hideKBM.

    • Hide Invalid hideInvalid (Default: false)
      When argument is provided will not show invalid glyphs such as Unbound, Null, and Uninitialized Valid value is hideInvalid.
    SetFormattedText(string)

    Set the text for this text output, replacing glyph rich text such as &lt;glyph "Jump"&gt; with its glyph's sprite or description.

    Docs generated for Rewired-Glyphs Unity Package. Package distributed under MIT license.