mirror of
https://github.com/Insality/druid
synced 2025-09-27 10:02:19 +02:00
Update annotations P.1
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class component_name : druid.base_component
|
||||
local Component = component.create("component_name")
|
||||
local M = component.create("component_name")
|
||||
|
||||
|
||||
-- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
|
||||
function Component:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
self.root = self:get_node("root")
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
self.root = self:get_node("root")
|
||||
|
||||
self.button = self.druid:new_button("button", function() end)
|
||||
self.button = self.druid:new_button("button", function() end)
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call on component remove or on druid:final
|
||||
function Component:on_remove()
|
||||
end
|
||||
|
||||
|
||||
return Component
|
||||
return M
|
||||
|
@@ -1,10 +1,10 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class component_name : druid.base_component
|
||||
local Component = component.create("component_name")
|
||||
---@class new_component: druid.base_component
|
||||
local M = component.create("new_component")
|
||||
|
||||
-- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
|
||||
function Component:init(template, nodes)
|
||||
function M:init(template, nodes)
|
||||
-- If your component is gui template, pass the template name and set it
|
||||
-- If your component is cloned my gui.clone_tree, pass nodes to component and set it
|
||||
-- Use inner druid instance to create components inside this component
|
||||
@@ -17,55 +17,55 @@ end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call every update step
|
||||
function Component:update(dt)
|
||||
function M:update(dt)
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call default on_input from gui script
|
||||
function Component:on_input(action_id, action)
|
||||
function M:on_input(action_id, action)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call on component creation and on component:set_style() function
|
||||
function Component:on_style_change(style)
|
||||
function M:on_style_change(style)
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call default on_message from gui script
|
||||
function Component:on_message(message_id, message, sender)
|
||||
function M:on_message(message_id, message, sender)
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call if druid has triggered on_language_change
|
||||
function Component:on_language_change()
|
||||
function M:on_language_change()
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call if game layout has changed and need to restore values in component
|
||||
function Component:on_layout_change()
|
||||
function M:on_layout_change()
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call, if input was capturing before this component
|
||||
-- Example: scroll is start scrolling, so you need unhover button
|
||||
function Component:on_input_interrupt()
|
||||
function M:on_input_interrupt()
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call, if game lost focus
|
||||
function Component:on_focus_lost()
|
||||
function M:on_focus_lost()
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call, if game gained focus
|
||||
function Component:on_focus_gained()
|
||||
function M:on_focus_gained()
|
||||
end
|
||||
|
||||
|
||||
-- [OPTIONAL] Call on component remove or on druid:final
|
||||
function Component:on_remove()
|
||||
function M:on_remove()
|
||||
end
|
||||
|
||||
|
||||
return Component
|
||||
return M
|
||||
|
Reference in New Issue
Block a user