feat: fastdl, mod menus (#291)
* fastdl init * ui_scripting fixes * fastfile loading changes * delete test ui script * add mod select button * Create iw7mod_code_post_gfx.ff * fastdl progress * fix download * remove debug print
This commit is contained in:
40
data/cdata/ui_scripts/Mods/ModDownload.lua
Normal file
40
data/cdata/ui_scripts/Mods/ModDownload.lua
Normal file
@ -0,0 +1,40 @@
|
||||
function ModDownloadCancel( arg0, arg1 )
|
||||
download.abort()
|
||||
LUI.FlowManager.RequestLeaveMenu( arg0 )
|
||||
end
|
||||
|
||||
function ModDownloadPopup( arg0, arg1 )
|
||||
local popup = MenuBuilder.BuildRegisteredType( "FenceDialogPopup", {
|
||||
message = "Downloading files...",
|
||||
controllerIndex = arg1.controllerIndex,
|
||||
onCancel = ModDownloadCancel
|
||||
} )
|
||||
popup.id = "ModDownloadPopup"
|
||||
|
||||
local file = ""
|
||||
|
||||
popup:registerEventHandler("mod_download_set_file", function(element, event)
|
||||
file = event.request.name
|
||||
popup.Message:setText(string.format("Downloading %s...", file))
|
||||
end)
|
||||
|
||||
popup:registerEventHandler("mod_download_progress", function(element, event)
|
||||
popup.Message:setText(string.format("Downloading %s (%i%%)...", file, math.floor(event.fraction * 100)))
|
||||
end)
|
||||
|
||||
popup:registerEventHandler("mod_download_done", function()
|
||||
LUI.FlowManager.RequestLeaveMenu(popup)
|
||||
end)
|
||||
|
||||
return popup
|
||||
end
|
||||
|
||||
MenuBuilder.registerType( "ModDownloadPopup", ModDownloadPopup )
|
||||
|
||||
local function reg_func()
|
||||
Engine.GetLuiRoot():registerEventHandler("mod_download_start", function(element, event)
|
||||
LUI.FlowManager.RequestPopupMenu( element, "ModDownloadPopup", true, event.controller, false )
|
||||
end)
|
||||
end
|
||||
|
||||
scheduler.once(reg_func)
|
223
data/cdata/ui_scripts/Mods/ModSelectButton.lua
Normal file
223
data/cdata/ui_scripts/Mods/ModSelectButton.lua
Normal file
@ -0,0 +1,223 @@
|
||||
local function PostLoadFunc( f1_arg0, f1_arg1, f1_arg2 )
|
||||
assert( f1_arg0.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 )
|
||||
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
|
||||
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
|
||||
end )
|
||||
f1_arg0: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
|
||||
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
|
||||
|
||||
GenericButton = MenuBuilder.BuildRegisteredType( "GenericButton", {
|
||||
controllerIndex = f8_local1
|
||||
} )
|
||||
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 )
|
||||
end
|
||||
end )
|
||||
self:addElement( GenericButton )
|
||||
self.GenericButton = GenericButton
|
||||
|
||||
local GenericListButtonBackground = nil
|
||||
|
||||
GenericListButtonBackground = MenuBuilder.BuildRegisteredType( "GenericListArrowButtonBackground", {
|
||||
controllerIndex = f8_local1
|
||||
} )
|
||||
GenericListButtonBackground.id = "GenericListButtonBackground"
|
||||
GenericListButtonBackground:SetAnchorsAndPosition( 0, 0, 0, 0, 0, 0, 0, 0 )
|
||||
self:addElement( GenericListButtonBackground )
|
||||
self.GenericListButtonBackground = GenericListButtonBackground
|
||||
|
||||
local Text = nil
|
||||
|
||||
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 )
|
||||
end
|
||||
end )
|
||||
self:addElement( Text )
|
||||
self.Text = Text
|
||||
|
||||
local Lock = nil
|
||||
|
||||
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
|
||||
|
||||
self._animationSets.DefaultAnimationSet = function ()
|
||||
self._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" )
|
||||
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" )
|
||||
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" )
|
||||
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" )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self._animationSets.DefaultAnimationSet()
|
||||
PostLoadFunc( self, f8_local1, controller )
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.registerType( "ModSelectButton", ModSelectButton )
|
317
data/cdata/ui_scripts/Mods/ModSelectMenu.lua
Normal file
317
data/cdata/ui_scripts/Mods/ModSelectMenu.lua
Normal file
@ -0,0 +1,317 @@
|
||||
local f0_local0 = "frontEnd.ModSelect"
|
||||
f0_local1 = function ()
|
||||
WipeGlobalModelsAtPath( f0_local0 )
|
||||
end
|
||||
|
||||
local function getmodname(path)
|
||||
local name = path
|
||||
local desc = Engine.Localize("LUA_MENU_MOD_DESC_DEFAULT", name)
|
||||
|
||||
return name, desc
|
||||
end
|
||||
|
||||
local function set_mod( modname )
|
||||
Engine.SetDvarString( "fs_game", modname )
|
||||
Engine.Exec( "vid_restart" )
|
||||
end
|
||||
|
||||
local unload_mod = function( arg0, arg1 )
|
||||
set_mod( "" )
|
||||
end
|
||||
|
||||
local f0_local4 = function ( f4_arg0, f4_arg1 )
|
||||
LUI.FlowManager.RequestLeaveMenu( f4_arg0 )
|
||||
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 = ""
|
||||
end
|
||||
if not f8_local0.currentDesc then
|
||||
f8_local0.currentDesc = ""
|
||||
end
|
||||
f8_arg0: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 )
|
||||
end
|
||||
|
||||
local f0_local9 = function ( f9_arg0, f9_arg1, f9_arg2 )
|
||||
set_mod( f9_arg2 )
|
||||
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 )
|
||||
Engine.PlaySound( CoD.SFX.SPMinimap )
|
||||
end
|
||||
|
||||
local f0_local12 = function ( f13_arg0, f13_arg1 )
|
||||
local f13_local0 = {}
|
||||
local mods = io.listfiles("mods/")
|
||||
for i = 1, #mods do
|
||||
local name, desc = getmodname(mods[i])
|
||||
f13_local0[#f13_local0 + 1] = {
|
||||
buttonLabel = ToUpperCase(name),
|
||||
modName = name,
|
||||
objectiveText = desc,
|
||||
}
|
||||
end
|
||||
local f13_local1 = LUI.DataSourceFromList.new( #f13_local0 )
|
||||
f13_local1.MakeDataSourceAtIndex = function ( f14_arg0, f14_arg1, f14_arg2 )
|
||||
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
|
||||
}
|
||||
end
|
||||
|
||||
assert( f13_arg0.ModSelectionList )
|
||||
f13_arg0.ModSelectionList:SetGridDataSource( f13_local1, f13_arg1 )
|
||||
end
|
||||
|
||||
local function PostLoadFunc( f17_arg0, f17_arg1, f17_arg2 )
|
||||
assert( f17_arg0.bindButton )
|
||||
f17_arg0.bindButton:addEventHandler( "button_secondary", f0_local4 )
|
||||
|
||||
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 )
|
||||
else
|
||||
f17_arg0.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( {
|
||||
x = 0,
|
||||
y = f18_local1
|
||||
}, true )
|
||||
local f18_local2 = f18_local0:GetElementAtPosition( 0, f18_local1 )
|
||||
if f18_local2 then
|
||||
f18_local2:processEvent( {
|
||||
name = "gain_focus",
|
||||
controllerIndex = f17_arg1
|
||||
} )
|
||||
end
|
||||
end )
|
||||
end
|
||||
|
||||
function ModSelectMenu( menu, controller )
|
||||
local self = LUI.UIElement.new()
|
||||
self.id = "ModSelectMenu"
|
||||
|
||||
local f20_local1 = controller and controller.controllerIndex
|
||||
if not f20_local1 and not Engine.InFrontend() then
|
||||
f20_local1 = self:getRootController()
|
||||
end
|
||||
assert( f20_local1 )
|
||||
|
||||
self:playSound( "menu_open" )
|
||||
|
||||
if Engine.IsSingleplayer() then
|
||||
local Background = nil
|
||||
|
||||
Background = LUI.UIImage.new()
|
||||
Background.id = "Background"
|
||||
Background:setImage( RegisterMaterial( "sp_frontend_bink_background" ), 0 )
|
||||
self:addElement( Background )
|
||||
self.Background = Background
|
||||
|
||||
local Bink = nil
|
||||
|
||||
Bink = LUI.UIImage.new()
|
||||
Bink.id = "Bink"
|
||||
Bink:setImage( RegisterMaterial( "cinematic" ), 0 )
|
||||
self:addElement( Bink )
|
||||
self.Bink = Bink
|
||||
end
|
||||
|
||||
local ButtonHelperBar = nil
|
||||
|
||||
ButtonHelperBar = MenuBuilder.BuildRegisteredType( "ButtonHelperBar", {
|
||||
controllerIndex = f61_local1
|
||||
} )
|
||||
ButtonHelperBar.id = "ButtonHelperBar"
|
||||
ButtonHelperBar:SetAnchorsAndPosition( 0, 0, 1, 0, 0, 0, _1080p * -85, 0 )
|
||||
self:addElement( ButtonHelperBar )
|
||||
self.ButtonHelperBar = ButtonHelperBar
|
||||
|
||||
MenuTitle = MenuBuilder.BuildRegisteredType( "MenuTitle", {
|
||||
controllerIndex = f61_local1
|
||||
} )
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
local ModSelectionList = nil
|
||||
|
||||
ModSelectionList = LUI.UIDataSourceGrid.new( nil, {
|
||||
maxVisibleColumns = 1,
|
||||
maxVisibleRows = 17,
|
||||
controllerIndex = f20_local1,
|
||||
buildChild = function ()
|
||||
return MenuBuilder.BuildRegisteredType( "ModSelectButton", {
|
||||
controllerIndex = f20_local1
|
||||
} )
|
||||
end,
|
||||
wrapX = true,
|
||||
wrapY = true,
|
||||
spacingX = _1080p * 10,
|
||||
spacingY = _1080p * 10,
|
||||
columnWidth = _1080p * 500,
|
||||
rowHeight = _1080p * 30,
|
||||
scrollingThresholdX = 1,
|
||||
scrollingThresholdY = 1,
|
||||
adjustSizeToContent = false,
|
||||
horizontalAlignment = LUI.Alignment.Left,
|
||||
verticalAlignment = LUI.Alignment.Top,
|
||||
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
|
||||
|
||||
local ArrowUp = nil
|
||||
|
||||
ArrowUp = MenuBuilder.BuildRegisteredType( "ArrowUp", {
|
||||
controllerIndex = f20_local1
|
||||
} )
|
||||
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
|
||||
|
||||
local ArrowDown = nil
|
||||
|
||||
ArrowDown = MenuBuilder.BuildRegisteredType( "ArrowDown", {
|
||||
controllerIndex = f20_local1
|
||||
} )
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
ModSelectionList:AddArrow( ArrowUp )
|
||||
ModSelectionList:AddArrow( ArrowDown )
|
||||
ModSelectionList:AddItemNumbers( ListCount )
|
||||
|
||||
self.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
|
||||
arg0:AddButtonHelperText( {
|
||||
helper_text = Engine.Localize( "LUA_MENU_UNLOAD" ),
|
||||
button_ref = "button_alt2",
|
||||
side = "left",
|
||||
clickable = true
|
||||
} )
|
||||
end
|
||||
end
|
||||
|
||||
self:addEventHandler( "menu_create", self.addButtonHelperFunction )
|
||||
|
||||
local bindButton = LUI.UIBindButton.new()
|
||||
bindButton.id = "selfBindButton"
|
||||
self:addElement( bindButton )
|
||||
self.bindButton = bindButton
|
||||
|
||||
PostLoadFunc( self, f20_local1, controller )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.registerType( "ModSelectMenu", ModSelectMenu )
|
||||
LUI.FlowManager.RegisterStackPushBehaviour( "ModSelectMenu", PushFunc )
|
||||
LUI.FlowManager.RegisterStackPopBehaviour( "ModSelectMenu", f0_local1 )
|
6
data/cdata/ui_scripts/Mods/__init__.lua
Normal file
6
data/cdata/ui_scripts/Mods/__init__.lua
Normal file
@ -0,0 +1,6 @@
|
||||
require( "ModSelectButton" )
|
||||
require( "ModSelectMenu" )
|
||||
|
||||
if (Engine.InFrontend()) then
|
||||
require("ModDownload")
|
||||
end
|
Reference in New Issue
Block a user