Trigger API Reference DCEI Functions Custom UI2 - BLKTower/TestWiki GitHub Wiki

Table of Contents

Trigger API Reference\DCEI Functions\Custom UI (3/8) {Trigger-API-ReferenceDCEI-FunctionsCustom-UI-38}

See Also

float GetScrollFrameScrollPosition(Transform ui) {float-GetScrollFrameScrollPositionTransform-ui}

float GetScrollFrameScrollPosition(Transform ui)

Description

Returns the position of a scroll frame.

Parameters

  • Transform ui the scroll frame (not the scroll content frame).

Example Usage

local vscroll_frame = DCEI.NewVScroll(DCEI.GetUiRoot())
DCEI.SetSize(vscroll_frame, 200, 300)
DCEI.SetBackgroundImageColor(vscroll_frame, 1, 0, 0, 0.3)
DCEI.SetScrollPosition(vscroll_frame, 300)

local content = DCEI.GetScrollContent(vscroll_frame)
local frame1 = DCEI.NewFrame(content)
DCEI.SetSize(frame1, 150, 400)
DCEI.SetBackgroundImageColor(frame1, 1, 0, 0, 1)

local frame2 = DCEI.NewFrame(content)
DCEI.SetSize(frame2, 150, 400)
DCEI.SetBackgroundImageColor(frame2, 0, 0, 1, 1)

local scroll_pos = DCEI.GetScrollPosition(vscroll_frame)
DCEI.LogMessage(scroll_pos)

Related

void SetScrollFrameScrollPosition2D(Transform ui, Float2 position) {void-SetScrollFrameScrollPosition2DTransform-ui-Float2-position}

void SetScrollFrameScrollPosition2D(Transform ui, Float2 position)

Description

Sets the position of a Scroll frame.

Parameters

  • Transform ui the scroll frame (not the scroll content frame).
  • Float2 position the new scroll position.

Example Usage

local scroll = DCEI.NewScroll(DCEI.GetUiRoot())
DCEI.SetSize(scroll, 500, 500)
DCEI.SetBackgroundImageColor(scroll, 1, 0, 0, 0.3)

local content = DCEI.GetScrollContent(scroll)
local big_content = DCEI.NewFrame(content)
DCEI.SetSize(big_content, 1000, 1000)
DCEI.SetBackgroundImageColor(big_content, 0, 0, 1, 0.4)

local small_content = DCEI.NewFrame(content)
DCEI.SetSize(small_content, 100, 100)
DCEI.SetBackgroundImageColor(small_content, 0, 1, 0, 0.4)

DCEI.SetScrollPosition2D(scroll, {x = 0, y = 500})

Related

Float2 GetScrollFrameScrollPosition2D(Transform ui) {Float2-GetScrollFrameScrollPosition2DTransform-ui}

Float2 GetScrollFrameScrollPosition2D(Transform ui)

Description

Returns the position of a Scroll frame.

Parameters

  • Transform ui the scroll frame (not the scroll content frame).

Example Usage

local scroll = DCEI.NewScroll(DCEI.GetUiRoot())
DCEI.SetSize(scroll, 500, 500)
DCEI.SetBackgroundImageColor(scroll, 1, 0, 0, 0.3)

local content = DCEI.GetScrollContent(scroll)
local big_content = DCEI.NewFrame(content)
DCEI.SetSize(big_content, 1000, 1000)
DCEI.SetBackgroundImageColor(big_content, 0, 0, 1, 0.4)

local small_content = DCEI.NewFrame(content)
DCEI.SetSize(small_content, 100, 100)
DCEI.SetBackgroundImageColor(small_content, 0, 1, 0, 0.4)
DCEI.SetScrollPosition2D(scroll, {x = 0, y = 500})

local scroll_pos = DCEI.GetScrollPosition2D(scroll)
DCEI.LogMessage("Scroll X position: " .. scroll_pos.x .. "\nScroll Y position: " .. scroll_pos.y)

Related

void SetScrollFrameScrollInertia(Transform ui, bool value) {void-SetScrollFrameScrollInertiaTransform-ui-bool-value}

void SetScrollFrameScrollInertia(Transform ui, bool value)

Description

Sets the inertia for a scroll frame. This is supported for all scroll frame types.

Parameters

  • Transform ui the scroll frame (not the scroll content frame).
  • bool value if true, the frame's content will decelerate instead of stopping when scrolling stops. This is true by default for newly created scroll frames.

Example Usage

local scroll = DCEI.NewScroll(DCEI.GetUiRoot())
DCEI.SetSize(scroll, 500, 500)
DCEI.SetBackgroundImageColor(scroll, 1, 0, 0, 0.3)
DCEI.SetScrollInertia(scroll, false)

local content = DCEI.GetScrollContent(scroll)
local big_content = DCEI.NewFrame(content)
DCEI.SetSize(big_content, 1000, 1000)
DCEI.SetBackgroundImageColor(big_content, 0, 0, 1, 0.4)

local small_content = DCEI.NewFrame(content)
DCEI.SetSize(small_content, 100, 100)
DCEI.SetBackgroundImageColor(small_content, 0, 1, 0, 0.4)

Related

void SetScrollFrameSCrollEnable(Transform ui, bool value) {void-SetScrollFrameSCrollEnableTransform-ui-bool-value}

void SetScrollFrameSCrollEnable(Transform ui, bool value)

⚠️Warning⚠️: This api was deprecated at 7/11/2022, and will be removed after 90 days.

Description

Parameters

Example Usage

void SetScrollFrameScrollEnable(Transform ui, bool value) {void-SetScrollFrameScrollEnableTransform-ui-bool-value}

void SetScrollFrameScrollEnable(Transform ui, bool value)

Description

Sets whether scrolling is enabled. This is supported for all scroll frame types.

Parameters

  • Transform ui the scroll frame (not the scroll content frame).
  • bool value if true, enables scrolling for the scroll element. This is true by default for newly created scroll frames.

Example Usage

local scroll = DCEI.NewScroll(DCEI.GetUiRoot())
DCEI.SetSize(scroll, 500, 500)
DCEI.SetBackgroundImageColor(scroll, 1, 0, 0, 0.3)
DCEI.SetEnableScroll(scroll, false)

local content = DCEI.GetScrollContent(scroll)
local big_content = DCEI.NewFrame(content)
DCEI.SetSize(big_content, 1000, 1000)
DCEI.SetBackgroundImageColor(big_content, 0, 0, 1, 0.4)

local small_content = DCEI.NewFrame(content)
DCEI.SetSize(small_content, 100, 100)
DCEI.SetBackgroundImageColor(small_content, 0, 1, 0, 0.4)

Related

void SetScrollFrameScrollDecelerationRate(Transform ui, float value) {void-SetScrollFrameScrollDecelerationRateTransform-ui-float-value}

void SetScrollFrameScrollDecelerationRate(Transform ui, float value)

Description

Sets the deceleration rate for scroll inertia. A value of 0 will cause instant deceleration (equivalent to setting the inertia to false). Values between 0 and 1 will cause deceleration. A value of 1 will cause no deceleration. A value greater than 1 will cause acceleration. A negative value will break the scroll element. This is supported for all scroll frame types.

Parameters

  • Transform ui the scroll frame (not the scroll content frame).
  • float value the scroll deceleration rate.

Example Usage

local scroll = DCEI.NewScroll(DCEI.GetUiRoot())
DCEI.SetSize(scroll, 500, 500)
DCEI.SetBackgroundImageColor(scroll, 1, 0, 0, 0.3)
DCEI.SetScrollDecelerationRate(scroll, 0.5)

local content = DCEI.GetScrollContent(scroll)
local big_content = DCEI.NewFrame(content)
DCEI.SetSize(big_content, 1000, 1000)
DCEI.SetBackgroundImageColor(big_content, 0, 0, 1, 0.4)

local small_content = DCEI.NewFrame(content)
DCEI.SetSize(small_content, 100, 100)
DCEI.SetBackgroundImageColor(small_content, 0, 1, 0, 0.4)

Related

void SetScrollFrameScrollContentAlignment(Transform ui, string value) {void-SetScrollFrameScrollContentAlignmentTransform-ui-string-value}

void SetScrollFrameScrollContentAlignment(Transform ui, string value)

Description

Sets the alignment for scroll content. The value determines where the initial display location of the scroll content is.

Parameters

  • Transform ui the scroll frame (not the scroll content frame).
  • string value the alignment. Possible values:
HScroll: left (default), right
VScroll: top (default), bottom
Scroll: left, right, top, bottom, (top|bottom)-(left|right)

Example Usage

local vscroll_frame = DCEI.NewVScroll(DCEI.GetUiRoot())
DCEI.SetSize(vscroll_frame, 200, 500)
DCEI.SetScrollContentAlignment(vscroll_frame, "right")

Related

void SetTextFrameRtlSupport(Transform text, bool value) {void-SetTextFrameRtlSupportTransform-text-bool-value}

void SetTextFrameRtlSupport(Transform text, bool value)

Description

Sets RTL (right to left) support for a text frame. When true, this text will be displayed from right-to-left when using RTL languages (such as Arabic). You typically want to disable this for numeric text, which is still displayed as left-to-right in such languages. This is enabled by default on all text frames.

Parameters

  • Transform text the text frame.
  • bool value if true, enables RTL support.

Example Usage

local text_frame = DCEI.NewText(DCEI.GetUiRoot())
DCEI.SetTextRtlSupport(text_frame, false)

Related

void SetTextFrameAlignment(Transform text, string alignment) {void-SetTextFrameAlignmentTransform-text-string-alignment}

void SetTextFrameAlignment(Transform text, string alignment)

Description

Sets the text alignment for a text frame.

Parameters

  • Transform text the text frame.
  • string alignment the text alignment. Possible values:
start, end, top, bottom, (top|bottom)-(start|end)

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextAlignment(text_frame, "end")

Related

void SetTextFrameWrapping(Transform text, bool enable) {void-SetTextFrameWrappingTransform-text-bool-enable}

void SetTextFrameWrapping(Transform text, bool enable)

Description

Sets text wrapping for a text frame.

Parameters

  • Transform text the text frame.
  • bool enable if true, enables text wrapping. This is true by default for newly created text frames.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextWrapping(text_frame, false)

Related

void SetTextFrameOverflow(Transform text, bool enable) {void-SetTextFrameOverflowTransform-text-bool-enable}

void SetTextFrameOverflow(Transform text, bool enable)

Description

Sets text overflow for a text frame.

Parameters

  • Transform text the text frame.
  • bool enable if true, enables text overflow. This is true by default for newly created text frames.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text Overflow Example")
DCEI.SetSize(text_frame, 200, 40)
DCEI.SetTextOverflow(text_frame, false)

Related

void SetTextFrameText(Transform text, string content) {void-SetTextFrameTextTransform-text-string-content}

void SetTextFrameText(Transform text, string content)

Description

Sets the text of a text frame. Supports rich text tags (see: http://digitalnativestudios.com/textmeshpro/docs/rich-text/). Use \n for newline.

Parameters

  • Transform text the text frame to set the text of.
  • string content the text to set. Supports rich text.

Example Usage

local text = "Here's some <b>RICH</b> text!" .. "\n" .. 
  "And here's some <size=50%>small</size> text." .. "\n" .. 
  "<color=blue>And here's some blue text.</color>"

local label = DCEI.NewText(DCEI.GetUiRoot())
DCEI.SetText(label, text)

Related

void SetTextFrameTextExpression(Transform text, string content) {void-SetTextFrameTextExpressionTransform-text-string-content}

void SetTextFrameTextExpression(Transform text, string content)

Description

Sets a text expression in a text frame. Unlike other UI expressions, text expressions must be surrounded with curly brackets {}. These brackets are used so the expression string can be concatenated with regular text.

Parameters

  • Transform text the text frame to set the text of.
  • string content the text to set. Supports the following parameters from bound units:
unit.Info.Icon
unit.Info.Name
unit.Health.Current
unit.Health.Max
unit.Health.Percentage
unit.Health.Fraction
unit.Health.Regeneration
unit.Shield.Current
unit.Shield.Max
unit.Shield.Percentage
unit.Shield.Fraction
unit.Shield.Regeneration
unit.Mana.Current
unit.Mana.Max
unit.Mana.Percentage
unit.Mana.Fraction
unit.Mana.Regeneration
unit.Ability.ability_name.CooldownRatio
unit.Ability.ability_name.MaxCharge
unit.Ability.ability_name.ChargeCount
unit.Expression.some_named_expression

Data bound values can be formatted to specific decimal values by appending the expression such as :F2. (You can find more documentation here)

Example Usage

-- unit binding for expressions
local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 16, 16, 0, -1)
DCEI.BindUnit("selected", unit)

local stats = {}
local vstack = DCEI.NewVStack(DCEI.GetUiRoot())
stats.health_label = DCEI.NewText(vstack)
stats.mana_regen_label = DCEI.NewText(vstack)

-- make it so that the healthbar shows <current HP>/<max HP>
DCEI.SetTextExpression(stats.health_label, "{selected.Health.Current}/{selected.Health.Max}")
    
-- assuming the selected unit's mana regeneration is 1.228
-- this expression will display 1.2
DCEI.SetTextExpression(stats.mana_regen_label, "{selected.Mana.Regeneration:F1}")
-- this expression will display 1.23
DCEI.SetTextExpression(stats.mana_regen_label, "{selected.Mana.Regeneration:F2}")

-- data binding for expressions
local data_table = {text = "data bound label"}
DCEI.BindData("data", data_table)

local data_binding = DCEI.NewText(vstack)
DCEI.SetTextExpression(data_binding, "{data.text}")

DreamEditor also provides an additional specifier :K to format huge numbers as "xxxK", "xxxM" or "xxxB". The default parameter for :K is :K2.

-- assuming the selected unit's max health is 1000000
-- this expression will display 1M
DCEI.SetTextExpression(stats.health_label, "{selected.Health.Max:K0}")
-- this expression will display 1.0M
DCEI.SetTextExpression(stats.health_label, "{selected.Health.Max:K1}")

Related

void SetTextFrameFontSize(Transform text, float size) {void-SetTextFrameFontSizeTransform-text-float-size}

void SetTextFrameFontSize(Transform text, float size)

Description

Sets the font size for a text frame. The default font size is 22.

Parameters

  • Transform text the text frame.
  • float size the new text size.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextFontSize(text_frame, 50)

Related

void SetTextFrameFontSizeMin(Transform text, float size) {void-SetTextFrameFontSizeMinTransform-text-float-size}

void SetTextFrameFontSizeMin(Transform text, float size)

Description

Sets a minimum font size for a text frame. To enable dynamic font sizing, a text frame needs a minium and maximum font size and either a maximum height or width. Does not work if there is a set font size.

Parameters

  • Transform text the text frame.
  • float size the new minimum text size.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)
    
local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetTextFontSizeMin(text_frame, 10)
DCEI.SetTextFontSizeMax(text_frame, 30)
DCEI.SetSize(text_frame, 50, 30)

Related

void SetTextFrameFontSizeMax(Transform text, float size) {void-SetTextFrameFontSizeMaxTransform-text-float-size}

void SetTextFrameFontSizeMax(Transform text, float size)

Description

Sets a maximum font size for a text frame. To enable dynamic font sizing, a text frame needs a minium and maximum font size and either a maximum height or width. Does not work if there is a set font size.

Parameters

  • Transform text the text frame.
  • float size the new maximum text size.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)
    
local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetTextFontSizeMin(text_frame, 10)
DCEI.SetTextFontSizeMax(text_frame, 30)
DCEI.SetSize(text_frame, 100, 30)

Related

void SetTextFrameColor(Transform text, ColorRGB color) {void-SetTextFrameColorTransform-text-ColorRGB-color}

void SetTextFrameColor(Transform text, ColorRGB color)

Description

Parameters

Example Usage

void SetTextFrameColorRGB(Transform text, ColorRGB color) {void-SetTextFrameColorRGBTransform-text-ColorRGB-color}

void SetTextFrameColorRGB(Transform text, ColorRGB color)

⚠️Warning⚠️: This api was deprecated at 7/19/2022, and will be removed after 90 days.

Description

Parameters

Example Usage

void SetTextFrameOutline(Transform text, bool outline) {void-SetTextFrameOutlineTransform-text-bool-outline}

void SetTextFrameOutline(Transform text, bool outline)

Description

Sets the outline for a text frame's text.

Parameters

  • Transform text the text frame.
  • bool outline if true, enables the text outline. This is true by default for newly created text frames.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextOutline(text_frame, false)

Related

void SetTextFrameShadow(Transform text, bool enableShadow) {void-SetTextFrameShadowTransform-text-bool-enableShadow}

void SetTextFrameShadow(Transform text, bool enableShadow)

Description

Sets the shadow for a text frame's text. Disabling the text shadow will also disable the outline.

Parameters

  • Transform text the text frame.
  • bool enableShadow if true, enables the text shadow. This is true by default for newly created text frames.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextShadow(text_frame, false)

Related

void SetTextFrameOutlineOutside(Transform text, bool outside) {void-SetTextFrameOutlineOutsideTransform-text-bool-outside}

void SetTextFrameOutlineOutside(Transform text, bool outside)

Description

Sets the outline for a text frame's text.

Parameters

  • Transform text the text frame.
  • bool outside if true, enables the text's outside outline. This is true by default for newly created text frames.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextOutlineOutside(text_frame, false)

Related

void SetTextFrameOutlineColor(Transform text, ColorRGBA color) {void-SetTextFrameOutlineColorTransform-text-ColorRGBA-color}

void SetTextFrameOutlineColor(Transform text, ColorRGBA color)

Description

Parameters

Example Usage

void SetTextFrameOutlineColorRGBA(Transform text, ColorRGBA color) {void-SetTextFrameOutlineColorRGBATransform-text-ColorRGBA-color}

void SetTextFrameOutlineColorRGBA(Transform text, ColorRGBA color)

⚠️Warning⚠️: This api was deprecated at 7/19/2022, and will be removed after 90 days.

Description

Parameters

Example Usage

void SetTextFrameOutlineWidth(Transform text, float width) {void-SetTextFrameOutlineWidthTransform-text-float-width}

void SetTextFrameOutlineWidth(Transform text, float width)

Description

Sets the width for a text frame's text outline.

Parameters

  • Transform text the text frame.
  • float width the width of the outline.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextFontSize(text_frame, 50)
DCEI.SetTextOutlineWidth(text_frame, 10)

Related

void SetTextFrameOutlineSoftness(Transform text, float softness) {void-SetTextFrameOutlineSoftnessTransform-text-float-softness}

void SetTextFrameOutlineSoftness(Transform text, float softness)

Description

Set the softness for a text frame's text outline.

Parameters

  • Transform text the text frame.
  • float softness the softness of the outline, scaled from 0-1.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextFontSize(text_frame, 50)
DCEI.SetTextOutlineSoftness(text_frame, 0.5)

Related

void SetTextFrameShadowWidth(Transform text, float width) {void-SetTextFrameShadowWidthTransform-text-float-width}

void SetTextFrameShadowWidth(Transform text, float width)

Description

Sets the width for a text frame's text shadow.

Parameters

  • Transform text the text frame.
  • float width the width of the shadow. A value of -1 will remove the shadow without removing the outline.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextFontSize(text_frame, 50)
DCEI.SetTextShadowWidth(text_frame, 10)

Related

void SetTextFrameShadowColor(Transform text, ColorRGBA color) {void-SetTextFrameShadowColorTransform-text-ColorRGBA-color}

void SetTextFrameShadowColor(Transform text, ColorRGBA color)

Description

Parameters

Example Usage

void SetTextFrameShadowColorRGBA(Transform text, ColorRGBA color) {void-SetTextFrameShadowColorRGBATransform-text-ColorRGBA-color}

void SetTextFrameShadowColorRGBA(Transform text, ColorRGBA color)

⚠️Warning⚠️: This api was deprecated at 7/19/2022, and will be removed after 90 days.

Description

Parameters

Example Usage

void SetTextFrameShadowSoftness(Transform text, float softness) {void-SetTextFrameShadowSoftnessTransform-text-float-softness}

void SetTextFrameShadowSoftness(Transform text, float softness)

Description

Set the softness for a text frame's text shadow.

Parameters

  • Transform text the text frame.
  • float softness the softness of the shadow, scaled from 0-1.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 1, 0, 0.5)

local text_frame = DCEI.NewText(frame)
DCEI.SetText(text_frame, "Text")
DCEI.SetSize(text_frame, 200, 100)
DCEI.SetTextFontSize(text_frame, 50)
DCEI.SetTextShadowSoftness(text_frame, 1)

Related

⚠️ **GitHub.com Fallback** ⚠️