format ui scripts

This commit is contained in:
quaK 2024-08-06 12:52:32 +03:00
parent 7835bb0477
commit 364813c486
13 changed files with 1907 additions and 2091 deletions

View File

@ -63,11 +63,13 @@ local f0_local3 = function ( f2_arg0, f2_arg1, f2_arg2 )
if CONDITIONS.IsGameBattlesAllowed(f2_arg0) then if CONDITIONS.IsGameBattlesAllowed(f2_arg0) then
f2_arg0.MLGGameBattlesButton:addEventHandler("button_action", function(f7_arg0, f7_arg1) f2_arg0.MLGGameBattlesButton:addEventHandler("button_action", function(f7_arg0, f7_arg1)
if Engine.GetDvarBool("splitscreen") then if Engine.GetDvarBool("splitscreen") then
LUI.FlowManager.RequestPopupMenu( f2_arg0, "MLGGamebattlesSplitscreenPopup", true, f7_arg1.controller, false, { LUI.FlowManager.RequestPopupMenu(f2_arg0, "MLGGamebattlesSplitscreenPopup", true, f7_arg1.controller,
false, {
controllerIndex = f2_arg1 controllerIndex = f2_arg1
}) })
elseif Lobby.IsNotAloneInPrivateParty() then elseif Lobby.IsNotAloneInPrivateParty() then
LUI.FlowManager.RequestPopupMenu( f2_arg0, "DisbandPartyEnterGameBattlesLobbyPopup", true, f7_arg1.controller, false, { LUI.FlowManager.RequestPopupMenu(f2_arg0, "DisbandPartyEnterGameBattlesLobbyPopup", true,
f7_arg1.controller, false, {
controllerIndex = f2_arg1 controllerIndex = f2_arg1
}) })
else else

View File

@ -119,36 +119,21 @@ function MissionsVerticalLayout( menu, controller )
end end
CreateAClassButton:RegisterAnimationSequence( "ContractsKillswitched", { CreateAClassButton:RegisterAnimationSequence("ContractsKillswitched", {{function()
{
function ()
return self.CreateAClassButton:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 80, _1080p * 110, 0) return self.CreateAClassButton:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 80, _1080p * 110, 0)
end end}})
}
} )
if CONDITIONS.IsQuarterMasterAllowed(self) then if CONDITIONS.IsQuarterMasterAllowed(self) then
f3_local6:RegisterAnimationSequence( "ContractsKillswitched", { f3_local6:RegisterAnimationSequence("ContractsKillswitched", {{function()
{
function ()
return self.Armory:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150, 0) return self.Armory:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150, 0)
end}})
end end
} Barracks:RegisterAnimationSequence("ContractsKillswitched", {{function()
} )
end
Barracks:RegisterAnimationSequence( "ContractsKillswitched", {
{
function ()
return self.Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190, 0) return self.Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190, 0)
end end}})
} ButtonDescription:RegisterAnimationSequence("ContractsKillswitched", {{function()
} ) return self.ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, _1080p * 201, _1080p * 301,
ButtonDescription:RegisterAnimationSequence( "ContractsKillswitched", { 0)
{ end}})
function ()
return self.ButtonDescription:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 504, _1080p * 201, _1080p * 301, 0 )
end
}
} )
self._sequences.ContractsKillswitched = function() self._sequences.ContractsKillswitched = function()
CreateAClassButton:AnimateSequence("ContractsKillswitched") CreateAClassButton:AnimateSequence("ContractsKillswitched")
if CONDITIONS.IsQuarterMasterAllowed(self) then if CONDITIONS.IsQuarterMasterAllowed(self) then

View File

@ -1,223 +1,193 @@
local function PostLoadFunc( f1_arg0, f1_arg1, f1_arg2 ) local function PostLoadFunc(buttonElement, controllerIndex, controller)
assert( f1_arg0.GenericButton ) assert(buttonElement.GenericButton)
f1_arg0.GenericButton:addEventHandler( "button_action", function ( f3_arg0, f3_arg1 ) buttonElement.GenericButton:addEventHandler("button_action", function(clickedElement, eventArgs)
local f3_local0 = f1_arg0:GetDataSource() local dataSource = buttonElement:GetDataSource()
f3_local0.buttonOnClickFunction( f3_arg0, f3_arg1 ) dataSource.buttonOnClickFunction(clickedElement, eventArgs)
end) end)
f1_arg0.GenericButton:addEventHandler( "button_over", function ( f4_arg0, f4_arg1 )
local f4_local0 = f1_arg0:GetDataSource() buttonElement.GenericButton:addEventHandler("button_over", function(hoveredElement, eventArgs)
f4_local0.buttonOnHoverFunction( f4_arg0, f4_arg1 ) local dataSource = buttonElement:GetDataSource()
f4_local0 = f1_arg0:GetDataSource() dataSource.buttonOnHoverFunction(hoveredElement, eventArgs)
f4_local0 = f4_local0.levelName dataSource = buttonElement:GetDataSource()
dataSource = dataSource.levelName
end) end)
f1_arg0.GenericButton:addEventHandler( "button_up", function ( f5_arg0, f5_arg1 )
local f5_local0 = f1_arg0:GetDataSource() buttonElement.GenericButton:addEventHandler("button_up", function(unhoveredElement, eventArgs)
f5_local0.buttonOnHoverFunction( f5_arg0, f5_arg1 ) local dataSource = buttonElement:GetDataSource()
f5_local0 = f1_arg0:GetDataSource() dataSource.buttonOnHoverFunction(unhoveredElement, eventArgs)
f5_local0 = f5_local0.levelName dataSource = buttonElement:GetDataSource()
dataSource = dataSource.levelName
end) end)
f1_arg0:registerEventHandler( "grid_anim", function ( element, event )
buttonElement:registerEventHandler("grid_anim", function(element, event)
element:SetAlpha(event.value) element:SetAlpha(event.value)
end) end)
assert( f1_arg0.MainMissionIcon )
assert( f1_arg0.SAIcon ) buttonElement:SubscribeToDataSourceThroughElement(buttonElement, nil, function()
assert( f1_arg0.JAIcon ) local dataSource = buttonElement:GetDataSource()
f1_arg0:SubscribeToDataSourceThroughElement( f1_arg0, nil, function () dataSource = dataSource.levelName
local f7_local0 = f1_arg0:GetDataSource()
f7_local0 = f7_local0.levelName
end) end)
end end
function ModSelectButton(menu, controller) function ModSelectButton(menu, controller)
local self = LUI.UIButton.new() local modSelectButton = LUI.UIButton.new()
self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 30 * _1080p ) modSelectButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 30 * _1080p)
self.id = "ModSelectButton" modSelectButton.id = "ModSelectButton"
self._animationSets = {} modSelectButton._animationSets = {}
self._sequences = {} modSelectButton._sequences = {}
local f8_local1 = controller and controller.controllerIndex
if not f8_local1 and not Engine.InFrontend() then
f8_local1 = self:getRootController()
end
assert( f8_local1 )
local f8_local2 = self
local GenericButton = nil
GenericButton = MenuBuilder.BuildRegisteredType( "GenericButton", { local controllerIndex = controller and controller.controllerIndex
controllerIndex = f8_local1 if not controllerIndex and not Engine.InFrontend() then
controllerIndex = modSelectButton:getRootController()
end
assert(controllerIndex)
local buttonContainer = modSelectButton
local genericButton = nil
genericButton = MenuBuilder.BuildRegisteredType("GenericButton", {
controllerIndex = controllerIndex
}) })
GenericButton.id = "GenericButton" genericButton.id = "GenericButton"
GenericButton:SetAlpha( 0, 0 ) genericButton:SetAlpha(0, 0)
GenericButton:SetAnchorsAndPosition( 0, 1, 0, 0, 0, _1080p * 500, 0, 0 ) genericButton:SetAnchorsAndPosition(0, 1, 0, 0, 0, _1080p * 500, 0, 0)
GenericButton:SubscribeToModelThroughElement( self, "buttonLabel", function ()
local f9_local0 = self:GetDataSource() genericButton:SubscribeToModelThroughElement(modSelectButton, "buttonLabel", function()
f9_local0 = f9_local0.buttonLabel:GetValue( f8_local1 ) local dataSource = modSelectButton:GetDataSource()
if f9_local0 ~= nil then local buttonLabel = dataSource.buttonLabel:GetValue(controllerIndex)
GenericButton.Text:setText( LocalizeString( ToUpperCase( f9_local0 ) ), 0 ) if buttonLabel ~= nil then
genericButton.Text:setText(LocalizeString(ToUpperCase(buttonLabel)), 0)
end end
end) end)
self:addElement( GenericButton )
self.GenericButton = GenericButton
local GenericListButtonBackground = nil modSelectButton:addElement(genericButton)
modSelectButton.GenericButton = genericButton
GenericListButtonBackground = MenuBuilder.BuildRegisteredType( "GenericListArrowButtonBackground", { local listButtonBackground = nil
controllerIndex = f8_local1
listButtonBackground = MenuBuilder.BuildRegisteredType("GenericListArrowButtonBackground", {
controllerIndex = controllerIndex
}) })
GenericListButtonBackground.id = "GenericListButtonBackground" listButtonBackground.id = "GenericListButtonBackground"
GenericListButtonBackground:SetAnchorsAndPosition( 0, 0, 0, 0, 0, 0, 0, 0 ) listButtonBackground:SetAnchorsAndPosition(0, 0, 0, 0, 0, 0, 0, 0)
self:addElement( GenericListButtonBackground )
self.GenericListButtonBackground = GenericListButtonBackground
local Text = nil modSelectButton:addElement(listButtonBackground)
modSelectButton.GenericListButtonBackground = listButtonBackground
Text = LUI.UIStyledText.new() local buttonText = nil
Text.id = "Text"
Text:SetRGBFromInt( 14277081, 0 ) buttonText = LUI.UIStyledText.new()
Text:SetFontSize( 22 * _1080p ) buttonText.id = "Text"
Text:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) ) buttonText:SetRGBFromInt(14277081, 0)
Text:SetAlignment( LUI.Alignment.Left ) buttonText:SetFontSize(22 * _1080p)
Text:SetStartupDelay( 2000 ) buttonText:SetFont(FONTS.GetFont(FONTS.MainMedium.File))
Text:SetLineHoldTime( 400 ) buttonText:SetAlignment(LUI.Alignment.Left)
Text:SetAnimMoveTime( 300 ) buttonText:SetStartupDelay(2000)
Text:SetEndDelay( 1500 ) buttonText:SetLineHoldTime(400)
Text:SetCrossfadeTime( 750 ) buttonText:SetAnimMoveTime(300)
Text:SetAutoScrollStyle( LUI.UIStyledText.AutoScrollStyle.ScrollH ) buttonText:SetEndDelay(1500)
Text:SetMaxVisibleLines( 1 ) buttonText:SetCrossfadeTime(750)
Text:SetOutlineRGBFromInt( 0, 0 ) buttonText:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH)
Text:SetAnchorsAndPosition( 0, 0, 0.5, 0.5, _1080p * 44, _1080p * -41, _1080p * -11, _1080p * 11 ) buttonText:SetMaxVisibleLines(1)
Text:SubscribeToModelThroughElement( self, "buttonLabel", function () buttonText:SetOutlineRGBFromInt(0, 0)
local f10_local0 = self:GetDataSource() buttonText:SetAnchorsAndPosition(0, 0, 0.5, 0.5, _1080p * 44, _1080p * -41, _1080p * -11, _1080p * 11)
f10_local0 = f10_local0.buttonLabel:GetValue( f8_local1 )
if f10_local0 ~= nil then buttonText:SubscribeToModelThroughElement(modSelectButton, "buttonLabel", function()
Text:setText( LocalizeString( ToUpperCase( f10_local0 ) ), 0 ) local dataSource = modSelectButton:GetDataSource()
local buttonLabel = dataSource.buttonLabel:GetValue(controllerIndex)
if buttonLabel ~= nil then
buttonText:setText(LocalizeString(ToUpperCase(buttonLabel)), 0)
end end
end) end)
self:addElement( Text )
self.Text = Text
local Lock = nil modSelectButton:addElement(buttonText)
modSelectButton.Text = buttonText
Lock = LUI.UIImage.new() local lockIcon = nil
Lock.id = "Lock"
Lock:SetRGBFromTable( SWATCHES.genericButton.textDisabled, 0 )
Lock:SetAlpha( 0, 0 )
Lock:setImage( RegisterMaterial( "icon_slot_locked" ), 0 )
Lock:SetAnchorsAndPosition( 1, 0, 0.5, 0.5, _1080p * -32, _1080p * -6, _1080p * -12, _1080p * 14 )
self:addElement( Lock )
self.Lock = Lock
self._animationSets.DefaultAnimationSet = function () lockIcon = LUI.UIImage.new()
self._sequences.DefaultSequence = function () lockIcon.id = "Lock"
lockIcon:SetRGBFromTable(SWATCHES.genericButton.textDisabled, 0)
lockIcon:SetAlpha(0, 0)
lockIcon:setImage(RegisterMaterial("icon_slot_locked"), 0)
lockIcon:SetAnchorsAndPosition(1, 0, 0.5, 0.5, _1080p * -32, _1080p * -6, _1080p * -12, _1080p * 14)
modSelectButton:addElement(lockIcon)
modSelectButton.Lock = lockIcon
modSelectButton._animationSets.DefaultAnimationSet = function()
modSelectButton._sequences.DefaultSequence = function()
end end
Text:RegisterAnimationSequence( "ButtonOver", { buttonText:RegisterAnimationSequence("ButtonOver", {{function()
{ return modSelectButton.Text:SetRGBFromInt(0, 0)
function () end}, {function()
return self.Text:SetRGBFromInt( 0, 0 ) return modSelectButton.Text:SetAlpha(1, 0)
end end}})
},
{ lockIcon:RegisterAnimationSequence("ButtonOver", {{function()
function () return modSelectButton.Lock:SetAlpha(0, 0)
return self.Text:SetAlpha( 1, 0 ) end}, {function()
end return modSelectButton.Lock:SetRGBFromTable(SWATCHES.genericButton.textDisabled, 0)
} end}})
} )
Lock:RegisterAnimationSequence( "ButtonOver", { modSelectButton._sequences.ButtonOver = function()
{ buttonText:AnimateSequence("ButtonOver")
function () lockIcon:AnimateSequence("ButtonOver")
return self.Lock:SetAlpha( 0, 0 )
end
},
{
function ()
return self.Lock:SetRGBFromTable( SWATCHES.genericButton.textDisabled, 0 )
end
}
} )
self._sequences.ButtonOver = function ()
Text:AnimateSequence( "ButtonOver" )
Lock:AnimateSequence( "ButtonOver" )
end end
Text:RegisterAnimationSequence( "ButtonUp", { buttonText:RegisterAnimationSequence("ButtonUp", {{function()
{ return modSelectButton.Text:SetRGBFromInt(14277081, 0)
function () end}})
return self.Text:SetRGBFromInt( 14277081, 0 )
end lockIcon:RegisterAnimationSequence("ButtonUp", {{function()
} return modSelectButton.Lock:SetAlpha(0, 0)
} ) end}})
Lock:RegisterAnimationSequence( "ButtonUp", {
{ modSelectButton._sequences.ButtonUp = function()
function () buttonText:AnimateSequence("ButtonUp")
return self.Lock:SetAlpha( 0, 0 ) lockIcon:AnimateSequence("ButtonUp")
end
}
} )
self._sequences.ButtonUp = function ()
Text:AnimateSequence( "ButtonUp" )
Lock:AnimateSequence( "ButtonUp" )
end end
Text:RegisterAnimationSequence( "ButtonOverDisabled", { buttonText:RegisterAnimationSequence("ButtonOverDisabled", {{function()
{ return modSelectButton.Text:SetRGBFromInt(0, 0)
function () end}, {function()
return self.Text:SetRGBFromInt( 0, 0 ) return modSelectButton.Text:SetAlpha(1, 0)
end end}})
},
{ lockIcon:RegisterAnimationSequence("ButtonOverDisabled", {{function()
function () return modSelectButton.Lock:SetAlpha(1, 0)
return self.Text:SetAlpha( 1, 0 ) end}, {function()
end return modSelectButton.Lock:SetRGBFromInt(0, 0)
} end}})
} )
Lock:RegisterAnimationSequence( "ButtonOverDisabled", { modSelectButton._sequences.ButtonOverDisabled = function()
{ buttonText:AnimateSequence("ButtonOverDisabled")
function () lockIcon:AnimateSequence("ButtonOverDisabled")
return self.Lock:SetAlpha( 1, 0 )
end
},
{
function ()
return self.Lock:SetRGBFromInt( 0, 0 )
end
}
} )
self._sequences.ButtonOverDisabled = function ()
Text:AnimateSequence( "ButtonOverDisabled" )
Lock:AnimateSequence( "ButtonOverDisabled" )
end end
Text:RegisterAnimationSequence( "ButtonUpDisabled", { buttonText:RegisterAnimationSequence("ButtonUpDisabled", {{function()
{ return modSelectButton.Text:SetRGBFromInt(14277081, 0)
function () end}})
return self.Text:SetRGBFromInt( 14277081, 0 )
end lockIcon:RegisterAnimationSequence("ButtonUpDisabled", {{function()
} return modSelectButton.Lock:SetAlpha(1, 0)
} ) end}, {function()
Lock:RegisterAnimationSequence( "ButtonUpDisabled", { return modSelectButton.Lock:SetRGBFromInt(12566463, 0)
{ end}})
function ()
return self.Lock:SetAlpha( 1, 0 ) modSelectButton._sequences.ButtonUpDisabled = function()
end buttonText:AnimateSequence("ButtonUpDisabled")
}, lockIcon:AnimateSequence("ButtonUpDisabled")
{
function ()
return self.Lock:SetRGBFromInt( 12566463, 0 )
end
}
} )
self._sequences.ButtonUpDisabled = function ()
Text:AnimateSequence( "ButtonUpDisabled" )
Lock:AnimateSequence( "ButtonUpDisabled" )
end end
end end
self._animationSets.DefaultAnimationSet() modSelectButton._animationSets.DefaultAnimationSet()
PostLoadFunc( self, f8_local1, controller ) PostLoadFunc(modSelectButton, controllerIndex, controller)
return self return modSelectButton
end end
MenuBuilder.registerType("ModSelectButton", ModSelectButton) MenuBuilder.registerType("ModSelectButton", ModSelectButton)

View File

@ -1,217 +1,216 @@
local f0_local0 = "frontEnd.ModSelect" local modSelectPath = "frontEnd.ModSelect"
f0_local1 = function ()
WipeGlobalModelsAtPath( f0_local0 ) modSelectPathCleanup = function()
WipeGlobalModelsAtPath(modSelectPath)
end end
local function getmodname(path) local function getModName(path)
local name = path local modName = path
local desc = Engine.Localize("LUA_MENU_MOD_DESC_DEFAULT", name) local modDesc = Engine.Localize("LUA_MENU_MOD_DESC_DEFAULT", modName)
return name, desc return modName, modDesc
end end
local function set_mod( modname ) local function setMod(modName)
Engine.SetDvarString( "fs_game", modname ) Engine.SetDvarString("fs_game", modName)
Engine.Exec("vid_restart") Engine.Exec("vid_restart")
end end
local unload_mod = function( arg0, arg1 ) local unloadMod = function(buttonElement, controllerIndex)
set_mod( "" ) setMod("")
end end
local f0_local4 = function ( f4_arg0, f4_arg1 ) local leaveMenu = function(menuElement, controllerIndex)
LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) LUI.FlowManager.RequestLeaveMenu(menuElement)
end end
local f0_local8 = function ( f8_arg0, f8_arg1 ) local updateModInfo = function(menuElement, controllerIndex)
local f8_local0 = LUI.FlowManager.GetScopedData( f8_arg0 ) local scopedData = LUI.FlowManager.GetScopedData(menuElement)
if not f8_local0.currentLabel then if not scopedData.currentLabel then
f8_local0.currentLabel = "" scopedData.currentLabel = ""
end end
if not f8_local0.currentDesc then if not scopedData.currentDesc then
f8_local0.currentDesc = "" scopedData.currentDesc = ""
end end
f8_arg0:processEvent( { menuElement:processEvent({
name = "menu_refresh" name = "menu_refresh"
}) })
local f8_local2 = f8_arg0:GetCurrentMenu() local currentMenu = menuElement:GetCurrentMenu()
assert( f8_local2.ModInfoTitle ) assert(currentMenu.ModInfoTitle)
f8_local2.ModInfoTitle:setText( f8_local0.currentLabel ) currentMenu.ModInfoTitle:setText(scopedData.currentLabel)
assert( f8_local2.ModInfoText ) assert(currentMenu.ModInfoText)
f8_local2.ModInfoText:setText( f8_local0.currentDesc ) currentMenu.ModInfoText:setText(scopedData.currentDesc)
end end
local f0_local9 = function ( f9_arg0, f9_arg1, f9_arg2 ) local applyMod = function(buttonElement, controllerIndex, modName)
set_mod( f9_arg2 ) setMod(modName)
end end
local f0_local10 = function ( f11_arg0, f11_arg1, f11_arg2 ) local updateModSelection = function(menuElement, controllerIndex, modData)
local f11_local0 = LUI.FlowManager.GetScopedData( f11_arg0 ) local scopedData = LUI.FlowManager.GetScopedData(menuElement)
f11_local0.currentLabel = f11_arg2.buttonLabel scopedData.currentLabel = modData.buttonLabel
f11_local0.currentName = f11_arg2.modName scopedData.currentName = modData.modName
f11_local0.currentDesc = f11_arg2.objectiveText scopedData.currentDesc = modData.objectiveText
f0_local8( f11_arg0, f11_arg1 ) updateModInfo(menuElement, controllerIndex)
Engine.PlaySound(CoD.SFX.SPMinimap) Engine.PlaySound(CoD.SFX.SPMinimap)
end end
local f0_local12 = function ( f13_arg0, f13_arg1 ) local populateModList = function(menuElement, controllerIndex)
local f13_local0 = {} local modList = {}
local mods = io.listfiles("mods/") local mods = io.listfiles("mods/")
for i = 1, #mods do for i = 1, #mods do
local name, desc = getmodname(mods[i]) local name, desc = getModName(mods[i])
f13_local0[#f13_local0 + 1] = { modList[#modList + 1] = {
buttonLabel = ToUpperCase(name), buttonLabel = ToUpperCase(name),
modName = name, modName = name,
objectiveText = desc, objectiveText = desc
} }
end end
local f13_local1 = LUI.DataSourceFromList.new( #f13_local0 ) local dataSource = LUI.DataSourceFromList.new(#modList)
f13_local1.MakeDataSourceAtIndex = function ( f14_arg0, f14_arg1, f14_arg2 ) dataSource.MakeDataSourceAtIndex = function(dataSource, index, controllerIndex)
return { return {
buttonLabel = LUI.DataSourceInGlobalModel.new( f0_local0 .. ".mods." .. f14_arg1, f13_local0[f14_arg1 + 1].buttonLabel ), buttonLabel = LUI.DataSourceInGlobalModel.new(modSelectPath .. ".mods." .. index,
buttonOnClickFunction = function ( f15_arg0, f15_arg1 ) modList[index + 1].buttonLabel),
f0_local9( f15_arg0, f15_arg1, f13_local0[f14_arg1 + 1].modName ) buttonOnClickFunction = function(buttonElement, controllerIndex)
end applyMod(buttonElement, controllerIndex, modList[index + 1].modName)
, end,
buttonOnHoverFunction = function ( f16_arg0, f16_arg1 ) buttonOnHoverFunction = function(buttonElement, controllerIndex)
f0_local10( f16_arg0, f16_arg1, f13_local0[f14_arg1 + 1] ) updateModSelection(buttonElement, controllerIndex, modList[index + 1])
end end,
, modName = modList[index + 1].modName
modName = f13_local0[f14_arg1 + 1].modName
} }
end end
assert( f13_arg0.ModSelectionList ) assert(menuElement.ModSelectionList)
f13_arg0.ModSelectionList:SetGridDataSource( f13_local1, f13_arg1 ) menuElement.ModSelectionList:SetGridDataSource(dataSource, controllerIndex)
end end
local function PostLoadFunc( f17_arg0, f17_arg1, f17_arg2 ) local function postLoadFunction(menuElement, controllerIndex, controller)
assert( f17_arg0.bindButton ) assert(menuElement.bindButton)
f17_arg0.bindButton:addEventHandler( "button_secondary", f0_local4 ) menuElement.bindButton:addEventHandler("button_secondary", leaveMenu)
local fs_game = Engine.GetDvarString( "fs_game" ) local fsGame = Engine.GetDvarString("fs_game")
if fs_game ~= "" then if fsGame ~= "" then
f17_arg0.LoadedModName:setText( "^3Loaded mod^7: " .. fs_game ) menuElement.LoadedModName:setText("^3Loaded mod^7: " .. fsGame)
f17_arg0.bindButton:addEventHandler( "button_alt2", unload_mod ) menuElement.bindButton:addEventHandler("button_alt2", unloadMod)
else else
f17_arg0.LoadedModName:setText( "" ) menuElement.LoadedModName:setText("")
end end
--f17_arg0:addEventHandler( "menu_create", f0_local3 ) -- menuElement:addEventHandler("menu_create", f0_local3)
f0_local12( f17_arg0, f17_arg1 ) populateModList(menuElement, controllerIndex)
f17_arg0:addEventHandler( "gain_focus", function ( f18_arg0, f18_arg1 ) menuElement:addEventHandler("gain_focus", function(focusElement, controllerIndex)
local f18_local0 = f18_arg0.ModSelectionList local modSelectionList = focusElement.ModSelectionList
local f18_local1 = f18_local0:GetContentOffset( LUI.DIRECTION.vertical ) local contentOffset = modSelectionList:GetContentOffset(LUI.DIRECTION.vertical)
f18_local0:SetFocusedPosition( { modSelectionList:SetFocusedPosition({
x = 0, x = 0,
y = f18_local1 y = contentOffset
}, true) }, true)
local f18_local2 = f18_local0:GetElementAtPosition( 0, f18_local1 ) local focusedElement = modSelectionList:GetElementAtPosition(0, contentOffset)
if f18_local2 then if focusedElement then
f18_local2:processEvent( { focusedElement:processEvent({
name = "gain_focus", name = "gain_focus",
controllerIndex = f17_arg1 controllerIndex = controllerIndex
}) })
end end
end) end)
end end
function ModSelectMenu(menu, controller) function ModSelectMenu(menu, controller)
local self = LUI.UIElement.new() local menuElement = LUI.UIElement.new()
self.id = "ModSelectMenu" menuElement.id = "ModSelectMenu"
local f20_local1 = controller and controller.controllerIndex local controllerIndex = controller and controller.controllerIndex
if not f20_local1 and not Engine.InFrontend() then if not controllerIndex and not Engine.InFrontend() then
f20_local1 = self:getRootController() controllerIndex = menuElement:getRootController()
end end
assert( f20_local1 ) assert(controllerIndex)
self:playSound( "menu_open" ) menuElement:playSound("menu_open")
if Engine.IsSingleplayer() then if Engine.IsSingleplayer() then
local Background = nil local backgroundImage = nil
Background = LUI.UIImage.new() backgroundImage = LUI.UIImage.new()
Background.id = "Background" backgroundImage.id = "Background"
Background:setImage( RegisterMaterial( "sp_frontend_bink_background" ), 0 ) backgroundImage:setImage(RegisterMaterial("sp_frontend_bink_background"), 0)
self:addElement( Background ) menuElement:addElement(backgroundImage)
self.Background = Background menuElement.Background = backgroundImage
local Bink = nil local binkImage = nil
Bink = LUI.UIImage.new() binkImage = LUI.UIImage.new()
Bink.id = "Bink" binkImage.id = "Bink"
Bink:setImage( RegisterMaterial( "cinematic" ), 0 ) binkImage:setImage(RegisterMaterial("cinematic"), 0)
self:addElement( Bink ) menuElement:addElement(binkImage)
self.Bink = Bink menuElement.Bink = binkImage
end end
local ButtonHelperBar = nil local buttonHelperBar = nil
ButtonHelperBar = MenuBuilder.BuildRegisteredType( "ButtonHelperBar", { buttonHelperBar = MenuBuilder.BuildRegisteredType("ButtonHelperBar", {
controllerIndex = f61_local1 controllerIndex = controllerIndex
}) })
ButtonHelperBar.id = "ButtonHelperBar" buttonHelperBar.id = "ButtonHelperBar"
ButtonHelperBar:SetAnchorsAndPosition( 0, 0, 1, 0, 0, 0, _1080p * -85, 0 ) buttonHelperBar:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -85, 0)
self:addElement( ButtonHelperBar ) menuElement:addElement(buttonHelperBar)
self.ButtonHelperBar = ButtonHelperBar menuElement.ButtonHelperBar = buttonHelperBar
MenuTitle = MenuBuilder.BuildRegisteredType( "MenuTitle", { local menuTitle = MenuBuilder.BuildRegisteredType("MenuTitle", {
controllerIndex = f61_local1 controllerIndex = controllerIndex
}) })
MenuTitle.id = "MenuTitle" menuTitle.id = "MenuTitle"
MenuTitle.MenuTitle:setText( ToUpperCase( Engine.Localize( "LUA_MENU_MODS" ) ), 0 ) menuTitle.MenuTitle:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS")), 0)
--MenuTitle.MenuTitle:setText( ToUpperCase( "Mods" ), 0 ) menuTitle.MenuBreadcrumbs:setText(ToUpperCase(""), 0)
MenuTitle.MenuBreadcrumbs:setText( ToUpperCase( "" ), 0 ) menuTitle.Icon:SetTop(_1080p * -28.5, 0)
MenuTitle.Icon:SetTop( _1080p * -28.5, 0 ) menuTitle.Icon:SetBottom(_1080p * 61.5, 0)
MenuTitle.Icon:SetBottom( _1080p * 61.5, 0 ) menuTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134)
MenuTitle:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134 ) menuElement:addElement(menuTitle)
self:addElement( MenuTitle ) menuElement.MenuTitle = menuTitle
self.MenuTitle = MenuTitle
local ModInfoTitle = nil local modInfoTitle = nil
ModInfoTitle = LUI.UIStyledText.new() modInfoTitle = LUI.UIStyledText.new()
ModInfoTitle.id = "ModInfoTitle" modInfoTitle.id = "ModInfoTitle"
ModInfoTitle:setText( "", 0 ) modInfoTitle:setText("", 0)
ModInfoTitle:SetFontSize( 30 * _1080p ) modInfoTitle:SetFontSize(30 * _1080p)
ModInfoTitle:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) ) modInfoTitle:SetFont(FONTS.GetFont(FONTS.MainMedium.File))
ModInfoTitle:SetAlignment( LUI.Alignment.Left ) modInfoTitle:SetAlignment(LUI.Alignment.Left)
ModInfoTitle:SetStartupDelay( 2000 ) modInfoTitle:SetStartupDelay(2000)
ModInfoTitle:SetLineHoldTime( 400 ) modInfoTitle:SetLineHoldTime(400)
ModInfoTitle:SetAnimMoveTime( 300 ) modInfoTitle:SetAnimMoveTime(300)
ModInfoTitle:SetEndDelay( 1500 ) modInfoTitle:SetEndDelay(1500)
ModInfoTitle:SetCrossfadeTime( 750 ) modInfoTitle:SetCrossfadeTime(750)
ModInfoTitle:SetAutoScrollStyle( LUI.UIStyledText.AutoScrollStyle.ScrollH ) modInfoTitle:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH)
ModInfoTitle:SetMaxVisibleLines( 1 ) modInfoTitle:SetMaxVisibleLines(1)
ModInfoTitle:SetDecodeLetterLength( 15 ) modInfoTitle:SetDecodeLetterLength(15)
ModInfoTitle:SetDecodeMaxRandChars( 6 ) modInfoTitle:SetDecodeMaxRandChars(6)
ModInfoTitle:SetDecodeUpdatesPerLetter( 4 ) modInfoTitle:SetDecodeUpdatesPerLetter(4)
ModInfoTitle:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 216, _1080p * 246 ) modInfoTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 216, _1080p * 246)
self:addElement( ModInfoTitle ) menuElement:addElement(modInfoTitle)
self.ModInfoTitle = ModInfoTitle menuElement.ModInfoTitle = modInfoTitle
local ModInfoText = nil local modInfoText = nil
ModInfoText = LUI.UIStyledText.new() modInfoText = LUI.UIStyledText.new()
ModInfoText.id = "ModInfoText" modInfoText.id = "ModInfoText"
ModInfoText:setText( "", 0 ) modInfoText:setText("", 0)
ModInfoText:SetFontSize( 20 * _1080p ) modInfoText:SetFontSize(20 * _1080p)
ModInfoText:SetFont( FONTS.GetFont( FONTS.MainCondensed.File ) ) modInfoText:SetFont(FONTS.GetFont(FONTS.MainCondensed.File))
ModInfoText:SetAlignment( LUI.Alignment.Left ) modInfoText:SetAlignment(LUI.Alignment.Left)
ModInfoText:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 248, _1080p * 268 ) modInfoText:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 1254, _1080p * 1824, _1080p * 248, _1080p * 268)
self:addElement( ModInfoText ) menuElement:addElement(modInfoText)
self.ModInfoText = ModInfoText menuElement.ModInfoText = modInfoText
local ModSelectionList = nil local modSelectionList = nil
ModSelectionList = LUI.UIDataSourceGrid.new( nil, { modSelectionList = LUI.UIDataSourceGrid.new(nil, {
maxVisibleColumns = 1, maxVisibleColumns = 1,
maxVisibleRows = 17, maxVisibleRows = 17,
controllerIndex = f20_local1, controllerIndex = controllerIndex,
buildChild = function() buildChild = function()
return MenuBuilder.BuildRegisteredType("ModSelectButton", { return MenuBuilder.BuildRegisteredType("ModSelectButton", {
controllerIndex = f20_local1 controllerIndex = controllerIndex
}) })
end, end,
wrapX = true, wrapX = true,
@ -228,69 +227,69 @@ function ModSelectMenu( menu, controller )
springCoefficient = 600, springCoefficient = 600,
maxVelocity = 5000 maxVelocity = 5000
}) })
ModSelectionList.id = "ModSelectionList" modSelectionList.id = "ModSelectionList"
ModSelectionList:setUseStencil( false ) modSelectionList:setUseStencil(false)
ModSelectionList:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 886 ) modSelectionList:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 886)
self:addElement( ModSelectionList ) menuElement:addElement(modSelectionList)
self.ModSelectionList = ModSelectionList menuElement.ModSelectionList = modSelectionList
local ArrowUp = nil local arrowUp = nil
ArrowUp = MenuBuilder.BuildRegisteredType( "ArrowUp", { arrowUp = MenuBuilder.BuildRegisteredType("ArrowUp", {
controllerIndex = f20_local1 controllerIndex = controllerIndex
}) })
ArrowUp.id = "ArrowUp" arrowUp.id = "ArrowUp"
ArrowUp:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 452.5, _1080p * 472.5, _1080p * 887, _1080p * 927 ) arrowUp:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 452.5, _1080p * 472.5, _1080p * 887, _1080p * 927)
self:addElement( ArrowUp ) menuElement:addElement(arrowUp)
self.ArrowUp = ArrowUp menuElement.ArrowUp = arrowUp
local ArrowDown = nil local arrowDown = nil
ArrowDown = MenuBuilder.BuildRegisteredType( "ArrowDown", { arrowDown = MenuBuilder.BuildRegisteredType("ArrowDown", {
controllerIndex = f20_local1 controllerIndex = controllerIndex
}) })
ArrowDown.id = "ArrowDown" arrowDown.id = "ArrowDown"
ArrowDown:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 287.5, _1080p * 307.5, _1080p * 886, _1080p * 926 ) arrowDown:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 287.5, _1080p * 307.5, _1080p * 886, _1080p * 926)
self:addElement( ArrowDown ) menuElement:addElement(arrowDown)
self.ArrowDown = ArrowDown menuElement.ArrowDown = arrowDown
local ListCount = nil local listCount = nil
ListCount = LUI.UIText.new() listCount = LUI.UIText.new()
ListCount.id = "ListCount" listCount.id = "ListCount"
ListCount:setText( "1/15", 0 ) listCount:setText("1/15", 0)
ListCount:SetFontSize( 24 * _1080p ) listCount:SetFontSize(24 * _1080p)
ListCount:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) ) listCount:SetFont(FONTS.GetFont(FONTS.MainMedium.File))
ListCount:SetAlignment( LUI.Alignment.Center ) listCount:SetAlignment(LUI.Alignment.Center)
ListCount:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 307.5, _1080p * 452.5, _1080p * 894, _1080p * 918 ) listCount:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 307.5, _1080p * 452.5, _1080p * 894, _1080p * 918)
self:addElement( ListCount ) menuElement:addElement(listCount)
self.ListCount = ListCount menuElement.ListCount = listCount
local LoadedModName = nil local loadedModName = nil
LoadedModName = LUI.UIText.new() loadedModName = LUI.UIText.new()
LoadedModName.id = "LoadedModName" loadedModName.id = "LoadedModName"
LoadedModName:setText( "LOADED MOD NAME", 0 ) loadedModName:setText("LOADED MOD NAME", 0)
LoadedModName:SetFontSize( 20 * _1080p ) loadedModName:SetFontSize(20 * _1080p)
LoadedModName:SetFont( FONTS.GetFont( FONTS.MainBold.File ) ) loadedModName:SetFont(FONTS.GetFont(FONTS.MainBold.File))
LoadedModName:SetAlignment( LUI.Alignment.Left ) loadedModName:SetAlignment(LUI.Alignment.Left)
LoadedModName:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 942, _1080p * 966 ) loadedModName:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 942, _1080p * 966)
self:addElement( LoadedModName ) menuElement:addElement(loadedModName)
self.LoadedModName = LoadedModName menuElement.LoadedModName = loadedModName
ModSelectionList:AddArrow( ArrowUp ) modSelectionList:AddArrow(arrowUp)
ModSelectionList:AddArrow( ArrowDown ) modSelectionList:AddArrow(arrowDown)
ModSelectionList:AddItemNumbers( ListCount ) modSelectionList:AddItemNumbers(listCount)
self.addButtonHelperFunction = function ( arg0, arg1 ) menuElement.addButtonHelperFunction = function(arg0, arg1)
arg0:AddButtonHelperText({ arg0:AddButtonHelperText({
helper_text = Engine.Localize("MENU_BACK"), helper_text = Engine.Localize("MENU_BACK"),
button_ref = "button_secondary", button_ref = "button_secondary",
side = "left", side = "left",
clickable = true clickable = true
}) })
local fs_game = Engine.GetDvarString( "fs_game" ) local fsGame = Engine.GetDvarString("fs_game")
if fs_game ~= "" then if fsGame ~= "" then
arg0:AddButtonHelperText({ arg0:AddButtonHelperText({
helper_text = Engine.Localize("LUA_MENU_UNLOAD"), helper_text = Engine.Localize("LUA_MENU_UNLOAD"),
button_ref = "button_alt2", button_ref = "button_alt2",
@ -300,18 +299,18 @@ function ModSelectMenu( menu, controller )
end end
end end
self:addEventHandler( "menu_create", self.addButtonHelperFunction ) menuElement:addEventHandler("menu_create", menuElement.addButtonHelperFunction)
local bindButton = LUI.UIBindButton.new() local bindButton = LUI.UIBindButton.new()
bindButton.id = "selfBindButton" bindButton.id = "selfBindButton"
self:addElement( bindButton ) menuElement:addElement(bindButton)
self.bindButton = bindButton menuElement.bindButton = bindButton
PostLoadFunc( self, f20_local1, controller ) postLoadFunction(menuElement, controllerIndex, controller)
return self return menuElement
end end
MenuBuilder.registerType("ModSelectMenu", ModSelectMenu) MenuBuilder.registerType("ModSelectMenu", ModSelectMenu)
LUI.FlowManager.RegisterStackPushBehaviour("ModSelectMenu", PushFunc) LUI.FlowManager.RegisterStackPushBehaviour("ModSelectMenu", PushFunc)
LUI.FlowManager.RegisterStackPopBehaviour( "ModSelectMenu", f0_local1 ) LUI.FlowManager.RegisterStackPopBehaviour("ModSelectMenu", modSelectPathCleanup)

View File

@ -1,70 +1,66 @@
function SystemLinkMenuButtons(menu, controller) function SystemLinkMenuButtons(menu, controller)
local self = LUI.UIVerticalList.new() local SystemLinkMenuButtons = LUI.UIVerticalList.new()
self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 500 * _1080p, 0, 300 * _1080p ) SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 300 * _1080p)
self.id = "SystemLinkMenuButtons" SystemLinkMenuButtons.id = "SystemLinkMenuButtons"
local f1_local1 = controller and controller.controllerIndex
if not f1_local1 and not Engine.InFrontend() then
f1_local1 = self:getRootController()
end
assert( f1_local1 )
local f1_local2 = self
self:SetSpacing( 10 * _1080p )
local f1_local5 = nil local controllerIndex = controller and controller.controllerIndex
if CONDITIONS.IsCoreMultiplayer( self ) then if not controllerIndex and not Engine.InFrontend() then
f1_local5 = MenuBuilder.BuildRegisteredType( "MenuButton", { controllerIndex = SystemLinkMenuButtons:getRootController()
controllerIndex = f1_local1 end
assert(controllerIndex)
SystemLinkMenuButtons:SetSpacing(10 * _1080p)
local casButton = nil
if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then
casButton = MenuBuilder.BuildRegisteredType("MenuButton", {
controllerIndex = controllerIndex
}) })
f1_local5.id = "CASButton" casButton.id = "CASButton"
if CONDITIONS.IsCoreMultiplayer( self ) then
else if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then
casButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_CREATE_A_CLASS")
end
casButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_CREATE_A_CLASS")), 0)
casButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110)
SystemLinkMenuButtons:addElement(casButton)
SystemLinkMenuButtons.CASButton = casButton
end end
if CONDITIONS.IsCoreMultiplayer( self ) then
f1_local5.buttonDescription = Engine.Localize( "LUA_MENU_DESC_CREATE_A_CLASS" ) local LoadoutButton = nil
end if CONDITIONS.IsThirdGameMode(SystemLinkMenuButtons) then
f1_local5.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_CREATE_A_CLASS" ) ), 0 ) LoadoutButton = MenuBuilder.BuildRegisteredType("MenuButton", {
f1_local5:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110 ) controllerIndex = controllerIndex
self:addElement( f1_local5 )
self.CASButton = f1_local5
end
local f1_local6 = nil
if CONDITIONS.IsThirdGameMode( self ) then
f1_local6 = MenuBuilder.BuildRegisteredType( "MenuButton", {
controllerIndex = f1_local1
}) })
f1_local6.id = "LoadoutButton" LoadoutButton.id = "LoadoutButton"
if CONDITIONS.IsThirdGameMode( self ) then
else if CONDITIONS.IsThirdGameMode(SystemLinkMenuButtons) then
LoadoutButton.buttonDescription = Engine.Localize("LUA_MENU_ZM_LOADOUT_DESC")
end
if CONDITIONS.IsThirdGameMode( self ) then
f1_local6.buttonDescription = Engine.Localize( "LUA_MENU_ZM_LOADOUT_DESC" )
end
f1_local6.Text:setText( ToUpperCase( Engine.Localize( "LUA_MENU_ZM_LOADOUT_CAPS" ) ), 0 )
f1_local6:SetAnchorsAndPosition( 0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150 )
self:addElement( f1_local6 )
self.LoadoutButton = f1_local6
end end
LoadoutButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_LOADOUT_CAPS")), 0)
LoadoutButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150)
SystemLinkMenuButtons:addElement(LoadoutButton)
SystemLinkMenuButtons.LoadoutButton = LoadoutButton
end
if CONDITIONS.IsCoreMultiplayer( self ) then if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then
f1_local5:addEventHandler( "button_action", function ( f2_arg0, f2_arg1 ) casButton:addEventHandler("button_action", function(button, event)
local f2_local0 = f2_arg1.controller or f1_local1 local currentControllerIndex = event.controller or controllerIndex
ClientWeapon.SetWeaponVisible(0, true) ClientWeapon.SetWeaponVisible(0, true)
ClientCharacter.SetCharacterVisible(0, true) ClientCharacter.SetCharacterVisible(0, true)
ACTIONS.OpenCreateAClass( self, f2_arg1 ) ACTIONS.OpenCreateAClass(SystemLinkMenuButtons, event)
end )
end
if CONDITIONS.IsThirdGameMode( self ) then
f1_local6:addEventHandler( "button_action", function ( f3_arg0, f3_arg1 )
ACTIONS.OpenMenu( "CPLoadoutMenu", true, f3_arg1.controller or f1_local1 )
end) end)
end end
return self if CONDITIONS.IsThirdGameMode(SystemLinkMenuButtons) then
loadoutButton:addEventHandler("button_action", function(button, event)
ACTIONS.OpenMenu("CPLoadoutMenu", true, event.controller or controllerIndex)
end)
end
return SystemLinkMenuButtons
end end
MenuBuilder.m_types["SystemLinkMenuButtons"] = SystemLinkMenuButtons MenuBuilder.m_types["SystemLinkMenuButtons"] = SystemLinkMenuButtons

File diff suppressed because it is too large Load Diff