mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Can setup additional zone to check button click
This commit is contained in:
parent
19a9d27635
commit
82b15243fc
@ -30,6 +30,7 @@ function M.init(instance, node, callback, params, anim_node, event)
|
|||||||
instance.hover_anim = b_settings.IS_HOVER
|
instance.hover_anim = b_settings.IS_HOVER
|
||||||
instance.sound = b_settings.BTN_SOUND
|
instance.sound = b_settings.BTN_SOUND
|
||||||
instance.sound_disable = b_settings.BTN_SOUND_DISABLED
|
instance.sound_disable = b_settings.BTN_SOUND_DISABLED
|
||||||
|
instance.ext_zone = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +69,12 @@ function M.on_input(instance, action_id, action)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if gui.pick_node(instance.node, action.x, action.y) then
|
local is_pick = gui.pick_node(instance.node, action.x, action.y)
|
||||||
|
if instance.ext_zone then
|
||||||
|
is_pick = is_pick and gui.pick_node(instance.ext_zone, action.x, action.y)
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_pick then
|
||||||
if action.pressed then
|
if action.pressed then
|
||||||
-- Can interact if start touch on the button
|
-- Can interact if start touch on the button
|
||||||
instance.can_action = true
|
instance.can_action = true
|
||||||
@ -172,4 +178,11 @@ function M.activate(instance, is_animate, callback)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
--- Set additional node, what need to be clicked on button click
|
||||||
|
-- Used, if need setup, what button can be clicked only in special zone
|
||||||
|
function M.set_ext_zone(instance, zone)
|
||||||
|
instance.ext_zone = helper.get_node(zone)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return M
|
Loading…
x
Reference in New Issue
Block a user