Trigger API Reference DCEI Functions Custom UI5 - funovus/editor-wiki GitHub Wiki
Table of Contents
- [Trigger API Reference\DCEI Functions\Custom UI (6/8)](#trigger-api-referencedcei-functionscustom-ui-68)
* [void SetFrameImageFillAmountExpression(Transform ui, string expression, bool inverse)](#void-setframeimagefillamountexpressiontransform-ui-string-expression-bool-inverse)
* [void SetFrameWidthExpression(Transform ui, string expression)](#void-setframewidthexpressiontransform-ui-string-expression)
* [void SetFrameHeightExpression(Transform ui, string expression)](#void-setframeheightexpressiontransform-ui-string-expression)
* [void SetFrameImageColor(Transform ui, ColorRGBA color)](#void-setframeimagecolortransform-ui-colorrgba-color)
* [void SetFrameImageColorRGBA(Transform ui, ColorRGBA color)](#void-setframeimagecolorrgbatransform-ui-colorrgba-color)
* [void SetFrameImageColorExpression(Transform ui, string r, string g, string b, string a)](#void-setframeimagecolorexpressiontransform-ui-string-r-string-g-string-b-string-a)
* [void SetFrameImageGrayScale(Transform ui, bool isGrayScale)](#void-setframeimagegrayscaletransform-ui-bool-isgrayscale)
* [void SetFrameTooltipText(Transform ui, string text)](#void-setframetooltiptexttransform-ui-string-text)
* [void SetFrameTooltipOffset(int offset)](#void-setframetooltipoffsetint-offset)
* [void SetFrameTooltipStyle(int style)](#void-setframetooltipstyleint-style)
* [void SetFrameTooltipPosition(int position)](#void-setframetooltippositionint-position)
* [void SetFrameTooltipImage(string name)](#void-setframetooltipimagestring-name)
* [void SetFrameTooltipFontSize(int size)](#void-setframetooltipfontsizeint-size)
* [void SetFrameTooltipPadding(int left, int right, int top, int bottom)](#void-setframetooltippaddingint-left-int-right-int-top-int-bottom)
* [void SetFrameTooltipMaxWidth(int width)](#void-setframetooltipmaxwidthint-width)
* [void SetFrameTooltipTextColor(ColorRGB color)](#void-setframetooltiptextcolorcolorrgb-color)
* [void SetFrameTooltipTextColorRGB(ColorRGB color)](#void-setframetooltiptextcolorrgbcolorrgb-color)
* [void SetButtonFrameClickSound(Transform ui, string path)](#void-setbuttonframeclicksoundtransform-ui-string-path)
* [void SetButtonFrameEnable(Transform ui, bool enable)](#void-setbuttonframeenabletransform-ui-bool-enable)
* [void SetButtonFrameDisabledImage(Transform ui, string name)](#void-setbuttonframedisabledimagetransform-ui-string-name)
* [void SetFrameRotation(Transform ui, float degrees)](#void-setframerotationtransform-ui-float-degrees)
* [void SetFrameRotation3D(Transform ui, float x, float y, float z)](#void-setframerotation3dtransform-ui-float-x-float-y-float-z)
* [void BindUnitData(string name, unit unit)](#void-bindunitdatastring-name-unit-unit)
* [void BindLuaTable(string name, object value)](#void-bindluatablestring-name-object-value)
* [bool IsFrameActive(Transform ui)](#bool-isframeactivetransform-ui)
* [void SetFrameActive(Transform ui, bool value)](#void-setframeactivetransform-ui-bool-value)
* [void SetFrameBlockInput(Transform ui, bool value)](#void-setframeblockinputtransform-ui-bool-value)
* [void AttachFrameToUnit(Transform ui, unit unit, UnitLabelOptions options, bool useCurrentUiRoot)](#void-attachframetounittransform-ui-unit-unit-unitlabeloptions-options-bool-usecurrentuiroot)
* [void SetMouseCursorFrame(Transform ui)](#void-setmousecursorframetransform-ui)
* [void SetMouseCursorFrameForPlayer(int player, Transform ui)](#void-setmousecursorframeforplayerint-player-transform-ui)
|
Trigger API Reference\DCEI Functions\Custom UI (6/8) {Trigger-API-ReferenceDCEI-FunctionsCustom-UI-68}
void SetFrameImageFillAmountExpression(Transform ui, string expression, bool inverse) {void-SetFrameImageFillAmountExpressionTransform-ui-string-expression-bool-inverse}
void SetFrameImageFillAmountExpression(Transform ui, string expression, bool inverse)
Sets the fill amount for the background image. Expressions use data bound by DCEI.BindData() or BindUnit().
-
Transform
ui
the frame to set the background image fill amount for. -
string
expression
an expression for the fill amount (between 0 and 1). -
bool
inverse
if true, inverts the fill amount (does 1-expression).
local vstack = DCEI.NewVStack(DCEI.GetUiRoot())
local data = {fill = 0.7}
DCEI.BindData("data", data)
local data_frame = DCEI.NewFrame(vstack)
DCEI.SetSize(data_frame, 100, 100)
DCEI.SetBackgroundImage(data_frame, "airship_onMap")
DCEI.SetBackgroundImageFillAmountExpression(data_frame, "data.fill", false)
local unit_frame = DCEI.NewFrame(vstack)
DCEI.SetBackgroundImage(unit_frame, "quest_page_progression_fill")
DCEI.SetSize(unit_frame, 100, 10)
local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 16, 16, 0, -1)
DCEI.BindUnit("selected", unit)
DCEI.SetBackgroundImageFillAmountExpression(unit_frame, "selected.Health.Fraction", false)
- BindUnit()
- BindData()
- SetBackgroundImageFillAmount()
- GetBackgroundImageFillAmount()
- SetBackgroundImageFillHorizontal()
- SetBackgroundImageFillVertical()
- SetBackgroundImageFillRadial()
- SetBackgroundImageFillOrigin()
- AnimateBackgroundImageFillAmount()
void SetFrameWidthExpression(Transform ui, string expression) {void-SetFrameWidthExpressionTransform-ui-string-expression}
void SetFrameWidthExpression(Transform ui, string expression)
Sets the width of a UI frame. Expressions use data bound by DCEI.BindData() or BindUnit().
local vstack = DCEI.NewVStack(DCEI.GetUiRoot())
local data_frame = DCEI.NewFrame(vstack)
DCEI.SetBackgroundImageColor(data_frame, 0.5, 0, 1, 1)
local data = {width = 100, height = 100}
DCEI.BindData("data", data)
DCEI.SetWidthExpression(data_frame, "data.width")
DCEI.SetHeightExpression(data_frame, "data.height")
local unit_frame = DCEI.NewFrame(vstack)
DCEI.SetBackgroundImageColor(unit_frame, 0, 1, 0.5, 1)
local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 16, 16, 0, -1)
DCEI.BindUnit("selected", unit)
DCEI.SetWidthExpression(unit_frame, "selected.Health.Max")
DCEI.SetHeightExpression(unit_frame, "selected.Health.Current")
void SetFrameHeightExpression(Transform ui, string expression) {void-SetFrameHeightExpressionTransform-ui-string-expression}
void SetFrameHeightExpression(Transform ui, string expression)
Sets the height of a UI frame. Expressions use data bound by DCEI.BindData() or BindUnit().
local vstack = DCEI.NewVStack(DCEI.GetUiRoot())
local data_frame = DCEI.NewFrame(vstack)
DCEI.SetBackgroundImageColor(data_frame, 0.5, 0, 1, 1)
local data = {width = 100, height = 100}
DCEI.BindData("data", data)
DCEI.SetWidthExpression(data_frame, "data.width")
DCEI.SetHeightExpression(data_frame, "data.height")
local unit_frame = DCEI.NewFrame(vstack)
DCEI.SetBackgroundImageColor(unit_frame, 0, 1, 0.5, 1)
local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 16, 16, 0, -1)
DCEI.BindUnit("selected", unit)
DCEI.SetWidthExpression(unit_frame, "selected.Health.Max")
DCEI.SetHeightExpression(unit_frame, "selected.Health.Current")
void SetFrameImageColor(Transform ui, ColorRGBA color) {void-SetFrameImageColorTransform-ui-ColorRGBA-color}
void SetFrameImageColor(Transform ui, ColorRGBA color)
Applies a tint color to the frame using RGBA values (valid values are between 0 and 1). Note that frames without background images can be tinted a solid color. Alpha 1 is completely opaque, alpha 0 is completely transparent.
-
Transform
ui
the frame to tint. -
ColorRGBA
color
the RGBA values for the line.
local frame = DCEI.CreateFrame(DCEI.GetUiRootFrame())
DCEI.SetFrameImageColor(frame, {r = 0.5, g = 0.5, b = 0, a = 0.5})
void SetFrameImageColorRGBA(Transform ui, ColorRGBA color) {void-SetFrameImageColorRGBATransform-ui-ColorRGBA-color}
void SetFrameImageColorRGBA(Transform ui, ColorRGBA color)
Applies a tint color to the frame using RGBA values (valid values are between 0 and 1). Note that frames without background images can be tinted a solid color. Alpha 1 is completely opaque, alpha 0 is completely transparent.
-
Transform
ui
the frame to tint. -
ColorRGBA
color
the RGBA values for the line.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetFrameImageColorRGBA(frame, {r = 0.5, g = 0.5, b = 0, a = 0.5})
void SetFrameImageColorExpression(Transform ui, string r, string g, string b, string a) {void-SetFrameImageColorExpressionTransform-ui-string-r-string-g-string-b-string-a}
void SetFrameImageColorExpression(Transform ui, string r, string g, string b, string a)
Applies a tint color to the frame using RGBA values (valid values are between 0 and 1). Note that frames without background images can be tinted a solid color. Alpha 1 is completely opaque, alpha 0 is completely transparent. Expressions use data bound by DCEI.BindData() or BindUnit().
-
Transform
ui
the frame to tint. -
float
r
an expression for the red value of the tint color (between 0 and 1). -
float
g
an expression for the green value of the tint color (between 0 and 1). -
float
b
an expression for the blue value of the tint color (between 0 and 1). -
float
a
an expression for the alpha value of the tint color (between 0 and 1).
local vstack = DCEI.NewVStack(DCEI.GetUiRoot())
local data = {bg_color = {r = 0.5, g = 0, b = 1, a = 1}}
DCEI.BindData("data", data)
local data_frame = DCEI.NewFrame(vstack)
DCEI.SetSize(data_frame, 200, 100)
DCEI.SetBackgroundImageColorExpression(data_frame, "data.bg_color.r", "data.bg_color.g", "data.bg_color.b", "data.bg_color.a")
local unit_frame = DCEI.NewFrame(vstack)
DCEI.SetSize(unit_frame, 200, 100)
local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 16, 16, 0, -1)
DCEI.BindUnit("selected", unit)
local rgbval = "selected.Health.Fraction"
DCEI.SetBackgroundImageColorExpression(unit_frame, rgbval, rgbval, rgbval, rgbval)
void SetFrameImageGrayScale(Transform ui, bool isGrayScale) {void-SetFrameImageGrayScaleTransform-ui-bool-isGrayScale}
void SetFrameImageGrayScale(Transform ui, bool isGrayScale)
Sets if the background image is rendered in gray scale for a UI frame.
-
Transform
ui
the frame to set the background image gray scale for. -
bool
isGrayScale
if true, renders the background image in gray scale. The default value is false for newly created frames.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetBackgroundImageGrayScale(frame, true)
void SetFrameTooltipText(Transform ui, string text) {void-SetFrameTooltipTextTransform-ui-string-text}
void SetFrameTooltipText(Transform ui, string text)
Sets the tooltip text for a UI frame. Child frame tooltips will display over parent frame tooltips.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipMaxWidth()
- SetTooltipTextColor()
void SetFrameTooltipOffset(int offset)
Sets the tooltip offset from the cursor. This will affect all tooltips.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetTooltipOffset(100)
- SetTooltipText()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipMaxWidth()
- SetTooltipTextColor()
void SetFrameTooltipStyle(int style)
Sets the tooltip style. This will affect all tooltips. By default, tooltips are displayed next to the cursor.
-
int
style
the style. A value of0
will display the tooltip next to the cursor (default). A value of1
will display the tooltip next to the frame.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetTooltipStyle(1)
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipMaxWidth()
- SetTooltipTextColor()
void SetFrameTooltipPosition(int position)
Sets the tooltip position. This will affect all tooltips.
-
int
position
the position of the tooltip. A value of0
will display the tooltip to the right of the frame. A value of1
will display the tooltip at the top.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetTooltipPosition(1)
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipMaxWidth()
- SetTooltipTextColor()
void SetFrameTooltipImage(string name)
Sets a background image for tooltips. This will affect all tooltips.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetTooltipBackgroundImage("airship_onMap")
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipMaxWidth()
- SetTooltipTextColor()
void SetFrameTooltipFontSize(int size)
Sets the tooltip font size. This will affect all tooltips.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetTooltipFontSize(50)
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipPadding()
- SetTooltipMaxWidth()
- SetTooltipTextColor()
void SetFrameTooltipPadding(int left, int right, int top, int bottom) {void-SetFrameTooltipPaddingint-left-int-right-int-top-int-bottom}
void SetFrameTooltipPadding(int left, int right, int top, int bottom)
Sets the tooltip padding. This will affect all tooltips.
-
int
left
the left padding. -
int
right
the right padding. -
int
top
the top padding. -
int
bottom
the bottom padding.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetTooltipPadding(30, 30, 30, 30)
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipMaxWidth()
- SetTooltipTextColor()
void SetFrameTooltipMaxWidth(int width)
Sets the tooltip max width. Tooltip text that exceeds this width will wrap. This will affect all tooltips.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetTooltipFontSize(50)
DCEI.SetTooltipMaxWidth(100)
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipTextColor()
void SetFrameTooltipTextColor(ColorRGB color)
Sets the tooltip text color. This will affect all tooltips.
-
ColorRGB
color
the RGB values for the line.
local frame = DCEI.CreateFrame(DCEI.GetUiRootFrame())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetFrameTooltipTextColor({r = 0.5, g = 0.5, b = 0})
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipMaxWidth()
void SetFrameTooltipTextColorRGB(ColorRGB color)
Sets the tooltip text color. This will affect all tooltips.
-
ColorRGB
color
the RGB values for the line.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.SetTooltipText(frame, "Frame 1")
DCEI.SetFrameTooltipTextColorRGB({r = 0.5, g = 0.5, b = 0})
- SetTooltipText()
- SetTooltipOffset()
- SetTooltipStyle()
- SetTooltipPosition()
- SetTooltipBackgroundImage()
- SetTooltipFontSize()
- SetTooltipPadding()
- SetTooltipMaxWidth()
void SetButtonFrameClickSound(Transform ui, string path) {void-SetButtonFrameClickSoundTransform-ui-string-path}
void SetButtonFrameClickSound(Transform ui, string path)
Sets the click sound for the given button.
local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetButtonClickSound(button, "ancienttree_ability_01")
void SetButtonFrameEnable(Transform ui, bool enable) {void-SetButtonFrameEnableTransform-ui-bool-enable}
void SetButtonFrameEnable(Transform ui, bool enable)
Enables or disables a button. Disabled buttons don't accept mouse input and have their background image tinted darker unless given a disabled button background image.
-
Transform
ui
the button frame. -
bool
enable
if true, enables the button. This is true by default for newly created buttons.
local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.EnableButton(button, false)
void SetButtonFrameDisabledImage(Transform ui, string name) {void-SetButtonFrameDisabledImageTransform-ui-string-name}
void SetButtonFrameDisabledImage(Transform ui, string name)
Sets the background image for a button while it is disabled.
local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.EnableButton(button, false)
DCEI.SetDisabledButtonBackgroundImage(button, "airship_onMap")
void SetFrameRotation(Transform ui, float degrees) {void-SetFrameRotationTransform-ui-float-degrees}
void SetFrameRotation(Transform ui, float degrees)
Sets the rotation for a UI frame and its children.
-
Transform
ui
the UI frame to rotate. -
float
degrees
the degrees to rotate counterclockwise. Negative values will cause clockwise rotation.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImageColor(frame, 1, 0, 1, 0.5)
DCEI.SetRotation(frame, 45)
void SetFrameRotation3D(Transform ui, float x, float y, float z) {void-SetFrameRotation3DTransform-ui-float-x-float-y-float-z}
void SetFrameRotation3D(Transform ui, float x, float y, float z)
Rotates a frame and its children in 3D space. DCEI.SetRotation3D(ui, 0, 180, 0)
will flip an image horizontally.
-
Transform
ui
the frame to rotate. -
float
x
the angle to rotate the frame in the "x" plane. -
float
y
the angle to rotate the frame in the "y" plane. -
float
z
the angle to rotate the frame in the "z" plane.
local big_hand = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(big_hand, "pointy_finger")
DCEI.SetSize(big_hand, 108, 87)
DCEI.SetRotation3D(big_hand, 0, 180, 0)
void BindUnitData(string name, unit unit)
Bind a given unit to a key, allowing the unit's attributes to be accessed by expressions. Data bound values can be formatted to specific decimal values by appending the expression such as :F2
. DreamEditor also provides an additional specifier :K
to format huge numbers as "xxxK", "xxxM" or "xxxB". The default parameter for :K
is :K2
. You can find more documentation here
-
string
name
the string to bind the unit to. -
unit
unit
the unit. Unit attributes list:
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
-- create and bind a unit
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)
-- make it so that the healthbar shows <current HP>/<max HP>
DCEI.SetTextExpression(stats.health_label, "{selected.Health.Current}/{selected.Health.Max}")
-- damage unit every second
DCEI.TriggerAddTimerEventPeriodicIndefinite(
function()
DCEI.SetHealth(unit, DCEI.GetHealth(unit) - 1)
end,
1, true
)
- SetTextExpression()
- SetBackgroundImageExpression()
- SetBackgroundImageGrayScaleExpression()
- SetEnableButtonExpression()
- SetBackgroundImageFillAmountExpression()
- SetWidthExpression()
- SetHeightExpression()
- SetBackgroundImageColorExpression()
void BindLuaTable(string name, object value)
Binds a lua table to a string, allowing the data inside to be accessed by expressions. Updating the bound table values will update any UI that reference these values in an expression. Some expressions evaluate 1
and 0
as true
and false
, respectively.
-- create and bind a data table
local data_table = {
score = 0
}
DCEI.BindData("data", data_table)
-- create a new text frame and bind its text to the score variable
local label = DCEI.NewText(DCEI.GetUiRoot())
DCEI.SetTextExpression(label, "Score: {data.score}")
-- increment score every second
DCEI.TriggerAddTimerEventPeriodicIndefinite(
function()
data_table.score = data_table.score + 1
end,
1, true
)
- SetTextExpression()
- SetBackgroundImageExpression()
- SetBackgroundImageGrayScaleExpression()
- SetEnableButtonExpression()
- SetBackgroundImageFillAmountExpression()
- SetWidthExpression()
- SetHeightExpression()
- SetBackgroundImageColorExpression()
bool IsFrameActive(Transform ui)
Returns whether the given UI frame is active.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImageColor(frame, 1, 0, 1, 0.5)
local is_active = DCEI.IsActive(frame)
DCEI.LogMessage(tostring(is_active))
void SetFrameActive(Transform ui, bool value)
Sets whether the given UI frame and its children are active. Inactive frames are not displayed.
Creating new UI frames under inactive parent frames can cause issues and should be avoided. You can use DCEI.UpdateUi() to safely create new frames under inactive parents.
-
Transform
ui
the UI frame to set the status of. -
bool
value
if true, sets the frame to active. Newly created frames are active by default.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 100, 100)
DCEI.SetBackgroundImageColor(frame, 1, 0, 1, 0.5)
DCEI.SetActive(frame, false)
void SetFrameBlockInput(Transform ui, bool value)
Makes a UI frame block all input. Requires a background image to be set (but it can be made invisible).
local fullscreen_mask = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetMatchParent(fullscreen_mask, true)
DCEI.SetBackgroundImageColor(fullscreen_mask, 0, 0, 0, 0.5)
DCEI.SetBlockInput(fullscreen_mask, true)
void AttachFrameToUnit(Transform ui, unit unit, UnitLabelOptions options, bool useCurrentUiRoot) {void-AttachFrameToUnitTransform-ui-unit-unit-UnitLabelOptions-options-bool-useCurrentUiRoot}
void AttachFrameToUnit(Transform ui, unit unit, UnitLabelOptions options, bool useCurrentUiRoot)
Attaches a UI frame to a unit, useful for creating custom health and status bars.
-
Transform
ui
the frame to attach. -
unit
unit
the unit to attach the frame to. -
table
options
accepted values:-
table
offset
as{up = 0, front = 0, right = 0}
. -
boolean
center_at_unit_origin
when true, uses the unit's origin point rather than status bar height for UI attachment.
-
table
-
boolean
useCurrentUiRoot
(optional) when true, uses the existing UI root for the attached UI layer. Otherwise the attached UI will be rendered beneath UI root.
local frame = DCEI.NewText(DCEI.GetUiRoot())
DCEI.SetText(frame, "Bob")
local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 16, 16, 0, -1)
local options = {
offset = {up = 1.2},
center_at_unit_origin = true
}
DCEI.AttachToUnit(frame, unit, options)
void SetMouseCursorFrame(Transform ui)
Using an UI to replace current cursor image
local frame = DCEI.NewText(DCEI.GetUiRoot())
DCEI.SetText(frame, "Bob")
DCEI.SetMouseCursorFrame(frame)
void SetMouseCursorFrameForPlayer(int player, Transform ui) {void-SetMouseCursorFrameForPlayerint-player-Transform-ui}
void SetMouseCursorFrameForPlayer(int player, Transform ui)
Set cursor image only for a specific player. Only useful in multiplayer.
local frame = DCEI.NewText(DCEI.GetUiRoot())
DCEI.SetText(frame, "Bob")
DCEI.SetMouseCursorFrame(1, frame)