Usable Fonts can now be defined per languagepack
This commit is contained in:
1 parent
2e47c85dbe
commit
f91fcf23be
4 files changed
+53
-10
No files matched your search
+13
@@ -945,6 +945,19 @@ function EID:getEntityData(entity, str)
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Function to fix font compatibility. Resets config font to a value compatible with your current language
|
||||
function EID:fixDefinedFont()
|
||||
local curLang = EID.Config["Language"]
|
||||
local curFont = EID.Config["FontType"]
|
||||
for _, v in ipairs(EID.descriptions[curLang].fonts) do
|
||||
if curFont == v then
|
||||
return false
|
||||
end
|
||||
end
|
||||
EID.Config["FontType"] = EID.descriptions[curLang].fonts[1]
|
||||
return true
|
||||
end
|
||||
|
||||
-- Creates a copy of a KColor object. This prevents overwriting existing
|
||||
function EID:copyKColor(colorObj)
|
||||
return KColor(colorObj.Red, colorObj.Green, colorObj.Blue, colorObj.Alpha)
|
||||
|
||||
+4
-4
@@ -45,7 +45,7 @@ local game = Game()
|
||||
local bingeBuff = EID:getDescriptionEntry("bingeEaterBuffs", descObj.ObjSubType)
|
||||
if bingeBuff ~= nil then
|
||||
local iconStr = "#{{Collectible664}} "
|
||||
EID:appendToDescription(descObj, iconStr..bingeBuff[3]:gsub("#",iconStr))
|
||||
EID:appendToDescription(descObj, iconStr..bingeBuff:gsub("#",iconStr))
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
@@ -73,7 +73,7 @@ local game = Game()
|
||||
local belialBuff = EID:getDescriptionEntry("bookOfBelialBuffs", descObj.ObjSubType)
|
||||
if belialBuff ~= nil then
|
||||
local iconStr = "#{{Collectible34}} "
|
||||
EID:appendToDescription(descObj, iconStr..belialBuff[3]:gsub("#",iconStr))
|
||||
EID:appendToDescription(descObj, iconStr..belialBuff:gsub("#",iconStr))
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
@@ -99,7 +99,7 @@ local game = Game()
|
||||
local wispType = EID:getDescriptionEntry("bookOfVirtuesWisps", descObj.ObjSubType)
|
||||
if wispType ~= nil then
|
||||
local iconStr = "#{{Collectible584}} "
|
||||
EID:appendToDescription(descObj, iconStr..wispType[1]:gsub("#",iconStr))
|
||||
EID:appendToDescription(descObj, iconStr..wispType:gsub("#",iconStr))
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
@@ -171,7 +171,7 @@ local game = Game()
|
||||
local clothBuff = EID:getDescriptionEntry("tarotClothBuffs", descObj.ObjSubType)
|
||||
if clothBuff ~= nil then
|
||||
local iconStr = "#{{Collectible451}} "
|
||||
EID:appendToDescription(descObj, iconStr..clothBuff[3]:gsub("#",iconStr))
|
||||
EID:appendToDescription(descObj, iconStr..clothBuff:gsub("#",iconStr))
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
|
||||
@@ -58,7 +58,6 @@ hudBBSprite:Load("gfx/eid_transform_icons.anm2", true)
|
||||
hudBBSprite:Play("boundingBox")
|
||||
|
||||
------- Load all modules and other stuff ------
|
||||
require("mod_config_menu")
|
||||
|
||||
--transformation infos
|
||||
require("descriptions."..EID.GameVersion..".transformations")
|
||||
@@ -66,7 +65,9 @@ require("descriptions."..EID.GameVersion..".transformations")
|
||||
for _,lang in ipairs(EID.Languages) do
|
||||
require("descriptions."..EID.GameVersion.."."..lang)
|
||||
end
|
||||
table.sort(EID.Languages)
|
||||
|
||||
require("mod_config_menu")
|
||||
require("eid_data")
|
||||
require("eid_xmldata")
|
||||
require("eid_api")
|
||||
@@ -111,6 +112,7 @@ end
|
||||
EID.modPath = GetCurrentModPath()
|
||||
|
||||
EID.font = Font() -- init font object
|
||||
EID:fixDefinedFont()
|
||||
local fontFile = EID.Config["FontType"] or "default"
|
||||
local success = EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt")
|
||||
if not success then
|
||||
@@ -959,6 +961,7 @@ if EID.MCMLoaded or REPENTANCE then
|
||||
EID.isHidden = EID.Config["InitiallyHidden"]
|
||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||
EID.Scale = EID.Config["Scale"]
|
||||
EID:fixDefinedFont()
|
||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
||||
if REPENTANCE then
|
||||
EID:addTextPosModifier("HudOffset", Vector(((Options.HUDOffset * 10) * 2) - 20, (Options.HUDOffset * 10) - 10))
|
||||
|
||||
+32
-5
@@ -33,6 +33,30 @@ local function renderDummyDesc()
|
||||
EID:displayPermanentText(demoDescObj)
|
||||
end
|
||||
|
||||
-- get list of all defined fonts per language file
|
||||
local fonts = {}
|
||||
for k, pack in pairs(EID.descriptions) do
|
||||
if pack.fonts then
|
||||
for _,fontToAdd in ipairs(pack.fonts) do
|
||||
local exists = false
|
||||
for _,font in ipairs(fonts) do
|
||||
if font == fontToAdd then
|
||||
exists = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not exists then
|
||||
table.insert(fonts, fontToAdd)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- get list of all defined Language names
|
||||
local displayLanguage = {}
|
||||
for k, lang in ipairs(EID.Languages) do
|
||||
table.insert(displayLanguage, EID.descriptions[lang].languageName)
|
||||
end
|
||||
|
||||
local function clearRenderDummyDesc()
|
||||
if MCMCompat_oldPermanentObj == nil then
|
||||
EID:hidePermanentText()
|
||||
@@ -182,7 +206,6 @@ if MCMLoaded then
|
||||
---------------------------------------------------------------------------
|
||||
---------------------------------General-----------------------------------
|
||||
-- Language
|
||||
local displayLanguage = {"English", "English (detailed)", "French", "Portuguese (AB+)", "Portugues (Brasil)", "Russian", "Spanish", "Italian", "Bulgarian (WIP) (AB+)", "Polish", "German (WIP) (AB+)", "Turkish"}
|
||||
MCM.AddSetting(
|
||||
"EID",
|
||||
"General",
|
||||
@@ -199,6 +222,10 @@ if MCMLoaded then
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
EID.Config["Language"] = EID.Languages[currentNum]
|
||||
local isFixed = EID:fixDefinedFont()
|
||||
if isFixed then
|
||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
||||
end
|
||||
end,
|
||||
Info = {"Changes the language.","Languages marked with (WIP) are incomplete"}
|
||||
}
|
||||
@@ -902,23 +929,23 @@ if MCMLoaded then
|
||||
---------------------------------------------------------------------------
|
||||
---------------------------------Visuals-----------------------------------
|
||||
-- Font Type
|
||||
local fontTypes = {"default","borderless","inverted"}
|
||||
MCM.AddSetting(
|
||||
"EID",
|
||||
"Visuals",
|
||||
{
|
||||
Type = ModConfigMenu.OptionType.NUMBER,
|
||||
CurrentSetting = function()
|
||||
return AnIndexOf(fontTypes, EID.Config["FontType"])
|
||||
return AnIndexOf(fonts, EID.Config["FontType"])
|
||||
end,
|
||||
Minimum = 1,
|
||||
Maximum = #fontTypes,
|
||||
Maximum = #fonts,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = "Visuals";
|
||||
return "Font Type: " .. EID.Config["FontType"]
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
EID.Config["FontType"] = fontTypes[currentNum]
|
||||
EID.Config["FontType"] = fonts[currentNum]
|
||||
EID:fixDefinedFont()
|
||||
local fontFile = EID.Config["FontType"] or "default"
|
||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt")
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user