Module BaseComponent

Basic class for all Druid components.

To create you custom component, use static function `component.create`

Usage:

    -- Create your component:
    local component = require("druid.component")
    
    local AwesomeComponent = component.create("awesome_component")
    
    function AwesomeComponent:init(template, nodes)
        self:set_template(template)
        self:set_nodes(nodes)
        self.druid = self:get_druid()
    end
    
    return AwesomeComponent
    

Functions

get_childrens(self) Return all children components, recursive
get_context(self) Context used as first arg in all Druid events
get_druid(self, template, nodes) Get Druid instance for inner component creation.
get_input_priority(self) Return component input priority
get_name(self) Return component name
get_node(self, node_or_name) Get component node by name.
get_parent_component(self) Return the parent component if exist
get_parent_name(self) Return parent component name
get_template(self) Get current component template name.
get_uid(self) Return component UID.
reset_input_priority(self) Reset component input priority to default value
set_input_enabled(self, state) Set component input state.
set_input_priority(self, value, is_temporary) Set component input priority


Functions

get_childrens(self)
Return all children components, recursive

Parameters:

Returns:

    table Array of childrens if the Druid component instance
get_context(self)
Context used as first arg in all Druid events Context is usually self of gui_script.

Parameters:

Returns:

    table BaseComponent context
get_druid(self, template, nodes)
Get Druid instance for inner component creation.

Parameters:

Returns:

    DruidInstance Druid instance with component context
get_input_priority(self)
Return component input priority

Parameters:

Returns:

    number The component input priority
get_name(self)
Return component name

Parameters:

Returns:

    string The component name
get_node(self, node_or_name)
Get component node by name.

If component has nodes, node_or_name should be string It autopick node by template name or from nodes by gui.clone_tree if they was setup via component:set_nodes, component:set_template. If node is not found, the exception will fired

Parameters:

Returns:

    node Gui node
get_parent_component(self)
Return the parent component if exist

Parameters:

Returns:

    BaseComponent or nil The druid component instance or nil
get_parent_name(self)
Return parent component name

Parameters:

Returns:

    string or nil The parent component name if exist or bil
get_template(self)
Get current component template name.

Parameters:

Returns:

    string Component full template name
get_uid(self)
Return component UID.

UID generated in component creation order.

Parameters:

Returns:

    number The component uid
reset_input_priority(self)
Reset component input priority to default value

Parameters:

Returns:

    number The component input priority
set_input_enabled(self, state)
Set component input state. By default it enabled

If input is disabled, the component will not receive input events

Parameters:

  • self BaseComponent BaseComponent
  • state boolean or nil The component input state

Returns:

    BaseComponent BaseComponent itself
set_input_priority(self, value, is_temporary)
Set component input priority Default value: 10

Parameters:

  • self BaseComponent BaseComponent
  • value number The new input priority value
  • is_temporary boolean or nil If true, the reset input priority will return to previous value

Returns:

    number The component input priority
generated by LDoc TESTING Last updated 2015-01-01 12:00:00