iw6-lui/lui/lui.dec.lua
2024-09-12 17:25:45 +02:00

290 lines
6.8 KiB
Lua

LUI = {
roots = {},
Alignment = {
None = 0,
Left = 1,
Center = 2,
Right = 3,
Top = 4,
Middle = 5,
Bottom = 6
},
savedMenuStates = {},
ActiveScoped = nil
}
if not Engine.IsDevelopmentBuild() then
function print()
end
function printf()
end
end
LUI.CachedEvents = {
process_events = {
name = "process_events",
immediate = true
},
transition_complete = {
name = "transistion_complete_default",
lateness = 0
},
gamepad_button = {
name = "gamepad_button",
controller = 0,
button = "primary",
down = true,
immediate = true
}
}
function DisableGlobals()
local f3_local0 = getmetatable( _G )
if not f3_local0 then
f3_local0 = {}
setmetatable( _G, f3_local0 )
end
f3_local0.__newindex = function ( f4_arg0, f4_arg1, f4_arg2 )
error( "LUI Error: Tried to create global variable " .. f4_arg1, 2 )
end
end
function LockTable( f5_arg0 )
local f5_local0 = getmetatable( f5_arg0 )
if not f5_local0 then
f5_local0 = {}
setmetatable( f5_arg0, f5_local0 )
end
f5_local0.__newindex = function ( f6_arg0, f6_arg1, f6_arg2 )
error( "LUI Error: Tried to create module variable " .. f6_arg1, 2 )
end
end
function InheritFrom( f7_arg0 )
if not f7_arg0 then
error( "LUI Error: Did not specify base class in InheritFrom!" )
end
local f7_local0 = {}
setmetatable( f7_local0, {
__index = f7_arg0
} )
f7_local0.m_eventHandlers = {}
setmetatable( f7_local0.m_eventHandlers, {
__index = f7_arg0.m_eventHandlers
} )
return f7_local0
end
if nil ~= hpairs then
pairs = hpairs
end
LUI.ShallowCopy = function ( f8_arg0 )
local f8_local0 = {}
for f8_local4, f8_local5 in pairs( f8_arg0 ) do
f8_local0[f8_local4] = f8_local5
end
return f8_local0
end
LUI.ConcatenateToTable = function ( f9_arg0, f9_arg1 )
if f9_arg1 == nil then
return
end
for f9_local3, f9_local4 in ipairs( f9_arg1 ) do
table.insert( f9_arg0, f9_local4 )
end
end
LUI.RemoveSingleItemFromArray = function ( f10_arg0, f10_arg1 )
for f10_local0 = 1, #f10_arg0, 1 do
if f10_arg0[f10_local0] == f10_arg1 then
table.remove( f10_arg0, f10_local0 )
break
end
end
end
LUI.IsItemInArray = function ( f11_arg0, f11_arg1 )
for f11_local0 = 1, #f11_arg0, 1 do
if f11_arg0[f11_local0] == f11_arg1 then
return true
end
end
return false
end
LUI.ReverseTable = function ( f12_arg0 )
local f12_local0 = #f12_arg0
local f12_local1 = {}
for f12_local5, f12_local6 in ipairs( f12_arg0 ) do
f12_local1[f12_local0 - f12_local5 + 1] = f12_local6
end
return f12_local1
end
LUI.clamp = function ( f13_arg0, f13_arg1, f13_arg2 )
if f13_arg0 < f13_arg1 then
return f13_arg1
elseif f13_arg2 < f13_arg0 then
return f13_arg2
else
return f13_arg0
end
end
LUI.FormatAnimStateFinishEvent = function ( f14_arg0 )
return "transition_complete_" .. f14_arg0
end
LUI.MakeFlyOverAnimationState = function ( f15_arg0, f15_arg1 )
assert( f15_arg0 )
assert( f15_arg1 )
local f15_local0, f15_local1, f15_local2, f15_local3 = f15_arg0:getCurrentGlobalRect()
local f15_local4, f15_local5, f15_local6, f15_local7 = f15_arg1:getCurrentGlobalRect()
local f15_local8 = f15_local4 - f15_local0
local f15_local9 = f15_local6 - f15_local2
local f15_local10 = f15_local5 - f15_local1
local f15_local11 = f15_local7 - f15_local3
local f15_local12, f15_local13, f15_local14, f15_local15 = f15_arg0:getLocalRect()
local f15_local16, f15_local17, f15_local18, f15_local19 = f15_arg0:GetAnchorData()
return {
topAnchor = f15_local17,
bottomAnchor = f15_local19,
leftAnchor = f15_local16,
rightAnchor = f15_local18,
top = f15_local13 + f15_local10,
bottom = f15_local15 + f15_local11,
left = f15_local12 + f15_local8,
right = f15_local14 + f15_local9
}
end
LUI.Debug = {}
LargestElements = {}
LargestElementsSize = {}
LargestElementsCount = {}
if debug then
debug.postdeploymentfunction = function ()
for f16_local3, f16_local4 in pairs( LUI.roots ) do
f16_local4.debugReload = true
end
end
end
function LUITestFunction()
DebugPrint( "Running LUITestFunction()" )
end
function CountFieldsHelper( f18_arg0, f18_arg1 )
if f18_arg1[f18_arg0] then
return
end
f18_arg1[f18_arg0] = true
local f18_local0 = 0
for f18_local4, f18_local5 in pairs( f18_arg0 ) do
if type( f18_local4 ) == "table" then
f18_local0 = f18_local0 + CountFieldsHelper( f18_local4, f18_arg1 )
end
f18_local0 = f18_local0 + 1
end
return f18_local0
end
function CountFields( f19_arg0 )
return CountFieldsHelper( f19_arg0, {} )
end
function CountReferencesHelper( f20_arg0, f20_arg1 )
if f20_arg1[f20_arg0] then
return
end
f20_arg1[f20_arg0] = true
if type( f20_arg0 ) == "userdata" then
local f20_local0 = getmetatable( f20_arg0 )
if not f20_local0 then
return
end
f20_arg0 = f20_local0.__index
if not f20_arg0 then
return
elseif type( f20_arg0 ) == "table" and f20_arg0.id then
local f20_local1 = CountFields( f20_arg0 )
if not LargestElementsSize[f20_arg0.id] or LargestElementsSize[f20_arg0.id] < f20_local1 then
LargestElements[f20_arg0.id] = f20_arg0
LargestElementsSize[f20_arg0.id] = f20_local1
end
if not LargestElementsCount[f20_arg0.id] then
LargestElementsCount[f20_arg0.id] = 0
end
LargestElementsCount[f20_arg0.id] = LargestElementsCount[f20_arg0.id] + 1
end
end
if type( f20_arg0 ) ~= "table" then
return
end
for f20_local3, f20_local4 in pairs( f20_arg0 ) do
CountReferencesHelper( f20_local4, f20_arg1 )
end
end
function CountReferences( f21_arg0 )
local f21_local0 = {
[f21_arg0] = true
}
if type( f21_arg0 ) == "userdata" then
local f21_local1 = getmetatable( f21_arg0 )
if not f21_local1 then
return 0
end
f21_arg0 = f21_local1.__index
if not f21_arg0 then
return 0
end
end
if type( f21_arg0 ) ~= "table" then
return 0
end
for f21_local4, f21_local5 in pairs( f21_arg0 ) do
CountReferencesHelper( f21_local5, f21_local0 )
end
f21_local1 = 0
for f21_local5, f21_local6 in pairs( f21_local0 ) do
f21_local1 = f21_local1 + 1
end
return f21_local1
end
require( "LUI.LUIElement" )
require( "LUI.LUIRoot" )
require( "LUI.LUITimer" )
require( "LUI.LUIButtonRepeater" )
require( "LUI.LUIImage" )
require( "LUI.LUILitImage" )
require( "LUI.LUIText" )
require( "LUI.LUIAnimNumber" )
require( "LUI.LUITightText" )
require( "LUI.LUIButton" )
require( "LUI.LUIBindButton" )
require( "LUI.LUIMouseCursor" )
require( "LUI.LUIVerticalList" )
require( "LUI.LUIScrollingVerticalList" )
require( "LUI.LUIHorizontalList" )
require( "LUI.LUIBarrelList" )
require( "LUI.LUIGrid" )
require( "LUI.LUIScrollable" )
require( "LUI.LUIVerticalScrollbar" )
require( "LUI.LUISafeAreaOverlay" )
require( "LUI.LUICountdown" )
require( "LUI.LUILongCountdown" )
require( "LUI.LUITechyDigits" )
require( "LUI.LUIPrettyNumber" )
require( "LUI.LUICharacterWindow" )
require( "LUI.FlowManager" )
require( "LUI.HudManager" )
require( "LUI.MenuBuilder" )
require( "LUI.LUIMarqueeText" )
MBh = LUI.MenuBuilder.helpers