mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
commit
10fad9c871
@ -71,7 +71,7 @@ function druid__back_handler.on_input(self, action_id, action) end
|
||||
|
||||
|
||||
---@class druid.base_component
|
||||
---@field ALL field Component Interests
|
||||
---@field ON_INPUT field Component Interests
|
||||
local druid__base_component = {}
|
||||
|
||||
--- Return all children components, recursive
|
||||
@ -268,13 +268,15 @@ function druid__checkbox.get_state(self) end
|
||||
---@param node node Gui node
|
||||
---@param callback function Checkbox callback
|
||||
---@param click_node node Trigger node, by default equals to node
|
||||
function druid__checkbox.init(self, node, callback, click_node) end
|
||||
---@param initial_state boolean The initial state of checkbox, default - false
|
||||
function druid__checkbox.init(self, node, callback, click_node, initial_state) end
|
||||
|
||||
--- Set checkbox state
|
||||
---@param self druid.checkbox
|
||||
---@param state bool Checkbox state
|
||||
---@param is_silent bool Don't trigger on_change_state if true
|
||||
function druid__checkbox.set_state(self, state, is_silent) end
|
||||
---@param is_instant bool If instant checkbox change
|
||||
function druid__checkbox.set_state(self, state, is_silent, is_instant) end
|
||||
|
||||
|
||||
---@class druid.checkbox.style
|
||||
@ -302,7 +304,8 @@ function druid__checkbox_group.init(self, nodes, callback, click_nodes) end
|
||||
--- Set checkbox group state
|
||||
---@param self druid.checkbox_group
|
||||
---@param indexes bool[] Array of checkbox state
|
||||
function druid__checkbox_group.set_state(self, indexes) end
|
||||
---@param is_instant boolean If instant state change
|
||||
function druid__checkbox_group.set_state(self, indexes, is_instant) end
|
||||
|
||||
|
||||
---@class druid.data_list : druid.base_component
|
||||
@ -527,7 +530,7 @@ function druid__hover.set_mouse_hover(self, state) end
|
||||
---@field on_input_full druid_event On input field text change to max length string callback(self, input_text)
|
||||
---@field on_input_select druid_event On input field select callback(self, button_node)
|
||||
---@field on_input_text druid_event On input field text change callback(self, input_text)
|
||||
---@field on_input_unselect druid_event On input field unselect callback(self, button_node)
|
||||
---@field on_input_unselect druid_event On input field unselect callback(self, input_text)
|
||||
---@field on_input_wrong druid_event On trying user input with not allowed character callback(self, params, button_instance)
|
||||
---@field style druid.input.style Component style params.
|
||||
---@field text druid.text Text component
|
||||
@ -584,22 +587,31 @@ local druid__input__style = {}
|
||||
---@field text Text The text component
|
||||
local druid__lang_text = {}
|
||||
|
||||
--- Format string with new text params on localized text
|
||||
---@param self druid.lang_text
|
||||
---@param ... string Locale arguments to pass in text function
|
||||
---@return druid.lang_text Current instance
|
||||
function druid__lang_text.format(self, ...) end
|
||||
|
||||
--- Component init function
|
||||
---@param self druid.lang_text
|
||||
---@param node node The text node
|
||||
---@param locale_id string Default locale id, optional
|
||||
---@param locale_id string Default locale id or text from node as default
|
||||
---@param no_adjust bool If true, will not correct text size
|
||||
function druid__lang_text.init(self, node, locale_id, no_adjust) end
|
||||
|
||||
--- Setup raw text to lang_text component
|
||||
---@param self druid.lang_text
|
||||
---@param text string Text for text node
|
||||
---@return druid.lang_text Current instance
|
||||
function druid__lang_text.set_to(self, text) end
|
||||
|
||||
--- Translate the text by locale_id
|
||||
---@param self druid.lang_text
|
||||
---@param locale_id string Locale id
|
||||
function druid__lang_text.translate(self, locale_id) end
|
||||
---@param ... string Locale arguments to pass in text function
|
||||
---@return druid.lang_text Current instance
|
||||
function druid__lang_text.translate(self, locale_id, ...) end
|
||||
|
||||
|
||||
---@class druid.progress : druid.base_component
|
||||
@ -676,7 +688,8 @@ function druid__radio_group.init(self, nodes, callback, click_nodes) end
|
||||
--- Set radio group state
|
||||
---@param self druid.radio_group
|
||||
---@param index number Index in radio group
|
||||
function druid__radio_group.set_state(self, index) end
|
||||
---@param is_instant boolean If is instant state change
|
||||
function druid__radio_group.set_state(self, index, is_instant) end
|
||||
|
||||
|
||||
---@class druid.scroll : druid.base_component
|
||||
@ -937,6 +950,7 @@ function druid__static_grid.set_position_function(self, callback) end
|
||||
|
||||
|
||||
---@class druid.static_grid.style
|
||||
---@field IS_ALIGN_LAST_ROW field If true, always align last row of the grid as grid pivot sets
|
||||
---@field IS_DYNAMIC_NODE_POSES field If true, always center grid content as grid pivot sets
|
||||
local druid__static_grid__style = {}
|
||||
|
||||
@ -1092,7 +1106,7 @@ function druid__timer.set_to(self, set_to) end
|
||||
|
||||
|
||||
---@class druid_const
|
||||
---@field ALL field Component Interests
|
||||
---@field ON_INPUT field Component Interests
|
||||
local druid_const = {}
|
||||
|
||||
|
||||
@ -1184,8 +1198,9 @@ function druid_instance.new_button(self, node, callback, params, anim_node) end
|
||||
---@param node node Gui node
|
||||
---@param callback function Checkbox callback
|
||||
---@param click_node node Trigger node, by default equals to node
|
||||
---@param initial_state boolean The initial state of checkbox, default - false
|
||||
---@return druid.checkbox checkbox component
|
||||
function druid_instance.new_checkbox(self, node, callback, click_node) end
|
||||
function druid_instance.new_checkbox(self, node, callback, click_node, initial_state) end
|
||||
|
||||
--- Create checkbox_group component
|
||||
---@param self druid_instance
|
||||
|
@ -1 +1 @@
|
||||
{"content":[{"name":"game.projectc","size":3748,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":13488,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":948341,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":13875,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
|
||||
{"content":[{"name":"game.projectc","size":3748,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":13488,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":948433,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":13875,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,12 +1,12 @@
|
||||
[project]
|
||||
title = druid
|
||||
version = 0.7.499
|
||||
version = 0.8.519
|
||||
write_log = 0
|
||||
compress_archive = 1
|
||||
publisher = Insality
|
||||
developer = Insality
|
||||
commit_sha = 1ae77e727fd29b01a514e73820b3e02213aeb7db
|
||||
build_time = 2021-10-23T14:38:03Z
|
||||
commit_sha = 4e0fd264b169693d088a47f2bb53376a1808fb1e
|
||||
build_time = 2022-02-12T15:15:53Z
|
||||
|
||||
[display]
|
||||
width = 600
|
||||
@ -121,7 +121,7 @@ default_language = en
|
||||
localizations = en
|
||||
|
||||
[android]
|
||||
version_code = 499
|
||||
version_code = 519
|
||||
minimum_sdk_version = 16
|
||||
target_sdk_version = 30
|
||||
package = com.insality.druid
|
||||
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -7,7 +7,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
|
||||
<title>druid 0.7.499</title>
|
||||
<title>druid 0.8.519</title>
|
||||
<style type='text/css'>
|
||||
/* Disable user selection to avoid strange bug in Chrome on Windows:
|
||||
* Selecting a text outside the canvas, then clicking+draging would
|
||||
|
@ -169,7 +169,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -149,11 +149,11 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">action_id</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
on_input action id
|
||||
</li>
|
||||
<li><span class="parameter">action</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
on_input action
|
||||
</li>
|
||||
</ul>
|
||||
@ -214,7 +214,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -141,7 +141,7 @@
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#ALL">ALL</a></td>
|
||||
<td class="name" nowrap><a href="#ON_INPUT">ON_INPUT</a></td>
|
||||
<td class="summary">Component Interests</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -170,7 +170,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">druid_style</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid style module
|
||||
</li>
|
||||
</ul>
|
||||
@ -195,7 +195,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">template</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
BaseComponent template name
|
||||
</li>
|
||||
</ul>
|
||||
@ -220,7 +220,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">nodes</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
BaseComponent nodes table
|
||||
</li>
|
||||
</ul>
|
||||
@ -249,7 +249,7 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
BaseComponent context
|
||||
</ol>
|
||||
|
||||
@ -275,7 +275,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">node_or_name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.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 <span class="type">node</span></span>
|
||||
Node name or node itself
|
||||
</li>
|
||||
</ul>
|
||||
@ -338,7 +338,7 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The component name
|
||||
</ol>
|
||||
|
||||
@ -532,15 +532,15 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">druid_instance</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
The parent druid instance
|
||||
</li>
|
||||
<li><span class="parameter">context</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid context. Usually it is self of script
|
||||
</li>
|
||||
<li><span class="parameter">style</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid style module
|
||||
</li>
|
||||
</ul>
|
||||
@ -575,7 +575,7 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Array of childrens if the Druid component instance
|
||||
</ol>
|
||||
|
||||
@ -588,8 +588,8 @@
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "ALL"></a>
|
||||
<strong>ALL</strong>
|
||||
<a name = "ON_INPUT"></a>
|
||||
<strong>ON_INPUT</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component Interests
|
||||
@ -608,7 +608,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -212,7 +212,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -207,7 +207,7 @@
|
||||
Button callback
|
||||
</li>
|
||||
<li><span class="parameter">params</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Button callback params
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
@ -775,7 +775,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -78,11 +78,11 @@
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#init">init(self, node, callback[, click_node=node])</a></td>
|
||||
<td class="name" nowrap><a href="#init">init(self, node, callback[, click_node=node[, initial_state=false]])</a></td>
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(self, state, is_silent)</a></td>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(self, state, is_silent, is_instant)</a></td>
|
||||
<td class="summary">Set checkbox state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -126,7 +126,7 @@
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "init"></a>
|
||||
<strong>init(self, node, callback[, click_node=node])</strong>
|
||||
<strong>init(self, node, callback[, click_node=node[, initial_state=false]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Component init function
|
||||
@ -151,6 +151,11 @@
|
||||
Trigger node, by default equals to node
|
||||
(<em>default</em> 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)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -160,7 +165,7 @@
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_state"></a>
|
||||
<strong>set_state(self, state, is_silent)</strong>
|
||||
<strong>set_state(self, state, is_silent, is_instant)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set checkbox state
|
||||
@ -180,6 +185,10 @@
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
Don't trigger on_change_state if true
|
||||
</li>
|
||||
<li><span class="parameter">is_instant</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
If instant checkbox change
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -333,7 +342,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -81,7 +81,7 @@
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(self, indexes)</a></td>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(self, indexes, is_instant)</a></td>
|
||||
<td class="summary">Set checkbox group state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -144,7 +144,7 @@
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_state"></a>
|
||||
<strong>set_state(self, indexes)</strong>
|
||||
<strong>set_state(self, indexes, is_instant)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set checkbox group state
|
||||
@ -160,6 +160,10 @@
|
||||
<span class="types"><span class="type">bool[]</span></span>
|
||||
Array of checkbox state
|
||||
</li>
|
||||
<li><span class="parameter">is_instant</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
If instant state change
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -228,7 +232,7 @@
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">checkboxes</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
@ -245,7 +249,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -218,7 +218,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">data</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
The new data array
|
||||
</li>
|
||||
</ul>
|
||||
@ -333,7 +333,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">data</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
@ -499,7 +499,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -489,7 +489,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -152,7 +152,7 @@
|
||||
Callback itself
|
||||
</li>
|
||||
<li><span class="parameter">context</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Additional context as first param to callback call
|
||||
</li>
|
||||
</ul>
|
||||
@ -181,7 +181,7 @@
|
||||
Callback itself
|
||||
</li>
|
||||
<li><span class="parameter">context</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Additional context as first param to callback call
|
||||
</li>
|
||||
</ul>
|
||||
@ -271,7 +271,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -209,7 +209,7 @@
|
||||
<td class="summary">Create slider component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#new_checkbox">new_checkbox(self, node, callback[, click_node=node])</a></td>
|
||||
<td class="name" nowrap><a href="#new_checkbox">new_checkbox(self, node, callback[, click_node=node[, initial_state=false]])</a></td>
|
||||
<td class="summary">Create checkbox component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -260,11 +260,11 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">context</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid context. Usually it is self of script
|
||||
</li>
|
||||
<li><span class="parameter">style</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid style module
|
||||
</li>
|
||||
</ul>
|
||||
@ -395,7 +395,7 @@
|
||||
Action_id from on_input
|
||||
</li>
|
||||
<li><span class="parameter">action</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Action from on_input
|
||||
</li>
|
||||
</ul>
|
||||
@ -430,7 +430,7 @@
|
||||
Message_id from on_message
|
||||
</li>
|
||||
<li><span class="parameter">message</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Message from on_message
|
||||
</li>
|
||||
<li><span class="parameter">sender</span>
|
||||
@ -550,7 +550,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">whitelist_components</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a> or <span class="type">Component</span></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a> or <span class="type">Component</span></span>
|
||||
The array of component to whitelist
|
||||
(<em>default</em> nil)
|
||||
</li>
|
||||
@ -578,7 +578,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">blacklist_components</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a> or <span class="type">Component</span></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a> or <span class="type">Component</span></span>
|
||||
The array of component to blacklist
|
||||
(<em>default</em> nil)
|
||||
</li>
|
||||
@ -612,7 +612,7 @@
|
||||
Button callback
|
||||
</li>
|
||||
<li><span class="parameter">params</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Button callback params
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
@ -755,7 +755,7 @@
|
||||
Gui text node
|
||||
</li>
|
||||
<li><span class="parameter">value</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Initial text. Default value is node text from GUI scene.
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
@ -1013,7 +1013,7 @@
|
||||
The text node
|
||||
</li>
|
||||
<li><span class="parameter">locale_id</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Default locale id
|
||||
</li>
|
||||
<li><span class="parameter">no_adjust</span>
|
||||
@ -1075,7 +1075,7 @@
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "new_checkbox"></a>
|
||||
<strong>new_checkbox(self, node, callback[, click_node=node])</strong>
|
||||
<strong>new_checkbox(self, node, callback[, click_node=node[, initial_state=false]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Create checkbox component
|
||||
@ -1100,6 +1100,11 @@
|
||||
Trigger node, by default equals to node
|
||||
(<em>default</em> 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)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
@ -1328,11 +1333,11 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">node</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.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 <span class="type">node</span></span>
|
||||
Progress bar fill node or node name
|
||||
</li>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Progress bar direction: const.SIDE.X or const.SIDE.Y
|
||||
</li>
|
||||
<li><span class="parameter">init_value</span>
|
||||
@ -1360,7 +1365,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -786,7 +786,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -330,7 +330,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -126,7 +126,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#on_input_unselect">on_input_unselect</a></td>
|
||||
<td class="summary">On input field unselect callback(self, button_node)</td>
|
||||
<td class="summary">On input field unselect callback(self, input_text)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#on_input_text">on_input_text</a></td>
|
||||
@ -196,7 +196,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">input_text</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The string to apply for input field
|
||||
</li>
|
||||
</ul>
|
||||
@ -267,7 +267,7 @@
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The current input field text
|
||||
</ol>
|
||||
|
||||
@ -324,7 +324,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">characters</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Regulax exp. for validate user input
|
||||
</li>
|
||||
</ul>
|
||||
@ -383,7 +383,7 @@
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
<li><span class="parameter">MASK_DEFAULT_CHAR</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Default character mask for password input
|
||||
(<em>default</em> *)
|
||||
</li>
|
||||
@ -405,7 +405,7 @@
|
||||
(self, button_node) Callback on wrong user input
|
||||
</li>
|
||||
<li><span class="parameter">button_style</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Custom button style for input node
|
||||
</li>
|
||||
</ul>
|
||||
@ -444,7 +444,7 @@
|
||||
<strong>on_input_unselect</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
On input field unselect callback(self, button_node)
|
||||
On input field unselect callback(self, input_text)
|
||||
|
||||
|
||||
<ul>
|
||||
@ -650,7 +650,7 @@
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">allowerd_characters</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
@ -688,7 +688,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -86,9 +86,13 @@
|
||||
<td class="summary">Setup raw text to lang_text component</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#translate">translate(self, locale_id)</a></td>
|
||||
<td class="name" nowrap><a href="#translate">translate(self, locale_id, ...)</a></td>
|
||||
<td class="summary">Translate the text by locale_id</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#format">format(self, ...)</a></td>
|
||||
<td class="summary">Format string with new text params on localized text</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
@ -128,8 +132,8 @@
|
||||
The text node
|
||||
</li>
|
||||
<li><span class="parameter">locale_id</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
Default locale id, optional
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Default locale id or text from node as default
|
||||
</li>
|
||||
<li><span class="parameter">no_adjust</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
@ -157,11 +161,17 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">text</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Text for text node
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">LangText</span></span>
|
||||
Current instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
@ -169,7 +179,7 @@
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "translate"></a>
|
||||
<strong>translate(self, locale_id)</strong>
|
||||
<strong>translate(self, locale_id, ...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Translate the text by locale_id
|
||||
@ -182,11 +192,52 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">locale_id</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Locale id
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Locale arguments to pass in text function
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">LangText</span></span>
|
||||
Current instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "format"></a>
|
||||
<strong>format(self, ...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Format string with new text params on localized text
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">self</span>
|
||||
<span class="types"><span class="type">LangText</span></span>
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Locale arguments to pass in text function
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">LangText</span></span>
|
||||
Current instance
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
@ -243,7 +294,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -168,11 +168,11 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">node</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a> or <a class="type" href="../modules/Progress.html#node">node</a></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/Progress.html#node">node</a></span>
|
||||
Progress bar fill node or node name
|
||||
</li>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Progress bar direction: const.SIDE.X or const.SIDE.Y
|
||||
</li>
|
||||
<li><span class="parameter">init_value</span>
|
||||
@ -425,7 +425,7 @@
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
@ -522,7 +522,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -81,7 +81,7 @@
|
||||
<td class="summary">Component init function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(self, index)</a></td>
|
||||
<td class="name" nowrap><a href="#set_state">set_state(self, index, is_instant)</a></td>
|
||||
<td class="summary">Set radio group state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -144,7 +144,7 @@
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_state"></a>
|
||||
<strong>set_state(self, index)</strong>
|
||||
<strong>set_state(self, index, is_instant)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set radio group state
|
||||
@ -160,6 +160,10 @@
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
Index in radio group
|
||||
</li>
|
||||
<li><span class="parameter">is_instant</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
If is instant state change
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -245,7 +249,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -555,7 +555,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">points</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Array of vector3 points
|
||||
</li>
|
||||
</ul>
|
||||
@ -1118,7 +1118,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -421,7 +421,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -619,6 +619,11 @@
|
||||
If true, always center grid content as grid pivot sets
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
<li><span class="parameter">IS_ALIGN_LAST_ROW</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
If true, always align last row of the grid as grid pivot sets
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -877,7 +882,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -283,7 +283,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -209,7 +209,7 @@
|
||||
Gui text node
|
||||
</li>
|
||||
<li><span class="parameter">value</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Initial text. Default value is node text from GUI scene.
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
@ -240,7 +240,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">text</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
@ -266,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
<li><span class="parameter">set_to</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Text for node
|
||||
</li>
|
||||
</ul>
|
||||
@ -547,12 +547,12 @@
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">TRIM_POSTFIX</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The postfix for TRIM adjust type
|
||||
(<em>default</em> ...)
|
||||
</li>
|
||||
<li><span class="parameter">DEFAULT_ADJUST</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The default adjust type for any text component
|
||||
(<em>default</em> DOWNSCALE)
|
||||
</li>
|
||||
@ -814,7 +814,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -403,7 +403,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -370,7 +370,7 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">message</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
The deprecated message
|
||||
</li>
|
||||
</ul>
|
||||
@ -387,7 +387,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -142,11 +142,11 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
module name
|
||||
</li>
|
||||
<li><span class="parameter">module</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
lua table with component
|
||||
</li>
|
||||
</ul>
|
||||
@ -167,11 +167,11 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">context</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid context. Usually it is self of script
|
||||
</li>
|
||||
<li><span class="parameter">style</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid style module
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
@ -199,7 +199,7 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">style</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
Druid style module
|
||||
</li>
|
||||
</ul>
|
||||
@ -268,7 +268,7 @@
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
Event param from window listener
|
||||
</li>
|
||||
</ul>
|
||||
@ -314,7 +314,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-10-23 17:45:31 </i>
|
||||
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -19,52 +19,53 @@ local M = component.create("my_component")
|
||||
function M.init(self, ...)
|
||||
end
|
||||
|
||||
-- Call only if exist interest: component.ON_UPDATE
|
||||
-- [OPTIONAL] If declared, will call this on script.update function
|
||||
function M.update(self, dt)
|
||||
end
|
||||
|
||||
-- Call only if exist interest: component.ON_INPUT
|
||||
-- [OPTIONAL] If declared, will call this on script.on_input function
|
||||
function M.on_input(self, action_id, action)
|
||||
end
|
||||
|
||||
-- Call on component creation and on component:set_style() function
|
||||
-- [OPTIONAL] If declared, will call on component creation and on component:set_style() function
|
||||
function M.on_style_change(self, style)
|
||||
end
|
||||
|
||||
-- Call only if exist interest: component.ON_MESSAGE
|
||||
-- [OPTIONAL] If declared, will call this on script.on_message function
|
||||
function M.on_message(self, message_id, message, sender)
|
||||
end
|
||||
|
||||
-- Call only if component with ON_LANGUAGE_CHANGE interest
|
||||
-- [OPTIONAL] If declared, will call this on druid.on_language_change call
|
||||
function M.on_language_change(self)
|
||||
end
|
||||
|
||||
-- Call only if component with ON_MESSAGE_INPUT interest
|
||||
-- [OPTIONAL] If declared, will call this on const.ON_MESSAGE_INPUT message to Druid script instance
|
||||
function M.on_message_input(self, node_id, message)
|
||||
end
|
||||
|
||||
-- Call only if component with ON_LAYOUT_CHANGE interest
|
||||
-- [OPTIONAL] If declared, will call this on layout changing
|
||||
function M.on_layout_change(self)
|
||||
end
|
||||
|
||||
-- Call, if input was capturing before this component
|
||||
-- [OPTIONAL] If declared, will call this on layout changing, if input was capturing before this component
|
||||
-- Example: scroll is start scrolling, so you need unhover button
|
||||
function M.on_input_interrupt(self)
|
||||
end
|
||||
|
||||
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
|
||||
-- [OPTIONAL] If declared, will call this if game lost focus
|
||||
function M.on_focus_lost(self)
|
||||
end
|
||||
|
||||
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
|
||||
-- [OPTIONAL] If declared, will call this if game gained focus
|
||||
function M.on_focus_gained(self)
|
||||
end
|
||||
|
||||
-- Call only if exist interest: component.ON_LATE_INIT
|
||||
|
||||
-- [OPTIONAL] If declared, will call this if late init step (first frame on update)
|
||||
function M.on_late_init(self)
|
||||
end
|
||||
|
||||
-- Call on component remove or on druid:final
|
||||
-- [OPTIONAL] If declared, will call this on component remove from Druid instance
|
||||
function M.on_remove(self)
|
||||
end
|
||||
|
||||
@ -100,29 +101,6 @@ function init(self)
|
||||
end
|
||||
```
|
||||
|
||||
### Interest
|
||||
Interest - is a way to indicate what events your component will respond to.
|
||||
There is next interests in druid:
|
||||
- **ON_MESSAGE** - component will receive messages from on_message
|
||||
|
||||
- **ON_UPDATE** - component will be updated from update
|
||||
|
||||
- **ON_INPUT_HIGH** - component will receive input from on_input, before other components with ON_INPUT
|
||||
|
||||
- **ON_INPUT** - component will receive input from on_input, after other components with ON_INPUT_HIGH
|
||||
|
||||
- **ON_LANGUAGE_CHANGE** - will call _on_language_change_ function on language change trigger
|
||||
|
||||
- **ON_MESSAGE_INPUT** - will call _on_message_input_ function on Druid _const.ON_MESSAGE_INPUT_ message
|
||||
|
||||
- **ON_LAYOUT_CHANGE** will call _on_layout_change_ function on layout change trigger
|
||||
|
||||
- **ON_FOCUS_LOST** will call _on_focust_lost_ function in on focus lost event. You need to pass window_callback to global `druid:on_window_callback`
|
||||
|
||||
- **ON_FOCUS_GAINED** will call _on_focust_gained_ function in on focus gained event. You need to pass window_callback to global `druid:on_window_callback`
|
||||
|
||||
- **ON_LATE_INIT** will call _on_late_init_ function once after component init on update step.
|
||||
|
||||
## Best practice on custom components
|
||||
On each component recommended describe component scheme in next way:
|
||||
|
||||
|
@ -270,3 +270,48 @@ Good luck!
|
||||
- **#142** [Scroll] Add Scroll style param `WHEEL_SCROLL_BY_INERTION` (default - false). If true - mouse wheel will add inertion to scroll, if false - set position directly per mouse wheel event.
|
||||
- This fix caused because Mac trackpad seems have additional mouse wheel events for simulate inertion. If you uncomfortable with this, you can disable `WHEEL_SCROLL_BY_INERTION` for more controllable scroll by mouse wheel.
|
||||
- **#132** Add example with grid add/remove with animations
|
||||
|
||||
|
||||
### Druid 0.8.0
|
||||
Hello!
|
||||
|
||||
In this Druid update no any huge special features. Mostly the bug fixes and reworking the component's interest points. If you used interests in your custom components, you should remove it from `component.create` and all should works as before.
|
||||
|
||||
Also added last row allignment in Static Grid component with "dynamic content poses" style enabled. You can look how it is work here: https://insality.github.io/druid/druid/?example=grid_static_grid_dynamic_pos
|
||||
|
||||
|
||||
You can say thanks to me via stars on GitHub 3! :wink:
|
||||
Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues)
|
||||
Have a nice day!
|
||||
|
||||
|
||||
**Changelog 0.8.0**
|
||||
|
||||
---
|
||||
|
||||
- **#160** __[BREAKING]__ Remove component interests list
|
||||
- The component interests now setup via function declaration inside your components. The functions are still the same.
|
||||
- Now `component.create` function have next signature: _create(component_name, input_priority)_
|
||||
- Your should remove interests list from your custom components if exists
|
||||
- From `component.create("custom", { component.ON_INPUT, component.ON_LATE_INIT }, const.PRIORITY_INPUT_HIGH)` to
|
||||
`component.create("custom", const.PRIORITY_INPUT_HIGH)`
|
||||
- **#166** [Input] Fix issue with Cyrillic symbols in range "[А-я]"
|
||||
- **#162** [Static Grid] Add last row alignment with dynamic content poses enabled
|
||||
- Add style param: _static_grid.IS_ALIGN_LAST_ROW_, true by default. Works only if _static_grid.IS_DYNAMIC_NODE_POSES_ enabled. See the "Static grid with dynamic poses" example.
|
||||
- **#163** [Lang Text] Set default locale_id value from text node
|
||||
- **#147** [Lang Text] Remove `...` from lang_text to fixed arguments, add _format_ function to change only string format arguments
|
||||
- There are some issues with `...`. Now Lang Text will support up to 7 _string.format_ arguments
|
||||
- [Lang Text] Add more self chaining to Lang text component (_set_to_, _translate_ and _format_ functions)
|
||||
- **#151** [Text] Fix text adjust by height
|
||||
- It still have not perfect fitting, but it's good enough!
|
||||
- **#164 #150** [Scroll] Fix `scroll:scroll_to_percent` by Y position
|
||||
- **#148** [Scroll] Remove scroll inertion after scroll `animate` or `set_to` functions
|
||||
- [Input] Add current text argument to _on_input_unselect_ event
|
||||
- **#152** [Checkbox] Add _is_instant_ argument to `set_state` function
|
||||
- Add _initial_state_ argument to Checkbox component constructor
|
||||
- Update Checkbox style, add _is_instant_ param
|
||||
- **#149** [Button] Call button style functions after actual callback
|
||||
- **#153** System: Mode Druid acquire input to late_init step
|
||||
- Required to solve issues, when go input acquire can be later, when gui input acquire (on init step)
|
||||
- **#154** System: Change text adjust const to strings
|
||||
- **#155** Fix: Add margin to total width calculation in `helper.centrate_nodes`
|
||||
|
@ -17,7 +17,7 @@ local Event = require("druid.event")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local BackHandler = component.create("back_handler", { component.ON_INPUT })
|
||||
local BackHandler = component.create("back_handler")
|
||||
|
||||
|
||||
--- Component init function
|
||||
|
@ -13,7 +13,7 @@
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Blocker = component.create("blocker", { component.ON_INPUT })
|
||||
local Blocker = component.create("blocker")
|
||||
|
||||
|
||||
--- Component init function
|
||||
|
19
druid/base/button.lua
Normal file → Executable file
19
druid/base/button.lua
Normal file → Executable file
@ -57,11 +57,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Button = component.create("button", {
|
||||
component.ON_INPUT,
|
||||
component.ON_MESSAGE_INPUT,
|
||||
component.ON_LATE_INIT
|
||||
})
|
||||
local Button = component.create("button")
|
||||
|
||||
|
||||
local function is_input_match(self, action_id)
|
||||
@ -88,10 +84,9 @@ end
|
||||
|
||||
|
||||
local function on_button_click(self)
|
||||
self.style.on_click(self, self.anim_node)
|
||||
|
||||
self.click_in_row = 1
|
||||
self.on_click:trigger(self:get_context(), self.params, self)
|
||||
self.style.on_click(self, self.anim_node)
|
||||
end
|
||||
|
||||
|
||||
@ -101,28 +96,24 @@ local function on_button_repeated_click(self)
|
||||
self.is_repeated_started = true
|
||||
end
|
||||
|
||||
self.style.on_click(self, self.anim_node)
|
||||
|
||||
self.click_in_row = self.click_in_row + 1
|
||||
|
||||
self.on_repeated_click:trigger(self:get_context(), self.params, self, self.click_in_row)
|
||||
self.style.on_click(self, self.anim_node)
|
||||
end
|
||||
|
||||
|
||||
local function on_button_long_click(self)
|
||||
self.style.on_click(self, self.anim_node)
|
||||
|
||||
self.click_in_row = 1
|
||||
local time = socket.gettime() - self.last_pressed_time
|
||||
self.on_long_click:trigger(self:get_context(), self.params, self, time)
|
||||
self.style.on_click(self, self.anim_node)
|
||||
end
|
||||
|
||||
|
||||
local function on_button_double_click(self)
|
||||
self.style.on_click(self, self.anim_node)
|
||||
|
||||
self.click_in_row = self.click_in_row + 1
|
||||
self.on_double_click:trigger(self:get_context(), self.params, self, self.click_in_row)
|
||||
self.style.on_click(self, self.anim_node)
|
||||
end
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Drag = component.create("drag", { component.ON_INPUT, component.ON_LATE_INIT }, const.PRIORITY_INPUT_HIGH)
|
||||
local Drag = component.create("drag", const.PRIORITY_INPUT_HIGH)
|
||||
|
||||
|
||||
local function start_touch(self, touch)
|
||||
|
@ -18,7 +18,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Hover = component.create("hover", { component.ON_INPUT, component.ON_LATE_INIT })
|
||||
local Hover = component.create("hover")
|
||||
|
||||
|
||||
--- Component init function
|
||||
|
12
druid/base/scroll.lua
Normal file → Executable file
12
druid/base/scroll.lua
Normal file → Executable file
@ -61,12 +61,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Scroll = component.create("scroll", {
|
||||
component.ON_INPUT,
|
||||
component.ON_UPDATE,
|
||||
component.ON_LAYOUT_CHANGE,
|
||||
component.ON_LATE_INIT
|
||||
})
|
||||
local Scroll = component.create("scroll")
|
||||
|
||||
|
||||
local function inverse_lerp(min, max, current)
|
||||
@ -282,7 +277,7 @@ function Scroll.scroll_to_percent(self, percent, is_instant)
|
||||
|
||||
local pos = vmath.vector3(
|
||||
-helper.lerp(border.x, border.z, 1 - percent.x),
|
||||
-helper.lerp(border.w, border.y, 1 - percent.y),
|
||||
helper.lerp(border.y, border.w, 1 - percent.y),
|
||||
0
|
||||
)
|
||||
|
||||
@ -531,6 +526,9 @@ end
|
||||
|
||||
--- Cancel animation on other animation or input touch
|
||||
function Scroll._cancel_animate(self)
|
||||
self.inertion.x = 0
|
||||
self.inertion.y = 0
|
||||
|
||||
if self.is_animate then
|
||||
self.target_position = gui.get_position(self.content_node)
|
||||
self.position.x = self.target_position.x
|
||||
|
@ -49,7 +49,7 @@ local Event = require("druid.event")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local StaticGrid = component.create("static_grid", { component.ON_LAYOUT_CHANGE })
|
||||
local StaticGrid = component.create("static_grid")
|
||||
|
||||
|
||||
local function _extend_border(border, pos, size, pivot)
|
||||
@ -70,9 +70,11 @@ end
|
||||
-- or create your own style
|
||||
-- @table style
|
||||
-- @tfield[opt=false] bool IS_DYNAMIC_NODE_POSES If true, always center grid content as grid pivot sets
|
||||
-- @tfield[opt=false] bool IS_ALIGN_LAST_ROW If true, always align last row of the grid as grid pivot sets
|
||||
function StaticGrid.on_style_change(self, style)
|
||||
self.style = {}
|
||||
self.style.IS_DYNAMIC_NODE_POSES = style.IS_DYNAMIC_NODE_POSES or false
|
||||
self.style.IS_ALIGN_LAST_ROW = style.IS_ALIGN_LAST_ROW or false
|
||||
end
|
||||
|
||||
|
||||
@ -122,7 +124,9 @@ function StaticGrid.get_pos(self, index)
|
||||
local row = math.ceil(index / self.in_row) - 1
|
||||
local col = (index - row * self.in_row) - 1
|
||||
|
||||
_temp_pos.x = col * self.node_size.x + self._zero_offset.x
|
||||
local zero_offset_x = self:_get_zero_offset_x(row)
|
||||
|
||||
_temp_pos.x = col * self.node_size.x + zero_offset_x
|
||||
_temp_pos.y = -row * self.node_size.y + self._zero_offset.y
|
||||
_temp_pos.z = 0
|
||||
|
||||
@ -437,4 +441,27 @@ function StaticGrid:_get_zero_offset()
|
||||
end
|
||||
|
||||
|
||||
--- Return offset x for last row in grid. Used to align this row accorting to grid's anchor
|
||||
-- @function static:_grid:_get_zero_offset_x
|
||||
-- @treturn number The offset x value
|
||||
-- @local
|
||||
function StaticGrid:_get_zero_offset_x(row_index)
|
||||
if not self.style.IS_DYNAMIC_NODE_POSES or not self.style.IS_ALIGN_LAST_ROW then
|
||||
return self._zero_offset.x
|
||||
end
|
||||
|
||||
local offset_x = self._zero_offset.x
|
||||
local last_row = math.ceil(self.last_index / self.in_row) - 1
|
||||
|
||||
if last_row > 0 and last_row == row_index then
|
||||
local elements_in_row = (self.last_index - (last_row * self.in_row)) - 1
|
||||
local offset = elements_in_row * self.node_size.x * self.anchor.x
|
||||
offset_x = self.node_size.x * self.node_pivot.x - self.node_size.x * self.pivot.x - offset
|
||||
end
|
||||
|
||||
return offset_x
|
||||
end
|
||||
|
||||
|
||||
|
||||
return StaticGrid
|
||||
|
@ -23,7 +23,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Swipe = component.create("swipe", { component.ON_INPUT, component.ON_LATE_INIT })
|
||||
local Swipe = component.create("swipe")
|
||||
|
||||
|
||||
local function start_swipe(self, action)
|
||||
|
3
druid/base/text.lua
Normal file → Executable file
3
druid/base/text.lua
Normal file → Executable file
@ -50,7 +50,7 @@ local const = require("druid.const")
|
||||
local utf8 = require("druid.system.utf8")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Text = component.create("text", { component.ON_LAYOUT_CHANGE, component.ON_MESSAGE_INPUT })
|
||||
local Text = component.create("text")
|
||||
|
||||
|
||||
local function update_text_size(self)
|
||||
@ -86,6 +86,7 @@ local function update_text_area_size(self)
|
||||
local max_text_area_square = max_width * max_height
|
||||
local cur_text_area_square = metrics.height * metrics.width * self.start_scale.x
|
||||
scale_modifier = self.start_scale.x * math.sqrt(max_text_area_square / cur_text_area_square)
|
||||
scale_modifier = math.min(scale_modifier, self.start_scale.x)
|
||||
end
|
||||
|
||||
if self._minimal_scale then
|
||||
|
@ -14,7 +14,6 @@ local BaseComponent = class("druid.component")
|
||||
|
||||
|
||||
--- Component Interests
|
||||
BaseComponent.ALL = const.ALL
|
||||
BaseComponent.ON_INPUT = const.ON_INPUT
|
||||
BaseComponent.ON_UPDATE = const.ON_UPDATE
|
||||
BaseComponent.ON_MESSAGE = const.ON_MESSAGE
|
||||
@ -27,7 +26,6 @@ BaseComponent.ON_LANGUAGE_CHANGE = const.ON_LANGUAGE_CHANGE
|
||||
|
||||
|
||||
BaseComponent.ALL_INTERESTS = {
|
||||
BaseComponent.ALL,
|
||||
BaseComponent.ON_INPUT,
|
||||
BaseComponent.ON_UPDATE,
|
||||
BaseComponent.ON_MESSAGE,
|
||||
@ -40,18 +38,13 @@ BaseComponent.ALL_INTERESTS = {
|
||||
}
|
||||
|
||||
|
||||
-- Value is method name of component
|
||||
-- Mapping from on_message method to specific method name
|
||||
BaseComponent.SPECIFIC_UI_MESSAGES = {
|
||||
[BaseComponent.ON_FOCUS_LOST] = "on_focus_lost",
|
||||
[BaseComponent.ON_FOCUS_GAINED] = "on_focus_gained",
|
||||
[BaseComponent.ON_LAYOUT_CHANGE] = "on_layout_change",
|
||||
[BaseComponent.ON_MESSAGE_INPUT] = "on_message_input",
|
||||
[BaseComponent.ON_LANGUAGE_CHANGE] = "on_language_change",
|
||||
}
|
||||
|
||||
|
||||
BaseComponent.UI_INPUT = {
|
||||
[BaseComponent.ON_INPUT] = true
|
||||
[hash(BaseComponent.ON_FOCUS_LOST)] = "on_focus_lost",
|
||||
[hash(BaseComponent.ON_FOCUS_GAINED)] = "on_focus_gained",
|
||||
[hash(BaseComponent.ON_LAYOUT_CHANGE)] = "on_layout_change",
|
||||
[hash(BaseComponent.ON_MESSAGE_INPUT)] = "on_message_input",
|
||||
[hash(BaseComponent.ON_LANGUAGE_CHANGE)] = "on_language_change",
|
||||
}
|
||||
|
||||
|
||||
@ -267,15 +260,11 @@ end
|
||||
-- by `BaseComponent.static.create`
|
||||
-- @tparam BaseComponent self
|
||||
-- @tparam string name BaseComponent name
|
||||
-- @tparam[opt={}] table interest List of component's interest
|
||||
-- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first
|
||||
-- @local
|
||||
function BaseComponent.initialize(self, name, interest, input_priority)
|
||||
interest = interest or {}
|
||||
|
||||
function BaseComponent.initialize(self, name, input_priority)
|
||||
self._component = {
|
||||
name = name,
|
||||
interest = interest,
|
||||
input_priority = input_priority or const.PRIORITY_INPUT,
|
||||
default_input_priority = input_priority or const.PRIORITY_INPUT,
|
||||
_is_input_priority_changed = true, -- Default true for sort once time after GUI init
|
||||
@ -319,7 +308,15 @@ end
|
||||
-- @treturn table List of component interests
|
||||
-- @local
|
||||
function BaseComponent.__get_interests(self)
|
||||
return self._component.interest
|
||||
local interests = {}
|
||||
for index = 1, #BaseComponent.ALL_INTERESTS do
|
||||
local interest = BaseComponent.ALL_INTERESTS[index]
|
||||
if self[interest] and type(self[interest]) == "function" then
|
||||
table.insert(interests, interest)
|
||||
end
|
||||
end
|
||||
|
||||
return interests
|
||||
end
|
||||
|
||||
|
||||
@ -386,15 +383,14 @@ end
|
||||
--- Create new component. It will inheritance from basic
|
||||
-- druid component.
|
||||
-- @tparam string name BaseComponent name
|
||||
-- @tparam[opt={}] table interest List of component's interest
|
||||
-- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first
|
||||
-- @local
|
||||
function BaseComponent.static.create(name, interest, input_priority)
|
||||
function BaseComponent.static.create(name, input_priority)
|
||||
-- Yea, inheritance here
|
||||
local new_class = class(name, BaseComponent)
|
||||
|
||||
new_class.initialize = function(self)
|
||||
BaseComponent.initialize(self, name, interest, input_priority)
|
||||
BaseComponent.initialize(self, name, input_priority)
|
||||
end
|
||||
|
||||
return new_class
|
||||
|
31
druid/const.lua
Normal file → Executable file
31
druid/const.lua
Normal file → Executable file
@ -32,16 +32,15 @@ M.ZERO = "0"
|
||||
|
||||
|
||||
--- Component Interests
|
||||
M.ALL = "all"
|
||||
M.ON_INPUT = hash("on_input")
|
||||
M.ON_UPDATE = hash("on_update")
|
||||
M.ON_MESSAGE = hash("on_message")
|
||||
M.ON_LATE_INIT = hash("on_late_init")
|
||||
M.ON_FOCUS_LOST = hash("on_focus_lost")
|
||||
M.ON_FOCUS_GAINED = hash("on_focus_gained")
|
||||
M.ON_LAYOUT_CHANGE = hash("layout_changed")
|
||||
M.ON_MESSAGE_INPUT = hash("on_message_input")
|
||||
M.ON_LANGUAGE_CHANGE = hash("on_language_change")
|
||||
M.ON_INPUT = "on_input"
|
||||
M.ON_UPDATE = "update"
|
||||
M.ON_MESSAGE = "on_message"
|
||||
M.ON_LATE_INIT = "on_late_init"
|
||||
M.ON_FOCUS_LOST = "on_focus_lost"
|
||||
M.ON_FOCUS_GAINED = "on_focus_gained"
|
||||
M.ON_LAYOUT_CHANGE = "on_layout_changed"
|
||||
M.ON_MESSAGE_INPUT = "on_message_input"
|
||||
M.ON_LANGUAGE_CHANGE = "on_language_change"
|
||||
|
||||
|
||||
M.PRIORITY_INPUT = 10
|
||||
@ -108,12 +107,12 @@ M.SHIFT = {
|
||||
|
||||
|
||||
M.TEXT_ADJUST = {
|
||||
DOWNSCALE = 0,
|
||||
TRIM = 1,
|
||||
NO_ADJUST = 2,
|
||||
DOWNSCALE_LIMITED = 3,
|
||||
SCROLL = 4,
|
||||
SCALE_THEN_SCROLL = 5,
|
||||
DOWNSCALE = "downscale",
|
||||
TRIM = "trim",
|
||||
NO_ADJUST = "no_adjust",
|
||||
DOWNSCALE_LIMITED = "downscale_limited",
|
||||
SCROLL = "scroll",
|
||||
SCALE_THEN_SCROLL = "scale_then_scroll",
|
||||
}
|
||||
|
||||
|
||||
|
14
druid/extended/checkbox.lua
Normal file → Executable file
14
druid/extended/checkbox.lua
Normal file → Executable file
@ -22,7 +22,7 @@
|
||||
local Event = require("druid.event")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Checkbox = component.create("checkbox", { component.ON_LAYOUT_CHANGE })
|
||||
local Checkbox = component.create("checkbox")
|
||||
|
||||
|
||||
local function on_click(self)
|
||||
@ -49,13 +49,14 @@ end
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function callback Checkbox callback
|
||||
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
|
||||
function Checkbox.init(self, node, callback, click_node)
|
||||
-- @tparam[opt=false] boolean initial_state The initial state of checkbox, default - false
|
||||
function Checkbox.init(self, node, callback, click_node, initial_state)
|
||||
self.druid = self:get_druid()
|
||||
self.node = self:get_node(node)
|
||||
self.click_node = self:get_node(click_node)
|
||||
|
||||
self.button = self.druid:new_button(self.click_node or self.node, on_click)
|
||||
self:set_state(false, true)
|
||||
self:set_state(initial_state, true, true)
|
||||
|
||||
self.on_change_state = Event(callback)
|
||||
end
|
||||
@ -70,13 +71,16 @@ end
|
||||
-- @tparam Checkbox self
|
||||
-- @tparam bool state Checkbox state
|
||||
-- @tparam bool is_silent Don't trigger on_change_state if true
|
||||
function Checkbox.set_state(self, state, is_silent)
|
||||
-- @tparam bool 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)
|
||||
self.style.on_change_state(self, self.node, state, is_instant)
|
||||
|
||||
if not is_silent then
|
||||
self.on_change_state:trigger(self:get_context(), state)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
@ -44,10 +44,11 @@ end
|
||||
--- Set checkbox group state
|
||||
-- @tparam CheckboxGroup self
|
||||
-- @tparam bool[] indexes Array of checkbox state
|
||||
function CheckboxGroup.set_state(self, indexes)
|
||||
-- @tparam boolean is_instant If instant state change
|
||||
function CheckboxGroup.set_state(self, indexes, is_instant)
|
||||
for i = 1, #indexes do
|
||||
if self.checkboxes[i] then
|
||||
self.checkboxes[i]:set_state(indexes[i], true)
|
||||
self.checkboxes[i]:set_state(indexes[i], true, is_instant)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -5,7 +5,7 @@
|
||||
-- @local
|
||||
local component = require("druid.component")
|
||||
|
||||
local Component = component.create("my_component_name", { component.ON_UPDATE })
|
||||
local Component = component.create("my_component_name")
|
||||
|
||||
|
||||
-- Component constructor
|
||||
@ -13,54 +13,54 @@ function Component:init(...)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if exist interest: component.ON_UPDATE
|
||||
-- [OPTIONAL] Call every update step
|
||||
function Component:update(dt)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if exist interest: component.ON_INPUT
|
||||
-- [OPTIONAL] Call default on_input from gui script
|
||||
function Component:on_input(action_id, action)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- Call on component creation and on component:set_style() function
|
||||
-- [OPTIONAL] Call on component creation and on component:set_style() function
|
||||
function Component:on_style_change(style)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if exist interest: component.ON_MESSAGE
|
||||
-- [OPTIONAL] Call default on_message from gui script
|
||||
function Component:on_message(message_id, message, sender)
|
||||
end
|
||||
|
||||
|
||||
-- Call only if component with ON_LANGUAGE_CHANGE interest
|
||||
-- [OPTIONAL] Call if druid has triggered on_language_change
|
||||
function Component:on_language_change()
|
||||
end
|
||||
|
||||
|
||||
-- Call only if component with ON_LAYOUT_CHANGE interest
|
||||
-- [OPTIONAL] Call if game layout has changed and need to restore values in component
|
||||
function Component:on_layout_change()
|
||||
end
|
||||
|
||||
|
||||
-- Call, if input was capturing before this component
|
||||
-- [OPTIONAL] Call, if input was capturing before this component
|
||||
-- Example: scroll is start scrolling, so you need unhover button
|
||||
function Component:on_input_interrupt()
|
||||
end
|
||||
|
||||
|
||||
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
|
||||
-- [OPTIONAL] Call, if game lost focus
|
||||
function Component:on_focus_lost()
|
||||
end
|
||||
|
||||
|
||||
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
|
||||
-- [OPTIONAL] Call, if game gained focus
|
||||
function Component:on_focus_gained()
|
||||
end
|
||||
|
||||
|
||||
-- Call on component remove or on druid:final
|
||||
-- [OPTIONAL] Call on component remove or on druid:final
|
||||
function Component:on_remove()
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,7 @@ local Event = require("druid.event")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local DynamicGrid = component.create("dynamic_grid", { component.ON_LAYOUT_CHANGE })
|
||||
local DynamicGrid = component.create("dynamic_grid")
|
||||
|
||||
|
||||
local SIDE_VECTORS = {
|
||||
|
10
druid/extended/input.lua
Normal file → Executable file
10
druid/extended/input.lua
Normal file → Executable file
@ -10,7 +10,7 @@
|
||||
--- On input field select callback(self, button_node)
|
||||
-- @tfield druid_event on_input_select
|
||||
|
||||
--- On input field unselect callback(self, button_node)
|
||||
--- On input field unselect callback(self, input_text)
|
||||
-- @tfield druid_event on_input_unselect
|
||||
|
||||
--- On input field text change callback(self, input_text)
|
||||
@ -53,7 +53,7 @@ local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
local utf8 = require("druid.system.utf8")
|
||||
|
||||
local Input = component.create("input", { component.ON_INPUT, component.ON_FOCUS_LOST })
|
||||
local Input = component.create("input")
|
||||
|
||||
|
||||
--- Mask text by replacing every character with a mask character
|
||||
@ -166,8 +166,8 @@ function Input.on_input(self, action_id, action)
|
||||
end)
|
||||
|
||||
-- ignore arrow keys
|
||||
if not string.match(hex, "EF9C8[0-3]") then
|
||||
if not self.allowed_characters or action.text:match(self.allowed_characters) then
|
||||
if not utf8.match(hex, "EF9C8[0-3]") then
|
||||
if not self.allowed_characters or utf8.match(action.text, self.allowed_characters) then
|
||||
input_text = self.value .. action.text
|
||||
if self.max_length then
|
||||
input_text = utf8.sub(input_text, 1, self.max_length)
|
||||
@ -307,7 +307,7 @@ function Input.unselect(self)
|
||||
self.is_selected = false
|
||||
|
||||
gui.hide_keyboard()
|
||||
self.on_input_unselect:trigger(self:get_context())
|
||||
self.on_input_unselect:trigger(self:get_context(), self:get_text())
|
||||
|
||||
self.style.on_unselect(self, self.button.node)
|
||||
end
|
||||
|
33
druid/extended/lang_text.lua
Normal file → Executable file
33
druid/extended/lang_text.lua
Normal file → Executable file
@ -18,24 +18,23 @@ local Event = require("druid.event")
|
||||
local settings = require("druid.system.settings")
|
||||
local component = require("druid.component")
|
||||
|
||||
local LangText = component.create("lang_text", { component.ON_LANGUAGE_CHANGE })
|
||||
local LangText = component.create("lang_text")
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @tparam LangText self
|
||||
-- @tparam node node The text node
|
||||
-- @tparam string locale_id Default locale id, optional
|
||||
-- @tparam string locale_id Default locale id or text from node as default
|
||||
-- @tparam bool no_adjust If true, will not correct text size
|
||||
function LangText.init(self, node, locale_id, no_adjust)
|
||||
self.druid = self:get_druid()
|
||||
self.text = self.druid:new_text(node, locale_id, no_adjust)
|
||||
self.node = self.text.node
|
||||
self.last_locale_args = {}
|
||||
|
||||
self.on_change = Event()
|
||||
|
||||
if locale_id then
|
||||
self:translate(locale_id)
|
||||
end
|
||||
self:translate(locale_id or gui.get_text(self.node))
|
||||
|
||||
return self
|
||||
end
|
||||
@ -51,21 +50,39 @@ end
|
||||
--- Setup raw text to lang_text component
|
||||
-- @tparam LangText self
|
||||
-- @tparam string text Text for text node
|
||||
-- @treturn LangText Current instance
|
||||
function LangText.set_to(self, text)
|
||||
self.last_locale = false
|
||||
self.text:set_to(text)
|
||||
self.on_change:trigger()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Translate the text by locale_id
|
||||
-- @tparam LangText self
|
||||
-- @tparam string locale_id Locale id
|
||||
function LangText.translate(self, locale_id, ...)
|
||||
self.last_locale_args = {...}
|
||||
-- @tparam string ... Locale arguments to pass in text function
|
||||
-- @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 }
|
||||
self.last_locale = locale_id or self.last_locale
|
||||
self.text:set_to(settings.get_text(self.last_locale, ...) or "")
|
||||
self.text:set_to(settings.get_text(self.last_locale, a, b, c, d, e, f, g) or "")
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Format string with new text params on localized text
|
||||
-- @tparam LangText self
|
||||
-- @tparam string ... Locale arguments to pass in text function
|
||||
-- @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 }
|
||||
self.text:set_to(settings.get_text(self.last_locale, a, b, c, d, e, f, g) or "")
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
return LangText
|
||||
|
@ -34,7 +34,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Progress = component.create("progress", { component.ON_UPDATE, component.ON_LAYOUT_CHANGE })
|
||||
local Progress = component.create("progress")
|
||||
|
||||
|
||||
local function check_steps(self, from, to, exactly)
|
||||
|
@ -19,9 +19,9 @@ local component = require("druid.component")
|
||||
local RadioGroup = component.create("radio_group")
|
||||
|
||||
|
||||
local function on_checkbox_click(self, index)
|
||||
local function on_checkbox_click(self, index, is_instant)
|
||||
for i = 1, #self.checkboxes do
|
||||
self.checkboxes[i]:set_state(i == index, true)
|
||||
self.checkboxes[i]:set_state(i == index, true, is_instant)
|
||||
end
|
||||
|
||||
self.on_radio_click:trigger(self:get_context(), index)
|
||||
@ -53,8 +53,9 @@ end
|
||||
--- Set radio group state
|
||||
-- @tparam RadioGroup self
|
||||
-- @tparam number index Index in radio group
|
||||
function RadioGroup.set_state(self, index)
|
||||
on_checkbox_click(self, index)
|
||||
-- @tparam boolean is_instant If is instant state change
|
||||
function RadioGroup.set_state(self, index, is_instant)
|
||||
on_checkbox_click(self, index, is_instant)
|
||||
end
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ local helper = require("druid.helper")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Slider = component.create("slider", { component.ON_INPUT, component.ON_LAYOUT_CHANGE }, const.PRIORITY_INPUT_HIGH)
|
||||
local Slider = component.create("slider", const.PRIORITY_INPUT_HIGH)
|
||||
|
||||
|
||||
local function on_change_value(self)
|
||||
|
@ -35,7 +35,7 @@ local formats = require("druid.helper.formats")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Timer = component.create("timer", { component.ON_UPDATE })
|
||||
local Timer = component.create("timer")
|
||||
|
||||
|
||||
--- Component init function
|
||||
|
@ -76,6 +76,7 @@ function M.centrate_nodes(margin, ...)
|
||||
node_widths[i] = get_width(node)
|
||||
width = width + node_widths[i]
|
||||
end
|
||||
width = width + margin * (count - 1)
|
||||
|
||||
-- Posing all elements
|
||||
local pos_x = 0
|
||||
|
@ -61,6 +61,7 @@ M["drag"] = {
|
||||
|
||||
M["static_grid"] = {
|
||||
IS_DYNAMIC_NODE_POSES = false, -- Always align by content size with node anchor
|
||||
IS_ALIGN_LAST_ROW = true, -- Align the last row of grid
|
||||
}
|
||||
|
||||
|
||||
@ -87,9 +88,15 @@ M["progress"] = {
|
||||
|
||||
|
||||
M["checkbox"] = {
|
||||
on_change_state = function(self, node, state)
|
||||
on_change_state = function(self, node, state, is_instant)
|
||||
local target = state and 1 or 0
|
||||
if not is_instant then
|
||||
gui.animate(node, "color.w", target, gui.EASING_OUTSINE, 0.1)
|
||||
else
|
||||
local color = gui.get_color(node)
|
||||
color.w = target
|
||||
gui.set_color(node, color)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
|
58
druid/system/druid_instance.lua
Normal file → Executable file
58
druid/system/druid_instance.lua
Normal file → Executable file
@ -63,7 +63,7 @@ local DruidInstance = class("druid.druid_instance")
|
||||
|
||||
|
||||
local function input_init(self)
|
||||
if sys.get_config("druid.no_auto_input") == "1" then
|
||||
if self._no_auto_input then
|
||||
return
|
||||
end
|
||||
|
||||
@ -75,7 +75,7 @@ end
|
||||
|
||||
|
||||
local function input_release(self)
|
||||
if sys.get_config("druid.no_auto_input") == "1" then
|
||||
if self._no_auto_input then
|
||||
return
|
||||
end
|
||||
|
||||
@ -87,7 +87,7 @@ end
|
||||
|
||||
|
||||
local function sort_input_stack(self)
|
||||
local input_components = self.components[base_component.ON_INPUT]
|
||||
local input_components = self.components_interest[base_component.ON_INPUT]
|
||||
if not input_components then
|
||||
return
|
||||
end
|
||||
@ -107,16 +107,12 @@ local function create(self, instance_class)
|
||||
local instance = instance_class()
|
||||
instance:setup_component(self, self._context, self._style)
|
||||
|
||||
table.insert(self.components[base_component.ALL], instance)
|
||||
table.insert(self.components_all, instance)
|
||||
|
||||
local register_to = instance:__get_interests()
|
||||
for i = 1, #register_to do
|
||||
local interest = register_to[i]
|
||||
table.insert(self.components[interest], instance)
|
||||
|
||||
if base_component.UI_INPUT[interest] then
|
||||
input_init(self)
|
||||
end
|
||||
table.insert(self.components_interest[interest], instance)
|
||||
end
|
||||
|
||||
return instance
|
||||
@ -209,10 +205,12 @@ function DruidInstance.initialize(self, context, style)
|
||||
|
||||
self._input_blacklist = nil
|
||||
self._input_whitelist = nil
|
||||
self._no_auto_input = (sys.get_config("druid.no_auto_input") == "1")
|
||||
|
||||
self.components = {}
|
||||
self.components_interest = {}
|
||||
self.components_all = {}
|
||||
for i = 1, #base_component.ALL_INTERESTS do
|
||||
self.components[base_component.ALL_INTERESTS[i]] = {}
|
||||
self.components_interest[base_component.ALL_INTERESTS[i]] = {}
|
||||
end
|
||||
end
|
||||
|
||||
@ -248,7 +246,7 @@ end
|
||||
-- on all druid components
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.final(self)
|
||||
local components = self.components[base_component.ALL]
|
||||
local components = self.components_all
|
||||
|
||||
for i = #components, 1, -1 do
|
||||
if components[i].on_remove then
|
||||
@ -283,7 +281,7 @@ function DruidInstance.remove(self, component)
|
||||
end
|
||||
component._meta.children = {}
|
||||
|
||||
local all_components = self.components[base_component.ALL]
|
||||
local all_components = self.components_all
|
||||
for i = #all_components, 1, -1 do
|
||||
if all_components[i] == component then
|
||||
if component.on_remove then
|
||||
@ -296,7 +294,7 @@ function DruidInstance.remove(self, component)
|
||||
local interests = component:__get_interests()
|
||||
for i = 1, #interests do
|
||||
local interest = interests[i]
|
||||
local components = self.components[interest]
|
||||
local components = self.components_interest[interest]
|
||||
for j = #components, 1, -1 do
|
||||
if components[j] == component then
|
||||
table.remove(components, j)
|
||||
@ -310,13 +308,18 @@ end
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam number dt Delta time
|
||||
function DruidInstance.update(self, dt)
|
||||
local late_init_components = self.components[base_component.ON_LATE_INIT]
|
||||
local late_init_components = self.components_interest[base_component.ON_LATE_INIT]
|
||||
while late_init_components[1] do
|
||||
late_init_components[1]:on_late_init()
|
||||
table.remove(late_init_components, 1)
|
||||
end
|
||||
|
||||
local components = self.components[base_component.ON_UPDATE]
|
||||
if not self.input_inited and #self.components_interest[base_component.ON_INPUT] > 0 then
|
||||
-- Input init on late init step, to be sure it goes after user go acquire input
|
||||
input_init(self)
|
||||
end
|
||||
|
||||
local components = self.components_interest[base_component.ON_UPDATE]
|
||||
for i = 1, #components do
|
||||
components[i]:update(dt)
|
||||
end
|
||||
@ -331,7 +334,7 @@ end
|
||||
function DruidInstance.on_input(self, action_id, action)
|
||||
self._is_input_processing = true
|
||||
|
||||
local components = self.components[base_component.ON_INPUT]
|
||||
local components = self.components_interest[base_component.ON_INPUT]
|
||||
check_sort_input_stack(self, components)
|
||||
local is_input_consumed = process_input(self, action_id, action, components)
|
||||
|
||||
@ -356,10 +359,10 @@ end
|
||||
function DruidInstance.on_message(self, message_id, message, sender)
|
||||
-- TODO: refactor for more juicy code
|
||||
local specific_ui_message = base_component.SPECIFIC_UI_MESSAGES[message_id]
|
||||
local on_message_input_message = base_component.SPECIFIC_UI_MESSAGES[base_component.ON_MESSAGE_INPUT]
|
||||
local on_message_input_message = base_component.ON_MESSAGE_INPUT
|
||||
|
||||
if specific_ui_message == on_message_input_message then
|
||||
local components = self.components[message_id]
|
||||
local components = self.components_interest[base_component.ON_MESSAGE_INPUT]
|
||||
if components then
|
||||
for i = 1, #components do
|
||||
local component = components[i]
|
||||
@ -369,7 +372,7 @@ function DruidInstance.on_message(self, message_id, message, sender)
|
||||
end
|
||||
end
|
||||
elseif specific_ui_message then
|
||||
local components = self.components[message_id]
|
||||
local components = self.components_interest[specific_ui_message]
|
||||
if components then
|
||||
for i = 1, #components do
|
||||
local component = components[i]
|
||||
@ -377,7 +380,7 @@ function DruidInstance.on_message(self, message_id, message, sender)
|
||||
end
|
||||
end
|
||||
else
|
||||
local components = self.components[base_component.ON_MESSAGE]
|
||||
local components = self.components_interest[base_component.ON_MESSAGE]
|
||||
for i = 1, #components do
|
||||
components[i]:on_message(message_id, message, sender)
|
||||
end
|
||||
@ -389,7 +392,7 @@ end
|
||||
-- This one called by on_window_callback by global window listener
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.on_focus_lost(self)
|
||||
local components = self.components[base_component.ON_FOCUS_LOST]
|
||||
local components = self.components_interest[base_component.ON_FOCUS_LOST]
|
||||
for i = 1, #components do
|
||||
components[i]:on_focus_lost()
|
||||
end
|
||||
@ -400,7 +403,7 @@ end
|
||||
-- This one called by on_window_callback by global window listener
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.on_focus_gained(self)
|
||||
local components = self.components[base_component.ON_FOCUS_GAINED]
|
||||
local components = self.components_interest[base_component.ON_FOCUS_GAINED]
|
||||
for i = 1, #components do
|
||||
components[i]:on_focus_gained()
|
||||
end
|
||||
@ -411,7 +414,7 @@ end
|
||||
-- Called on update gui layout
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.on_layout_change(self)
|
||||
local components = self.components[base_component.ON_LAYOUT_CHANGE]
|
||||
local components = self.components_interest[base_component.ON_LAYOUT_CHANGE]
|
||||
for i = 1, #components do
|
||||
components[i]:on_layout_change()
|
||||
end
|
||||
@ -424,7 +427,7 @@ end
|
||||
-- @tparam DruidInstance self
|
||||
-- @function druid.on_language_change
|
||||
function DruidInstance.on_language_change(self)
|
||||
local components = self.components[base_component.ON_LANGUAGE_CHANGE]
|
||||
local components = self.components_interest[base_component.ON_LANGUAGE_CHANGE]
|
||||
for i = 1, #components do
|
||||
components[i]:on_language_change()
|
||||
end
|
||||
@ -622,10 +625,11 @@ end
|
||||
-- @tparam node node Gui node
|
||||
-- @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
|
||||
-- @treturn Checkbox checkbox component
|
||||
function DruidInstance.new_checkbox(self, node, callback, click_node)
|
||||
function DruidInstance.new_checkbox(self, node, callback, click_node, initial_state)
|
||||
-- return helper.extended_component("checkbox")
|
||||
return DruidInstance.new(self, checkbox, node, callback, click_node)
|
||||
return DruidInstance.new(self, checkbox, node, callback, click_node, initial_state)
|
||||
end
|
||||
|
||||
|
||||
|
2
druid/system/settings.lua
Normal file → Executable file
2
druid/system/settings.lua
Normal file → Executable file
@ -9,7 +9,7 @@ local M = {}
|
||||
M.default_style = nil
|
||||
|
||||
|
||||
function M.get_text(name, ...)
|
||||
function M.get_text(name, a, b, c, d, e, f)
|
||||
return "[Druid]: locales not inited"
|
||||
end
|
||||
|
||||
|
@ -210,7 +210,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Button:"
|
||||
text: "ui_section_button"
|
||||
font: "game"
|
||||
id: "text_button"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -604,7 +604,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Text:"
|
||||
text: "ui_section_text"
|
||||
font: "game"
|
||||
id: "text_text"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -848,7 +848,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Timer:"
|
||||
text: "ui_section_timer"
|
||||
font: "game"
|
||||
id: "text_timer"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -1029,7 +1029,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Progress bar:"
|
||||
text: "ui_section_progress"
|
||||
font: "game"
|
||||
id: "text_progress"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -1320,7 +1320,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Slider:"
|
||||
text: "ui_section_slider"
|
||||
font: "game"
|
||||
id: "text_slider"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -1611,7 +1611,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Radio:"
|
||||
text: "ui_section_radio"
|
||||
font: "game"
|
||||
id: "text_radio"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -2234,7 +2234,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Checkbox:"
|
||||
text: "ui_section_checkbox"
|
||||
font: "game"
|
||||
id: "text_checkbox"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -2857,7 +2857,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Input:"
|
||||
text: "ui_section_input"
|
||||
font: "game"
|
||||
id: "text_input"
|
||||
xanchor: XANCHOR_NONE
|
||||
|
@ -25,14 +25,14 @@ end
|
||||
|
||||
|
||||
local function setup_texts(self)
|
||||
self.druid:new_lang_text("text_button", "ui_section_button")
|
||||
self.druid:new_lang_text("text_text", "ui_section_text")
|
||||
self.druid:new_lang_text("text_timer", "ui_section_timer")
|
||||
self.druid:new_lang_text("text_progress", "ui_section_progress")
|
||||
self.druid:new_lang_text("text_slider", "ui_section_slider")
|
||||
self.druid:new_lang_text("text_radio", "ui_section_radio")
|
||||
self.druid:new_lang_text("text_checkbox", "ui_section_checkbox")
|
||||
self.druid:new_lang_text("text_input", "ui_section_input")
|
||||
self.druid:new_lang_text("text_button")
|
||||
self.druid:new_lang_text("text_text")
|
||||
self.druid:new_lang_text("text_timer")
|
||||
self.druid:new_lang_text("text_progress")
|
||||
self.druid:new_lang_text("text_slider")
|
||||
self.druid:new_lang_text("text_radio")
|
||||
self.druid:new_lang_text("text_checkbox")
|
||||
self.druid:new_lang_text("text_input")
|
||||
|
||||
self.druid:new_lang_text("text_translated", "ui_text_example")
|
||||
self.druid:new_lang_text("text_button_lang", "ui_text_change_lang")
|
||||
@ -69,8 +69,8 @@ local function setup_checkbox(self)
|
||||
nil,
|
||||
{"checkbox1/back", "checkbox2/back", "checkbox3/back"})
|
||||
|
||||
radio_group:set_state(2)
|
||||
checkbox_group:set_state({true, false, true})
|
||||
radio_group:set_state(2, true)
|
||||
checkbox_group:set_state({true, false, true}, true)
|
||||
end
|
||||
|
||||
|
||||
|
@ -39,6 +39,10 @@ function init(self)
|
||||
grid_e,
|
||||
}
|
||||
|
||||
for i = 1, #grids do
|
||||
grids[i].style.IS_DYNAMIC_NODE_POSES = false
|
||||
end
|
||||
|
||||
|
||||
local animate_grides = function()
|
||||
for _, grid in ipairs(grids) do
|
||||
|
@ -10,7 +10,7 @@ height = 900
|
||||
|
||||
[project]
|
||||
title = druid
|
||||
version = 0.7.0
|
||||
version = 0.8.0
|
||||
publisher = Insality
|
||||
developer = Insality
|
||||
dependencies#0 = https://github.com/insalitygames/deftest/archive/master.zip
|
||||
|
Loading…
x
Reference in New Issue
Block a user