Annotations update [3]

This commit is contained in:
Insality 2023-10-17 22:32:22 +03:00
parent 50c9b6bad5
commit c99b97f392
17 changed files with 1981 additions and 106 deletions

View File

@ -360,7 +360,7 @@ local button = self.druid:new_button("button_name", on_button_click, c
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a> or <span class="type">nil</span></span>
Gui node
</li>
</ul>

View File

@ -158,7 +158,7 @@ end
<td class="summary">Create <a href="../modules/Button.html#">Button</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_checkbox">new_checkbox(self, node, callback[, click_node=node[, initial_state=false]])</a></td>
<td class="name" nowrap><a href="#new_checkbox">new_checkbox(self, node, callback, click_node, initial_state)</a></td>
<td class="summary">Create <a href="../modules/Checkbox.html#">Checkbox</a> component</td>
</tr>
<tr>
@ -198,7 +198,7 @@ end
<td class="summary">Create <a href="../modules/Layout.html#">Layout</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_progress">new_progress(self, node, key[, init_value=1])</a></td>
<td class="name" nowrap><a href="#new_progress">new_progress(self, node, key, init_value)</a></td>
<td class="summary">Create <a href="../modules/Progress.html#">Progress</a> component</td>
</tr>
<tr>
@ -218,7 +218,7 @@ end
<td class="summary">Create <a href="../modules/Slider.html#">Slider</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_static_grid">new_static_grid(self, parent_node, element[, in_row=1])</a></td>
<td class="name" nowrap><a href="#new_static_grid">new_static_grid(self, parent_node, item, in_row)</a></td>
<td class="summary">Create <a href="../modules/StaticGrid.html#">StaticGrid</a> component</td>
</tr>
<tr>
@ -230,7 +230,7 @@ end
<td class="summary">Create <a href="../modules/Text.html#">Text</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_timer">new_timer(self, node, seconds_from[, seconds_to=0], callback)</a></td>
<td class="name" nowrap><a href="#new_timer">new_timer(self, node, seconds_from, seconds_to, callback)</a></td>
<td class="summary">Create <a href="../modules/Timer.html#">Timer</a> component</td>
</tr>
<tr>
@ -311,6 +311,12 @@ end
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
Component instance
</ol>
@ -331,7 +337,7 @@ end
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>
@The callback(self, custom_args) to call on back event
</li>
<li><span class="parameter">params</span>
@ -401,7 +407,7 @@ end
The node_id or gui.get_node(node_id)
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>
Button callback
</li>
<li><span class="parameter">params</span>
@ -427,7 +433,7 @@ end
</dd>
<dt>
<a name = "new_checkbox"></a>
<strong>new_checkbox(self, node, callback[, click_node=node[, initial_state=false]])</strong>
<strong>new_checkbox(self, node, callback, click_node, initial_state)</strong>
</dt>
<dd>
Create <a href="../modules/Checkbox.html#">Checkbox</a> component
@ -444,18 +450,16 @@ end
The_node id or gui.get_node(node_id).
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>
Checkbox callback
</li>
<li><span class="parameter">click_node</span>
<span class="types"><span class="type">node</span></span>
Trigger node, by default equals to node
(<em>default</em> node)
<span class="types"><span class="type">node</span> or <span class="type">nil</span></span>
Trigger node, Default: node
</li>
<li><span class="parameter">initial_state</span>
<span class="types"><span class="type">boolean</span></span>
The initial state of checkbox, default - false
(<em>default</em> false)
<span class="types"><span class="type">boolean</span> or <span class="type">nil</span></span>
The initial state of checkbox, Default: false
</li>
</ul>
@ -568,7 +572,7 @@ end
The node_id or gui.get_node(node_id). Will used as user input node.
</li>
<li><span class="parameter">on_drag_callback</span>
<span class="types"><span class="type">function</span></span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>
Callback for on_drag_event(self, dx, dy)
</li>
</ul>
@ -673,7 +677,7 @@ end
The node_id or gui.get_node(node_id)
</li>
<li><span class="parameter">on_hover_callback</span>
<span class="types"><span class="type">function</span></span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>
Hover callback
</li>
</ul>
@ -804,7 +808,7 @@ end
</dd>
<dt>
<a name = "new_progress"></a>
<strong>new_progress(self, node, key[, init_value=1])</strong>
<strong>new_progress(self, node, key, init_value)</strong>
</dt>
<dd>
Create <a href="../modules/Progress.html#">Progress</a> component
@ -825,9 +829,8 @@ end
Progress bar direction: const.SIDE.X or const.SIDE.Y
</li>
<li><span class="parameter">init_value</span>
<span class="types"><span class="type">number</span></span>
Initial value of progress bar
(<em>default</em> 1)
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
Initial value of progress bar. Default: 1
</li>
</ul>
@ -994,7 +997,7 @@ end
</dd>
<dt>
<a name = "new_static_grid"></a>
<strong>new_static_grid(self, parent_node, element[, in_row=1])</strong>
<strong>new_static_grid(self, parent_node, item, in_row)</strong>
</dt>
<dd>
Create <a href="../modules/StaticGrid.html#">StaticGrid</a> component
@ -1010,14 +1013,13 @@ end
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
The node_id or gui.get_node(node_id). Parent of all Grid items.
</li>
<li><span class="parameter">element</span>
<span class="types"><span class="type">node</span></span>
Element prefab. Need to get it size
<li><span class="parameter">item</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
Item prefab. Required to get grid's item size. Can be adjusted separately.
</li>
<li><span class="parameter">in_row</span>
<span class="types"><span class="type">number</span></span>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
How many nodes in row can be placed
(<em>default</em> 1)
</li>
</ul>
@ -1051,7 +1053,7 @@ end
The node_id or gui.get_node(node_id). Will used as user input node.
</li>
<li><span class="parameter">on_swipe_callback</span>
<span class="types"><span class="type">function</span></span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>
Swipe callback for on_swipe_end event
</li>
</ul>
@ -1108,7 +1110,7 @@ end
</dd>
<dt>
<a name = "new_timer"></a>
<strong>new_timer(self, node, seconds_from[, seconds_to=0], callback)</strong>
<strong>new_timer(self, node, seconds_from, seconds_to, callback)</strong>
</dt>
<dd>
Create <a href="../modules/Timer.html#">Timer</a> component
@ -1129,9 +1131,8 @@ end
Start timer value in seconds
</li>
<li><span class="parameter">seconds_to</span>
<span class="types"><span class="type">number</span></span>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
End timer value in seconds
(<em>default</em> 0)
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>

View File

@ -91,7 +91,7 @@ helper.centrate_nodes(0, node_1, node_2)
<td class="summary">Add all elements from source array to the target array</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes([margin=0], ...)</a></td>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes(margin, ...)</a></td>
<td class="summary">Centerate nodes by x position with margin.</td>
</tr>
<tr>
@ -163,7 +163,7 @@ helper.centrate_nodes(0, node_1, node_2)
<td class="summary">Remove value from array with shift policy</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.round">helper.round(num[, num_decimal_places=0])</a></td>
<td class="name" nowrap><a href="#helper.round">helper.round(num, num_decimal_places)</a></td>
<td class="summary">Round number to specified decimal places</td>
</tr>
<tr>
@ -220,7 +220,7 @@ helper.centrate_nodes(0, node_1, node_2)
</dd>
<dt>
<a name = "helper.centrate_nodes"></a>
<strong>helper.centrate_nodes([margin=0], ...)</strong>
<strong>helper.centrate_nodes(margin, ...)</strong>
</dt>
<dd>
Centerate nodes by x position with margin.
@ -231,9 +231,8 @@ helper.centrate_nodes(0, node_1, node_2)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
Offset between nodes
(<em>default</em> 0)
</li>
<li><span class="parameter">...</span>
Gui nodes
@ -752,7 +751,7 @@ helper.centrate_nodes(0, node_1, node_2)
</dd>
<dt>
<a name = "helper.round"></a>
<strong>helper.round(num[, num_decimal_places=0])</strong>
<strong>helper.round(num, num_decimal_places)</strong>
</dt>
<dd>
Round number to specified decimal places
@ -765,9 +764,8 @@ helper.centrate_nodes(0, node_1, node_2)
Number
</li>
<li><span class="parameter">num_decimal_places</span>
<span class="types"><span class="type">number</span></span>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
Decimal places
(<em>default</em> 0)
</li>
</ul>

View File

@ -107,6 +107,10 @@
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Text node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change">on_change</a></td>
<td class="summary">On change text callback</td>
@ -194,7 +198,7 @@
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/LangText.html#node">node</a></span>
The node_id or gui.get_node(node_id)
</li>
<li><span class="parameter">locale_id</span>
@ -308,6 +312,26 @@
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Text node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/LangText.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change"></a>
<strong>on_change</strong>

View File

@ -144,7 +144,7 @@
<td class="summary">Strict drag scroll area.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_extra_stretch_size">set_extra_stretch_size(self[, stretch_size=0])</a></td>
<td class="name" nowrap><a href="#set_extra_stretch_size">set_extra_stretch_size(self, stretch_size)</a></td>
<td class="summary">Set extra size for scroll stretching.</td>
</tr>
<tr>
@ -537,7 +537,7 @@
</dd>
<dt>
<a name = "set_extra_stretch_size"></a>
<strong>set_extra_stretch_size(self[, stretch_size=0])</strong>
<strong>set_extra_stretch_size(self, stretch_size)</strong>
</dt>
<dd>
Set extra size for scroll stretching.
@ -551,9 +551,8 @@
<a href="../modules/Scroll.html#">Scroll</a>
</li>
<li><span class="parameter">stretch_size</span>
<span class="types"><span class="type">number</span></span>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
Size in pixels of additional scroll area
(<em>default</em> 0)
</li>
</ul>

View File

@ -102,7 +102,7 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#add">add(self, item, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
<td class="name" nowrap><a href="#add">add(self, item, index, shift_policy, is_instant)</a></td>
<td class="summary">Add new item to the grid</td>
</tr>
<tr>
@ -142,7 +142,7 @@
<td class="summary">The <a href="../modules/StaticGrid.html#">StaticGrid</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
<td class="name" nowrap><a href="#remove">remove(self, index, shift_policy, is_instant)</a></td>
<td class="summary">Remove the item from the grid.</td>
</tr>
<tr>
@ -230,7 +230,7 @@
<dl class="function">
<dt>
<a name = "add"></a>
<strong>add(self, item, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</strong>
<strong>add(self, item, index, shift_policy, is_instant)</strong>
</dt>
<dd>
Add new item to the grid
@ -244,21 +244,19 @@
</li>
<li><span class="parameter">item</span>
<span class="types"><span class="type">node</span></span>
Gui node
GUI node
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
The item position. By default add as last item
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
How shift nodes, if required. Default: const.SHIFT.RIGHT
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
<span class="types"><span class="type">boolean</span> or <span class="type">nil</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
@ -532,7 +530,7 @@
</dd>
<dt>
<a name = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</strong>
<strong>remove(self, index, shift_policy, is_instant)</strong>
</dt>
<dd>
Remove the item from the grid. Note that gui node will be not deleted
@ -549,14 +547,12 @@
The grid node index to remove
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
How shift nodes, if required. Default: const.SHIFT.RIGHT
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
<span class="types"><span class="type">boolean</span> or <span class="type">nil</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>

View File

@ -84,7 +84,7 @@
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, node, seconds_from[, seconds_to=0], callback)</a></td>
<td class="name" nowrap><a href="#init">init(self, node, seconds_from, seconds_to, callback)</a></td>
<td class="summary">The <a href="../modules/Timer.html#">Timer</a> constructor</td>
</tr>
<tr>
@ -141,7 +141,7 @@
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, node, seconds_from[, seconds_to=0], callback)</strong>
<strong>init(self, node, seconds_from, seconds_to, callback)</strong>
</dt>
<dd>
The <a href="../modules/Timer.html#">Timer</a> constructor
@ -162,9 +162,8 @@
Start timer value in seconds
</li>
<li><span class="parameter">seconds_to</span>
<span class="types"><span class="type">number</span></span>
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
End timer value in seconds
(<em>default</em> 0)
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span> or <span class="type">nil</span></span>

File diff suppressed because it is too large Load Diff

View File

@ -478,7 +478,7 @@ end
--
-- This functions calls automatically if you don't disable it in game.project: druid.no_stencil_check
-- @tparam Button self @{Button}
-- @tparam node zone Gui node
-- @tparam node|nil zone Gui node
-- @treturn Button Current button instance
-- @usage
-- button:set_click_zone("stencil_node")

View File

@ -359,7 +359,7 @@ end
--- Set extra size for scroll stretching.
-- Set 0 to disable stretching effect
-- @tparam Scroll self @{Scroll}
-- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area
-- @tparam number|nil stretch_size Size in pixels of additional scroll area
-- @treturn druid.scroll Current scroll instance
function Scroll.set_extra_stretch_size(self, stretch_size)
self.style.EXTRA_STRETCH_SIZE = stretch_size or 0

View File

@ -213,10 +213,10 @@ end
--- Add new item to the grid
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam node item Gui node
-- @tparam node item GUI node
-- @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
-- @tparam number|nil shift_policy How shift nodes, if required. Default: const.SHIFT.RIGHT
-- @tparam boolean|nil is_instant If true, update node positions instantly
function StaticGrid.add(self, item, index, shift_policy, is_instant)
index = index or ((self.last_index or 0) + 1)
@ -239,8 +239,8 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam number index The grid node index to remove
-- @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
-- @tparam number|nil shift_policy How shift nodes, if required. Default: const.SHIFT.RIGHT
-- @tparam boolean|nil is_instant If true, update node positions instantly
-- @treturn node The deleted gui node from grid
function StaticGrid.remove(self, index, shift_policy, is_instant)
assert(self.nodes[index], "No grid item at given index " .. index)

View File

@ -347,7 +347,7 @@ end
-- by `BaseComponent.create`
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string name BaseComponent name
-- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first
-- @tparam number|nil input_priority The input priority. The bigger number processed first
-- @local
function BaseComponent.initialize(self, name, input_priority)
self._component = {
@ -483,7 +483,7 @@ end
--- Create new component. It will inheritance from basic Druid component.
-- @function BaseComponent.create
-- @tparam string name BaseComponent name
-- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first
-- @tparam number|nil input_priority The input priority. The bigger number processed first
-- @local
function BaseComponent.create(name, input_priority)
-- Yea, inheritance here

View File

@ -7,18 +7,18 @@
local M = {}
M.ACTION_TEXT = hash(sys.get_config("druid.input_text", "text"))
M.ACTION_TOUCH = hash(sys.get_config("druid.input_touch", "touch"))
M.ACTION_MARKED_TEXT = hash(sys.get_config("druid.input_marked_text", "marked_text"))
M.ACTION_ESC = hash(sys.get_config("druid.input_key_esc", "key_esc"))
M.ACTION_BACK = hash(sys.get_config("druid.input_key_back", "key_back"))
M.ACTION_ENTER = hash(sys.get_config("druid.input_key_enter", "key_enter"))
M.ACTION_MULTITOUCH = hash(sys.get_config("druid.input_multitouch", "touch_multi"))
M.ACTION_BACKSPACE = hash(sys.get_config("druid.input_key_backspace", "key_backspace"))
M.ACTION_SCROLL_UP = hash(sys.get_config("druid.input_scroll_up", "mouse_wheel_up"))
M.ACTION_SCROLL_DOWN = hash(sys.get_config("druid.input_scroll_down", "mouse_wheel_down"))
M.ACTION_TEXT = hash(sys.get_config_string("druid.input_text", "text"))
M.ACTION_TOUCH = hash(sys.get_config_string("druid.input_touch", "touch"))
M.ACTION_MARKED_TEXT = hash(sys.get_config_string("druid.input_marked_text", "marked_text"))
M.ACTION_ESC = hash(sys.get_config_string("druid.input_key_esc", "key_esc"))
M.ACTION_BACK = hash(sys.get_config_string("druid.input_key_back", "key_back"))
M.ACTION_ENTER = hash(sys.get_config_string("druid.input_key_enter", "key_enter"))
M.ACTION_MULTITOUCH = hash(sys.get_config_string("druid.input_multitouch", "touch_multi"))
M.ACTION_BACKSPACE = hash(sys.get_config_string("druid.input_key_backspace", "key_backspace"))
M.ACTION_SCROLL_UP = hash(sys.get_config_string("druid.input_scroll_up", "mouse_wheel_up"))
M.ACTION_SCROLL_DOWN = hash(sys.get_config_string("druid.input_scroll_down", "mouse_wheel_down"))
M.IS_STENCIL_CHECK = not (sys.get_config("druid.no_stencil_check") == "1")
M.IS_STENCIL_CHECK = not (sys.get_config_string("druid.no_stencil_check") == "1")
M.ON_INPUT = "on_input"

View File

@ -23,6 +23,9 @@
--- The text component
-- @tfield Text text @{Text}
--- Text node
-- @tfield node node
---
local Event = require("druid.event")

View File

@ -48,7 +48,7 @@ end
-- @tparam Timer self @{Timer}
-- @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 number|nil seconds_to End timer value in seconds
-- @tparam function|nil callback Function on timer end
function Timer.init(self, node, seconds_from, seconds_to, callback)
self.node = self:get_node(node)

View File

@ -63,7 +63,7 @@ end
-- @function helper.centrate_icon_with_text
-- @tparam box|nil icon_node Gui box node
-- @tparam text|nil text_node Gui text node
-- @tparam[opt=0] number margin Offset between nodes
-- @tparam number|nil margin Offset between nodes
-- @local
function M.centrate_icon_with_text(icon_node, text_node, margin)
return M.centrate_nodes(margin, icon_node, text_node)
@ -75,7 +75,7 @@ end
-- This functions calculate total width of nodes and set position for each node.
-- The centrate will be around 0 x position.
-- @function helper.centrate_nodes
-- @tparam[opt=0] number margin Offset between nodes
-- @tparam number|nil margin Offset between nodes
-- @param ... Gui nodes
function M.centrate_nodes(margin, ...)
margin = margin or 0
@ -200,7 +200,7 @@ end
--- Round number to specified decimal places
-- @function helper.round
-- @tparam number num Number
-- @tparam[opt=0] number num_decimal_places Decimal places
-- @tparam number|nil num_decimal_places Decimal places
-- @treturn number Rounded number
function M.round(num, num_decimal_places)
local mult = 10^(num_decimal_places or 0)

View File

@ -261,6 +261,7 @@ end
-- @tparam DruidInstance self
-- @tparam BaseComponent component Component module
-- @tparam any ... Other component params to pass it to component:init function
-- @treturn BaseComponent Component instance
function DruidInstance.new(self, component, ...)
local instance = create(self, component)
@ -559,7 +560,7 @@ end
--- Create @{Button} component
-- @tparam DruidInstance self
-- @tparam string|node node The node_id or gui.get_node(node_id)
-- @tparam function callback Button callback
-- @tparam function|nil callback Button callback
-- @tparam table|nil params Button callback params
-- @tparam node|nil anim_node Button anim node (node, if not provided)
-- @treturn Button @{Button} component
@ -579,7 +580,7 @@ end
--- Create @{BackHandler} component
-- @tparam DruidInstance self
-- @tparam function callback @The callback(self, custom_args) to call on back event
-- @tparam function|nil callback @The callback(self, custom_args) to call on back event
-- @tparam any|nil params Callback argument
-- @treturn BackHandler @{BackHandler} component
function DruidInstance.new_back_handler(self, callback, params)
@ -590,7 +591,7 @@ end
--- Create @{Hover} component
-- @tparam DruidInstance self
-- @tparam string|node node The node_id or gui.get_node(node_id)
-- @tparam function on_hover_callback Hover callback
-- @tparam function|nil on_hover_callback Hover callback
-- @treturn Hover @{Hover} component
function DruidInstance.new_hover(self, node, on_hover_callback)
return DruidInstance.new(self, hover, node, on_hover_callback)
@ -612,24 +613,24 @@ end
-- Deprecated
-- @tparam DruidInstance self
-- @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
-- @tparam node item Element prefab. Required to get grid's item size. Can be adjusted separately.
-- @tparam number|nil in_row How many nodes in row can be placed
-- @treturn StaticGrid @{StaticGrid} component
-- @local
function DruidInstance.new_grid(self, parent_node, element, in_row)
function DruidInstance.new_grid(self, parent_node, item, in_row)
helper.deprecated("The druid:new_grid is deprecated. Please use druid:new_static_grid instead")
return DruidInstance.new(self, static_grid, parent_node, element, in_row)
return DruidInstance.new(self, static_grid, parent_node, item, in_row)
end
--- Create @{StaticGrid} component
-- @tparam DruidInstance self
-- @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
-- @tparam string|node item Item prefab. Required to get grid's item size. Can be adjusted separately.
-- @tparam number|nil in_row How many nodes in row can be placed
-- @treturn StaticGrid @{StaticGrid} component
function DruidInstance.new_static_grid(self, parent_node, element, in_row)
return DruidInstance.new(self, static_grid, parent_node, element, in_row)
function DruidInstance.new_static_grid(self, parent_node, item, in_row)
return DruidInstance.new(self, static_grid, parent_node, item, in_row)
end
@ -646,7 +647,7 @@ end
--- Create @{Drag} component
-- @tparam DruidInstance self
-- @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)
-- @tparam function|nil on_drag_callback Callback for on_drag_event(self, dx, dy)
-- @treturn Drag @{Drag} component
function DruidInstance.new_drag(self, node, on_drag_callback)
return DruidInstance.new(self, drag, node, on_drag_callback)
@ -656,7 +657,7 @@ end
--- Create @{Swipe} component
-- @tparam DruidInstance self
-- @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
-- @tparam function|nil on_swipe_callback Swipe callback for on_swipe_end event
-- @treturn Swipe @{Swipe} component
function DruidInstance.new_swipe(self, node, on_swipe_callback)
return helper.require_component_message("swipe")
@ -697,9 +698,9 @@ end
--- Create @{Checkbox} component
-- @tparam DruidInstance self
-- @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
-- @tparam function|nil callback Checkbox callback
-- @tparam node|nil click_node Trigger node, Default: node
-- @tparam boolean|nil initial_state The initial state of checkbox, Default: false
-- @treturn Checkbox @{Checkbox} component
function DruidInstance.new_checkbox(self, node, callback, click_node, initial_state)
return helper.require_component_message("checkbox")
@ -754,7 +755,7 @@ end
-- @tparam DruidInstance self
-- @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 number|nil seconds_to End timer value in seconds
-- @tparam function|nil callback Function on timer end
-- @treturn Timer @{Timer} component
function DruidInstance.new_timer(self, node, seconds_from, seconds_to, callback)
@ -766,7 +767,7 @@ end
-- @tparam DruidInstance self
-- @tparam string|node node Progress bar fill node or node name
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
-- @tparam[opt=1] number init_value Initial value of progress bar
-- @tparam number|nil init_value Initial value of progress bar. Default: 1
-- @treturn Progress @{Progress} component
function DruidInstance.new_progress(self, node, key, init_value)
return helper.require_component_message("progress")