Move data files
This commit is contained in:
154
data/cdata/ui_scripts/settings/__init__.lua
Normal file
154
data/cdata/ui_scripts/settings/__init__.lua
Normal file
@ -0,0 +1,154 @@
|
||||
require("language")
|
||||
|
||||
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,
|
||||
text = "@MENU_GENERAL",
|
||||
description = Engine.Localize("@MENU_GENERAL_DESC"),
|
||||
callback = function()
|
||||
LUI.FlowManager.RequestAddMenu(nil, "settings_menu")
|
||||
end
|
||||
})
|
||||
|
||||
LUI.MenuBuilder.m_types_build["settings_menu"] = function(a1)
|
||||
local menu = LUI.MenuTemplate.new(a1, {
|
||||
menu_title = "@MENU_GENERAL",
|
||||
menu_list_divider_top_offset = -(LUI.H1MenuTab.tabChangeHoldingElementHeight + H1MenuDims.spacing),
|
||||
menu_width = GenericMenuDims.OptionMenuWidth
|
||||
})
|
||||
|
||||
createdivider(menu, "@LUA_MENU_UPDATES")
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_auto_update",
|
||||
"@LUA_MENU_AUTO_UPDATE",
|
||||
"@LUA_MENU_AUTO_UPDATE_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
menu:AddButton("@LUA_MENU_CHECK_UPDATES", function()
|
||||
LUI.tryupdating(false)
|
||||
end, nil, true, nil, {
|
||||
desc_text = Engine.Localize("@LUA_MENU_CHECK_UPDATES_DESC")
|
||||
})
|
||||
|
||||
createdivider(menu, "@LUA_MENU_DRAWING")
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_drawFps",
|
||||
"@LUA_MENU_DRAW_FPS",
|
||||
"@LUA_MENU_DRAW_FPS_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = 0
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_FPS_ONLY",
|
||||
value = 1
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_FPS_AND_VIEWPOS",
|
||||
value = 2
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_drawSpeed",
|
||||
"@LUA_MENU_DRAW_SPEED",
|
||||
"@LUA_MENU_DRAW_SPEED_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_speedGraph",
|
||||
"@LUA_MENU_DRAW_SPEEDGRAPH",
|
||||
"@LUA_MENU_DRAW_SPEEDGRAPH_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
createdivider(menu, "@LUA_MENU_RENDERING")
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"r_fullbright",
|
||||
"@LUA_MENU_R_FULLBRIGHT",
|
||||
"@LUA_MENU_R_FULLBRIGHT_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = 0
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = 1
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_MODE2",
|
||||
value = 2
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_MODE3",
|
||||
value = 3
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
LUI.Options.InitScrollingList(menu.list, nil)
|
||||
LUI.Options.AddOptionTextInfo(menu)
|
||||
|
||||
menu:AddBackButton()
|
||||
|
||||
return menu
|
||||
end
|
214
data/cdata/ui_scripts/settings/language.lua
Normal file
214
data/cdata/ui_scripts/settings/language.lua
Normal file
@ -0,0 +1,214 @@
|
||||
game:addlocalizedstring("MENU_english", "English")
|
||||
game:addlocalizedstring("MENU_french", "Français")
|
||||
game:addlocalizedstring("MENU_german", "Deutsch")
|
||||
game:addlocalizedstring("MENU_italian", "Italiano")
|
||||
game:addlocalizedstring("MENU_spanish", "Español")
|
||||
game:addlocalizedstring("MENU_russian", "Русский")
|
||||
game:addlocalizedstring("MENU_polish", "Polski")
|
||||
game:addlocalizedstring("MENU_portuguese", "Português")
|
||||
game:addlocalizedstring("MENU_japanese_full", "日本語")
|
||||
game:addlocalizedstring("MENU_japanese_partial", "日本語(一部)")
|
||||
game:addlocalizedstring("MENU_traditional_chinese", "繁體中文")
|
||||
game:addlocalizedstring("MENU_simplified_chinese", "简体中文")
|
||||
game:addlocalizedstring("MENU_arabic", "العربية")
|
||||
game:addlocalizedstring("MENU_czech", "České") -- ??
|
||||
game:addlocalizedstring("MENU_spanishna", "Español (México)") -- text only (English dubbing)
|
||||
game:addlocalizedstring("MENU_korean", "한국어")
|
||||
game:addlocalizedstring("MENU_english_safe", "English (Safe)")
|
||||
game:addlocalizedstring("MENU_russian_partial", "Русский (Только текст)") -- text only (English dubbing)
|
||||
|
||||
LUI.addmenubutton("pc_controls", {
|
||||
index = 4,
|
||||
text = "@LUA_MENU_CHOOSE_LANGUAGE",
|
||||
description = Engine.Localize("@LUA_MENU_CHOOSE_LANGUAGE_DESC"),
|
||||
callback = function()
|
||||
LUI.FlowManager.RequestAddMenu(nil, "choose_language_menu")
|
||||
end
|
||||
})
|
||||
|
||||
local factory = LUI.UIGenericButton.ButtonLabelFactory
|
||||
local overrideyoffset = nil
|
||||
LUI.UIGenericButton.ButtonLabelFactory = function(data, ...)
|
||||
if (overrideyoffset) then
|
||||
data.yOffset = overrideyoffset
|
||||
overrideyoffset = nil
|
||||
end
|
||||
|
||||
return factory(data, ...)
|
||||
end
|
||||
|
||||
local arabicfont = RegisterFont("fonts/arabic.ttf", 30)
|
||||
local koreanfont = RegisterFont("fonts/korean.ttf", 30)
|
||||
local polrusfont = RegisterFont("polrus/fonts/default.otf", 30)
|
||||
local japanesefont = RegisterFont("fonts/japanese.ttf", 30)
|
||||
local chinesefont = RegisterFont("fonts/chinese.ttf", 30)
|
||||
|
||||
local function setchinesefont(lang)
|
||||
if (lang ~= CoD.Language.Traditional_chinese and lang ~= CoD.Language.Simplified_chinese) then
|
||||
return
|
||||
end
|
||||
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Font = chinesefont
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Height = 22
|
||||
overrideyoffset = 1
|
||||
end
|
||||
|
||||
local function setjapanesefont(lang)
|
||||
if (lang ~= CoD.Language.Japanese_full and lang ~= CoD.Language.Japanese_partial) then
|
||||
return
|
||||
end
|
||||
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Font = japanesefont
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Height = 18
|
||||
overrideyoffset = 1
|
||||
end
|
||||
|
||||
local function setkoreanfont(lang)
|
||||
if (lang ~= CoD.Language.Korean) then
|
||||
return
|
||||
end
|
||||
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Font = koreanfont
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Height = 25
|
||||
overrideyoffset = 1
|
||||
end
|
||||
|
||||
local function setarabicfont(lang)
|
||||
if (lang ~= CoD.Language.Arabic) then
|
||||
return
|
||||
end
|
||||
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Font = arabicfont
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Height = 28
|
||||
overrideyoffset = 0
|
||||
end
|
||||
|
||||
local function setpolrusfont(lang)
|
||||
if (lang ~= CoD.Language.Russian and lang ~= CoD.Language.Russian_partial and lang ~= CoD.Language.Polish) then
|
||||
return
|
||||
end
|
||||
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Font = polrusfont
|
||||
overrideyoffset = 2.5
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.registerType("choose_language_menu", function(a1)
|
||||
local menu = LUI.MenuTemplate.new(a1, {
|
||||
menu_title = "@LUA_MENU_CHOOSE_LANGUAGE",
|
||||
menu_list_divider_top_offset = -(LUI.H1MenuTab.tabChangeHoldingElementHeight + H1MenuDims.spacing),
|
||||
menu_width = 300,
|
||||
uppercase_title = true
|
||||
})
|
||||
|
||||
local languages = Engine.GetSupportedLanguages()
|
||||
|
||||
for i = 1, #languages do
|
||||
local prevfont = LUI.MenuGenericButtons.ButtonLabelFont.Font
|
||||
local prevheight = LUI.MenuGenericButtons.ButtonLabelFont.Height
|
||||
local id = languages[i].id
|
||||
|
||||
local lang = Engine.GetCurrentLanguage()
|
||||
|
||||
if (lang == CoD.Language.Traditional_chinese or lang == CoD.Language.Simplified_chinese) then
|
||||
setjapanesefont(id)
|
||||
setkoreanfont(id)
|
||||
setarabicfont(id)
|
||||
elseif (lang == CoD.Language.Japanese_full or lang == CoD.Language.Japanese_partial) then
|
||||
setchinesefont(id)
|
||||
setkoreanfont(id)
|
||||
setarabicfont(id)
|
||||
elseif (lang ~= CoD.Language.Arabic and lang ~= CoD.Language.Korean) then
|
||||
setpolrusfont(id)
|
||||
setchinesefont(id)
|
||||
setjapanesefont(id)
|
||||
setkoreanfont(id)
|
||||
setarabicfont(id)
|
||||
end
|
||||
|
||||
local button = menu:AddButton("", function()
|
||||
if (languages[i].id == Engine.GetCurrentLanguage()) then
|
||||
LUI.FlowManager.RequestLeaveMenu(nil, "choose_language_menu")
|
||||
return
|
||||
end
|
||||
|
||||
LUI.FlowManager.RequestAddMenu(nil, "choose_language_confirm_popup", false, nil, true, {
|
||||
language = languages[i].id
|
||||
})
|
||||
end)
|
||||
|
||||
overrideyoffset = nil
|
||||
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Font = prevfont
|
||||
LUI.MenuGenericButtons.ButtonLabelFont.Height = prevheight
|
||||
|
||||
local label = button:getFirstDescendentById("text_label")
|
||||
label:setText(Engine.ToUpperCase(languages[i].name))
|
||||
end
|
||||
|
||||
LUI.Options.InitScrollingList(menu.list, nil, {
|
||||
rows = 11
|
||||
})
|
||||
menu:AddBackButton()
|
||||
|
||||
return menu
|
||||
end)
|
||||
|
||||
-- rus/pol patches
|
||||
|
||||
if (not Engine.InFrontend()) then
|
||||
local weaponinfodef = LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"]
|
||||
LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] = function(...)
|
||||
local rus = CoD.Language.Russian
|
||||
CoD.Language.Russian = 1337
|
||||
local res = weaponinfodef(...)
|
||||
CoD.Language.Russian = rus
|
||||
return res
|
||||
end
|
||||
else
|
||||
local levelselectmenu = LUI.sp_menus.LevelSelectMenu
|
||||
local setupinfobox = levelselectmenu.SetupInfoBoxLeftForArcadeMode
|
||||
levelselectmenu.SetupInfoBoxLeftForArcadeMode = function(...)
|
||||
local rus = CoD.Language.Russian
|
||||
CoD.Language.Russian = 1337
|
||||
local res = setupinfobox(...)
|
||||
CoD.Language.Russian = rus
|
||||
return res
|
||||
end
|
||||
end
|
||||
|
||||
LUI.UIButtonText.IsOffsetedLanguage = function()
|
||||
if Engine.IsRightToLeftLanguage() then
|
||||
return true
|
||||
elseif Engine.IsAsianLanguage() then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local lang = Engine.GetCurrentLanguage()
|
||||
if (lang == 5 or lang == 6 or lang == 17) then
|
||||
local scale = function (size)
|
||||
return size * 720 / 1080
|
||||
end
|
||||
|
||||
CoD.TextSettings.SP_HudAmmoStatusText = {
|
||||
Font = RegisterFont("fonts/bank.ttf", 16),
|
||||
Height = 16
|
||||
}
|
||||
|
||||
CoD.TextSettings.SP_HudAmmoCounterFont = {
|
||||
Font = RegisterFont("fonts/bank.ttf", 34),
|
||||
Height = 34
|
||||
}
|
||||
|
||||
CoD.TextSettings.HudAmmoCounterFont = {
|
||||
Font = RegisterFont("fonts/bank.ttf", 105),
|
||||
Height = 64
|
||||
}
|
||||
|
||||
CoD.TextSettings.H2TitleFont = {
|
||||
Font = RegisterFont("fonts/bank.ttf", 56),
|
||||
Height = scale(56)
|
||||
}
|
||||
end
|
Reference in New Issue
Block a user