Fix main menu buttons

This commit is contained in:
fed 2023-04-09 19:23:36 +02:00
parent 74455d3eb3
commit ae55d8af08
3 changed files with 31 additions and 32 deletions

View File

@ -1,17 +1,3 @@
local maincampaign = LUI.MenuBuilder.m_types_build["main_campaign"]
LUI.MenuBuilder.m_types_build["main_campaign"] = function(...)
local initlist = LUI.Options.InitScrollingList
LUI.Options.InitScrollingList = function(list)
initlist(list, nil ,{
rows = 10
})
end
local menu = maincampaign(...)
LUI.Options.InitScrollingList = initlist
return menu
end
LUI.MenuBuilder.registerType("achievements_menu", function(root, controller) LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
local menuwidth = 1129 local menuwidth = 1129
local menu = LUI.MenuTemplate.new(root, { local menu = LUI.MenuTemplate.new(root, {

View File

@ -0,0 +1,31 @@
LUI.addmenubutton("main_campaign", {
index = 6,
text = "@LUA_MENU_ACHIEVEMENTS",
description = Engine.Localize("@LUA_MENU_ACHIEVEMENTS_DESC"),
callback = function()
LUI.FlowManager.RequestAddMenu(nil, "achievements_menu")
end
})
LUI.addmenubutton("main_campaign", {
index = 6,
text = "@MENU_MODS",
description = Engine.Localize("@MENU_MODS_DESC"),
callback = function()
LUI.FlowManager.RequestAddMenu(nil, "mods_menu")
end
})
local maincampaign = LUI.MenuBuilder.m_types_build["main_campaign"]
LUI.MenuBuilder.m_types_build["main_campaign"] = function(...)
local initlist = LUI.Options.InitScrollingList
LUI.Options.InitScrollingList = function(list)
initlist(list, nil ,{
rows = 10
})
end
local menu = maincampaign(...)
LUI.Options.InitScrollingList = initlist
return menu
end

View File

@ -29,24 +29,6 @@ function string:truncate(length)
return self:sub(1, length - 3) .. "..." return self:sub(1, length - 3) .. "..."
end end
LUI.addmenubutton("main_campaign", {
index = 6,
text = "@LUA_MENU_ACHIEVEMENTS",
description = Engine.Localize("@LUA_MENU_ACHIEVEMENTS_DESC"),
callback = function()
LUI.FlowManager.RequestAddMenu(nil, "achievements_menu")
end
})
LUI.addmenubutton("main_campaign", {
index = 6,
text = "@MENU_MODS",
description = Engine.Localize("@MENU_MODS_DESC"),
callback = function()
LUI.FlowManager.RequestAddMenu(nil, "mods_menu")
end
})
function getmodname(path) function getmodname(path)
local modinfo = mods.getinfo(path) local modinfo = mods.getinfo(path)