Trigger API Reference DCEI Functions Custom UI0 - funovus/editor-wiki GitHub Wiki
Table of Contents
- [Trigger API Reference\DCEI Functions\Custom UI (1/8)](#trigger-api-referencedcei-functionscustom-ui-18)
* [Transform GetUiRootFrame()](#transform-getuirootframe)
* [Float2 GetUiCanvasSize(bool ignoreSafeArea)](#float2-getuicanvassizebool-ignoresafearea)
* [float SetUiSizeMultiplier(float multiplier)](#float-setuisizemultiplierfloat-multiplier)
* [Transform GetUiRootFrameForPlayer(int player)](#transform-getuirootframeforplayerint-player)
* [void DestroyFrame(Transform ui)](#void-destroyframetransform-ui)
* [bool FrameExists(Transform ui)](#bool-frameexiststransform-ui)
* [Transform GetParentFrame(Transform item)](#transform-getparentframetransform-item)
* [Transform CreateFrame(Transform parent)](#transform-createframetransform-parent)
* [float GetFrameWidth(Transform ui)](#float-getframewidthtransform-ui)
* [float GetFrameHeight(Transform ui)](#float-getframeheighttransform-ui)
* [void SetFrameUseImageSizeRatio(Transform ui, float ratio)](#void-setframeuseimagesizeratiotransform-ui-float-ratio)
* [void SetFrameAlpha(Transform ui, float alpha)](#void-setframealphatransform-ui-float-alpha)
* [Transform CreateMaskFrame(Transform parent)](#transform-createmaskframetransform-parent)
* [Transform CreateStencilMaskFrame(Transform parent)](#transform-createstencilmaskframetransform-parent)
* [Transform CreateHighlightFrame(Transform parent)](#transform-createhighlightframetransform-parent)
* [Transform CreateCameraFrame(Transform parent)](#transform-createcameraframetransform-parent)
* [Transform CreateVStackFrame(Transform parent)](#transform-createvstackframetransform-parent)
* [Transform CreateHStackFrame(Transform parent)](#transform-createhstackframetransform-parent)
* [Transform CreateGridFrame(Transform parent)](#transform-creategridframetransform-parent)
* [void SetGridFrameLeftAlignment(Transform ui)](#void-setgridframeleftalignmenttransform-ui)
* [void SetGridFrameRightAlignment(Transform ui)](#void-setgridframerightalignmenttransform-ui)
* [void SetGridFrameHorizontalCenterAlignment(Transform ui)](#void-setgridframehorizontalcenteralignmenttransform-ui)
* [void SetGridFrameTopAlignment(Transform ui)](#void-setgridframetopalignmenttransform-ui)
* [void SetGridFrameBottomAlignment(Transform ui)](#void-setgridframebottomalignmenttransform-ui)
* [void SetGridFrameVerticalCenterAlignment(Transform ui)](#void-setgridframeverticalcenteralignmenttransform-ui)
* [Transform CreateHScrollFrame(Transform parent)](#transform-createhscrollframetransform-parent)
* [Transform CreateVScrollFrame(Transform parent)](#transform-createvscrollframetransform-parent)
* [Transform CreateScrollFrame(Transform parent)](#transform-createscrollframetransform-parent)
* [int GetFrameIndexInParent(Transform item)](#int-getframeindexinparenttransform-item)
* [void SetFrameIndexInParent(Transform item, int index)](#void-setframeindexinparenttransform-item-int-index)
|
Trigger API Reference\DCEI Functions\Custom UI (1/8) {Trigger-API-ReferenceDCEI-FunctionsCustom-UI-18}
- UI frames will either have a default size of 0 and expand to fit any children or attempt to fill their parent.
- Placing a frame that attempts to fill its parent inside a frame with a default size of 0 will cause the parent frame to expand to fill their parent.
- Trigger API Reference\DCEI Functions\Custom UI (2/4)
- Trigger API Reference\DCEI Functions\Custom UI (3/4)
- Trigger API Reference\DCEI Functions\Custom UI (4/4)
Transform GetUiRootFrame()
local ui_root = DCEI.GetUiRoot()
Float2 GetUiCanvasSize(bool ignoreSafeArea)
local ui_canvas_size = DCEI.GetUiCanvasSize(true)
DCEI.LogMessage("UI canvas X dim: " .. ui_canvas_size.x .. " Y dim: " .. ui_canvas_size.y)
float SetUiSizeMultiplier(float multiplier)
Applies a multiplier to all size parameters of all custom UI frames. This was added to help migrate legacy maps to portrait mode, due to the canvas scaling change.
local multiplier = 16/9
DCEI.SetUiSizeMultiplier(multiplier)
Transform GetUiRootFrameForPlayer(int player)
Returns the root UI frame for the given player.
local ui_root = DCEI.GetUiRootForPlayer(1)
void DestroyFrame(Transform ui)
Destroys the given UI frame and all its children.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.Destroy(frame)
bool FrameExists(Transform ui)
Returns true if the given UI exists.
local ui_exists = DCEI.UiExists(DCEI.GetUiRoot())
DCEI.LogMessage("Root UI exists: " .. tostring(ui_exists))
Transform GetParentFrame(Transform item)
Returns the parent frame of the given UI frame.
local parent_frame = DCEI.GetParentFrame(frame)
Transform CreateFrame(Transform parent)
Creates and returns a new frame as a child of the given a parent frame. This frame has a default height/width of 0 and expands to fit any children.
-- creates a red square
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 200, 200)
DCEI.SetBackgroundImageColor(frame, 1, 0, 0, 1)
float GetFrameWidth(Transform ui)
Returns the width of a UI frame. Note that UI frame size changes are applied at the end of a game update, so you'd need to wait a frame after changing the size of a UI frame to get the new dimensions.
local root_width = DCEI.GetFrameWidth(DCEI.GetUiRoot())
DCEI.LogMessage("The width of the root UI frame is: " .. root_width)
float GetFrameHeight(Transform ui)
Returns the height of a UI frame. Note that UI frame size changes are applied at the end of a game update, so you'd need to wait a frame after changing the size of a UI frame to get the new dimensions.
local root_height = DCEI.GetFrameHeight(DCEI.GetUiRoot())
DCEI.LogMessage("The height of the root UI frame is: " .. root_height)
void SetFrameUseImageSizeRatio(Transform ui, float ratio) {void-SetFrameUseImageSizeRatioTransform-ui-float-ratio}
void SetFrameUseImageSizeRatio(Transform ui, float ratio)
Makes the given UI frame set its sized based on the texture used for it's background image. This ratio determines the rendering size of the frame, where 1
will use the original dimensions of the texture. Once set, setting either height or width (but not both) will adjust the other dimension proportionally to match the size ratio.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.UseImageSizeRatio(frame, 2)
void SetFrameAlpha(Transform ui, float alpha)
Sets the transparency for the given UI frame and all of its children. This option with have a compounding effect with an alpha value set by SetBackgroundImageColor(). Child frames cannot be made less transparent than their parent with this function.
-
Transform
ui
the UI frame. -
float
alpha
the frame transparency, from 0 to 1, where 0 is transparent and 1 is opaque.
local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame, 200, 200)
DCEI.SetBackgroundImageColor(frame, 1, 0, 0, 1)
DCEI.SetFrameAlpha(frame, 0.5)
Transform CreateMaskFrame(Transform parent)
Creates a mask. Masks can be used to 'crop' child frames to the masks size/shape. If given a background image, the opaque white pixels will be used to determine the shape of the effect. By default, this frame type attempts to fill its parent size unless given explicit dimensions.
-- mask's its children using a circle texture
local mask = DCEI.NewMask(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(mask, "circle_mask")
DCEI.SetSize(mask, 150, 150)
-- frame to mask (note the original texture is square)
local frame = DCEI.NewFrame(mask)
DCEI.SetBackgroundImage(frame, "question_green")
DCEI.SetSize(frame, 200, 200)
Transform CreateStencilMaskFrame(Transform parent) {Transform-CreateStencilMaskFrameTransform-parent}
Transform CreateStencilMaskFrame(Transform parent)
Creates a stencil mask. Stencil masks can be used to 'cut holes' in a parent mask frame. Similar to a mask frame, if given a background image, the white/opaque values will be used to determine the shape of the effect. A stencil mask will also cut through any of its sibling frames. By default, this frame type attempts to fill its parent size unless given explicit dimensions.
-- fullscreen mask that can be used by the stencil
local mask = DCEI.NewMask(DCEI.GetUiRoot())
-- stencil used to cut out a section from the mask and its children
local stencil = DCEI.NewStencilMask(mask)
DCEI.SetSize(stencil, 100, 100)
DCEI.SetBackgroundImage(stencil, "circle_mask")
-- this frame will be affected by the stencil
local frame_to_stencil = DCEI.NewFrame(mask)
DCEI.SetMatchParent(frame_to_stencil, true, true)
DCEI.SetBackgroundImageColor(frame_to_stencil, 0, 0, 0, 0.5)
Transform CreateHighlightFrame(Transform parent)
Creates a highlight frame. If the highlight is given a background image, it will animate a highlight effect across the texture; otherwise the highlight will display a simple animation around its border. This frame type has a default size of 0 and expands to fit any children.
local highlight = DCEI.NewHighlight(DCEI.GetUiRoot())
local frame = DCEI.NewFrame(highlight)
DCEI.SetSize(frame, 100, 100)
Transform CreateCameraFrame(Transform parent)
Creates a new camera frame. Camera frames can be used to project views of the game world onto a UI frame. This can be used to make animated portraits using in-game models, among other uses. Requires the use of helper functions to set default values.
-- create unit
DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 16, 12, 0, -1)
-- create camera frame border
local container = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(container, "frame01")
DCEI.SetPadding(container, 10)
-- create camera frame facing our unit
local camera = DCEI.NewCameraFrame(container)
DCEI.SetSize(camera, 150, 150)
DCEI.SetCameraFrameSize(camera, 200, 200, true)
DCEI.SetCameraFramePosition(camera, 16, 1, 11)
DCEI.SetCameraFrameRotation(camera, 35, 0, 0)
- SetCameraFrameSize()
- SetCameraFramePosition()
- SetCameraFrameRotation()
- AnimateCameraFramePosition()
- AnimateCameraFrameRotation()
- AnimateCameraFrameOrthographicSize()
- SetCameraFrameCullingMask()
- SetUiCameraBackgroundColor()
- SetCameraFrameOrthographic()
- SetCameraFrameOrthographicSize()
- NewMiniMapFrame()
Transform CreateVStackFrame(Transform parent)
Creates a new vertical stack. This frame will arrange child frames vertically within it. By default, child frames are stacked from top to bottom. This frame type has a default size of 0 and expands to fit any children.
local stack = DCEI.NewVStack(DCEI.GetUiRoot())
DCEI.SetSize(stack, 200, 600)
DCEI.SetBackgroundImageColor(stack, 0, 0, 1, 0.2)
local frame1 = DCEI.NewFrame(stack)
DCEI.SetSize(frame1, 200, 100)
DCEI.SetBackgroundImageColor(frame1, 1, 1, 0, 0.5)
local frame2 = DCEI.NewFrame(stack)
DCEI.SetSize(frame2, 200, 100)
DCEI.SetBackgroundImageColor(frame2, 1, 0, 1, 0.4)
local frame3 = DCEI.NewFrame(stack)
DCEI.SetSize(frame3, 200, 100)
DCEI.SetBackgroundImageColor(frame3, 1, 0, 0, 0.6)
local frame4 = DCEI.NewFrame(stack)
DCEI.SetSize(frame4, 200, 100)
DCEI.SetBackgroundImageColor(frame4, 1, 1, 1, 0.3)
local frame5 = DCEI.NewFrame(stack)
DCEI.SetSize(frame5, 200, 100)
DCEI.SetBackgroundImageColor(frame5, 1, 1, 0, 1)
Transform CreateHStackFrame(Transform parent)
Creates a new horizontal stack. This frame will arrange child frames horizontally within it. By default, child frames are stacked from left to right. This frame type has a default size of 0 and expands to fit any children. If this frame is assigned a set size, oversized child frames will overflow.
local stack = DCEI.NewHStack(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(stack, 0, 0, 1, 0.2)
DCEI.SetSize(stack, 600, 100)
local frame1 = DCEI.NewFrame(stack)
DCEI.SetSize(frame1, 100, 100)
DCEI.SetBackgroundImageColor(frame1, 1, 1, 0, 0.5)
local frame2 = DCEI.NewFrame(stack)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 1, 0, 1, 0.4)
local frame3 = DCEI.NewFrame(stack)
DCEI.SetSize(frame3, 100, 100)
DCEI.SetBackgroundImageColor(frame3, 1, 0, 0, 0.6)
local frame4 = DCEI.NewFrame(stack)
DCEI.SetSize(frame4, 100, 100)
DCEI.SetBackgroundImageColor(frame4, 1, 1, 1, 0.3)
local frame5 = DCEI.NewFrame(stack)
DCEI.SetSize(frame5, 100, 100)
DCEI.SetBackgroundImageColor(frame5, 1, 1, 0, 1)
Transform CreateGridFrame(Transform parent)
Creates a new grid. This frame will arrange child frames in a grid by determining the number of rows/columns automatically from the cellWidth and cellHeight properties. This should be followed by SetGridCellHeight() and SetGridCellWidth() to set the aforementioned properties, as it does not have default values for either.
local grid = DCEI.NewGrid(DCEI.GetUiRoot())
DCEI.SetGridCellHeight(grid, 100)
DCEI.SetGridCellWidth(grid, 100)
DCEI.SetSize(grid, 200, 200)
local content1 = DCEI.NewText(grid)
DCEI.SetText(content1, "a")
DCEI.SetSize(content1, 100, 100)
local content2 = DCEI.NewText(grid)
DCEI.SetText(content2, "b")
DCEI.SetSize(content2, 100, 100)
local content3 = DCEI.NewText(grid)
DCEI.SetText(content3, "c")
DCEI.SetSize(content3, 100, 100)
local content4 = DCEI.NewText(grid)
DCEI.SetText(content4, "d")
DCEI.SetSize(content4, 100, 100)
- SetGridCellHeight()
- SetGridCellWidth()
- SetReverseLayoutOrder()
- SetSpacing()
- GetFrameIndexInParent()
- SetFrameIndexInParent()
void SetGridFrameLeftAlignment(Transform ui)
Sets left alignment for a UI frame's contents.
local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetBackgroundImageColor(frame1, 1, 0, 1, 0.4)
DCEI.SetGridFrameLeftAlignment(frame1)
local frame2 = DCEI.NewFrame(frame1)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 0, 1, 1, 0.4)
void SetGridFrameRightAlignment(Transform ui)
Sets right alignment for a UI frame's contents.
local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetBackgroundImageColor(frame1, 1, 0, 1, 0.4)
DCEI.SetGridFrameRightAlignment(frame1)
local frame2 = DCEI.NewFrame(frame1)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 0, 1, 1, 0.4)
void SetGridFrameHorizontalCenterAlignment(Transform ui) {void-SetGridFrameHorizontalCenterAlignmentTransform-ui}
void SetGridFrameHorizontalCenterAlignment(Transform ui)
Sets horizontal center alignment for a UI frame's contents.
local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetGridFrameHorizontalCenterAlignment(frame1, 1, 0, 1, 0.4)
DCEI.SetTopAlignment(frame1)
local frame2 = DCEI.NewFrame(frame1)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 0, 1, 1, 0.4)
void SetGridFrameTopAlignment(Transform ui)
Sets top alignment for a UI frame's contents.
local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetGridFrameTopAlignment(frame1, 1, 0, 1, 0.4)
DCEI.SetTopAlignment(frame1)
local frame2 = DCEI.NewFrame(frame1)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 0, 1, 1, 0.4)
void SetGridFrameBottomAlignment(Transform ui)
Sets bottom alignment for a UI frame's contents.
local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetBackgroundImageColor(frame1, 1, 0, 1, 0.4)
DCEI.SetGridFrameBottomAlignment(frame1)
local frame2 = DCEI.NewFrame(frame1)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 0, 1, 1, 0.4)
void SetGridFrameVerticalCenterAlignment(Transform ui) {void-SetGridFrameVerticalCenterAlignmentTransform-ui}
void SetGridFrameVerticalCenterAlignment(Transform ui)
Sets vertical center alignment for a UI frame's contents.
local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetGridFrameVerticalCenterAlignment(frame1, 1, 0, 1, 0.4)
DCEI.SetTopAlignment(frame1)
local frame2 = DCEI.NewFrame(frame1)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 0, 1, 1, 0.4)
Transform CreateHScrollFrame(Transform parent)
Creates a new horizontal scrolling frame. This frame functions similarly to a HStack, in that it will arrange its child frames horizontally, however this frame also supports horizontal scrolling if the contents would be larger than the size of the scroll frame. Do not place content inside this frame directly, instead use GetScrollContent() to fetch the content frame. By default, this frame type attempts to fill its parent size unless given explicit dimensions.
local hscroll_frame = DCEI.NewHScroll(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(hscroll_frame, "frame01")
DCEI.SetSize(hscroll_frame, 350, 120)
local hscroll_content = DCEI.GetScrollContent(hscroll_frame)
DCEI.SetSpacing(hscroll_content, 10)
DCEI.SetPadding(hscroll_content, 10)
local frame1 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame1, 100, 100)
DCEI.SetBackgroundImage(frame1, "frame01_blue")
local frame2 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImage(frame2, "frame01_brown")
local frame3 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame3, 100, 100)
DCEI.SetBackgroundImage(frame3, "frame01_purple")
local frame4 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame4, 100, 100)
DCEI.SetBackgroundImage(frame4, "frame01_grey")
local frame5 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame5, 100, 100)
DCEI.SetBackgroundImage(frame5, "frame01_yellow")
- HStack
- GetScrollContent()
- SetScrollPosition()
- GetScrollPosition()
- SetScrollInertia()
- SetEnableScroll()
- SetScrollDecelerationRate()
- SetScrollContentAlignment()
- AnimateScrollPosition()
Transform CreateVScrollFrame(Transform parent)
Creates a new vertically scrolling frame. This frame functions similarly to a VStack, in that it will arrange its child frames vertically, however this frame also supports vertical scrolling if the contents would be larger than the size of the scroll frame. Do not place content inside this frame directly, instead use GetScrollContent() to fetch the content frame. By default, this frame type attempts to fill its parent size unless given explicit dimensions.
local vscroll_frame = DCEI.NewVScroll(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(vscroll_frame, "frame01")
DCEI.SetSize(vscroll_frame, 120, 350)
local vscroll_content = DCEI.GetScrollContent(vscroll_frame)
DCEI.SetSpacing(vscroll_content, 10)
DCEI.SetPadding(vscroll_content, 10)
local frame1 = DCEI.NewFrame(vscroll_content)
DCEI.SetSize(frame1, 100, 100)
DCEI.SetBackgroundImage(frame1, "frame01_blue")
local frame2 = DCEI.NewFrame(vscroll_content)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImage(frame2, "frame01_brown")
local frame3 = DCEI.NewFrame(vscroll_content)
DCEI.SetSize(frame3, 100, 100)
DCEI.SetBackgroundImage(frame3, "frame01_purple")
local frame4 = DCEI.NewFrame(vscroll_content)
DCEI.SetSize(frame4, 100, 100)
DCEI.SetBackgroundImage(frame4, "frame01_grey")
local frame5 = DCEI.NewFrame(vscroll_content)
DCEI.SetSize(frame5, 100, 100)
DCEI.SetBackgroundImage(frame5, "frame01_yellow")
- VStack
- GetScrollContent()
- SetScrollPosition()
- GetScrollPosition()
- SetScrollInertia()
- SetEnableScroll()
- SetScrollDecelerationRate()
- SetScrollContentAlignment()
- AnimateScrollPosition()
Transform CreateScrollFrame(Transform parent)
Creates a horizontally and vertically scrolling frame. Useful for making scrollable maps. Do not place content inside this frame directly, instead use GetScrollContent()] to fetch the content frame. By default, this frame type attempts to fill its parent size unless given explicit dimensions.
local scroll_frame = DCEI.NewScroll(DCEI.GetUiRoot())
DCEI.SetSize(scroll_frame, 500, 500)
DCEI.SetBackgroundImageColor(scroll_frame, 1, 0, 0, 0.3)
DCEI.SetScrollInertia(scroll_frame, false)
local scroll_content = DCEI.GetScrollContent(scroll_frame)
local big_content = DCEI.NewFrame(scroll_content)
DCEI.SetSize(big_content, 1000, 1000)
DCEI.SetBackgroundImageColor(big_content, 0, 0, 1, 0.4)
local small_content = DCEI.NewFrame(scroll_content)
DCEI.SetSize(small_content, 100, 100)
DCEI.SetBackgroundImageColor(small_content, 0, 1, 0, 0.4)
- GetScrollContent()
- SetScrollPosition2D()
- GetScrollPosition2D()
- SetScrollInertia()
- SetEnableScroll()
- SetScrollDecelerationRate()
- SetScrollContentAlignment()
- AnimateScrollPosition2D()
int GetFrameIndexInParent(Transform item)
Returns the given UI frame's child index in its parent UI frame. This can be useful for getting an item's position from within a stack.
local stack = DCEI.NewHStack(DCEI.GetUiRoot())
DCEI.SetSize(stack, 100, 100)
local frame1 = DCEI.NewFrame(stack)
DCEI.SetSize(frame1, 100, 100)
DCEI.SetBackgroundImageColor(frame1, 1, 0, 0, 0.4)
local frame2 = DCEI.NewFrame(stack)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImageColor(frame2, 1, 0, 0, 0.6)
local frame3 = DCEI.NewFrame(stack)
DCEI.SetSize(frame3, 100, 100)
DCEI.SetBackgroundImageColor(frame3, 1, 0, 0, 0.8)
local frame4 = DCEI.NewFrame(stack)
DCEI.SetSize(frame4, 100, 100)
DCEI.SetBackgroundImageColor(frame4, 0, 1, 0, 1)
local frame_index = DCEI.GetFrameIndexInParent(frame4)
DCEI.LogMessage("The child index of 'frame4' is: " .. frame_index)
void SetFrameIndexInParent(Transform item, int index) {void-SetFrameIndexInParentTransform-item-int-index}
void SetFrameIndexInParent(Transform item, int index)
Sets the given UI frame's child index in its parent UI frame. If the new index already has a UI frame assigned to it, the frame will be inserted at the new position and its siblings indices will update to match the new order. Indices must be contiguous, trying to set a child's index to a non-contiguous index will just set it to the last contiguous index. The frame index is by default the order in which the child frames were created within the parent.
local hscroll_frame = DCEI.NewHScroll(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(hscroll_frame, "frame01")
DCEI.SetSize(hscroll_frame, 350, 120)
local hscroll_content = DCEI.GetScrollContent(hscroll_frame)
DCEI.SetSpacing(hscroll_content, 10)
DCEI.SetPadding(hscroll_content, 10)
local frame1 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame1, 100, 100)
DCEI.SetBackgroundImage(frame1, "frame01_blue")
local frame2 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame2, 100, 100)
DCEI.SetBackgroundImage(frame2, "frame01_brown")
local frame3 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame3, 100, 100)
DCEI.SetBackgroundImage(frame3, "frame01_purple")
-- This will move 'frame3' to the first index, causing it to display first
DCEI.SetFrameIndexInParent(frame3, 1)
local frame4 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame4, 100, 100)
DCEI.SetBackgroundImage(frame4, "frame01_grey")
local frame5 = DCEI.NewFrame(hscroll_content)
DCEI.SetSize(frame5, 100, 100)
DCEI.SetBackgroundImage(frame5, "frame01_yellow")