mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Merge branch 'develop' into 43-infinity-scroll
# Conflicts: # druid/base/grid.lua # druid/const.lua # druid/system/druid_instance.lua
This commit is contained in:
@@ -1,51 +1,62 @@
|
||||
--- Druid main class. Create instance of this
|
||||
-- to start creating components
|
||||
-- @module druid_instance
|
||||
-- @see druid.button
|
||||
-- @see druid.blocker
|
||||
-- @see druid.back_handler
|
||||
-- @see druid.input
|
||||
-- @see druid.text
|
||||
-- @see druid.lang_text
|
||||
-- @see druid.timer
|
||||
-- @see druid.progress
|
||||
-- @see druid.grid
|
||||
-- @see druid.scroll
|
||||
-- @see druid.slider
|
||||
-- @see druid.checkbox
|
||||
-- @see druid.checkbox_group
|
||||
-- @see druid.radio_group
|
||||
-- @see druid.swipe
|
||||
-- @see druid.drag
|
||||
-- @see druid.infinity_list
|
||||
--- Instance of Druid. Make one instance per gui_script with next code:
|
||||
--
|
||||
-- local druid = require("druid.druid")
|
||||
-- function init(self)
|
||||
-- self.druid = druid.new(self)
|
||||
-- local button = self.druid:new_button(...)
|
||||
-- end
|
||||
--
|
||||
-- Learn Druid instance function here
|
||||
-- @module DruidInstance
|
||||
-- @alias druid_instance
|
||||
-- @see Button
|
||||
-- @see Blocker
|
||||
-- @see BackHandler
|
||||
-- @see Input
|
||||
-- @see Text
|
||||
-- @see LangText
|
||||
-- @see Timer
|
||||
-- @see Progress
|
||||
-- @see StaticGrid
|
||||
-- @see DynamicGrid
|
||||
-- @see Scroll
|
||||
-- @see Slider
|
||||
-- @see Checkbox
|
||||
-- @see CheckboxGroup
|
||||
-- @see RadioGroup
|
||||
-- @see Swipe
|
||||
-- @see Drag
|
||||
-- @see Hover
|
||||
|
||||
local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local druid_input = require("druid.helper.druid_input")
|
||||
local settings = require("druid.system.settings")
|
||||
local class = require("druid.system.middleclass")
|
||||
|
||||
local button = require("druid.base.button")
|
||||
local blocker = require("druid.base.blocker")
|
||||
local back_handler = require("druid.base.back_handler")
|
||||
local hover = require("druid.base.hover")
|
||||
local text = require("druid.base.text")
|
||||
local lang_text = require("druid.base.lang_text")
|
||||
local timer = require("druid.base.timer")
|
||||
local progress = require("druid.base.progress")
|
||||
local grid = require("druid.base.grid")
|
||||
local scroll = require("druid.base.scroll")
|
||||
local slider = require("druid.base.slider")
|
||||
local checkbox = require("druid.base.checkbox")
|
||||
local checkbox_group = require("druid.base.checkbox_group")
|
||||
local radio_group = require("druid.base.radio_group")
|
||||
local input = require("druid.base.input")
|
||||
local swipe = require("druid.base.swipe")
|
||||
local blocker = require("druid.base.blocker")
|
||||
local button = require("druid.base.button")
|
||||
local drag = require("druid.base.drag")
|
||||
local infinity_list = require("druid.base.infinity_list")
|
||||
-- local infinity_scroll = require("druid.base.infinity_scroll")
|
||||
local hover = require("druid.base.hover")
|
||||
local scroll = require("druid.base.scroll")
|
||||
local static_grid = require("druid.base.static_grid")
|
||||
local swipe = require("druid.base.swipe")
|
||||
local text = require("druid.base.text")
|
||||
|
||||
-- @classmod Druid
|
||||
local Druid = class("druid.druid_instance")
|
||||
local checkbox = require("druid.extended.checkbox")
|
||||
local checkbox_group = require("druid.extended.checkbox_group")
|
||||
local dynamic_grid = require("druid.extended.dynamic_grid")
|
||||
local input = require("druid.extended.input")
|
||||
local lang_text = require("druid.extended.lang_text")
|
||||
local progress = require("druid.extended.progress")
|
||||
local radio_group = require("druid.extended.radio_group")
|
||||
local slider = require("druid.extended.slider")
|
||||
local timer = require("druid.extended.timer")
|
||||
local infinity_list = require("druid.extended.infinity_list")
|
||||
|
||||
|
||||
local DruidInstance = class("druid.druid_instance")
|
||||
|
||||
|
||||
local function input_init(self)
|
||||
@@ -79,7 +90,7 @@ local function create(self, instance_class)
|
||||
|
||||
table.insert(self.components[const.ALL], instance)
|
||||
|
||||
local register_to = instance:get_interests()
|
||||
local register_to = instance:__get_interests()
|
||||
for i = 1, #register_to do
|
||||
local interest = register_to[i]
|
||||
table.insert(self.components[interest], instance)
|
||||
@@ -101,7 +112,8 @@ local function process_input(action_id, action, components, is_input_consumed)
|
||||
for i = #components, 1, -1 do
|
||||
local component = components[i]
|
||||
-- Process increased input priority first
|
||||
if component._meta.increased_input_priority then
|
||||
local meta = component._meta
|
||||
if meta.input_enabled and meta.increased_input_priority then
|
||||
if not is_input_consumed then
|
||||
is_input_consumed = component:on_input(action_id, action)
|
||||
else
|
||||
@@ -114,7 +126,9 @@ local function process_input(action_id, action, components, is_input_consumed)
|
||||
|
||||
for i = #components, 1, -1 do
|
||||
local component = components[i]
|
||||
if not component._meta.increased_input_priority then
|
||||
-- Process usual input priority next
|
||||
local meta = component._meta
|
||||
if meta.input_enabled and not meta.increased_input_priority then
|
||||
if not is_input_consumed then
|
||||
is_input_consumed = component:on_input(action_id, action)
|
||||
else
|
||||
@@ -130,10 +144,10 @@ end
|
||||
|
||||
|
||||
--- Druid class constructor
|
||||
-- @function druid:initialize
|
||||
-- @tparam context table Druid context. Usually it is self of script
|
||||
-- @tparam style table Druid style module
|
||||
function Druid.initialize(self, context, style)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam table context Druid context. Usually it is self of script
|
||||
-- @tparam table style Druid style module
|
||||
function DruidInstance.initialize(self, context, style)
|
||||
self._context = context
|
||||
self._style = style or settings.default_style
|
||||
self._deleted = false
|
||||
@@ -149,10 +163,10 @@ end
|
||||
|
||||
|
||||
--- Create new druid component
|
||||
-- @function druid:create
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam Component component Component module
|
||||
-- @tparam args ... Other component params to pass it to component:init function
|
||||
function Druid.create(self, component, ...)
|
||||
function DruidInstance.create(self, component, ...)
|
||||
local instance = create(self, component)
|
||||
|
||||
if instance.init then
|
||||
@@ -165,8 +179,8 @@ end
|
||||
|
||||
--- Call on final function on gui_script. It will call on_remove
|
||||
-- on all druid components
|
||||
-- @function druid:final
|
||||
function Druid.final(self)
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.final(self)
|
||||
local components = self.components[const.ALL]
|
||||
|
||||
for i = #components, 1, -1 do
|
||||
@@ -183,24 +197,26 @@ end
|
||||
|
||||
--- Remove component from druid instance.
|
||||
-- Component `on_remove` function will be invoked, if exist.
|
||||
-- @function druid:remove
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam Component component Component instance
|
||||
function Druid.remove(self, component)
|
||||
function DruidInstance.remove(self, component)
|
||||
if self._is_input_processing then
|
||||
table.insert(self._late_remove, component)
|
||||
return
|
||||
end
|
||||
|
||||
local all_components = self.components[const.ALL]
|
||||
|
||||
-- Recursive remove all children of component
|
||||
for i = #all_components, 1, -1 do
|
||||
local inst = all_components[i]
|
||||
if inst:is_child_of(component) then
|
||||
self:remove(inst)
|
||||
local children = component._meta.children
|
||||
for i = #children, 1, -1 do
|
||||
self:remove(children[i])
|
||||
local parent = children[i]:get_parent_component()
|
||||
if parent then
|
||||
parent:__remove_children(children[i])
|
||||
end
|
||||
end
|
||||
component._meta.children = {}
|
||||
|
||||
local all_components = self.components[const.ALL]
|
||||
for i = #all_components, 1, -1 do
|
||||
if all_components[i] == component then
|
||||
if component.on_remove then
|
||||
@@ -210,7 +226,7 @@ function Druid.remove(self, component)
|
||||
end
|
||||
end
|
||||
|
||||
local interests = component:get_interests()
|
||||
local interests = component:__get_interests()
|
||||
for i = 1, #interests do
|
||||
local interest = interests[i]
|
||||
local components = self.components[interest]
|
||||
@@ -224,9 +240,9 @@ end
|
||||
|
||||
|
||||
--- Druid update function
|
||||
-- @function druid:update
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam number dt Delta time
|
||||
function Druid.update(self, dt)
|
||||
function DruidInstance.update(self, dt)
|
||||
local components = self.components[const.ON_UPDATE]
|
||||
for i = 1, #components do
|
||||
components[i]:update(dt)
|
||||
@@ -235,10 +251,10 @@ end
|
||||
|
||||
|
||||
--- Druid on_input function
|
||||
-- @function druid:on_input
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam hash action_id Action_id from on_input
|
||||
-- @tparam table action Action from on_input
|
||||
function Druid.on_input(self, action_id, action)
|
||||
function DruidInstance.on_input(self, action_id, action)
|
||||
self._is_input_processing = true
|
||||
|
||||
local is_input_consumed = false
|
||||
@@ -263,11 +279,11 @@ end
|
||||
|
||||
|
||||
--- Druid on_message function
|
||||
-- @function druid:on_message
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam hash message_id Message_id from on_message
|
||||
-- @tparam table message Message from on_message
|
||||
-- @tparam hash sender Sender from on_message
|
||||
function Druid.on_message(self, message_id, message, sender)
|
||||
function DruidInstance.on_message(self, message_id, message, sender)
|
||||
local specific_ui_message = const.SPECIFIC_UI_MESSAGES[message_id]
|
||||
|
||||
if specific_ui_message then
|
||||
@@ -289,8 +305,8 @@ end
|
||||
|
||||
--- Druid on focus lost interest function.
|
||||
-- This one called by on_window_callback by global window listener
|
||||
-- @function druid:on_focus_lost
|
||||
function Druid.on_focus_lost(self)
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.on_focus_lost(self)
|
||||
local components = self.components[const.ON_FOCUS_LOST]
|
||||
for i = 1, #components do
|
||||
components[i]:on_focus_lost()
|
||||
@@ -300,8 +316,8 @@ end
|
||||
|
||||
--- Druid on focus gained interest function.
|
||||
-- This one called by on_window_callback by global window listener
|
||||
-- @function druid:on_focus_gained
|
||||
function Druid.on_focus_gained(self)
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.on_focus_gained(self)
|
||||
local components = self.components[const.ON_FOCUS_GAINED]
|
||||
for i = 1, #components do
|
||||
components[i]:on_focus_gained()
|
||||
@@ -311,8 +327,8 @@ end
|
||||
|
||||
--- Druid on layout change function.
|
||||
-- Called on update gui layout
|
||||
-- @function druid:on_layout_change
|
||||
function Druid.on_layout_change(self)
|
||||
-- @tparam DruidInstance self
|
||||
function DruidInstance.on_layout_change(self)
|
||||
local components = self.components[const.ON_LAYOUT_CHANGE]
|
||||
for i = 1, #components do
|
||||
components[i]:on_layout_change()
|
||||
@@ -324,7 +340,7 @@ end
|
||||
-- This one called by global gruid.on_language_change, but can be
|
||||
-- call manualy to update all translations
|
||||
-- @function druid.on_language_change
|
||||
function Druid.on_language_change(self)
|
||||
function DruidInstance.on_language_change(self)
|
||||
local components = self.components[const.ON_LANGUAGE_CHANGE]
|
||||
for i = 1, #components do
|
||||
components[i]:on_language_change()
|
||||
@@ -333,149 +349,182 @@ end
|
||||
|
||||
|
||||
--- Create button basic component
|
||||
-- @function druid:new_button
|
||||
-- @tparam args ... button init args
|
||||
-- @treturn Component button component
|
||||
function Druid.new_button(self, ...)
|
||||
return Druid.create(self, button, ...)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function callback Button callback
|
||||
-- @tparam[opt] table params Button callback params
|
||||
-- @tparam[opt] node anim_node Button anim node (node, if not provided)
|
||||
-- @treturn Button button component
|
||||
function DruidInstance.new_button(self, node, callback, params, anim_node)
|
||||
return DruidInstance.create(self, button, node, callback, params, anim_node)
|
||||
end
|
||||
|
||||
|
||||
--- Create blocker basic component
|
||||
-- @function druid:new_blocker
|
||||
-- @tparam args ... blocker init args
|
||||
-- @treturn Component blocker component
|
||||
function Druid.new_blocker(self, ...)
|
||||
return Druid.create(self, blocker, ...)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @treturn Blocker blocker component
|
||||
function DruidInstance.new_blocker(self, node)
|
||||
return DruidInstance.create(self, blocker, node)
|
||||
end
|
||||
|
||||
|
||||
--- Create back_handler basic component
|
||||
-- @function druid:new_back_handler
|
||||
-- @tparam args ... back_handler init args
|
||||
-- @treturn Component back_handler component
|
||||
function Druid.new_back_handler(self, ...)
|
||||
return Druid.create(self, back_handler, ...)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam callback callback On back button
|
||||
-- @tparam[opt] any params Callback argument
|
||||
-- @treturn BackHandler back_handler component
|
||||
function DruidInstance.new_back_handler(self, callback, params)
|
||||
return DruidInstance.create(self, back_handler, callback, params)
|
||||
end
|
||||
|
||||
|
||||
--- Create hover basic component
|
||||
-- @function druid:new_hover
|
||||
-- @tparam args ... hover init args
|
||||
-- @treturn Component hover component
|
||||
function Druid.new_hover(self, ...)
|
||||
return Druid.create(self, hover, ...)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function on_hover_callback Hover callback
|
||||
-- @treturn Hover hover component
|
||||
function DruidInstance.new_hover(self, node, on_hover_callback)
|
||||
return DruidInstance.create(self, hover, node, on_hover_callback)
|
||||
end
|
||||
|
||||
|
||||
--- Create text basic component
|
||||
-- @function druid:new_text
|
||||
-- @tparam args ... text init args
|
||||
-- @treturn Component text component
|
||||
function Druid.new_text(self, ...)
|
||||
return Druid.create(self, text, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create lang_text basic component
|
||||
-- @function druid:new_lang_text
|
||||
-- @tparam args ... lang_text init args
|
||||
-- @treturn Component lang_text component
|
||||
function Druid.new_lang_text(self, ...)
|
||||
return Druid.create(self, lang_text, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create timer basic component
|
||||
-- @function druid:new_timer
|
||||
-- @tparam args ... timer init args
|
||||
-- @treturn Component timer component
|
||||
function Druid.new_timer(self, ...)
|
||||
return Druid.create(self, timer, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create progress basic component
|
||||
-- @function druid:new_progress
|
||||
-- @tparam args ... progress init args
|
||||
-- @treturn Component progress component
|
||||
function Druid.new_progress(self, ...)
|
||||
return Druid.create(self, progress, ...)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui text node
|
||||
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
||||
-- @tparam[opt] bool no_adjust If true, text will be not auto-adjust size
|
||||
-- @treturn Tet text component
|
||||
function DruidInstance.new_text(self, node, value, no_adjust)
|
||||
return DruidInstance.create(self, text, node, value, no_adjust)
|
||||
end
|
||||
|
||||
|
||||
--- Create grid basic component
|
||||
-- @function druid:new_grid
|
||||
-- @tparam args ... grid init args
|
||||
-- @treturn Component grid component
|
||||
function Druid.new_grid(self, ...)
|
||||
return Druid.create(self, grid, ...)
|
||||
-- Deprecated
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @tparam node element Element prefab. Need to get it size
|
||||
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
||||
-- @treturn StaticGrid grid component
|
||||
function DruidInstance.new_grid(self, parent, element, in_row)
|
||||
helper.deprecated("The druid:new_grid is deprecated. Please use druid:new_static_grid instead")
|
||||
return DruidInstance.create(self, static_grid, parent, element, in_row)
|
||||
end
|
||||
|
||||
|
||||
--- Create static grid basic component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @tparam node element Element prefab. Need to get it size
|
||||
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
||||
-- @treturn StaticGrid grid component
|
||||
function DruidInstance.new_static_grid(self, parent, element, in_row)
|
||||
return DruidInstance.create(self, static_grid, parent, element, in_row)
|
||||
end
|
||||
|
||||
|
||||
--- Create scroll basic component
|
||||
-- @function druid:new_scroll
|
||||
-- @tparam args ... scroll init args
|
||||
-- @treturn Component scroll component
|
||||
function Druid.new_scroll(self, ...)
|
||||
return Druid.create(self, scroll, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create slider basic component
|
||||
-- @function druid:new_slider
|
||||
-- @tparam args ... slider init args
|
||||
-- @treturn Component slider component
|
||||
function Druid.new_slider(self, ...)
|
||||
return Druid.create(self, slider, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox basic component
|
||||
-- @function druid:new_checkbox
|
||||
-- @tparam args ... checkbox init args
|
||||
-- @treturn Component checkbox component
|
||||
function Druid.new_checkbox(self, ...)
|
||||
return Druid.create(self, checkbox, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create input basic component
|
||||
-- @function druid:new_input
|
||||
-- @tparam args ... input init args
|
||||
-- @treturn Component input component
|
||||
function Druid.new_input(self, ...)
|
||||
return Druid.create(self, input, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox_group basic component
|
||||
-- @function druid:new_checkbox_group
|
||||
-- @tparam args ... checkbox_group init args
|
||||
-- @treturn Component checkbox_group component
|
||||
function Druid.new_checkbox_group(self, ...)
|
||||
return Druid.create(self, checkbox_group, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create radio_group basic component
|
||||
-- @function druid:new_radio_group
|
||||
-- @tparam args ... radio_group init args
|
||||
-- @treturn Component radio_group component
|
||||
function Druid.new_radio_group(self, ...)
|
||||
return Druid.create(self, radio_group, ...)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node view_node GUI view scroll node
|
||||
-- @tparam node content_node GUI content scroll node
|
||||
-- @treturn Scroll scroll component
|
||||
function DruidInstance.new_scroll(self, view_node, content_node)
|
||||
return DruidInstance.create(self, scroll, view_node, content_node)
|
||||
end
|
||||
|
||||
|
||||
--- Create swipe basic component
|
||||
-- @function druid:new_swipe
|
||||
-- @tparam args ... swipe init args
|
||||
-- @treturn Component swipe component
|
||||
function Druid.new_swipe(self, ...)
|
||||
return Druid.create(self, swipe, ...)
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
|
||||
-- @treturn Swipe swipe component
|
||||
function DruidInstance.new_swipe(self, node, on_swipe_callback)
|
||||
return DruidInstance.create(self, swipe, node, on_swipe_callback)
|
||||
end
|
||||
|
||||
|
||||
--- Create drag basic component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node GUI node to detect dragging
|
||||
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
|
||||
-- @treturn Drag drag component
|
||||
function DruidInstance.new_drag(self, node, on_drag_callback)
|
||||
return DruidInstance.create(self, drag, node, on_drag_callback)
|
||||
end
|
||||
|
||||
|
||||
--- Create dynamic grid component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node parent The gui node parent, where items will be placed
|
||||
-- @treturn DynamicGrid grid component
|
||||
function DruidInstance.new_dynamic_grid(self, parent)
|
||||
-- return helper.extended_component("dynamic_grid")
|
||||
return DruidInstance.create(self, dynamic_grid, parent)
|
||||
end
|
||||
|
||||
|
||||
--- Create lang_text component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node The text node
|
||||
-- @tparam string locale_id Default locale id
|
||||
-- @tparam bool no_adjust If true, will not correct text size
|
||||
-- @treturn LangText lang_text component
|
||||
function DruidInstance.new_lang_text(self, node, locale_id, no_adjust)
|
||||
-- return helper.extended_component("lang_text")
|
||||
return DruidInstance.create(self, lang_text, node, locale_id, no_adjust)
|
||||
end
|
||||
|
||||
|
||||
--- Create slider component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui pin node
|
||||
-- @tparam vector3 end_pos The end position of slider
|
||||
-- @tparam[opt] function callback On slider change callback
|
||||
-- @treturn Slider slider component
|
||||
function DruidInstance.new_slider(self, node, end_pos, callback)
|
||||
-- return helper.extended_component("slider")
|
||||
return DruidInstance.create(self, slider, node, end_pos, callback)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui node
|
||||
-- @tparam function callback Checkbox callback
|
||||
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
|
||||
-- @treturn Checkbox checkbox component
|
||||
function DruidInstance.new_checkbox(self, node, callback, click_node)
|
||||
-- return helper.extended_component("checkbox")
|
||||
return DruidInstance.create(self, checkbox, node, callback, click_node)
|
||||
end
|
||||
|
||||
|
||||
--- Create input component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node click_node Button node to enabled input component
|
||||
-- @tparam node text_node Text node what will be changed on user input
|
||||
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
|
||||
-- @treturn Input input component
|
||||
function DruidInstance.new_input(self, click_node, text_node, keyboard_type)
|
||||
-- return helper.extended_component("input")
|
||||
return DruidInstance.create(self, input, click_node, text_node, keyboard_type)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox_group component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node[] nodes Array of gui node
|
||||
-- @tparam function callback Checkbox callback
|
||||
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
|
||||
-- @treturn CheckboxGroup checkbox_group component
|
||||
function DruidInstance.new_checkbox_group(self, nodes, callback, click_nodes)
|
||||
-- return helper.extended_component("checkbox_group")
|
||||
return DruidInstance.create(self, checkbox_group, nodes, callback, click_nodes)
|
||||
end
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
--- Create drag basic component
|
||||
-- @function druid:new_drag
|
||||
-- @tparam args ... drag init args
|
||||
@@ -495,3 +544,43 @@ end
|
||||
|
||||
|
||||
return Druid
|
||||
=======
|
||||
--- Create radio_group component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node[] nodes Array of gui node
|
||||
-- @tparam function callback Radio callback
|
||||
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
|
||||
-- @treturn RadioGroup radio_group component
|
||||
function DruidInstance.new_radio_group(self, nodes, callback, click_nodes)
|
||||
-- return helper.extended_component("radio_group")
|
||||
return DruidInstance.create(self, radio_group, nodes, callback, click_nodes)
|
||||
end
|
||||
|
||||
|
||||
--- Create timer component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam node node Gui text node
|
||||
-- @tparam number seconds_from Start timer value in seconds
|
||||
-- @tparam[opt=0] number seconds_to End timer value in seconds
|
||||
-- @tparam[opt] function callback Function on timer end
|
||||
-- @treturn Timer timer component
|
||||
function DruidInstance.new_timer(self, node, seconds_from, seconds_to, callback)
|
||||
-- return helper.extended_component("timer")
|
||||
return DruidInstance.create(self, timer, node, seconds_from, seconds_to, callback)
|
||||
end
|
||||
|
||||
|
||||
--- Create progress component
|
||||
-- @tparam DruidInstance self
|
||||
-- @tparam string|node node Progress bar fill node or node name
|
||||
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
|
||||
-- @tparam[opt=1] number init_value Initial value of progress bar
|
||||
-- @treturn Progress progress component
|
||||
function DruidInstance.new_progress(self, node, key, init_value)
|
||||
-- return helper.extended_component("progress")
|
||||
return DruidInstance.create(self, progress, node, key, init_value)
|
||||
end
|
||||
|
||||
|
||||
return DruidInstance
|
||||
>>>>>>> develop
|
||||
|
Reference in New Issue
Block a user