mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Annotations update [2]
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ local BackHandler = component.create("back_handler")
|
||||
--- The @{BackHandler} constructor
|
||||
-- @tparam BackHandler self @{BackHandler}
|
||||
-- @tparam function callback @The callback(self, custom_args) to call on back event
|
||||
-- @tparam[opt] any custom_args Button events custom arguments
|
||||
-- @tparam any|nil custom_args Button events custom arguments
|
||||
-- @local
|
||||
function BackHandler.init(self, callback, custom_args)
|
||||
self.params = custom_args
|
||||
|
@@ -71,7 +71,7 @@ end
|
||||
--
|
||||
-- Don't change node enabled state itself.
|
||||
-- @tparam Blocker self @{Blocker}
|
||||
-- @tparam boolean state Enabled state
|
||||
-- @tparam boolean|nil state Enabled state
|
||||
function Blocker.set_enabled(self, state)
|
||||
self._is_enabled = state
|
||||
end
|
||||
|
@@ -282,10 +282,10 @@ end
|
||||
|
||||
--- The @{Button} constructor
|
||||
-- @tparam Button self @{Button}
|
||||
-- @tparam string|node node Node name or GUI Node itself
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id)
|
||||
-- @tparam function callback On click button callback
|
||||
-- @tparam[opt] any custom_args Button events custom arguments
|
||||
-- @tparam[opt] string|node anim_node Node to animate instead of trigger node.
|
||||
-- @tparam any|nil custom_args Button events custom arguments
|
||||
-- @tparam string|node|nil anim_node Node to animate instead of trigger node.
|
||||
function Button.init(self, node, callback, custom_args, anim_node)
|
||||
self.druid = self:get_druid()
|
||||
self.node = self:get_node(node)
|
||||
@@ -447,7 +447,7 @@ end
|
||||
-- The style.on_set_enabled will be triggered.
|
||||
-- Disabled button is not clickable.
|
||||
-- @tparam Button self @{Button}
|
||||
-- @tparam boolean state Enabled state
|
||||
-- @tparam boolean|nil state Enabled state
|
||||
-- @treturn Button Current button instance
|
||||
-- @usage
|
||||
-- button:set_enabled(false)
|
||||
@@ -515,8 +515,8 @@ end
|
||||
|
||||
--- Set function for additional check for button click availability
|
||||
-- @tparam Button self
|
||||
-- @tparam[opt] function check_function Should return true or false. If true - button can be pressed.
|
||||
-- @tparam[opt] function failure_callback Function will be called on button click, if check function return false
|
||||
-- @tparam function|nil check_function Should return true or false. If true - button can be pressed.
|
||||
-- @tparam function|nil failure_callback Function will be called on button click, if check function return false
|
||||
-- @treturn Button Current button instance
|
||||
function Button.set_check_function(self, check_function, failure_callback)
|
||||
self._check_function = check_function
|
||||
@@ -531,7 +531,7 @@ end
|
||||
--
|
||||
-- If the game is not HTML, html mode will be not enabled
|
||||
-- @tparam Button self
|
||||
-- @tparam[opt] boolean is_web_mode If true - button will be called inside html5 callback
|
||||
-- @tparam boolean|nil is_web_mode If true - button will be called inside html5 callback
|
||||
-- @treturn Button Current button instance
|
||||
-- @usage
|
||||
-- button:set_web_user_interaction(true)
|
||||
|
@@ -313,7 +313,7 @@ end
|
||||
|
||||
--- Set Drag input enabled or disabled
|
||||
-- @tparam Drag self @{Drag}
|
||||
-- @tparam boolean is_enabled
|
||||
-- @tparam boolean|nil is_enabled
|
||||
function Drag.set_enabled(self, is_enabled)
|
||||
self._is_enabled = is_enabled
|
||||
end
|
||||
|
@@ -89,7 +89,7 @@ end
|
||||
|
||||
--- Set hover state
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @tparam boolean state The hover state
|
||||
-- @tparam boolean|nil state The hover state
|
||||
function Hover.set_hover(self, state)
|
||||
if self._is_hovered ~= state then
|
||||
self._is_hovered = state
|
||||
@@ -108,7 +108,7 @@ end
|
||||
|
||||
--- Set mouse hover state
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @tparam boolean state The mouse hover state
|
||||
-- @tparam boolean|nil state The mouse hover state
|
||||
function Hover.set_mouse_hover(self, state)
|
||||
if self._is_mouse_hovered ~= state then
|
||||
self._is_mouse_hovered = state
|
||||
@@ -138,7 +138,7 @@ end
|
||||
-- If hover is not enabled, it will not generate
|
||||
-- any hover events
|
||||
-- @tparam Hover self @{Hover}
|
||||
-- @tparam boolean state The hover enabled state
|
||||
-- @tparam boolean|nil state The hover enabled state
|
||||
function Hover.set_enabled(self, state)
|
||||
self._is_enabled = state
|
||||
|
||||
|
@@ -234,7 +234,7 @@ end
|
||||
--- Start scroll to target point.
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam vector3 point Target point
|
||||
-- @tparam[opt] boolean is_instant Instant scroll flag
|
||||
-- @tparam boolean|nil is_instant Instant scroll flag
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
|
||||
-- @usage scroll:scroll_to(vmath.vector3(0), true)
|
||||
function Scroll.scroll_to(self, point, is_instant)
|
||||
@@ -268,7 +268,7 @@ end
|
||||
--- Scroll to item in scroll by point index.
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam number index Point index
|
||||
-- @tparam[opt] boolean skip_cb If true, skip the point callback
|
||||
-- @tparam boolean|nil skip_cb If true, skip the point callback
|
||||
function Scroll.scroll_to_index(self, index, skip_cb)
|
||||
if not self.points then
|
||||
return
|
||||
@@ -291,7 +291,7 @@ end
|
||||
--- Start scroll to target scroll percent
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam vector3 percent target percent
|
||||
-- @tparam[opt] boolean is_instant instant scroll flag
|
||||
-- @tparam boolean|nil is_instant instant scroll flag
|
||||
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
|
||||
function Scroll.scroll_to_percent(self, percent, is_instant)
|
||||
local border = self.available_pos
|
||||
@@ -339,7 +339,7 @@ end
|
||||
-- If disabled, scroll through points (if exist)
|
||||
-- If no points, just simple drag without inertion
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam boolean state Inert scroll state
|
||||
-- @tparam boolean|nil state Inert scroll state
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll.set_inert(self, state)
|
||||
self._is_inert = state
|
||||
@@ -397,7 +397,7 @@ end
|
||||
|
||||
--- Lock or unlock horizontal scroll
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam boolean state True, if horizontal scroll is enabled
|
||||
-- @tparam boolean|nil state True, if horizontal scroll is enabled
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll.set_horizontal_scroll(self, state)
|
||||
self._is_horizontal_scroll = state
|
||||
@@ -408,7 +408,7 @@ end
|
||||
|
||||
--- Lock or unlock vertical scroll
|
||||
-- @tparam Scroll self @{Scroll}
|
||||
-- @tparam boolean state True, if vertical scroll is enabled
|
||||
-- @tparam boolean|nil state True, if vertical scroll is enabled
|
||||
-- @treturn druid.scroll Current scroll instance
|
||||
function Scroll.set_vertical_scroll(self, state)
|
||||
self._is_vertical_scroll = state
|
||||
|
@@ -214,7 +214,7 @@ end
|
||||
--- Add new item to the grid
|
||||
-- @tparam StaticGrid self @{StaticGrid}
|
||||
-- @tparam node item Gui node
|
||||
-- @tparam[opt] number index The item position. By default add as last item
|
||||
-- @tparam number|nil index The item position. By default add as last item
|
||||
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
||||
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
|
||||
function StaticGrid.add(self, item, index, shift_policy, is_instant)
|
||||
@@ -379,7 +379,7 @@ end
|
||||
|
||||
--- Update grid inner state
|
||||
-- @tparam StaticGrid self @{StaticGrid}
|
||||
-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function StaticGrid._update(self, is_instant)
|
||||
self:_update_indexes()
|
||||
@@ -425,7 +425,7 @@ end
|
||||
|
||||
--- Update grid nodes position
|
||||
-- @tparam StaticGrid self @{StaticGrid}
|
||||
-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function StaticGrid._update_pos(self, is_instant)
|
||||
local zero_offset = self:_get_zero_offset()
|
||||
|
@@ -225,7 +225,7 @@ end
|
||||
--- The @{Text} constructor
|
||||
-- @tparam Text self @{Text}
|
||||
-- @tparam string|node node Node name or GUI Text Node itself
|
||||
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
||||
-- @tparam string|nil value Initial text. Default value is node text from GUI scene.
|
||||
-- @tparam[opt=downscale] string adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
|
||||
function Text.init(self, node, value, adjust_type)
|
||||
self.node = self:get_node(node)
|
||||
@@ -273,7 +273,7 @@ end
|
||||
|
||||
--- Calculate text width with font with respect to trailing space
|
||||
-- @tparam Text self @{Text}
|
||||
-- @tparam[opt] string text
|
||||
-- @tparam string|nil text
|
||||
-- @treturn number Width
|
||||
-- @treturn number Height
|
||||
function Text.get_text_size(self, text)
|
||||
@@ -392,8 +392,8 @@ end
|
||||
|
||||
--- Set text adjust, refresh the current text visuals, if needed
|
||||
-- @tparam Text self @{Text}
|
||||
-- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type
|
||||
-- @tparam[opt] number minimal_scale If pass nil - not use minimal scale
|
||||
-- @tparam number|nil adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type
|
||||
-- @tparam number|nil minimal_scale If pass nil - not use minimal scale
|
||||
-- @treturn Text Current text instance
|
||||
function Text.set_text_adjust(self, adjust_type, minimal_scale)
|
||||
self.adjust_type = adjust_type
|
||||
|
@@ -242,7 +242,7 @@ end
|
||||
-- Default value: 10
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @tparam number value The new input priority value
|
||||
-- @tparam boolean is_temporary If true, the reset input priority will return to previous value
|
||||
-- @tparam boolean|nil is_temporary If true, the reset input priority will return to previous value
|
||||
-- @treturn number The component input priority
|
||||
function BaseComponent.set_input_priority(self, value, is_temporary)
|
||||
assert(value)
|
||||
@@ -290,7 +290,7 @@ end
|
||||
--
|
||||
-- If input is disabled, the component will not receive input events
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @tparam boolean state The component input state
|
||||
-- @tparam boolean|nil state The component input state
|
||||
-- @treturn BaseComponent BaseComponent itself
|
||||
function BaseComponent.set_input_enabled(self, state)
|
||||
self._meta.input_enabled = state
|
||||
@@ -376,7 +376,7 @@ end
|
||||
|
||||
--- Set debug logs for component enabled or disabled
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @tparam boolean is_debug
|
||||
-- @tparam boolean|nil is_debug
|
||||
-- @local
|
||||
function BaseComponent.set_debug(self, is_debug)
|
||||
self._component.is_debug = is_debug
|
||||
|
@@ -92,7 +92,7 @@ end
|
||||
--
|
||||
-- @function druid.new
|
||||
-- @tparam table context The Druid context. Usually, this is the self of the gui_script. It is passed into all Druid callbacks.
|
||||
-- @tparam[opt] table style The Druid style table to override style parameters for this Druid instance.
|
||||
-- @tparam table|nil style The Druid style table to override style parameters for this Druid instance.
|
||||
-- @treturn druid_instance The Druid instance @{DruidInstance}.
|
||||
-- @usage
|
||||
-- local druid = require("druid.druid")
|
||||
|
@@ -15,7 +15,7 @@ local DruidEvent = class("druid.event")
|
||||
|
||||
--- DruidEvent constructor
|
||||
-- @tparam DruidEvent self @{DruidEvent}
|
||||
-- @tparam[opt] function initial_callback Subscribe the callback on new event, if callback exist
|
||||
-- @tparam function|nil initial_callback Subscribe the callback on new event, if callback exist
|
||||
-- @usage
|
||||
-- local Event = require("druid.event")
|
||||
-- ...
|
||||
@@ -32,7 +32,7 @@ end
|
||||
--- Subscribe callback on event
|
||||
-- @tparam DruidEvent self @{DruidEvent}
|
||||
-- @tparam function callback Callback itself
|
||||
-- @tparam[opt] any context Additional context as first param to callback call, usually it's self
|
||||
-- @tparam any|nil context Additional context as first param to callback call, usually it's self
|
||||
-- @usage
|
||||
-- local function on_long_callback(self)
|
||||
-- print("Long click!")
|
||||
@@ -57,7 +57,7 @@ end
|
||||
--- Unsubscribe callback on event
|
||||
-- @tparam DruidEvent self @{DruidEvent}
|
||||
-- @tparam function callback Callback itself
|
||||
-- @tparam[opt] any context Additional context as first param to callback call
|
||||
-- @tparam any|nil context Additional context as first param to callback call
|
||||
-- @usage
|
||||
-- local function on_long_callback(self)
|
||||
-- print("Long click!")
|
||||
|
@@ -71,9 +71,9 @@ end
|
||||
|
||||
--- Set checkbox state
|
||||
-- @tparam Checkbox self @{Checkbox}
|
||||
-- @tparam boolean state Checkbox state
|
||||
-- @tparam boolean is_silent Don't trigger on_change_state if true
|
||||
-- @tparam boolean is_instant If instant checkbox change
|
||||
-- @tparam boolean|nil state Checkbox state
|
||||
-- @tparam boolean|nil is_silent Don't trigger on_change_state if true
|
||||
-- @tparam boolean|nil is_instant If instant checkbox change
|
||||
function Checkbox.set_state(self, state, is_silent, is_instant)
|
||||
self.state = state
|
||||
self.style.on_change_state(self, self.node, state, is_instant)
|
||||
|
@@ -46,7 +46,7 @@ end
|
||||
--- Set checkbox group state
|
||||
-- @tparam CheckboxGroup self @{CheckboxGroup}
|
||||
-- @tparam boolean[] indexes Array of checkbox state
|
||||
-- @tparam boolean is_instant If instant state change
|
||||
-- @tparam boolean|nil is_instant If instant state change
|
||||
function CheckboxGroup.set_state(self, indexes, is_instant)
|
||||
for i = 1, #indexes do
|
||||
if self.checkboxes[i] then
|
||||
|
@@ -100,7 +100,7 @@ end
|
||||
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||
-- @tparam number index The grid element index
|
||||
-- @tparam node node The node to be placed
|
||||
-- @tparam[opt] number origin_index Index of nearby node
|
||||
-- @tparam number|nil origin_index Index of nearby node
|
||||
-- @treturn vector3 Node position
|
||||
function DynamicGrid.get_pos(self, index, node, origin_index)
|
||||
local origin_node = self.nodes[origin_index]
|
||||
@@ -140,7 +140,7 @@ end
|
||||
--- Add new node to the grid
|
||||
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam[opt] number index The node position. By default add as last node
|
||||
-- @tparam number|nil index The node position. By default add as last node
|
||||
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
||||
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
|
||||
function DynamicGrid.add(self, node, index, shift_policy, is_instant)
|
||||
@@ -322,7 +322,7 @@ end
|
||||
|
||||
--- Update grid inner state
|
||||
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||
-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function DynamicGrid._update(self, is_instant)
|
||||
self:_update_indexes()
|
||||
@@ -378,7 +378,7 @@ end
|
||||
|
||||
--- Update grid nodes position
|
||||
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||
-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @tparam boolean|nil is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||
-- @local
|
||||
function DynamicGrid._update_pos(self, is_instant)
|
||||
for index, node in pairs(self.nodes) do
|
||||
|
@@ -31,7 +31,7 @@ local Hotkey = component.create("hotkey")
|
||||
-- @tparam Hotkey self @{Hotkey}
|
||||
-- @tparam string[]|string keys The keys to be pressed for trigger callback. Should contains one key and any modificator keys
|
||||
-- @tparam function callback The callback function
|
||||
-- @tparam[opt] any callback_argument The argument to pass into the callback function
|
||||
-- @tparam any|nil callback_argument The argument to pass into the callback function
|
||||
function Hotkey.init(self, keys, callback, callback_argument)
|
||||
self.druid = self:get_druid()
|
||||
|
||||
@@ -63,7 +63,7 @@ end
|
||||
--- Add hotkey for component callback
|
||||
-- @tparam Hotkey self @{Hotkey}
|
||||
-- @tparam string[]|hash[]|string|hash keys that have to be pressed before key pressed to activate
|
||||
-- @tparam[opt] any callback_argument The argument to pass into the callback function
|
||||
-- @tparam any|nil callback_argument The argument to pass into the callback function
|
||||
function Hotkey.add_hotkey(self, keys, callback_argument)
|
||||
keys = keys or {}
|
||||
if type(keys) == "string" then
|
||||
|
@@ -119,7 +119,7 @@ end
|
||||
-- @tparam Input self @{Input}
|
||||
-- @tparam node click_node Node to enabled input component
|
||||
-- @tparam node|Text text_node Text node what will be changed on user input. You can pass text component instead of text node name @{Text}
|
||||
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
|
||||
-- @tparam number|nil keyboard_type Gui keyboard type for input field
|
||||
function Input.init(self, click_node, text_node, keyboard_type)
|
||||
self.druid = self:get_druid(self)
|
||||
|
||||
|
@@ -34,8 +34,8 @@ local LangText = component.create("lang_text")
|
||||
|
||||
--- The @{LangText} constructor
|
||||
-- @tparam LangText self @{LangText}
|
||||
-- @tparam string|node node Node name or GUI Text Node itself
|
||||
-- @tparam string locale_id Default locale id or text from node as default
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id)
|
||||
-- @tparam[opt=node_text] string locale_id Default locale id or text from node as default
|
||||
-- @tparam[opt=downscale] string adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
|
||||
function LangText.init(self, node, locale_id, adjust_type)
|
||||
self.druid = self:get_druid()
|
||||
@@ -75,13 +75,13 @@ end
|
||||
--- Translate the text by locale_id
|
||||
-- @tparam LangText self @{LangText}
|
||||
-- @tparam string locale_id Locale id
|
||||
-- @tparam[opt] string a Optional param to string.format
|
||||
-- @tparam[opt] string b Optional param to string.format
|
||||
-- @tparam[opt] string c Optional param to string.format
|
||||
-- @tparam[opt] string d Optional param to string.format
|
||||
-- @tparam[opt] string e Optional param to string.format
|
||||
-- @tparam[opt] string f Optional param to string.format
|
||||
-- @tparam[opt] string g Optional param to string.format
|
||||
-- @tparam string|nil a Optional param to string.format
|
||||
-- @tparam string|nil b Optional param to string.format
|
||||
-- @tparam string|nil c Optional param to string.format
|
||||
-- @tparam string|nil d Optional param to string.format
|
||||
-- @tparam string|nil e Optional param to string.format
|
||||
-- @tparam string|nil f Optional param to string.format
|
||||
-- @tparam string|nil g Optional param to string.format
|
||||
-- @treturn LangText Current instance
|
||||
function LangText.translate(self, locale_id, a, b, c, d, e, f, g)
|
||||
self.last_locale_args = { a, b, c, d, e, f, g }
|
||||
@@ -94,13 +94,13 @@ end
|
||||
|
||||
--- Format string with new text params on localized text
|
||||
-- @tparam LangText self @{LangText}
|
||||
-- @tparam[opt] string a Optional param to string.format
|
||||
-- @tparam[opt] string b Optional param to string.format
|
||||
-- @tparam[opt] string c Optional param to string.format
|
||||
-- @tparam[opt] string d Optional param to string.format
|
||||
-- @tparam[opt] string e Optional param to string.format
|
||||
-- @tparam[opt] string f Optional param to string.format
|
||||
-- @tparam[opt] string g Optional param to string.format
|
||||
-- @tparam string|nil a Optional param to string.format
|
||||
-- @tparam string|nil b Optional param to string.format
|
||||
-- @tparam string|nil c Optional param to string.format
|
||||
-- @tparam string|nil d Optional param to string.format
|
||||
-- @tparam string|nil e Optional param to string.format
|
||||
-- @tparam string|nil f Optional param to string.format
|
||||
-- @tparam string|nil g Optional param to string.format
|
||||
-- @treturn LangText Current instance
|
||||
function LangText.format(self, a, b, c, d, e, f, g)
|
||||
self.last_locale_args = { a, b, c, d, e, f, g }
|
||||
|
@@ -32,7 +32,7 @@ local Layout = component.create("layout")
|
||||
-- @tparam Layout self @{Layout}
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam string mode The layout mode (from const.LAYOUT_MODE)
|
||||
-- @tparam[opt] function on_size_changed_callback The callback on window resize
|
||||
-- @tparam function|nil on_size_changed_callback The callback on window resize
|
||||
function Layout.init(self, node, mode, on_size_changed_callback)
|
||||
self.node = self:get_node(node)
|
||||
|
||||
@@ -194,7 +194,7 @@ end
|
||||
|
||||
--- Set node for layout node to fit inside it. Pass nil to reset
|
||||
-- @tparam Layout self @{Layout}
|
||||
-- @tparam[opt] node node
|
||||
-- @tparam node|nil node
|
||||
-- @treturn Layout @{Layout}
|
||||
function Layout.fit_into_node(self, node)
|
||||
self._fit_node = node
|
||||
|
@@ -210,7 +210,7 @@ end
|
||||
--- Start animation of a progress bar
|
||||
-- @tparam Progress self @{Progress}
|
||||
-- @tparam number to value between 0..1
|
||||
-- @tparam[opt] function callback Callback on animation ends
|
||||
-- @tparam function|nil callback Callback on animation ends
|
||||
function Progress.to(self, to, callback)
|
||||
to = helper.clamp(to, 0, 1)
|
||||
-- cause of float error
|
||||
|
@@ -55,7 +55,7 @@ end
|
||||
--- Set radio group state
|
||||
-- @tparam RadioGroup self @{RadioGroup}
|
||||
-- @tparam number index Index in radio group
|
||||
-- @tparam boolean is_instant If is instant state change
|
||||
-- @tparam boolean|nil is_instant If is instant state change
|
||||
function RadioGroup.set_state(self, index, is_instant)
|
||||
on_checkbox_click(self, index, is_instant)
|
||||
end
|
||||
|
@@ -60,7 +60,7 @@ end
|
||||
-- @tparam Slider self @{Slider}
|
||||
-- @tparam node node Gui pin node
|
||||
-- @tparam vector3 end_pos The end position of slider
|
||||
-- @tparam[opt] function callback On slider change callback
|
||||
-- @tparam function|nil callback On slider change callback
|
||||
function Slider.init(self, node, end_pos, callback)
|
||||
self.node = self:get_node(node)
|
||||
|
||||
@@ -174,7 +174,7 @@ end
|
||||
--- Set value for slider
|
||||
-- @tparam Slider self @{Slider}
|
||||
-- @tparam number value Value from 0 to 1
|
||||
-- @tparam[opt] boolean is_silent Don't trigger event if true
|
||||
-- @tparam boolean|nil is_silent Don't trigger event if true
|
||||
function Slider.set(self, value, is_silent)
|
||||
value = helper.clamp(value, 0, 1)
|
||||
set_position(self, value)
|
||||
|
@@ -13,7 +13,7 @@
|
||||
-- @tparam node node
|
||||
|
||||
--- Restriction zone
|
||||
-- @tparam[opt] node click_zone
|
||||
-- @tparam node|nil click_zone
|
||||
|
||||
--- Trigger on swipe event(self, swipe_side, dist, delta_time)
|
||||
-- @tfield DruidEvent on_swipe) @{DruidEvent}
|
||||
|
@@ -49,7 +49,7 @@ end
|
||||
-- @tparam node node Gui text node
|
||||
-- @tparam number seconds_from Start timer value in seconds
|
||||
-- @tparam[opt=0] number seconds_to End timer value in seconds
|
||||
-- @tparam[opt] function callback Function on timer end
|
||||
-- @tparam function|nil callback Function on timer end
|
||||
function Timer.init(self, node, seconds_from, seconds_to, callback)
|
||||
self.node = self:get_node(node)
|
||||
seconds_from = math.max(seconds_from, 0)
|
||||
@@ -110,7 +110,7 @@ end
|
||||
|
||||
--- Called when update
|
||||
-- @tparam Timer self @{Timer}
|
||||
-- @tparam boolean is_on Timer enable state
|
||||
-- @tparam boolean|nil is_on Timer enable state
|
||||
function Timer.set_state(self, is_on)
|
||||
self.is_on = is_on
|
||||
|
||||
|
@@ -48,8 +48,8 @@ end
|
||||
-- Nodes will be center around 0 x position
|
||||
-- text_node will be first (at left side)
|
||||
-- @function helper.centrate_text_with_icon
|
||||
-- @tparam[opt] text text_node Gui text node
|
||||
-- @tparam[opt] box icon_node Gui box node
|
||||
-- @tparam text|nil text_node Gui text node
|
||||
-- @tparam box|nil icon_node Gui box node
|
||||
-- @tparam number margin Offset between nodes
|
||||
-- @local
|
||||
function M.centrate_text_with_icon(text_node, icon_node, margin)
|
||||
@@ -61,8 +61,8 @@ end
|
||||
-- Nodes will be center around 0 x position
|
||||
-- icon_node will be first (at left side)
|
||||
-- @function helper.centrate_icon_with_text
|
||||
-- @tparam[opt] box icon_node Gui box node
|
||||
-- @tparam[opt] text text_node Gui text node
|
||||
-- @tparam box|nil icon_node Gui box node
|
||||
-- @tparam text|nil text_node Gui text node
|
||||
-- @tparam[opt=0] number margin Offset between nodes
|
||||
-- @local
|
||||
function M.centrate_icon_with_text(icon_node, text_node, margin)
|
||||
@@ -256,7 +256,7 @@ end
|
||||
--- Add all elements from source array to the target array
|
||||
-- @function helper.add_array
|
||||
-- @tparam any[] target Array to put elements from source
|
||||
-- @tparam[opt] any[] source The source array to get elements from
|
||||
-- @tparam any[]|nil source The source array to get elements from
|
||||
-- @treturn any[] The target array
|
||||
function M.add_array(target, source)
|
||||
assert(target)
|
||||
@@ -278,7 +278,7 @@ end
|
||||
-- @tparam node node
|
||||
-- @tparam number x
|
||||
-- @tparam number y
|
||||
-- @tparam[opt] Node node_click_area
|
||||
-- @tparam node|nil node_click_area
|
||||
-- @local
|
||||
function M.pick_node(node, x, y, node_click_area)
|
||||
local is_pick = gui.pick_node(node, x, y)
|
||||
@@ -302,7 +302,7 @@ end
|
||||
--- Get cumulative parent's node scale
|
||||
-- @function helper.get_scene_scale
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam boolean include_passed_node_scale True if add current node scale to result
|
||||
-- @tparam boolean|nil include_passed_node_scale True if add current node scale to result
|
||||
-- @treturn vector3 The scene node scale
|
||||
function M.get_scene_scale(node, include_passed_node_scale)
|
||||
local scale = include_passed_node_scale and gui.get_scale(node) or vmath.vector3(1)
|
||||
@@ -394,7 +394,7 @@ end
|
||||
--- Distance from node position to his borders
|
||||
-- @function helper.get_border
|
||||
-- @tparam node node GUI node
|
||||
-- @tparam[opt] vector3 offset Offset from node position. Pass current node position to get non relative border values
|
||||
-- @tparam vector3|nil offset Offset from node position. Pass current node position to get non relative border values
|
||||
-- @treturn vector4 Vector4 with border values (left, top, right, down)
|
||||
function M.get_border(node, offset)
|
||||
local pivot = gui.get_pivot(node)
|
||||
@@ -452,8 +452,8 @@ end
|
||||
-- @function helper.insert_with_shift
|
||||
-- @tparam table array Array
|
||||
-- @param any Item to insert
|
||||
-- @tparam[opt] number index Index to insert. If nil, item will be inserted at the end of array
|
||||
-- @tparam[opt] number shift_policy The druid_const.SHIFT.* constant
|
||||
-- @tparam number|nil index Index to insert. If nil, item will be inserted at the end of array
|
||||
-- @tparam number|nil shift_policy The druid_const.SHIFT.* constant
|
||||
-- @treturn any Inserted item
|
||||
function M.insert_with_shift(array, item, index, shift_policy)
|
||||
shift_policy = shift_policy or const.SHIFT.RIGHT
|
||||
@@ -483,8 +483,8 @@ end
|
||||
-- Shift policy can be: left, right, no_shift
|
||||
-- @function helper.remove_with_shift
|
||||
-- @tparam table array Array
|
||||
-- @tparam[opt] number index Index to remove. If nil, item will be removed from the end of array
|
||||
-- @tparam[opt] number shift_policy The druid_const.SHIFT.* constant
|
||||
-- @tparam number|nil index Index to remove. If nil, item will be removed from the end of array
|
||||
-- @tparam number|nil shift_policy The druid_const.SHIFT.* constant
|
||||
-- @treturn any Removed item
|
||||
function M.remove_with_shift(array, index, shift_policy)
|
||||
shift_policy = shift_policy or const.SHIFT.RIGHT
|
||||
|
@@ -518,7 +518,7 @@ end
|
||||
|
||||
--- Set debug mode for current Druid instance. It's enable debug log messages
|
||||
-- @tparam DruidInstance self @{DruidInstance}
|
||||
-- @tparam boolean is_debug
|
||||
-- @tparam boolean|nil is_debug
|
||||
-- @treturn self @{DruidInstance}
|
||||
-- @local
|
||||
function DruidInstance.set_debug(self, is_debug)
|
||||
@@ -530,7 +530,7 @@ end
|
||||
--- Log message, if is_debug mode is enabled
|
||||
-- @tparam DruidInstance self @{DruidInstance}
|
||||
-- @tparam string message
|
||||
-- @tparam[opt] table context
|
||||
-- @tparam table|nil context
|
||||
-- @local
|
||||
function DruidInstance.log_message(self, message, context)
|
||||
if not self._is_debug then
|
||||
@@ -558,10 +558,10 @@ end
|
||||
|
||||
--- Create @{Button} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node GUI node
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id)
|
||||
-- @tparam function callback Button callback
|
||||
-- @tparam[opt] table params Button callback params
|
||||
-- @tparam[opt] node anim_node Button anim node (node, if not provided)
|
||||
-- @tparam table|nil params Button callback params
|
||||
-- @tparam node|nil anim_node Button anim node (node, if not provided)
|
||||
-- @treturn Button @{Button} component
|
||||
function DruidInstance.new_button(self, node, callback, params, anim_node)
|
||||
return DruidInstance.new(self, button, node, callback, params, anim_node)
|
||||
@@ -570,7 +570,7 @@ end
|
||||
|
||||
--- Create @{Blocker} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id)
|
||||
-- @treturn Blocker @{Blocker} component
|
||||
function DruidInstance.new_blocker(self, node)
|
||||
return DruidInstance.new(self, blocker, node)
|
||||
@@ -580,7 +580,7 @@ end
|
||||
--- Create @{BackHandler} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam function callback @The callback(self, custom_args) to call on back event
|
||||
-- @tparam[opt] any params Callback argument
|
||||
-- @tparam any|nil params Callback argument
|
||||
-- @treturn BackHandler @{BackHandler} component
|
||||
function DruidInstance.new_back_handler(self, callback, params)
|
||||
return DruidInstance.new(self, back_handler, callback, params)
|
||||
@@ -589,7 +589,7 @@ end
|
||||
|
||||
--- Create @{Hover} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id)
|
||||
-- @tparam function on_hover_callback Hover callback
|
||||
-- @treturn Hover @{Hover} component
|
||||
function DruidInstance.new_hover(self, node, on_hover_callback)
|
||||
@@ -599,9 +599,9 @@ end
|
||||
|
||||
--- Create @{Text} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui text node
|
||||
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
||||
-- @tparam[opt] boolean no_adjust If true, text will be not auto-adjust size
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id)
|
||||
-- @tparam string|nil value Initial text. Default value is node text from GUI scene.
|
||||
-- @tparam boolean|nil no_adjust If true, text will be not auto-adjust size
|
||||
-- @treturn Text @{Text} component
|
||||
function DruidInstance.new_text(self, node, value, no_adjust)
|
||||
return DruidInstance.new(self, text, node, value, no_adjust)
|
||||
@@ -611,32 +611,32 @@ end
|
||||
--- Create @{StaticGrid} component
|
||||
-- Deprecated
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @tparam string|node parent_node The node_id or gui.get_node(node_id). Parent of all Grid items.
|
||||
-- @tparam node element Element prefab. Need to get it size
|
||||
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
||||
-- @treturn StaticGrid @{StaticGrid} component
|
||||
-- @local
|
||||
function DruidInstance.new_grid(self, parent, element, in_row)
|
||||
function DruidInstance.new_grid(self, parent_node, element, in_row)
|
||||
helper.deprecated("The druid:new_grid is deprecated. Please use druid:new_static_grid instead")
|
||||
return DruidInstance.new(self, static_grid, parent, element, in_row)
|
||||
return DruidInstance.new(self, static_grid, parent_node, element, in_row)
|
||||
end
|
||||
|
||||
|
||||
--- Create @{StaticGrid} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @tparam string|node parent_node The node_id or gui.get_node(node_id). Parent of all Grid items.
|
||||
-- @tparam node element Element prefab. Need to get it size
|
||||
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
||||
-- @treturn StaticGrid @{StaticGrid} component
|
||||
function DruidInstance.new_static_grid(self, parent, element, in_row)
|
||||
return DruidInstance.new(self, static_grid, parent, element, in_row)
|
||||
function DruidInstance.new_static_grid(self, parent_node, element, in_row)
|
||||
return DruidInstance.new(self, static_grid, parent_node, element, in_row)
|
||||
end
|
||||
|
||||
|
||||
--- Create @{Scroll} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node view_node GUI view scroll node
|
||||
-- @tparam node content_node GUI content scroll node
|
||||
-- @tparam string|node view_node The node_id or gui.get_node(node_id). Will used as user input node.
|
||||
-- @tparam string|node content_node The node_id or gui.get_node(node_id). Will used as scrollable node inside view_node.
|
||||
-- @treturn Scroll @{Scroll} component
|
||||
function DruidInstance.new_scroll(self, view_node, content_node)
|
||||
return DruidInstance.new(self, scroll, view_node, content_node)
|
||||
@@ -645,7 +645,7 @@ end
|
||||
|
||||
--- Create @{Drag} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node GUI node to detect dragging
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id). Will used as user input node.
|
||||
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
|
||||
-- @treturn Drag @{Drag} component
|
||||
function DruidInstance.new_drag(self, node, on_drag_callback)
|
||||
@@ -655,7 +655,7 @@ end
|
||||
|
||||
--- Create @{Swipe} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam string|node node The node_id or gui.get_node(node_id). Will used as user input node.
|
||||
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
|
||||
-- @treturn Swipe @{Swipe} component
|
||||
function DruidInstance.new_swipe(self, node, on_swipe_callback)
|
||||
@@ -665,38 +665,38 @@ end
|
||||
|
||||
--- Create @{DynamicGrid} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @tparam string|node parent_node The node_id or gui.get_node(node_id). Parent of all Grid items.
|
||||
-- @treturn DynamicGrid @{DynamicGrid} component
|
||||
function DruidInstance.new_dynamic_grid(self, parent)
|
||||
function DruidInstance.new_dynamic_grid(self, parent_node)
|
||||
return helper.require_component_message("dynamic_grid")
|
||||
end
|
||||
|
||||
|
||||
--- Create @{LangText} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node The text node
|
||||
-- @tparam string locale_id Default locale id
|
||||
-- @tparam boolean no_adjust If true, will not correct text size
|
||||
-- @tparam string|node node The_node id or gui.get_node(node_id)
|
||||
-- @tparam string|nil locale_id Default locale id or text from node as default
|
||||
-- @tparam string|nil adjust_type Adjust type for text node. Default: const.TEXT_ADJUST.DOWNSCALE
|
||||
-- @treturn LangText @{LangText} component
|
||||
function DruidInstance.new_lang_text(self, node, locale_id, no_adjust)
|
||||
function DruidInstance.new_lang_text(self, node, locale_id, adjust_type)
|
||||
return helper.require_component_message("lang_text")
|
||||
end
|
||||
|
||||
|
||||
--- Create @{Slider} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui pin node
|
||||
-- @tparam string|node pin_node The_node id or gui.get_node(node_id).
|
||||
-- @tparam vector3 end_pos The end position of slider
|
||||
-- @tparam[opt] function callback On slider change callback
|
||||
-- @tparam function|nil callback On slider change callback
|
||||
-- @treturn Slider @{Slider} component
|
||||
function DruidInstance.new_slider(self, node, end_pos, callback)
|
||||
function DruidInstance.new_slider(self, pin_node, end_pos, callback)
|
||||
return helper.require_component_message("slider")
|
||||
end
|
||||
|
||||
|
||||
--- Create @{Checkbox} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam string|node node The_node id or gui.get_node(node_id).
|
||||
-- @tparam function callback Checkbox callback
|
||||
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
|
||||
-- @tparam[opt=false] boolean initial_state The initial state of checkbox, default - false
|
||||
@@ -708,9 +708,9 @@ end
|
||||
|
||||
--- Create @{Input} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node click_node Button node to enabled input component
|
||||
-- @tparam node text_node Text node what will be changed on user input
|
||||
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
|
||||
-- @tparam string|node click_node Button node to enabled input component
|
||||
-- @tparam string|node text_node Text node what will be changed on user input
|
||||
-- @tparam number|nil keyboard_type Gui keyboard type for input field
|
||||
-- @treturn Input @{Input} component
|
||||
function DruidInstance.new_input(self, click_node, text_node, keyboard_type)
|
||||
return helper.require_component_message("input")
|
||||
@@ -752,10 +752,10 @@ end
|
||||
|
||||
--- Create @{Timer} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui text node
|
||||
-- @tparam string|node node Gui text node
|
||||
-- @tparam number seconds_from Start timer value in seconds
|
||||
-- @tparam[opt=0] number seconds_to End timer value in seconds
|
||||
-- @tparam[opt] function callback Function on timer end
|
||||
-- @tparam function|nil callback Function on timer end
|
||||
-- @treturn Timer @{Timer} component
|
||||
function DruidInstance.new_timer(self, node, seconds_from, seconds_to, callback)
|
||||
return helper.require_component_message("timer")
|
||||
@@ -775,7 +775,7 @@ end
|
||||
|
||||
--- Create @{Layout} component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam string|node node Layout node
|
||||
-- @tparam string|node node The_node id or gui.get_node(node_id).
|
||||
-- @tparam string mode The layout mode
|
||||
-- @treturn Layout @{Layout} component
|
||||
function DruidInstance.new_layout(self, node, mode)
|
||||
@@ -787,7 +787,7 @@ end
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam string|string[] keys_array Keys for trigger action. Should contains one action key and any amount of modificator keys
|
||||
-- @tparam function callback The callback function
|
||||
-- @tparam[opt] any callback_argument The argument to pass into the callback function
|
||||
-- @tparam any|nil callback_argument The argument to pass into the callback function
|
||||
-- @treturn Hotkey @{Hotkey} component
|
||||
function DruidInstance.new_hotkey(self, keys_array, callback, callback_argument)
|
||||
return helper.require_component_message("hotkey")
|
||||
@@ -797,8 +797,8 @@ end
|
||||
--- Create @{RichText} component.
|
||||
-- As a template please check rich_text.gui layout.
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam[opt] string template Template name if used
|
||||
-- @tparam[opt] table nodes Nodes table from gui.clone_tree
|
||||
-- @tparam string|nil template Template name if used
|
||||
-- @tparam table|nil nodes Nodes table from gui.clone_tree
|
||||
-- @treturn RichText @{RichText} component
|
||||
function DruidInstance.new_rich_text(self, template, nodes)
|
||||
return helper.require_component_message("rich_text", "custom")
|
||||
|
Reference in New Issue
Block a user