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
f2_arg0.MLGGameBattlesButton:addEventHandler("button_action", function(f7_arg0, f7_arg1)
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
})
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
})
else

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff