|
|
(25 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | The SUIText class provides tools to work with the SUIText component, which is a component responsible for displaying text
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/suitext |
− | | + | |
− | ==Properties==
| + | |
− | | + | |
− | {{ScriptFunction|bool|AlignByGeometry|{get;set;}|Use the range of glyph geometry to perform horizontal alignment. |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|SColor|Color|{get;set;}|Base color of the Graphic.
| + | |
− | | + | |
− | |5=
| + | |
− | | + | |
− | "--This script dynamically changes the text's color of a GameObject with UIText component."<br>
| + | |
− | "--For example in a text sign over your shop that you want to make more visually stand out"<br>
| + | |
− | "--or perhaps text decoration during a celebration or a text element in your User Interface or HUD."<br>
| + | |
− | <br>
| + | |
− | thisObject = Space.Host.ExecutingObject<br>
| + | |
− | "--get a reference to our object"<br>
| + | |
− | thisObjectText = thisObject.UIText<br>
| + | |
− | "--get a reference to the SUIText component in our object "<br>
| + | |
− | colors = {Color.Red, Color.Black, Color.White, Color.Blue, Color.Green, Color.Yellow}<br>
| + | |
− | " --here we are holding 6 predefined colors in a Lua Table which we will go through"<br>
| + | |
− | <br>
| + | |
− | <br>
| + | |
− | function ColorChanger()<br>
| + | |
− | <br>
| + | |
− | while true do<br>
| + | |
− | "--infinite loop"<br>
| + | |
− | <br>
| + | |
− | for i=1,#colors do<br>
| + | |
− | " --For Loop to cycle through all the table items"<br>
| + | |
− | thisObjectText.color = colors[i] <br>
| + | |
− | " --this will set the color based on which item in the table we are now at"<br>
| + | |
− | coroutine.yield(0.1)<br>
| + | |
− | " --this will pause for a tenth of a second before we change to the next color"<br>
| + | |
− | end<br>
| + | |
− | <br>
| + | |
− | end<br>
| + | |
− | end<br>
| + | |
− | <br>
| + | |
− | thisObjectText.color = Color.Red <br>
| + | |
− | "--this is how to set text color using one of the predefined colors in the SColor class."<br>
| + | |
− | thisObjectText.color = Color.New(0,0,0,1)<br>
| + | |
− | "--this sets our text color to Black (RGB 000) but also Alpha to 1 (meaning fully opaque, not transparent)"<br>
| + | |
− | | + | |
− | colorOfThisObject = thisObjectText.color<br>
| + | |
− | thisObjectText.color = colorOfThisObject<br>
| + | |
− | "--The color property also allows you to "get" it, not only "set" it, meaning you can get"<br>
| + | |
− | "--your text's current color and save it. In this case, the color of your text wouldn't change."<br>
| + | |
− | <br>
| + | |
− | "--The last 4 lines of code above are not important to this color changing script, it's just extra information for you."<br>
| + | |
− | | + | |
− | Space.Host.StartCoroutine(ColorChanger) <br>
| + | |
− | "--this coroutine will now call our ColorChanger() function which is infinitely changing our text colors between a select range."<br>
| + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|bool|Enabled|{get;set;}|Enabled Behaviours are Updated, disabled Behaviours are not.
| + | |
− | | + | |
− | | + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|FlexibleHeight|{get;}|Called by the layout system.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|FlexibleWidth|{get;}|Called by the layout system.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|int|FontSize|{get;set;}|The size that the Font should render at.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|int|LayoutPriority|{get;}|Called by the layout system.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|LineSpacing|{get;set;}|Line spacing, specified as a factor of font line height. A value of 1 will produce normal line spacing.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|MinHeight|{get;}|Called by the layout system.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|MinWidth|{get;}|Called by the layout system.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|PixelsPerUnit|{get;}|Provides information about how fonts are scale to the screen. |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|PreferredHeight|{get;}|Called by the layout system.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|float|PreferredWidth|{get;}|Called by the layout system.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|bool|ResizeTextForBestFit|{get;set;}|Should the text be allowed to auto resized.
| + | |
− | | + | |
− | | + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|int|ResizeTextMaxSize|{get;set;}|The maximum size the text is allowed to be. 1 = infinitly large.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|int|ResizeTextMinSize|{get;set;}|The minimum size the text is allowed to be.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | {{ScriptFunction|bool|SupportRichText|{get;set;}|Whether this Text will support rich text.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |
− | | + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|string|Text|{get;set;}|The string value this Text displays.
| + | |
− | |5=
| + | |
− | | + | |
− | | + | |
− | }}
| + | |