init
This commit is contained in:
105
lui/luibindbutton.dec.lua
Normal file
105
lui/luibindbutton.dec.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
LUI.UIBindButton = {}
|
||||
LUI.UIBindButton.GamepadButton = function ( f1_arg0, f1_arg1 )
|
||||
if f1_arg0:handleGamepadButton( f1_arg1 ) then
|
||||
return true
|
||||
elseif f1_arg0.m_ownerController ~= nil and f1_arg0.m_ownerController ~= f1_arg1.controller then
|
||||
DebugPrint( "Item Exclusive to controller " .. f1_arg1.controller )
|
||||
return false
|
||||
elseif f1_arg1.down == true then
|
||||
local f1_local0 = false
|
||||
local f1_local1 = {
|
||||
controller = f1_arg1.controller,
|
||||
qualifier = f1_arg1.qualifier
|
||||
}
|
||||
if not f1_arg0.disabled then
|
||||
f1_local0 = true
|
||||
if f1_arg1.button == "secondary" then
|
||||
f1_local1.name = "button_secondary"
|
||||
elseif f1_arg1.button == "alt1" then
|
||||
f1_local1.name = "button_alt1"
|
||||
elseif f1_arg1.button == "alt2" then
|
||||
f1_local1.name = "button_alt2"
|
||||
elseif f1_arg1.button == "right_trigger" then
|
||||
f1_local1.name = "button_right_trigger"
|
||||
elseif f1_arg1.button == "left_trigger" then
|
||||
f1_local1.name = "button_left_trigger"
|
||||
elseif f1_arg1.button == "shoulderr" then
|
||||
f1_local1.name = "button_shoulderr"
|
||||
elseif f1_arg1.button == "shoulderl" then
|
||||
f1_local1.name = "button_shoulderl"
|
||||
elseif f1_arg1.button == "right_stick" then
|
||||
f1_local1.name = "button_right_stick"
|
||||
elseif f1_arg1.button == "left_stick" then
|
||||
f1_local1.name = "button_left_stick"
|
||||
elseif f1_arg1.button == "left" then
|
||||
f1_local1.name = "button_left"
|
||||
elseif f1_arg1.button == "right" then
|
||||
f1_local1.name = "button_right"
|
||||
elseif f1_arg1.button == "up" then
|
||||
f1_local1.name = "button_up"
|
||||
elseif f1_arg1.button == "down" then
|
||||
f1_local1.name = "button_down"
|
||||
elseif f1_arg1.button == "start" then
|
||||
f1_local1.name = "button_start"
|
||||
elseif f1_arg1.button == "select" then
|
||||
f1_local1.name = "button_select"
|
||||
elseif f1_arg1.button == "options" then
|
||||
f1_local1.name = "button_options"
|
||||
else
|
||||
f1_local0 = false
|
||||
end
|
||||
end
|
||||
if f1_local0 and f1_arg0:processEvent( f1_local1 ) then
|
||||
if f1_arg0.actionSFX then
|
||||
Engine.PlaySound( f1_arg0.actionSFX )
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
return f1_arg0:dispatchEventToChildren( f1_arg1 )
|
||||
end
|
||||
|
||||
LUI.UIBindButton.ElementEnable = function ( f2_arg0, f2_arg1 )
|
||||
f2_arg0.disabled = nil
|
||||
end
|
||||
|
||||
LUI.UIBindButton.ElementDisable = function ( f3_arg0, f3_arg1 )
|
||||
f3_arg0.disabled = true
|
||||
end
|
||||
|
||||
LUI.UIBindButton.Enable = function ( f4_arg0 )
|
||||
f4_arg0:processEvent( {
|
||||
name = "enable",
|
||||
dispatchChildren = true
|
||||
} )
|
||||
end
|
||||
|
||||
LUI.UIBindButton.Disable = function ( f5_arg0 )
|
||||
f5_arg0:processEvent( {
|
||||
name = "disable",
|
||||
dispatchChildren = true
|
||||
} )
|
||||
end
|
||||
|
||||
LUI.UIBindButton.SetActionSFX = function ( f6_arg0, f6_arg1 )
|
||||
f6_arg0.actionSFX = f6_arg1
|
||||
end
|
||||
|
||||
LUI.UIBindButton.build = function ( f7_arg0, f7_arg1 )
|
||||
return LUI.UIBindButton.new()
|
||||
end
|
||||
|
||||
LUI.UIBindButton.new = function ( menu, controller )
|
||||
local self = LUI.UIElement.new( menu )
|
||||
self.id = "LUIBindButton"
|
||||
self.enable = LUI.UIBindButton.Enable
|
||||
self.disable = LUI.UIBindButton.Disable
|
||||
self.setActionSFX = LUI.UIBindButton.SetActionSFX
|
||||
self:registerEventHandlerIfFree( "enable", LUI.UIBindButton.ElementEnable )
|
||||
self:registerEventHandlerIfFree( "disable", LUI.UIBindButton.ElementDisable )
|
||||
self:registerEventHandlerIfFree( "popup_active", LUI.UIBindButton.ElementDisable )
|
||||
self:registerEventHandlerIfFree( "popup_inactive", LUI.UIBindButton.ElementEnable )
|
||||
self:registerEventHandler( "gamepad_button", LUI.UIBindButton.GamepadButton )
|
||||
return self
|
||||
end
|
||||
|
Reference in New Issue
Block a user