Trigger API Reference DCEI Functions Custom UI6 - funovus/editor-wiki 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 MoveFrameToTop(Transform ui)](#void-moveframetotoptransform-ui)
* [void MoveFrameToBottom(Transform ui)](#void-moveframetobottomtransform-ui)
* [void SetPauseButtonFrame(Transform ui)](#void-setpausebuttonframetransform-ui)
* [void SetPauseMenuFrame(Transform ui)](#void-setpausemenuframetransform-ui)
* [void ShowPauseMenuFrame()](#void-showpausemenuframe)
* [void HidePauseMenuFrame()](#void-hidepausemenuframe)
* [void SetPauseMenuFrameMusicButton(Transform ui)](#void-setpausemenuframemusicbuttontransform-ui)
* [void SetPauseMenuFrameSoundButton(Transform ui)](#void-setpausemenuframesoundbuttontransform-ui)
* [void SetPauseMenuFrameResumeButton(Transform ui)](#void-setpausemenuframeresumebuttontransform-ui)
* [void SetPauseMenuFrameQuitButton(Transform ui)](#void-setpausemenuframequitbuttontransform-ui)
* [void SetPauseMenuFrameRestartButton(Transform ui)](#void-setpausemenuframerestartbuttontransform-ui)
* [void SetPauseMenuFramePlayLevelButton(Transform ui, string path, string displayName)](#void-setpausemenuframeplaylevelbuttontransform-ui-string-path-string-displayname)
* [void SetPauseMenuFrameSettingsButton(Transform ui)](#void-setpausemenuframesettingsbuttontransform-ui)
* [void SuppressPauseMenuOnApplicationPause()](#void-suppresspausemenuonapplicationpause)
* [Float3 GetFramePosition3D(Transform ui)](#float3-getframeposition3dtransform-ui)
* [Float3 GetCanvasPositionFromWorldPosition(Float3 worldPosition)](#float3-getcanvaspositionfromworldpositionfloat3-worldposition)
* [void MoveFrameToPosition(Transform ui, Float3 canvasPosition, Offset offset)](#void-moveframetopositiontransform-ui-float3-canvasposition-offset-offset)
* [void SetFrameAnimationLoops(Tweener tweener, int loops, string loopType)](#void-setframeanimationloopstweener-tweener-int-loops-string-looptype)
* [void StopFrameAnimationLoops(Tweener tweener, bool waitAnimationComplete)](#void-stopframeanimationloopstweener-tweener-bool-waitanimationcomplete)
* [Tweener AnimateFrameScale(Transform ui, Float3 start, Float3 end, float duration, string ease)](#tweener-animateframescaletransform-ui-float3-start-float3-end-float-duration-string-ease)
* [Tweener AnimateFrameImageFillAmount(Transform ui, float start, float end, float duration, string ease)](#tweener-animateframeimagefillamounttransform-ui-float-start-float-end-float-duration-string-ease)
* [Tweener AnimateFrameRotation(Transform ui, Float3 start, Float3 end, float duration, string ease)](#tweener-animateframerotationtransform-ui-float3-start-float3-end-float-duration-string-ease)
* [Tweener AnimateFrameAlpha(Transform ui, float start, float end, float duration, string ease)](#tweener-animateframealphatransform-ui-float-start-float-end-float-duration-string-ease)
* [Tweener AnimateFrameHorizontalOffset(Transform ui, float start, float end, float duration, string ease)](#tweener-animateframehorizontaloffsettransform-ui-float-start-float-end-float-duration-string-ease)
* [Tweener AnimateFrameVerticalOffset(Transform ui, float start, float end, float duration, string ease)](#tweener-animateframeverticaloffsettransform-ui-float-start-float-end-float-duration-string-ease)
* [Tweener AnimateFrameScrollPosition(Transform ui, float start, float end, float duration, string ease)](#tweener-animateframescrollpositiontransform-ui-float-start-float-end-float-duration-string-ease)
* [Tweener AnimateFrameScrollPosition2D(Transform ui, Float2 start, Float2 end, float duration, string ease)](#tweener-animateframescrollposition2dtransform-ui-float2-start-float2-end-float-duration-string-ease)
* [Float2 GetScreenSizeInPixel()](#float2-getscreensizeinpixel)
* [Float2 GetScreenSafeAreaOffsetInPixel()](#float2-getscreensafeareaoffsetinpixel)
|
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)
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.
-
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.
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)
Moves a UI frame (and all of its parents) above all sibling UI frames.
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)
Moves a UI frame (and all of its parents) below all sibling UI frames.
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)
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).
local button = DCEI.NewButton(DCEI.GetUiRoot())
DCEI.SetSize(button, 100, 100)
DCEI.SetPauseButton(button)
void SetPauseMenuFrame(Transform ui)
Sets a UI frame to be the pause menu, replacing the default pause menu UI and functionality.
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
)
- SetPauseButton()
- ShowPauseMenu()
- HidePauseMenu()
- SetPauseMenuCallback()
- SetPauseMenuResumeButton()
- SetPauseMenuQuitButton()
- SetPauseMenuRestartButton()
- SetPauseMenuPlayLevelButton()
- SetPauseMenuSettingsButton()
- SuppressPauseMenuOnApplicationPause()
void ShowPauseMenuFrame()
void HidePauseMenuFrame()
DCEI.HidePauseMenuFrame()
void SetPauseMenuFrameMusicButton(Transform ui)
Replace default music button to this UI.
DCEI.SetPauseMenuFrameMusicButton(new_music_btn)
void SetPauseMenuFrameSoundButton(Transform ui)
Replace default sound button to this UI.
DCEI.SetPauseMenuFrameSoundButton(new_music_btn)
void SetPauseMenuFrameResumeButton(Transform ui)
Sets the pause menu resume button. This button will exit the pause menu.
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)
void SetPauseMenuFrameQuitButton(Transform ui)
Sets the pause menu quit button. This button will exit the game.
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)
void SetPauseMenuFrameRestartButton(Transform ui)
Sets the pause menu restart button. This button will restart the game.
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)
void SetPauseMenuFramePlayLevelButton(Transform ui, string path, string displayName) {void-SetPauseMenuFramePlayLevelButtonTransform-ui-string-path-string-displayName}
void SetPauseMenuFramePlayLevelButton(Transform ui, string path, string displayName)
Sets the pause menu play level button. This button will play the specified level, exiting the current one.
-
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.
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)
void SetPauseMenuFrameSettingsButton(Transform ui) {void-SetPauseMenuFrameSettingsButtonTransform-ui}
void SetPauseMenuFrameSettingsButton(Transform ui)
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.
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)
void SuppressPauseMenuOnApplicationPause()
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.
DCEI.SuppressPauseMenuOnApplicationPause()
Float3 GetFramePosition3D(Transform ui)
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.
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)
Transfomr world position to UI position
-
Float3
worldPosition
the world position
local unit_frame_position = DCEI.GetCanvasPositionFromWorldPosition(unit_position)
DCEI.MoveFrameToPosition(ui_coin_frame, unit_frame_position, {right = 0, up = 0, front = 0})
void MoveFrameToPosition(Transform ui, Float3 canvasPosition, Offset offset) {void-MoveFrameToPositionTransform-ui-Float3-canvasPosition-Offset-offset}
void MoveFrameToPosition(Transform ui, Float3 canvasPosition, Offset offset)
Move a certain UI to new position
-
Transform
ui
the ui that moves -
Float3
canvasPosition
the canvas position -
Offset
offset
final offset of the position
local unit_frame_position = DCEI.GetCanvasPositionFromWorldPosition(unit_position)
DCEI.MoveFrameToPosition(ui_coin_frame, unit_frame_position, {right = 0, up = 0, front = 0})
void SetFrameAnimationLoops(Tweener tweener, int loops, string loopType) {void-SetFrameAnimationLoopsTweener-tweener-int-loops-string-loopType}
void SetFrameAnimationLoops(Tweener tweener, int loops, string loopType)
Plays a given UI animation a specified number of loops.
-
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).
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")
- AnimateCameraFramePosition()
- AnimateCameraFrameRotation()
- AnimateCameraFrameOrthographicSize()
- AnimateScale()
- AnimateBackgroundImageFillAmount()
- AnimateRotation()
- AnimateAlpha()
- AnimateHorizontalOffset()
- AnimateVerticalOffset()
- AnimateScrollPosition()
- AnimateScrollPosition2D()
void StopFrameAnimationLoops(Tweener tweener, bool waitAnimationComplete) {void-StopFrameAnimationLoopsTweener-tweener-bool-waitAnimationComplete}
void StopFrameAnimationLoops(Tweener tweener, bool waitAnimationComplete)
-
Tweener
tweener
the UI animation. -
bool
waitAnimationComplete
if true, waits for the current animation to complete before stopping the loop.
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
)
- AnimateCameraFramePosition()
- AnimateCameraFrameRotation()
- AnimateCameraFrameOrthographicSize()
- AnimateScale()
- AnimateBackgroundImageFillAmount()
- AnimateRotation()
- AnimateAlpha()
- AnimateHorizontalOffset()
- AnimateVerticalOffset()
- AnimateScrollPosition()
- AnimateScrollPosition2D()
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)
Animates a UI frame's scale over time.
-
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
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)
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)
Animates a UI frame's background image fill. Requires a background image to be set, a background image color alone does not work.
-
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
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)
- SetAnimationLoops()
- StopAnimationLoops()
- SetBackgroundImageFillAmount()
- GetBackgroundImageFillAmount()
- SetBackgroundImageFillHorizontal()
- SetBackgroundImageFillVertical()
- SetBackgroundImageFillRadial()
- SetBackgroundImageFillOrigin()
- SetBackgroundImageFillAmountExpression()
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)
Animates a UI frame's rotation.
-
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
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)
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)
-
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
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")
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)
Animates a UI frame's horizontal offset.
-
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
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)
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)
Animates a UI frame's vertical offset.
-
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
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)
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)
Animates a scroll frame's scroll position. This function is for HScrolls and VScrolls.
-
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
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)
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)
Animates a scroll frame's scroll position. This function is for Scrolls.
-
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
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)
Float2 GetScreenSizeInPixel()
Returns the screen size in pixels.
local screen_size = DCEI.GetScreenSizeInPixel()
DCEI.LogMessage(string.format("Screen X: %f, Screen Y: %f", screen_size.x, screen_size.y))
Float2 GetScreenSafeAreaOffsetInPixel()
Returns the screen safe area offset in pixels.
local safe_offset = DCEI.GetScreenSafeAreaOffsetInPixel()
DCEI.LogMessage(string.format("Screen safe area offset X: %f, Y: %f", safe_offset.x, safe_offset.y))