Rename locale -> lang_text

This commit is contained in:
Insality
2020-02-22 15:24:52 +03:00
parent 2c0b100ab7
commit 640753c080
7 changed files with 46 additions and 43 deletions

View File

@@ -16,6 +16,26 @@ local function on_button_hover(self, hover_state)
self.style.on_hover(self, self.anim_node, hover_state)
end
local function on_button_release(self)
if not self.disabled then
if not self.stub and self.can_action then
self.can_action = false
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.callback(self:get_context(), self.params, self)
end
return true
else
if self.style.on_click_disabled then
self.style.on_click_disabled(self, self.anim_node)
end
return false
end
end
--- Component init function
-- @function button:init
-- @tparam table self Component instance
@@ -44,25 +64,6 @@ function M.init(self, node, callback, params, anim_node, event)
end
local function on_button_release(self)
if not self.disabled then
if not self.stub and self.can_action then
self.can_action = false
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.callback(self:get_context(), self.params, self)
end
return true
else
if self.style.on_click_disabled then
self.style.on_click_disabled(self, self.anim_node)
end
return false
end
end
function M.on_input(self, action_id, action)
if action_id ~= const.ACTION_TOUCH then
return false

View File

@@ -1,12 +1,12 @@
--- Component to handle all GUI texts
-- Good working with localization system
-- @module druid.locale
-- @module druid.lang_text
local const = require("druid.const")
local settings = require("druid.system.settings")
local component = require("druid.component")
local M = component.create("locale", { const.ON_CHANGE_LANGUAGE })
local M = component.create("lang_text", { const.ON_CHANGE_LANGUAGE })
function M.init(self, node, lang_id, no_adjust)