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

Table of Contents

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

void AttachOffscreenUnitIndicatorFrame(Transform ui, unit unit, Transform rotatingPointerChildFrame) {void-AttachOffscreenUnitIndicatorFrameTransform-ui-unit-unit-Transform-rotatingPointerChildFrame}

void AttachOffscreenUnitIndicatorFrame(Transform ui, unit unit, Transform rotatingPointerChildFrame)

Description

Attaches a UI frame as an offscreen indicator to a unit. This frame will only be visible if the related unit is off screen for the viewing player.

Parameters

  • Transform ui the UI frame to use as an offscreen indicator.
  • unit unit the unit to attach the indicator to.
  • Transform rotatingPointerChildFrame (optional) if set, this frame will rotate towards the direction of the offscreen unit.

Example Usage

local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 30, 30, 0, -1)
DCEI.Move(unit, 30, 0)

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

local frame2 = DCEI.NewFrame(frame)
DCEI.SetBackgroundImage(frame2, "airship_onMap")
DCEI.SetSize(frame2, 100, 100)

DCEI.AttachOffscreenUnitIndicator(frame, unit, frame2)

void MoveFrameToTop(Transform ui) {void-MoveFrameToTopTransform-ui}

void MoveFrameToTop(Transform ui)

Description

Moves a UI frame (and all of its parents) above all sibling UI frames.

Parameters

  • Transform ui the UI frame to move to the top.

Example Usage

local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetHorizontalOffsetInParent(frame1, -50)
DCEI.SetBackgroundImageColor(frame1, 1, 0, 0, 1)
    
local frame2 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame2, 200, 200)
DCEI.SetHorizontalOffsetInParent(frame2, 50)
DCEI.SetBackgroundImageColor(frame2, 0, 0, 1, 1)

DCEI.TriggerAddTimerEventElapsed(
    function()
        -- frame1 is moved above frame2, by default frame2 will overlap frame1
        DCEI.MoveToTop(frame1)
    end,
    1,
    true
)

void MoveFrameToBottom(Transform ui) {void-MoveFrameToBottomTransform-ui}

void MoveFrameToBottom(Transform ui)

Description

Moves a UI frame (and all of its parents) below all sibling UI frames.

Parameters

  • Transform ui the UI frame to move to the bottom.

Example Usage

local frame1 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame1, 200, 200)
DCEI.SetHorizontalOffsetInParent(frame1, -50)
DCEI.SetBackgroundImageColor(frame1, 1, 0, 0, 1)
    
local frame2 = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(frame2, 200, 200)
DCEI.SetHorizontalOffsetInParent(frame2, 50)
DCEI.SetBackgroundImageColor(frame2, 0, 0, 1, 1)

DCEI.TriggerAddTimerEventElapsed(
  function()
        -- frame2 is moved below frame1, by default frame2 will overlap frame1
        DCEI.MoveToBottom(frame2)
    end,
    1,
    true
)

void SetPauseButtonFrame(Transform ui) {void-SetPauseButtonFrameTransform-ui}

void SetPauseButtonFrame(Transform ui)

Description

Sets a button to be used as the game's pause button. Setting this will replace the default pause button in the top right corner (hiding the default UI).

Parameters

  • Transform ui the button frame to set as the pause button.

Example Usage

local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetPauseButton(button)

Related

void SetPauseMenuFrame(Transform ui) {void-SetPauseMenuFrameTransform-ui}

void SetPauseMenuFrame(Transform ui)

Description

Sets a UI frame to be the pause menu, replacing the default pause menu UI and functionality.

Parameters

  • Transform ui the UI frame to set as the pause menu.

Example Usage

local menu = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetSize(menu, 400, 600)
DCEI.SetBackgroundImage(menu, "frame01_purple")
DCEI.SetPauseMenu(menu)

-- the pause menu is inactive by default but we can update it safely with UpdateUi
DCEI.UpdateUi(
    menu,
    function()
        local resume_button = DCEI.NewButton(menu)
        DCEI.SetSize(resume_button, 200, 100)
        DCEI.SetPauseMenuResumeButton(resume_button)
    end
)

Related

void ShowPauseMenuFrame() {void-ShowPauseMenuFrame}

void ShowPauseMenuFrame()

Description

Show current pause menu

Example Usage

void HidePauseMenuFrame() {void-HidePauseMenuFrame}

void HidePauseMenuFrame()

Description

Example Usage

void SetPauseMenuFrameMusicButton(Transform ui) {void-SetPauseMenuFrameMusicButtonTransform-ui}

void SetPauseMenuFrameMusicButton(Transform ui)

Description

Parameters

Example Usage

void SetPauseMenuFrameSoundButton(Transform ui) {void-SetPauseMenuFrameSoundButtonTransform-ui}

void SetPauseMenuFrameSoundButton(Transform ui)

Description

Parameters

Example Usage

void SetPauseMenuFrameResumeButton(Transform ui) {void-SetPauseMenuFrameResumeButtonTransform-ui}

void SetPauseMenuFrameResumeButton(Transform ui)

Description

Sets the pause menu resume button. This button will exit the pause menu.

Parameters

  • Transform ui the button to set as the resume button.

Example Usage

local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetPauseButton(button)

local menu = DCEI.NewVStack(DCEI.GetUiRoot())
DCEI.SetSize(menu, 400, 600)
DCEI.SetBackgroundImage(menu, "frame01_purple")

local resume = DCEI.NewButton(menu)
DCEI.SetSize(resume, 400, 200)
DCEI.SetPauseMenuResumeButton(resume)

local resume_text = DCEI.NewText(resume)
DCEI.SetText(resume_text, "Resume")

DCEI.SetPauseMenu(menu)

Related

void SetPauseMenuFrameQuitButton(Transform ui) {void-SetPauseMenuFrameQuitButtonTransform-ui}

void SetPauseMenuFrameQuitButton(Transform ui)

Description

Sets the pause menu quit button. This button will exit the game.

Parameters

  • Transform ui the button to set as the quit button.

Example Usage

local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetPauseButton(button)

local menu = DCEI.NewVStack(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(menu, "frame01_purple")
DCEI.SetPadding(menu, 20)
DCEI.SetSpacing(menu, 20)

local resume = DCEI.NewButton(menu)
DCEI.SetSize(resume, 200, 100)
DCEI.SetPauseMenuResumeButton(resume)

local resume_text = DCEI.NewText(resume)
DCEI.SetText(resume_text, "Resume")

local quit = DCEI.NewButton(menu)
DCEI.SetSize(quit, 200, 100)
DCEI.SetPauseMenuQuitButton(quit)

local quit_text = DCEI.NewText(quit)
DCEI.SetText(quit_text, "Quit")

DCEI.SetPauseMenu(menu)

Related

void SetPauseMenuFrameRestartButton(Transform ui) {void-SetPauseMenuFrameRestartButtonTransform-ui}

void SetPauseMenuFrameRestartButton(Transform ui)

Description

Sets the pause menu restart button. This button will restart the game.

Parameters

  • Transform ui the button to set as the restart button.

Example Usage

local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetPauseButton(button)

local menu = DCEI.NewVStack(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(menu, "frame01_purple")
DCEI.SetPadding(menu, 20)
DCEI.SetSpacing(menu, 20)

local resume = DCEI.NewButton(menu)
DCEI.SetSize(resume, 200, 100)
DCEI.SetPauseMenuResumeButton(resume)

local resume_text = DCEI.NewText(resume)
DCEI.SetText(resume_text, "Resume")

local quit = DCEI.NewButton(menu)
DCEI.SetSize(quit, 200, 100)
DCEI.SetPauseMenuQuitButton(quit)

local quit_text = DCEI.NewText(quit)
DCEI.SetText(quit_text, "Quit")

local restart = DCEI.NewButton(menu)
DCEI.SetSize(restart, 200, 100)
DCEI.SetPauseMenuRestartButton(restart)

local restart_text = DCEI.NewText(restart)
DCEI.SetText(restart_text, "Restart")

DCEI.SetPauseMenu(menu)

Related

void SetPauseMenuFramePlayLevelButton(Transform ui, string path, string displayName) {void-SetPauseMenuFramePlayLevelButtonTransform-ui-string-path-string-displayName}

void SetPauseMenuFramePlayLevelButton(Transform ui, string path, string displayName)

Description

Sets the pause menu play level button. This button will play the specified level, exiting the current one.

Parameters

  • Transform ui the button to set as the play level button.
  • string path the level's path.
  • string displayName the name to display for the level.

Example Usage

local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetPauseButton(button)

local menu = DCEI.NewVStack(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(menu, "frame01_purple")
DCEI.SetPadding(menu, 20)
DCEI.SetSpacing(menu, 20)

local resume = DCEI.NewButton(menu)
DCEI.SetSize(resume, 200, 100)
DCEI.SetPauseMenuResumeButton(resume)

local resume_text = DCEI.NewText(resume)
DCEI.SetText(resume_text, "Resume")

local quit = DCEI.NewButton(menu)
DCEI.SetSize(quit, 200, 100)
DCEI.SetPauseMenuQuitButton(quit)

local quit_text = DCEI.NewText(quit)
DCEI.SetText(quit_text, "Quit")

local restart = DCEI.NewButton(menu)
DCEI.SetSize(restart, 200, 100)
DCEI.SetPauseMenuRestartButton(restart)

local restart_text = DCEI.NewText(restart)
DCEI.SetText(restart_text, "Restart")

local play_level = DCEI.NewButton(menu)
DCEI.SetSize(play_level, 200, 100)
DCEI.SetPauseMenuPlayLevelButton(play_level, "Workshop 02 - Debugging & Foundations", "Level")

local play_level_text = DCEI.NewText(play_level)
DCEI.SetText(play_level_text, "Open Workshop 02")

DCEI.SetPauseMenu(menu)

Related

void SetPauseMenuFrameSettingsButton(Transform ui) {void-SetPauseMenuFrameSettingsButtonTransform-ui}

void SetPauseMenuFrameSettingsButton(Transform ui)

Description

Sets the pause menu settings button. Note that the settings menu only appears in standalone builds--nothing will happen if this button is used in editor play mode.

Parameters

  • Transform ui the button to set as the settings button.

Example Usage

local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetPauseButton(button)

local menu = DCEI.NewVStack(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(menu, "frame01_purple")
DCEI.SetPadding(menu, 20)
DCEI.SetSpacing(menu, 20)

local resume = DCEI.NewButton(menu)
DCEI.SetSize(resume, 200, 100)
DCEI.SetPauseMenuResumeButton(resume)

local resume_text = DCEI.NewText(resume)
DCEI.SetText(resume_text, "Resume")

local quit = DCEI.NewButton(menu)
DCEI.SetSize(quit, 200, 100)
DCEI.SetPauseMenuQuitButton(quit)

local quit_text = DCEI.NewText(quit)
DCEI.SetText(quit_text, "Quit")

local restart = DCEI.NewButton(menu)
DCEI.SetSize(restart, 200, 100)
DCEI.SetPauseMenuRestartButton(restart)

local restart_text = DCEI.NewText(restart)
DCEI.SetText(restart_text, "Restart")

local settings = DCEI.NewButton(menu)
DCEI.SetSize(settings, 200, 100)
DCEI.SetPauseMenuSettingsButton(settings)

local settings_text = DCEI.NewText(settings)
DCEI.SetText(settings_text, "Settings")

DCEI.SetPauseMenu(menu)

Related

void SuppressPauseMenuOnApplicationPause() {void-SuppressPauseMenuOnApplicationPause}

void SuppressPauseMenuOnApplicationPause()

Description

Suppresses the pause menu on application pause. This is necessary if your game features in-game ads, as the ads screen will pause the application and show the pause menu by default.

Example Usage

DCEI.SuppressPauseMenuOnApplicationPause()

Float3 GetFramePosition3D(Transform ui) {Float3-GetFramePosition3DTransform-ui}

Float3 GetFramePosition3D(Transform ui)

Description

Returns the 3D Position of a UI frame. Similar to other UI getters, you may need to wait a frame after any UI adjustments to get the latest position.

Parameters

  • Transform ui the button to get the position of.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetVerticalOffsetInParent(frame, 200)
    
-- wait a frame to get the new UI position
DCEI.TriggerAddTimerEventElapsed(
    function()
        local pos = DCEI.GetUiPosition3D(frame)
        DCEI.LogMessage(string.format("Frame X position: %f, Y position: %f, Z position: %f", pos.x, pos.y, pos.z))
    end,
    0, 
    true
)

Float3 GetCanvasPositionFromWorldPosition(Float3 worldPosition) {Float3-GetCanvasPositionFromWorldPositionFloat3-worldPosition}

Float3 GetCanvasPositionFromWorldPosition(Float3 worldPosition)

Description

Parameters

Example Usage

void MoveFrameToPosition(Transform ui, Float3 canvasPosition, Offset offset) {void-MoveFrameToPositionTransform-ui-Float3-canvasPosition-Offset-offset}

void MoveFrameToPosition(Transform ui, Float3 canvasPosition, Offset offset)

Description

Parameters

Example Usage

void SetFrameAnimationLoops(Tweener tweener, int loops, string loopType) {void-SetFrameAnimationLoopsTweener-tweener-int-loops-string-loopType}

void SetFrameAnimationLoops(Tweener tweener, int loops, string loopType)

Description

Plays a given UI animation a specified number of loops.

Parameters

  • Tweener tweener the UI animation.
  • int loops the number of loops to play. If loops is set to -1 it will loop infinitely, until stopped with DCEI.StopAnimationLoops().
  • string loopType the type of loop. Options:
Restart - restarts animation from beginning for each loop.
Yoyo - animates forwards then backwards, alternating for each loop.
Incremental - each loop is incrementally executed (useful for animating clock hands).

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 0, 1, 1)
DCEI.SetSize(frame, 100, 100)
    
local k1, k2 = 0.5, 1.5
local duration = 2
local easing = "InCubic"
local anim = DCEI.AnimateScale(frame, {x = k1, y = k1, z = k1}, {x = k2, y = k2, z = k2}, duration, easing)
DCEI.SetAnimationLoops(anim, -1, "Yoyo")

Related

void StopFrameAnimationLoops(Tweener tweener, bool waitAnimationComplete) {void-StopFrameAnimationLoopsTweener-tweener-bool-waitAnimationComplete}

void StopFrameAnimationLoops(Tweener tweener, bool waitAnimationComplete)

Description

Stops an animation loop.

Parameters

  • Tweener tweener the UI animation.
  • bool waitAnimationComplete if true, waits for the current animation to complete before stopping the loop.

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 0, 1, 1)
DCEI.SetSize(frame, 100, 100)
    
local k1, k2 = 0.5, 1.5
local duration = 2
local easing = "InCubic"
local anim = DCEI.AnimateScale(frame, {x = k1, y = k1, z = k1}, {x = k2, y = k2, z = k2}, duration, easing)
DCEI.SetAnimationLoops(anim, -1, "Yoyo")

DCEI.TriggerAddTimerEventElapsed(
    function()
        DCEI.StopAnimationLoops(anim, true)
    end,
    1,
    true
)

Related

Tweener AnimateFrameScale(Transform ui, Float3 start, Float3 end, float duration, string ease) {Tweener-AnimateFrameScaleTransform-ui-Float3-start-Float3-end-float-duration-string-ease}

Tweener AnimateFrameScale(Transform ui, Float3 start, Float3 end, float duration, string ease)

Description

Animates a UI frame's scale over time.

Parameters

  • Transform ui which frame to animate.

  • Float3 start the initial scale of the frame animation as {x = 1, y = 1, z = 1}.

  • Float3 end the final scale of the frame animation as {x = 1, y = 1, z = 1}.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImageColor(frame, 1, 0, 0, 1)
DCEI.SetSize(frame, 100, 100)
    
local k1, k2 = 1, 2
local duration = 2
local ease = "InCubic"
DCEI.AnimateScale(frame, {x = k1, y = k1, z = k1}, {x = k2, y = k2, z = k2}, duration, ease)

Related

Tweener AnimateFrameImageFillAmount(Transform ui, float start, float end, float duration, string ease) {Tweener-AnimateFrameImageFillAmountTransform-ui-float-start-float-end-float-duration-string-ease}

Tweener AnimateFrameImageFillAmount(Transform ui, float start, float end, float duration, string ease)

Description

Animates a UI frame's background image fill. Requires a background image to be set, a background image color alone does not work.

Parameters

  • Transform ui the UI frame to animate background image fill for.

  • float start the starting fill, from 0-1.

  • float end the ending fill, from 0-1.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(frame, "quest_page_progression_fill")
DCEI.SetSize(frame, 100, 50)
        
local k1, k2 = 0, 1
local duration = 2
local ease = "Linear"
DCEI.AnimateBackgroundImageFillAmount(frame, k1, k2, duration, ease)

Related

Tweener AnimateFrameRotation(Transform ui, Float3 start, Float3 end, float duration, string ease) {Tweener-AnimateFrameRotationTransform-ui-Float3-start-Float3-end-float-duration-string-ease}

Tweener AnimateFrameRotation(Transform ui, Float3 start, Float3 end, float duration, string ease)

Description

Animates a UI frame's rotation.

Parameters

  • Transform ui the UI frame to animate the rotation for.

  • Float3 start the starting rotation.

  • Float3 end the ending rotation.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.UseImageSizeRatio(frame, 1)

local k1, k2 = 0, 180
local duration = 2
local ease = "Linear"

DCEI.AnimateRotation(frame, {x = 0, y = 0, z = k1}, {x = 0, y = 0, z = k2}, duration, ease)

Related

Tweener AnimateFrameAlpha(Transform ui, float start, float end, float duration, string ease) {Tweener-AnimateFrameAlphaTransform-ui-float-start-float-end-float-duration-string-ease}

Tweener AnimateFrameAlpha(Transform ui, float start, float end, float duration, string ease)

Description

Animates a UI frame's alpha.

Parameters

  • Transform ui the UI frame to animate the alpha for.

  • float start the starting alpha, from 0-1.

  • float end the ending alpha, from 0-1.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.UseImageSizeRatio(frame, 1)

local k1, k2 = 0, 1
local duration = 2
local ease = "Linear"

local anim = DCEI.AnimateAlpha(frame, k1, k2, duration, ease)

DCEI.SetAnimationLoops(anim, -1, "Yoyo")

Related

Tweener AnimateFrameHorizontalOffset(Transform ui, float start, float end, float duration, string ease) {Tweener-AnimateFrameHorizontalOffsetTransform-ui-float-start-float-end-float-duration-string-ease}

Tweener AnimateFrameHorizontalOffset(Transform ui, float start, float end, float duration, string ease)

Description

Animates a UI frame's horizontal offset.

Parameters

  • Transform ui the UI frame to animate the horizontal offset for.

  • float start the starting offset.

  • float end the ending offset.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.UseImageSizeRatio(frame, 1)

local k1, k2 = 0, 500
local duration = 2
local ease = "Linear"

DCEI.AnimateHorizontalOffset(frame, k1, k2, duration, ease)

Related

Tweener AnimateFrameVerticalOffset(Transform ui, float start, float end, float duration, string ease) {Tweener-AnimateFrameVerticalOffsetTransform-ui-float-start-float-end-float-duration-string-ease}

Tweener AnimateFrameVerticalOffset(Transform ui, float start, float end, float duration, string ease)

Description

Animates a UI frame's vertical offset.

Parameters

  • Transform ui the UI frame to animate the vertical offset for.

  • float start the starting offset.

  • float end the ending offset.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

local frame = DCEI.NewFrame(DCEI.GetUiRoot())
DCEI.SetBackgroundImage(frame, "airship_onMap")
DCEI.UseImageSizeRatio(frame, 1)

local k1, k2 = 0, 500
local duration = 2
local ease = "Linear"

DCEI.AnimateVerticalOffset(frame, k1, k2, duration, ease)

Related

Tweener AnimateFrameScrollPosition(Transform ui, float start, float end, float duration, string ease) {Tweener-AnimateFrameScrollPositionTransform-ui-float-start-float-end-float-duration-string-ease}

Tweener AnimateFrameScrollPosition(Transform ui, float start, float end, float duration, string ease)

Description

Animates a scroll frame's scroll position. This function is for HScrolls and VScrolls.

Parameters

  • Transform ui the scroll frame to animate the scroll position for.

  • float start the starting position.

  • float end the ending position.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

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")

local k1, k2 = 0, 200
local duration = 2
local ease = "Linear"

DCEI.AnimateScrollPosition(hscroll_frame, k1, k2, duration, ease)

Related

Tweener AnimateFrameScrollPosition2D(Transform ui, Float2 start, Float2 end, float duration, string ease) {Tweener-AnimateFrameScrollPosition2DTransform-ui-Float2-start-Float2-end-float-duration-string-ease}

Tweener AnimateFrameScrollPosition2D(Transform ui, Float2 start, Float2 end, float duration, string ease)

Description

Animates a scroll frame's scroll position. This function is for Scrolls.

Parameters

  • Transform ui the scroll frame to animate the scroll position for.

  • Float2 start the starting position.

  • Float2 end the ending position.

  • float duration the duration of the animation.

  • string ease the easing function to use for the animation. See https://easings.net/en for examples. Accepted values:

    Linear
    InSine, OutSine, InOutSine
    InQuad, OutQuad, InOutQuad
    InCubic, OutCubic, InOutCubic
    InQuart, OutQuart, InOutQuart
    InQuint, OutQuint, InOutQuint
    InExpo, OutExpo, InOutExpo
    InCirc, OutCirc, InOutCirc
    InElastic, OutElastic, InOutElastic
    InBack, OutBack, InOutBack
    InBounce, OutBounce, InOutBounce
    Flash, InFlash, OutFlash, InOutFlash
    

Example Usage

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)

local k1, k2 = 0, 500
local duration = 2
local ease = "Linear"

DCEI.AnimateScrollPosition2D(scroll_frame, {x = k1, y = k1}, {x = k2, y = k2}, duration, ease)

Related

Float2 GetScreenSizeInPixel() {Float2-GetScreenSizeInPixel}

Float2 GetScreenSizeInPixel()

Description

Returns the screen size in pixels.

Example Usage

local screen_size = DCEI.GetScreenSizeInPixel()
DCEI.LogMessage(string.format("Screen X: %f, Screen Y: %f", screen_size.x, screen_size.y))

Float2 GetScreenSafeAreaOffsetInPixel() {Float2-GetScreenSafeAreaOffsetInPixel}

Float2 GetScreenSafeAreaOffsetInPixel()

Description

Returns the screen safe area offset in pixels.

Example Usage

local safe_offset = DCEI.GetScreenSafeAreaOffsetInPixel()
DCEI.LogMessage(string.format("Screen safe area offset X: %f, Y: %f", safe_offset.x, safe_offset.y))

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