local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) function Property( f1_arg0 ) local f1_local0 = {} assert( f1_arg0, "No property name given" ) f1_local0.propName = f1_arg0 f1_local0.isProperty = true f1_local0.func = function ( f2_arg0 ) assert( f2_arg0[f1_local0.propName] ~= nil, "Could not find property named " .. f1_local0.propName ) return f2_arg0[f1_local0.propName] end return f1_local0 end function OppositeProperty( f3_arg0 ) local f3_local0 = {} assert( f3_arg0, "No property name given" ) f3_local0.propName = f3_arg0 f3_local0.isProperty = true f3_local0.func = function ( f4_arg0 ) assert( f4_arg0[f3_local0.propName] ~= nil, "Could not find property named " .. f3_local0.propName ) if type( f4_arg0[f3_local0.propName] ) == "number" then return -f4_arg0[f3_local0.propName] elseif type( f4_arg0[f3_local0.propName] ) == "boolean" then return not f4_arg0[f3_local0.propName] else assert( false, "Property " .. f3_local0.propName .. " should be a number or a boolean for use with the OppositeProperty helper" ) end end return f3_local0 end function HalfProperty( f5_arg0 ) local f5_local0 = {} assert( f5_arg0, "No property name given" ) f5_local0.propName = f5_arg0 f5_local0.isProperty = true f5_local0.func = function ( f6_arg0 ) assert( f6_arg0[f5_local0.propName] ~= nil, "Could not find property named " .. f5_local0.propName ) if type( f6_arg0[f5_local0.propName] ) == "number" then return 0.5 * f6_arg0[f5_local0.propName] else assert( false, "Property " .. f5_local0.propName .. " should be a number for use with the HalfProperty helper" ) end end return f5_local0 end function HalfOppositeProperty( f7_arg0 ) local f7_local0 = {} assert( f7_arg0, "No property name given" ) f7_local0.propName = f7_arg0 f7_local0.isProperty = true f7_local0.func = function ( f8_arg0 ) assert( f8_arg0[f7_local0.propName] ~= nil, "Could not find property named " .. f7_local0.propName ) if type( f8_arg0[f7_local0.propName] ) == "number" then return -0.5 * f8_arg0[f7_local0.propName] else assert( false, "Property " .. f7_local0.propName .. " should be a number for use with the HalfOppositeProperty helper" ) end end return f7_local0 end function RunPropertyFunc( f9_arg0 ) return function ( f10_arg0, f10_arg1 ) if f10_arg0.properties[f9_arg0] and type( f10_arg0.properties[f9_arg0] ) == "function" then f10_arg0.properties[f9_arg0]( f10_arg0, f10_arg1 ) end end end function ParentProperty( f11_arg0 ) local f11_local0 = f11_arg0 return function ( f12_arg0, f12_arg1 ) assert( f12_arg1, "ParentProperty can only be included inside the property section" ) return f12_arg1[f11_local0] end end function TryProperty( f13_arg0 ) local f13_local0 = f13_arg0 return function ( f14_arg0 ) return f14_arg0[f13_local0] end end function Function( f15_arg0 ) local f15_local0 = f15_arg0 return function ( f16_arg0 ) return f15_local0( f16_arg0 ) end end function BaseState( f17_arg0, f17_arg1 ) local f17_local0 = f17_arg0 local f17_local1 = f17_arg1 if not f17_local1 then f17_local1 = {} end return function ( f18_arg0 ) assert( f18_arg0 ) assert( f18_arg0.states ) assert( f18_arg0.states[f17_local0], "Could not find base state " .. f17_local0 ) assert( type( f18_arg0.states[f17_local0] ) == "table", "Must only use BaseState on non-derived states! state = " .. f17_local0 ) local f18_local0 = {} for f18_local4, f18_local5 in pairs( f18_arg0.states[f17_local0] ) do f18_local0[f18_local4] = f18_local5 end for f18_local4, f18_local5 in pairs( f17_local1 ) do f18_local0[f18_local4] = f18_local5 end return f18_local0 end end function OpenMenu( f19_arg0, f19_arg1, f19_arg2, f19_arg3 ) local f19_local0 = f19_arg0 local f19_local1 = f19_arg1 local f19_local2 = f19_arg2 local f19_local3 = f19_arg3 return function ( f20_arg0, f20_arg1 ) LUI.FlowManager.RequestAddMenu( f20_arg0, f19_local0, f19_local1, f20_arg1.controller, f19_local2, f19_local3 ) end end function PopupMenu( f21_arg0, f21_arg1, f21_arg2, f21_arg3 ) local f21_local0 = f21_arg0 local f21_local1 = f21_arg1 local f21_local2 = f21_arg2 local f21_local3 = f21_arg3 return function ( f22_arg0, f22_arg1 ) LUI.FlowManager.RequestPopupMenu( f22_arg0, f21_local0, f21_local1, f22_arg1.controller, f21_local2, f21_local3 ) end end function LeaveMenu() return function ( f24_arg0, f24_arg1 ) LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) end end function RestoreMenu( f25_arg0, f25_arg1, f25_arg2 ) return function ( f26_arg0, f26_arg1 ) LUI.FlowManager.RequestRestoreMenu( f26_arg0, f25_arg0, f25_arg1, f26_arg1.controller, f25_arg2 ) end end function CloseAllMenus() return function ( f28_arg0, f28_arg1 ) LUI.FlowManager.RequestCloseAllMenus( f28_arg0, nil ) end end function OpenOldMenu( f29_arg0 ) local f29_local0 = f29_arg0 return function ( f30_arg0, f30_arg1 ) LUI.FlowManager.RequestOldMenu( f30_arg0, f29_local0 ) end end function EmitEvent( f31_arg0 ) local f31_local0 = f31_arg0 if type( f31_local0 ) == "string" then f31_local0 = { name = f31_local0 } end return function ( f32_arg0, f32_arg1 ) f32_arg0:processEvent( f31_local0 ) end end function EmitEventToParent( f33_arg0, f33_arg1 ) local f33_local0 if f33_arg1 then f33_local0 = f33_arg1.saveOriginal if not f33_local0 then else local f33_local1 = f33_arg0 if not f33_local0 and type( f33_local1 ) == "string" then f33_local1 = { name = f33_local1 } end return function ( f34_arg0, f34_arg1 ) if f33_local0 then local f34_local0 = {} if type( f33_local1 ) == "string" then f34_local0.name = f33_local1 else for f34_local4, f34_local5 in pairs( f33_local1 ) do f34_local0[f34_local4] = f34_local5 end end f34_local0.original = f34_arg1 return f34_arg0:dispatchEventToParent( f34_local0 ) else return f34_arg0:dispatchEventToParent( f33_local1 ) end end end end f33_local0 = false end function EmitEventToRoot( f35_arg0 ) local f35_local0 = f35_arg0 if type( f35_local0 ) == "string" then f35_local0 = { name = f35_local0 } end return function ( f36_arg0, f36_arg1 ) f36_arg0:dispatchEventToRoot( f35_local0 ) end end function EmitOmnvarUpdateEventToRoot( f37_arg0 ) return function ( f38_arg0 ) f38_arg0:dispatchEventToRoot( { name = "omnvar_update", omnvar = f37_arg0, value = Game.GetOmnvar( f37_arg0 ) } ) end end f0_local0 = function ( f39_arg0, f39_arg1 ) local f39_local0 = type( f39_arg0 ) if f39_local0 == "function" then assert( f39_arg1.properties, "Item built that didn't get it's properties set!" ) DebugPrint( "defaultDuration is " .. f39_arg0( f39_arg1.properties ) ) return f39_arg0( f39_arg1.properties ) elseif f39_local0 == "table" and f39_arg0.isProperty then assert( f39_arg1.properties, "Item built that didn't get it's properties set!" ) DebugPrint( "defaultDuration is " .. f39_arg0.func( f39_arg1.properties ) ) return f39_arg0.func( f39_arg1.properties ) else return f39_arg0 end end function AnimateToStateWithEvent( f40_arg0, f40_arg1, f40_arg2, f40_arg3 ) local f40_local0 = f40_arg0 local f40_local1 = f40_arg1 local f40_local2 = f40_arg2 local f40_local3 = f40_arg3 return function ( f41_arg0, f41_arg1 ) local f41_local0 = f0_local0( f40_local1, f41_arg0 ) local f41_local1 = f0_local0( f40_local2, f41_arg0 ) local f41_local2 = f0_local0( f40_local3, f41_arg0 ) if f41_arg0:hasAnimationState( f40_local0 ) then if Engine.GetDvarBool( "lui_print_anim_states" ) then local f41_local3 = "None" if f41_arg0.id ~= nil then f41_local3 = f41_arg0.id end DebugPrint( "LUI: AnimateToStateWithEvent: id: " .. f41_local3 .. " state: " .. f40_local0 ) end f41_arg0:animateToState( f40_local0, f41_local0, f41_local1, f41_local2 ) end end end function AnimateToState( f42_arg0, f42_arg1, f42_arg2, f42_arg3 ) local f42_local0 = f42_arg0 local f42_local1 = f42_arg1 local f42_local2 = f42_arg2 local f42_local3 = f42_arg3 return function ( f43_arg0, f43_arg1 ) f43_arg0:registerEventHandler( LUI.FormatAnimStateFinishEvent( f42_local0 ), nil ) local f43_local0 = f0_local0( f42_local1, f43_arg0 ) local f43_local1 = f0_local0( f42_local2, f43_arg0 ) local f43_local2 = f0_local0( f42_local3, f43_arg0 ) if f43_arg0:hasAnimationState( f42_local0 ) then if Engine.GetDvarBool( "lui_print_anim_states" ) then local f43_local3 = "None" if f43_arg0.id ~= nil then f43_local3 = f43_arg0.id end DebugPrint( "LUI: AnimateToState: id: " .. f43_local3 .. " state: " .. f42_local0 ) end f43_arg0:animateToState( f42_local0, f43_local0, f43_local1, f43_local2 ) end end end function ChooseAnimateToState( f44_arg0, f44_arg1, f44_arg2 ) local f44_local0 = f44_arg0 local f44_local1 = f44_arg1 local f44_local2 = f44_arg2 return function ( f45_arg0, f45_arg1 ) local f45_local0 = f44_local2[1] local f45_local1 = f0_local0( f44_local2[2], f45_arg0 ) local f45_local2 = f0_local0( f44_local2[3], f45_arg0 ) local f45_local3 = f0_local0( f44_local2[4], f45_arg0 ) if f44_local0( f45_arg0, f45_arg1 ) then f45_local0 = f44_local1[1] f45_local1 = f0_local0( f44_local1[2], f45_arg0 ) f45_local2 = f0_local0( f44_local1[3], f45_arg0 ) f45_local3 = f0_local0( f44_local1[4], f45_arg0 ) end if f45_arg0:hasAnimationState( f45_local0 ) then if Engine.GetDvarBool( "lui_print_anim_states" ) then local f45_local4 = "None" if f45_arg0.id ~= nil then f45_local4 = f45_arg0.id end DebugPrint( "LUI: ChooseAnimateToState: id: " .. f45_local4 .. " state: " .. f45_local0 ) end f45_arg0:animateToState( f45_local0, f45_local1, f45_local2, f45_local3 ) end end end f0_local1 = function ( f46_arg0, f46_arg1, f46_arg2, f46_arg3 ) local f46_local0 = f46_arg0 local f46_local1 = 2 local f46_local2 = f46_arg1 local f46_local3 = f46_arg2 local f46_local4 = f46_arg3 return function ( f47_arg0, f47_arg1 ) if #f46_local0 < f46_local1 then f46_local1 = 1 if not f46_local3 then return end end local f47_local0 = f46_local0[f46_local1] f47_arg0:registerEventHandler( f47_arg1.name, nil ) if f46_local2 and not f47_arg0:isInFocus() and not f47_arg0:isParentInFocus() then return elseif f47_arg1.interrupted then if Engine.GetDvarBool( "lui_print_anim_states" ) then local f47_local1 = "None" if f47_arg0.id ~= nil then f47_local1 = f47_arg0.id end DebugPrint( "LUI: Animation to state '" .. f47_local0[1] .. "' interrupted! id: " .. f47_local1 ) end return end local f47_local1 = LUI.FormatAnimStateFinishEvent( f47_local0[1] ) f47_arg0:animateToState( f47_local0[1], f47_local0[2], f47_local0[3], f47_local0[4] ) if f46_local3 or f46_local1 ~= #f46_local0 and not f46_local3 then f47_arg0:registerEventHandler( f47_local1, REG9 ) end if f46_local1 == #f46_local0 and not f46_local3 and f46_local4 then f47_arg0:registerEventHandler( f47_local1, function ( element, event ) element:close() end ) end f46_local1 = f46_local1 + 1 end end function AnimateLoop( f49_arg0, f49_arg1 ) local f49_local0 = f49_arg0 local f49_local1 = f49_arg1 return function ( f50_arg0, f50_arg1 ) if Engine.GetDvarBool( "lui_print_anim_states" ) then local f50_local0 = "None" if f50_arg0.id ~= nil then f50_local0 = f50_arg0.id end DebugPrint( "LUI: AnimateLoop: id: " .. f50_local0 ) end if Engine.GetDvarBool( "lui_print_anim_states" ) then for f50_local3, f50_local4 in ipairs( f49_local0 ) do DebugPrint( "\t->" .. f50_local4[1] ) end end local f50_local0 = assert local f50_local1 = f49_local0 if f50_local1 then f50_local1 = #f49_local0 end f50_local0( f50_local1, "AnimateLoop does not have animation states!" ) f50_local0 = f49_local0[1] f50_local1 = LUI.FormatAnimStateFinishEvent( f50_local0[1] ) if #f49_local0 == 1 then DebugPrint( "LUI Warning: AnimateLoop only has one animation state! " .. f49_local0[1][1] ) else f50_arg0:registerEventHandler( f50_local1, f0_local1( f49_local0, f49_local1, true ) ) end f50_arg0:animateToState( f50_local0[1], f50_local0[2], f50_local0[3], f50_local0[4] ) end end function AnimateSequence( f51_arg0 ) local f51_local0 = f51_arg0 local f51_local1 = requireFocus return function ( f52_arg0, f52_arg1 ) if Engine.GetDvarBool( "lui_print_anim_states" ) then local f52_local0 = "None" if f52_arg0.id ~= nil then f52_local0 = f52_arg0.id end DebugPrint( "LUI: AnimateSequence: id: " .. f52_local0 ) end if Engine.GetDvarBool( "lui_print_anim_states" ) then for f52_local3, f52_local4 in ipairs( f51_local0 ) do DebugPrint( "\t->" .. f52_local4[1] ) end end local f52_local0 = assert local f52_local1 = f51_local0 if f52_local1 then f52_local1 = #f51_local0 end f52_local0( f52_local1, "AnimateSequence does not have animation states!" ) f52_local0 = f51_local0[1] f52_local1 = LUI.FormatAnimStateFinishEvent( f52_local0[1] ) if #f51_local0 == 1 then DebugPrint( "LUI Warning: AnimateSequence only has one animation state! " .. f51_local0[1][1] ) else f52_arg0:registerEventHandler( f52_local1, f0_local1( f51_local0, f51_local1, false ) ) end f52_arg0:animateToState( f52_local0[1], f52_local0[2], f52_local0[3], f52_local0[4] ) end end function AnimateSequenceAndClose( f53_arg0 ) local f53_local0 = f53_arg0 local f53_local1 = requireFocus return function ( f54_arg0, f54_arg1 ) if Engine.GetDvarBool( "lui_print_anim_states" ) then local f54_local0 = "None" if f54_arg0.id ~= nil then f54_local0 = f54_arg0.id end DebugPrint( "LUI: AnimateSequence: id: " .. f54_local0 ) end for f54_local3, f54_local4 in ipairs( f53_local0 ) do local f54_local5 = LUI.FormatAnimStateFinishEvent( f54_local4[1] ) if Engine.GetDvarBool( "lui_print_anim_states" ) then DebugPrint( "\t->" .. f54_local4[1] ) end f54_arg0:registerEventHandler( f54_local5, nil ) end f54_local0 = assert f54_local1 = f53_local0 if f54_local1 then f54_local1 = #f53_local0 end f54_local0( f54_local1, "AnimateSequence does not have animation states!" ) f54_local0 = f53_local0[1] f54_local1 = f53_local0[#f53_local0] f54_local2 = LUI.FormatAnimStateFinishEvent( f54_local0[1] ) if #f53_local0 == 1 then DebugPrint( "LUI Warning: AnimateSequence only has one animation state! " .. f53_local0[1][1] ) else f54_arg0:registerEventHandler( f54_local2, f0_local1( f53_local0, f53_local1, false, true ) ) end f54_arg0:animateToState( f54_local0[1], f54_local0[2], f54_local0[3], f54_local0[4] ) end end function DoMultiple( f55_arg0 ) local f55_local0 = f55_arg0 return function ( f56_arg0, f56_arg1 ) for f56_local3, f56_local4 in ipairs( f55_local0 ) do assert( type( f56_local4 ) == "function" ) f56_local4( f56_arg0, f56_arg1 ) end end end function HandleSilently( f57_arg0 ) return function ( f58_arg0, f58_arg1 ) if not f58_arg1.dispatchChildren then f58_arg0:dispatchEventToChildren( f58_arg1 ) end return f57_arg0( f58_arg0, f58_arg1 ) end end function OmnvarUpdateFilter( f59_arg0, f59_arg1 ) return { [f59_arg0] = f59_arg1 } end function HandlePrint( f60_arg0 ) local f60_local0 = f60_arg0 return function ( f61_arg0, f61_arg1 ) DebugPrint( f60_local0 ) end end function UpdateTextWithCall( f62_arg0, ... ) local f62_local0 = { ... } return function ( f63_arg0, f63_arg1 ) if f62_arg0 ~= nil then local f63_local0 = f62_arg0( unpack( f62_local0 ) ) if f63_local0 ~= nil then f63_arg0:setText( f63_local0 ) end end end end helpers = { Property = Property, OppositeProperty = OppositeProperty, HalfProperty = HalfProperty, HalfOppositeProperty = HalfOppositeProperty, RunPropertyFunc = RunPropertyFunc, Function = Function, BaseState = BaseState, AnimateToState = AnimateToState, AnimateToStateWithEvent = AnimateToStateWithEvent, DoMultiple = DoMultiple, HandleSilently = HandleSilently, OmnvarUpdateFilter = OmnvarUpdateFilter, AnimateLoop = AnimateLoop, AnimateSequence = AnimateSequence, TryProperty = TryProperty, ParentProperty = ParentProperty, OpenMenu = OpenMenu, PopupMenu = PopupMenu, LeaveMenu = LeaveMenu, RestoreMenu = RestoreMenu, CloseAllMenus = CloseAllMenus, OpenOldMenu = OpenOldMenu, HandlePrint = HandlePrint, UpdateTextWithCall = UpdateTextWithCall, EmitEvent = EmitEvent, EmitEventToParent = EmitEventToParent, EmitEventToRoot = EmitEventToRoot, EmitOmnvarUpdateEventToRoot = EmitOmnvarUpdateEventToRoot, ChooseAnimateToState = ChooseAnimateToState, AnimateSequenceAndClose = AnimateSequenceAndClose } f0_local2 = function ( menu, controller ) local self = LUI.UIElement.new() self:setUseStencil( true ) return self end local f0_local3 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupPopulationMap() return self end local f0_local4 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupLeakyWatermark() return self end local f0_local5 = function ( menu, controller ) local self = LUI.UIElement.new() local f67_local1 = nil if controller then f67_local1 = controller.compassType end self:setupMinimap( f67_local1 ) return self end local f0_local6 = function ( menu, controller ) local self = LUI.UIElement.new() local f68_local1 = nil if controller then f68_local1 = controller.compassType end self:setupMinimapIcons( f68_local1 ) return self end local f0_local7 = function ( f69_arg0, f69_arg1 ) if not LUI.UIElement.setupCompass then return LUI.UIImage.new( f69_arg0, f69_arg1 ) else local self = LUI.UIElement.new() self:setupCompass() return self end end local f0_local8 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupUIBindText( controller.dataSource, controller.textFormat, controller.param1 or 0 ) self:setClass( LUI.UIText ) return self end local f0_local9 = function ( menu, controller ) local self = LUI.UIImage.new() self:setupUIBindImage( controller.dataSource, controller.param1 or 0 ) return self end local f0_local10 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupUIIntWatch( controller.dataSource, controller.param1 or 0 ) return self end local f0_local11 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupUIScorebar( controller.dataSource ) self.m_maxWidth = controller.maxWidth self.m_maxScore = controller.maxScore return self end local f0_local12 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupWorldBlur() return self end local f0_local13 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupScreenshotViewer() return self end local f0_local14 = function ( menu, controller ) local self = LUI.UIElement.new() self:setupScreenshotViewer() return self end function buildOwnerDraw( menu, controller ) local self = LUI.UIElement.new() self:setupOwnerdraw( controller.ownerDraw, controller.ownerDrawTextScale, controller.ownerDrawTextStyle ) return self end function buildTextEdit( menu, controller ) local self = LUI.UIElement.new() self:setupTextEdit( controller.max_length, controller.password_field, controller.use_auto_align ) if controller.use_auto_align then self:setUseStencil( true ) end return self end function buildLoadingDots( menu, controller ) local self = LUI.UIElement.new() if self.setLoadingDots then self:setLoadingDots() end return self end function buildContentServerImage( menu, controller ) local self = LUI.UIElement.new() self:setupContentServerImage() self.setFileId = function ( f81_arg0, f81_arg1, f81_arg2 ) f81_arg0.m_fileId = f81_arg1 or "" f81_arg0.m_waitingForDownload = true f81_arg0.m_thumbName = f81_arg2 or "" end self:setFileId( controller.file_id, controller.thumbName ) return self end m_types = { UIElement = LUI.UIElement.build, UIText = LUI.UIText.build, UIBindText = f0_local8, UIBindImage = f0_local9, UIIntWatch = f0_local10, UIImage = LUI.UIImage.build, UILitImage = LUI.UILitImage.build, UIButton = LUI.UIButton.build, UITimer = LUI.UITimer.build, UIStencil = f0_local2, UIVerticalList = LUI.UIVerticalList.build, UIScrollingVerticalList = LUI.UIScrollingVerticalList.build, UIVerticalScrollbar = LUI.UIVerticalScrollbar.build, UIHorizontalList = LUI.UIHorizontalList.build, UIBarrelList = LUI.UIBarrelList.build, UIGrid = LUI.UIGrid.build, UIVerticalNavigator = LUI.UIVerticalNavigator.build, UIHorizontalNavigator = LUI.UIHorizontalNavigator.build, UICountdown = LUI.UICountdown.build, UILongCountdown = LUI.UILongCountdown.build, UITechyDigits = LUI.UITechyDigits.build, UIBindButton = LUI.UIBindButton.build, UILoadingDots = buildLoadingDots, UIPopulationMap = f0_local3, UILeakyWatermark = f0_local4, UIMinimap = f0_local5, UIMinimapIcons = f0_local6, UICompass = f0_local7, UIScorebar = f0_local11, UIWorldBlur = f0_local12, UIScreenshotViewer = f0_local13, UICharacterWindow = LUI.UICharacterWindow.build, UIOwnerdraw = buildOwnerDraw, UITextEdit = buildTextEdit, ContentServerImage = buildContentServerImage } m_definitions = {} m_debugData = { requstedMenu = "", currentDef = {}, definitionStack = {} } baseAssert = assert local f0_local15 = function ( f82_arg0, f82_arg1 ) m_debugData.currentDef = f82_arg0 m_debugData.definitionStack[#m_debugData.definitionStack + 1] = { type = f82_arg0.type, id = f82_arg0.id, childNum = f82_arg1 } end local f0_local16 = function () m_debugData.definitionStack[#m_debugData.definitionStack] = nil end local f0_local17 = function () for f84_local4, f84_local5 in ipairs( m_debugData.definitionStack ) do local f84_local3 = f84_local4 .. ") type: " .. f84_local5.type if f84_local5.id then f84_local3 = f84_local3 .. " id: " .. f84_local5.id end if f84_local5.childNum then f84_local3 = f84_local3 .. " childNum: " .. f84_local5.childNum end DebugPrint( f84_local3 ) end DebugPrint( "Current itemDef: " ) defPrint( m_debugData.currentDef ) end local f0_local18 = function ( f85_arg0, f85_arg1, ... ) if not f85_arg0 then if type( f85_arg1 ) == "string" then DebugPrint( "Error: " .. string.format( f85_arg1, ... ) ) end DebugPrint( "Error Making Menu: " .. m_debugData.requstedMenu ) f0_local17() baseAssert( f85_arg0, ... ) end end function defPrint( f86_arg0, f86_arg1 ) if not f86_arg1 then f86_arg1 = 0 end for f86_local4, f86_local5 in pairs( f86_arg0 ) do local f86_local6 = string.rep( " ", f86_arg1 ) .. f86_local4 .. ": " if type( f86_local5 ) == "table" then DebugPrint( f86_local6 ) defPrint( f86_local5, f86_arg1 + 1 ) else DebugPrint( f86_local6 .. tostring( f86_local5 ) ) end local f86_local3 = getmetatable( f86_arg0 ) if f86_local3 and f86_local3.__index then DebugPrint( f86_local6 .. "__index" ) defPrint( f86_local3.__index, f86_arg1 + 1 ) end end end assert = f0_local18 function registerDef( f87_arg0, f87_arg1 ) assert( m_definitions[f87_arg0] == nil, "This type has already been registered! " .. f87_arg0 ) assert( m_types[f87_arg0] == nil, "This type is a basic element type that has been registered! " .. f87_arg0 ) assert( type( f87_arg1 ) == "function", "Attempting to register old style type definition! See wiki for info on how to update your def. def = " .. f87_arg0 ) m_definitions[f87_arg0] = f87_arg1 end function registerType( f88_arg0, f88_arg1 ) assert( m_definitions[f88_arg0] == nil, "This type has already been registered! " .. f88_arg0 ) assert( m_types[f88_arg0] == nil, "This type is a basic element type that has been registered! " .. f88_arg0 ) assert( type( f88_arg1 ) == "function", "The buildFunction for this type is not a function! typeName = " .. f88_arg0 ) m_types[f88_arg0] = f88_arg1 end g_keyWordList = hashset( { "properties", "children", "childrenFeeder", "states", "id", "type", "handlers" } ) local f0_local19 = function ( f89_arg0 ) if g_keyWordList[f89_arg0] then assert( false, "It appears that you are using the keyword '" .. f89_arg0 .. "' as a member name, are you sure this is set up correctly?" ) end end validateName = f0_local19 f0_local19 = function ( f90_arg0, f90_arg1, f90_arg2 ) local f90_local0 = type( f90_arg0 ) if f90_local0 == "function" then return f0_local19( f90_arg0( f90_arg1, f90_arg2 ), f90_arg1, f90_arg2 ) end assert( f90_local0 == "table", "Current state is not a table, did you forget {}?" ) for f90_local5, f90_local6 in pairs( f90_arg0 ) do validateName( f90_local5 ) if f90_arg1.type ~= "UIImage" and f90_arg1.type ~= "UILitImage" and f90_arg1.type ~= "UIScorebar" and f90_arg1.type ~= "UICompass" and f90_local5 == "material" then DebugPrint( "LUI Warning: It appears that you are assigning material as a state member in an element that is not of type UIImage, is this intentional?" ) end local f90_local4 = type( f90_local6 ) if f90_local4 == "function" then f90_arg0[f90_local5] = f90_local6( f90_arg2 ) end if f90_local4 == "table" and f90_local6.isProperty then f90_arg0[f90_local5] = f90_local6.func( f90_arg2 ) else f90_arg0[f90_local5] = f90_local6 end end return f90_arg0 end local f0_local20 = function ( f91_arg0, f91_arg1, f91_arg2, f91_arg3 ) if f91_arg1.states then assert( f91_arg1.states.default, "No default state provided for element definition" ) for f91_local3, f91_local4 in pairs( f91_arg1.states ) do validateName( f91_local3 ) f91_local4 = f0_local19( f91_local4, f91_arg1, f91_arg2 ) if f91_arg1.debug or f91_arg2 and f91_arg2.debug then DebugPrint( "Printing out formatted state:" ) defPrint( builtState ) end f91_arg0:registerAnimationState( f91_local3, f91_local4 ) if not (f91_local3 ~= "default" or f91_arg3) or f91_local4.animateOnRefresh then f91_arg0:animateToState( f91_local3 ) end end end end function buildChildren( f92_arg0, f92_arg1, f92_arg2 ) assert( not f92_arg2.type, "It appears that the children list is not a list but instead is a single element definition." ) for f92_local3, f92_local4 in ipairs( f92_arg2 ) do local f92_local5 = buildItems( f92_local4, f92_arg1, f92_arg0, f92_local3 ) f92_local5:close() f92_arg0:addElement( f92_local5 ) end end local f0_local21 = function ( f93_arg0, f93_arg1 ) if type( f93_arg0 ) == "table" and f93_arg0.isProperty then return f93_arg0.func( f93_arg1 ) else return f93_arg0 end end function buildItems( f94_arg0, f94_arg1, f94_arg2, f94_arg3 ) assert( f94_arg0.type, "No type in itemDef!" ) f0_local15( f94_arg0, f94_arg3 ) Memory.CheckLow() if m_definitions[f94_arg0.type] then local f94_local0 = nil if type( m_definitions[f94_arg0.type] ) == "function" then f94_local0 = m_definitions[f94_arg0.type]() else f94_local0 = m_definitions[f94_arg0.type] end f94_arg0.type = nil if not f94_local0.properties then f94_local0.properties = {} end if f94_arg0.properties and f94_local0.properties then for f94_local4, f94_local5 in pairs( f94_arg0.properties ) do validateName( f94_local4 ) f94_local0.properties[f94_local4] = f94_local5 end f94_arg0.properties = nil end for f94_local4, f94_local5 in pairs( f94_arg0 ) do f94_local0[f94_local4] = f94_local5 end f94_local1 = buildItems( f94_local0, f94_arg1, f94_arg2 ) if f94_local1 and f94_local1.properties then f94_local1.m_ownerController = f94_local1.properties.exclusiveController end f0_local16() return f94_local1 else assert( m_types[f94_arg0.type], "Unknown type for element definition: " .. f94_arg0.type ) local f94_local0 = f94_arg0.properties or f94_arg1 if f94_local0 then for f94_local4, f94_local5 in pairs( f94_local0 ) do validateName( f94_local4 ) if type( f94_local5 ) == "table" and f94_local5.isProperty then f94_local0[f94_local4] = f94_local5.func( f94_arg1 ) end end end local f94_local1 = nil local f94_local2 = true if f94_arg2 and f94_arg0.id then f94_local1 = f94_arg2:getChildById( f94_arg0.id ) end if not f94_local1 then f94_local2 = false f94_local1 = m_types[f94_arg0.type]( f94_arg0, f94_local0, f94_arg3 ) end f94_local1._marked = true f94_local1._fromMenuBuilder = true f94_local1._isRefresh = f94_local2 if f94_arg1 and f94_arg1.exclusiveController then f94_local1.m_ownerController = f94_arg1.exclusiveController f94_local0.exclusiveController = f94_arg1.exclusiveController end if not (not f94_local0 or not f94_local0.debug) or f94_arg0.debug then DebugPrint( "Printing out item Props:" ) defPrint( f94_local0 ) DebugPrint( "Printing out item Def:" ) defPrint( f94_arg0 ) f94_local0.debug = nil f94_arg0.debug = nil end if f94_arg0.focusable == true then f94_local1:makeFocusable() elseif f94_arg0.focusable == false then f94_local1:makeNotFocusable() end if f94_arg0.ignoreMouseFocus then f94_local1:makeFocusable() f94_local1.m_ignoreMouseFocus = true end f94_local1.m_outsideParentList = f94_local1.m_outsideParentList or false f94_local1.m_requireFocusType = f94_arg0.requireFocusType if f94_arg0.disableNavigation then f94_local1.m_disableNavigation = true end if f94_local1.setText and f94_local0 and f94_local0.text then f94_local1:setText( f94_local0.text ) end if f94_local1.setTextStyle and f94_local0 and f94_local0.textStyle then f94_local1:setTextStyle( f94_local0.textStyle ) end local f94_local3 = f94_local1.disabled if not f94_local3 then f94_local3 = false end f94_local1.disabled = false if f94_arg0.disabledFunc then f94_local1.disabled = f94_arg0.disabledFunc( f94_local1, f94_local0 ) end if f94_arg0.disabled then f94_local1.disabled = true end if f94_local3 ~= f94_local1.disabled then f94_local1.disabledStateChange = true else f94_local1.disabledStateChange = false end if f94_arg0.audio then if f94_local1.setGainFocusSFX and f94_arg0.audio.button_over then f94_local1:setGainFocusSFX( f94_arg0.audio.button_over ) end if f94_local1.setActionSFX and f94_arg0.audio.button_action then f94_local1:setActionSFX( f94_arg0.audio.button_action ) end end if f94_arg0.childrenFeeder then local f94_local4 = f94_arg0.childrenFeeder if type( f94_local4 ) == "table" and f94_local4.isProperty then f94_local4 = f94_arg0.childrenFeeder.func( f94_local0 ) end assert( type( f94_local4 ) == "function", "Feeders must be a function or referenced by the MBh.Property helper" ) f94_arg0.children = f94_local4( f94_local0 ) f94_local1.childrenFeeder = f94_local4 f94_local1:registerEventHandler( "menu_refresh", HandleMenuRefresh ) end if f94_arg0.children then for f94_local7, f94_local8 in ipairs( f94_arg0.children ) do if f94_local8.disabledFunc then f94_local1:registerEventHandler( "menu_refresh", HandleMenuRefresh ) f94_local1.children = f94_arg0.children break end end end if f94_arg0.id then f94_local1.id = f94_arg0.id end if f94_arg0.listDefaultFocus then f94_local1.listDefaultFocus = true end assert( not f94_arg0.additionalHandlers, "The additional_handlers must be specified inside the 'properties' tables, not in the main definition" ) f0_local20( f94_local1, f94_arg0, f94_local0, f94_local2 ) if f94_arg0.handlers then for f94_local7, f94_local8 in pairs( f94_arg0.handlers ) do if f94_local7 == "omnvar_update" then assert( type( f94_local8 ) == "table", "omnvar_update should be a table of handlers for specific omnvars" ) local f94_local9 = f94_local1:getRootParent() f94_local9 = f94_local9.eventCatcher for f94_local13, f94_local14 in pairs( f94_local8 ) do f94_local9:registerOmnvarHandler( f94_local1, f94_local13, f0_local21( f94_local14, f94_local0 ) ) end end if f94_local7 == "dvar_update" then assert( type( f94_local8 ) == "table", "dvar_update should be a table of handlers for specific dvars" ) local f94_local9 = f94_local1:getRootParent() f94_local9 = f94_local9.eventCatcher for f94_local13, f94_local14 in pairs( f94_local8 ) do f94_local9:registerDvarHandler( f94_local1, f94_local13, f0_local21( f94_local14, f94_local0 ) ) end end f94_local1:registerEventHandler( f94_local7, f0_local21( f94_local8, f94_local0 ) ) end else f94_arg0.handlers = {} end if f94_local0 and f94_local0.additional_handlers then assert( not f94_local0.additional_handlers.omnvar_update, "Omnvar_update events don't support being an 'additional_handler'" ) assert( not f94_local0.additional_handlers.dvar_update, "Dvar_update events don't support being an 'additional_handler'" ) for f94_local7, f94_local8 in pairs( f94_local0.additional_handlers ) do if not (not f94_local2 or not f94_arg0.handlers[f94_local7]) or not f94_local2 then f94_local1:addEventHandler( f94_local7, f94_local8 ) end end f94_local0.additional_handlers = nil end f94_local1.properties = f94_local0 if f94_arg0.children then buildChildren( f94_local1, f94_local0, f94_arg0.children ) end if f94_local1.disabledStateChange then if f94_local1.disabled then f94_local1:processEvent( { name = "disable" } ) else f94_local1:processEvent( { name = "enable" } ) end end if f94_arg0.isSignInMenu then f94_local1.isSignInMenu = f94_arg0.isSignInMenu end f0_local16() return f94_local1 end end function buildMenu( f95_arg0, f95_arg1 ) m_debugData.requstedMenu = f95_arg0 m_debugData.definitionStack = {} if not f95_arg1 then f95_arg1 = {} end local f95_local0 = buildItems( { type = f95_arg0, properties = f95_arg1 }, {}, nil ) m_debugData.requstedMenu = nil m_debugData.definitionStack = {} m_debugData.currentDef = {} return f95_local0 end function unmarkChildren( f96_arg0 ) local f96_local0 = f96_arg0:getFirstChild() while f96_local0 ~= nil do local f96_local1 = f96_local0:getNextSibling() f96_local0._marked = false unmarkChildren( f96_local0 ) f96_local0 = f96_local1 end end function closeUnmarkedChildren( f97_arg0 ) local f97_local0 = f97_arg0:getFirstChild() while f97_local0 ~= nil do local f97_local1 = f97_local0:getNextSibling() if f97_local0._fromMenuBuilder and not f97_local0._marked then f97_local0:close() else closeUnmarkedChildren( f97_local0 ) end f97_local0 = f97_local1 end end function HandleMenuRefresh( f98_arg0, f98_arg1 ) unmarkChildren( f98_arg0 ) local f98_local0 = f98_arg0.children if f98_arg0.childrenFeeder then f98_local0 = f98_arg0.childrenFeeder( f98_arg0.properties ) end local f98_local1 = f98_arg0:getAllFocusedChildren() if #f98_local1 > 0 then f98_arg0:saveState() end m_debugData.requstedMenu = "menuRefreshEvent" m_debugData.definitionStack = {} buildChildren( f98_arg0, f98_arg0.properties, f98_local0 ) m_debugData.requstedMenu = nil m_debugData.definitionStack = {} m_debugData.currentDef = {} closeUnmarkedChildren( f98_arg0 ) if #f98_local1 > 0 then local f98_local2, f98_local3 = f98_arg0:restoreState( true ) if f98_local3 == 0 then f98_arg0:clearSavedState() f98_arg0:processEvent( { name = "gain_focus" } ) end end f98_arg0:processEvent( { name = "element_refresh", dispatchChildren = true } ) end function BuildAddChild( f99_arg0, f99_arg1 ) local f99_local0 = nil if type( f99_arg1 ) == "table" then f99_local0 = buildItems( f99_arg1, f99_arg0.properties, f99_arg0 ) else f99_local0 = f99_arg1 end m_debugData.requstedMenu = nil m_debugData.definitionStack = {} m_debugData.currentDef = {} f99_arg0:addElement( f99_local0 ) return f99_local0 end function BuildRegisteredType( f100_arg0, f100_arg1 ) assert( type( f100_arg0 ) == "string" ) assert( m_types[f100_arg0], "Could not find a constructor for " .. f100_arg0 .. "." .. (m_definitions[f100_arg0] and " Use 'LUI.MenuBuilder.BuildAddChild' to build elements registered using the deprecated MenuBuilder" or "") ) return m_types[f100_arg0]( nil, f100_arg1 ) end function AnimStateBasedOn( f101_arg0, f101_arg1 ) return setmetatable( f101_arg1, { __index = f101_arg0 } ) end LockTable( _M )