h2-mod/data/ui_scripts/settings/__init__.lua

155 lines
3.6 KiB
Lua
Raw Normal View History

2022-07-14 21:52:46 -04:00
require("language")
2022-07-13 21:23:56 -04:00
2022-01-31 16:47:57 -05:00
function createdivider(menu, text)
local element = LUI.UIElement.new({
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
topAnchor = true,
bottomAnchor = false,
top = 0,
bottom = 33.33
})
element.scrollingToNext = true
element:addElement(LUI.MenuBuilder.BuildRegisteredType("h1_option_menu_titlebar", {
title_bar_text = Engine.ToUpperCase(Engine.Localize(text))
}))
menu.list:addElement(element)
end
LUI.addmenubutton("pc_controls", {
index = 4,
2022-03-19 19:41:25 -04:00
text = "@MENU_GENERAL",
2022-03-19 19:57:07 -04:00
description = Engine.Localize("@MENU_GENERAL_DESC"),
2022-01-31 16:47:57 -05:00
callback = function()
LUI.FlowManager.RequestAddMenu(nil, "settings_menu")
end
})
LUI.MenuBuilder.m_types_build["settings_menu"] = function(a1)
local menu = LUI.MenuTemplate.new(a1, {
2022-03-19 19:41:25 -04:00
menu_title = "@MENU_GENERAL",
2022-04-28 16:41:29 -04:00
menu_list_divider_top_offset = -(LUI.H1MenuTab.tabChangeHoldingElementHeight + H1MenuDims.spacing),
menu_width = GenericMenuDims.OptionMenuWidth
2022-01-31 16:47:57 -05:00
})
2022-03-19 19:41:25 -04:00
createdivider(menu, "@LUA_MENU_UPDATES")
2022-01-31 16:47:57 -05:00
LUI.Options.CreateOptionButton(
menu,
2022-03-19 20:26:41 -04:00
"cg_auto_update",
2022-03-19 19:41:25 -04:00
"@LUA_MENU_AUTO_UPDATE",
2022-07-15 18:29:44 -04:00
"@LUA_MENU_AUTO_UPDATE_DESC",
2022-01-31 16:47:57 -05:00
{
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_ENABLED",
value = true
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_DISABLED",
value = false
2022-01-31 16:47:57 -05:00
}
2022-03-19 19:41:25 -04:00
}
2022-01-31 16:47:57 -05:00
)
2022-03-19 19:41:25 -04:00
menu:AddButton("@LUA_MENU_CHECK_UPDATES", function()
2022-01-31 16:47:57 -05:00
LUI.tryupdating(false)
end, nil, true, nil, {
2022-03-19 19:41:25 -04:00
desc_text = Engine.Localize("@LUA_MENU_CHECK_UPDATES_DESC")
2022-01-31 16:47:57 -05:00
})
2022-03-19 19:41:25 -04:00
createdivider(menu, "@LUA_MENU_DRAWING")
2022-01-31 16:47:57 -05:00
LUI.Options.CreateOptionButton(
menu,
2022-03-19 19:41:25 -04:00
"cg_drawFps",
"@LUA_MENU_DRAW_FPS",
"@LUA_MENU_DRAW_FPS_DESC",
2022-01-31 16:47:57 -05:00
{
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_DISABLED",
value = 0
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_FPS_ONLY",
value = 1
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_FPS_AND_VIEWPOS",
value = 2
2022-01-31 16:47:57 -05:00
}
2022-03-19 19:41:25 -04:00
}
2022-01-31 16:47:57 -05:00
)
LUI.Options.CreateOptionButton(
menu,
2022-03-19 19:41:25 -04:00
"cg_drawSpeed",
"@LUA_MENU_DRAW_SPEED",
2022-07-15 18:29:44 -04:00
"@LUA_MENU_DRAW_SPEED_DESC",
2022-01-31 16:47:57 -05:00
{
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_ENABLED",
value = true
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_DISABLED",
value = false
2022-01-31 16:47:57 -05:00
}
2022-03-19 19:41:25 -04:00
}
2022-01-31 16:47:57 -05:00
)
LUI.Options.CreateOptionButton(
menu,
2022-03-19 19:41:25 -04:00
"cg_speedGraph",
"@LUA_MENU_DRAW_SPEEDGRAPH",
"@LUA_MENU_DRAW_SPEEDGRAPH_DESC",
2022-01-31 16:47:57 -05:00
{
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_ENABLED",
value = true
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_DISABLED",
value = false
2022-01-31 16:47:57 -05:00
}
2022-03-19 19:41:25 -04:00
}
2022-01-31 16:47:57 -05:00
)
2022-03-19 19:41:25 -04:00
createdivider(menu, "@LUA_MENU_RENDERING")
2022-01-31 16:47:57 -05:00
LUI.Options.CreateOptionButton(
menu,
2022-03-19 19:41:25 -04:00
"r_fullbright",
"@LUA_MENU_R_FULLBRIGHT",
"@LUA_MENU_R_FULLBRIGHT_DESC",
2022-01-31 16:47:57 -05:00
{
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_DISABLED",
value = 0
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_ENABLED",
value = 1
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_MODE2",
value = 2
2022-01-31 16:47:57 -05:00
},
{
2022-03-19 19:41:25 -04:00
text = "@LUA_MENU_MODE3",
value = 3
2022-01-31 16:47:57 -05:00
}
2022-03-19 19:41:25 -04:00
}
2022-01-31 16:47:57 -05:00
)
LUI.Options.InitScrollingList(menu.list, nil)
LUI.Options.AddOptionTextInfo(menu)
menu:AddBackButton()
return menu
2022-03-19 19:57:07 -04:00
end