Added config option for LineHeight and Textbox Width

This commit is contained in:
Wofsauge committed 2022-01-15 17:27:17 +01:00
1 parent 22d50b5fe2
commit 0ec8a0ae60
7 files changed
+66 -14

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ EID.descriptions[languageCode] = {}
EID.descriptions[languageCode].custom = {} -- table for custom entity descriptions
EID.descriptions[languageCode].languageName = "English"
EID.descriptions[languageCode].fonts = {"default", "inverted", "borderless"} -- Fonts to be used with this languagepack
EID.descriptions[languageCode].fonts = {{name="default", lineHeight=11}, {name="inverted", lineHeight=11}, {name="borderless", lineHeight=11}} -- Fonts to be used with this languagepack
EID.descriptions[languageCode].collectibles={
{"1", "The Sad Onion", "↑ +0.7 Tears up"},
+1 -1
View File
@@ -16,7 +16,7 @@ EID.descriptions[languageCode].languageName = "Korean"
korean_galmoori9, korean_galmoori11 is added for community request.
]]
EID.descriptions[languageCode].fonts = {"korean_hcrdotum", "korean_lanapixel", "korean_soyakkoma", "korean_soyakkoma_borderless", "korean_soyakkoma_inverted", "korean_soyanon", "korean_galmoori9", "korean_galmoori11"} -- Fonts to be used with this languagepack
EID.descriptions[languageCode].fonts = {{name="korean_hcrdotum", lineHeight=14}, {name="korean_lanapixel", lineHeight=14}, {name="korean_soyakkoma", lineHeight=14}, {name="korean_soyakkoma_borderless", lineHeight=14}, {name="korean_soyakkoma_inverted", lineHeight=14}, {name="korean_soyanon", lineHeight=14}, {name="korean_galmoori9", lineHeight=14}, {name="korean_galmoori11", lineHeight=14}} -- Fonts to be used with this languagepack
+1 -1
View File
@@ -16,7 +16,7 @@ EID.descriptions[languageCode].custom = {} -- table for custom entity descriptio
EID.descriptions[languageCode].languageName = "Chinese"
-- Fonts to be used with this languagepack
EID.descriptions[languageCode].fonts = {"default_cn"}
EID.descriptions[languageCode].fonts = {{name = "default_cn", lineHeight = 14}}
---------- Collectibles ----------
EID.descriptions[languageCode].collectibles={
+3 -2
View File
@@ -1012,11 +1012,12 @@ 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
if curFont == v.name then
return false
end
end
EID.Config["FontType"] = EID.descriptions[curLang].fonts[1]
EID.Config["FontType"] = EID.descriptions[curLang].fonts[1].name
EID.lineHeight = EID.descriptions[curLang].fonts[1].lineHeight
return true
end
+4
View File
@@ -44,6 +44,9 @@ EID.UserConfig = {
-- Set the Y Position (height) of the description texts
-- Default = 45
["YPosition"] = 45,
-- Set the height of a line, effectivly changing the distance between two lines of text
-- Default = 11 (11 for English, 14 for Korean / Chinese)
["LineHeight"] = 11,
-- Set the distance between an item and its information display (in tiles)
-- Default = 5
["MaxDistance"] = 5,
@@ -344,6 +347,7 @@ EID.DefaultConfig = {
["HUDOffset"] = 10,
["XPosition"] = 60,
["YPosition"] = 45,
["LineHeight"] = 11,
["DisplayMode"] = "default",
["LocalScale"] = 0.5,
["LocalModeCentered"] = true,
+3
View File
@@ -1081,6 +1081,8 @@ 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.lineHeight = EID.Config["LineHeight"]
EID:fixDefinedFont()
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
if REPENTANCE then
@@ -1112,6 +1114,7 @@ if EID.MCMLoaded or REPENTANCE then
end
EID.Config["FlipItemPositions"] = flipItemTable or {}
end
EID.Config["LineHeight"] = EID.lineHeight
EID.SaveData(EID, json.encode(EID.Config))
EID:hidePermanentText()
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil
+53 -9
View File
@@ -27,26 +27,28 @@ local colorNameArray = {}
local function renderDummyDesc()
MCMCompat_oldPermanentObj = EID.permanentDisplayTextObj
local demoDescObj = EID:getDescriptionObj(5, 100, 33)
demoDescObj.Name = "Demo Object Name"
demoDescObj.Transformation = "Demo Transformation"
demoDescObj.Description = "A very cool description as a demonstration of the power of EID!#\1 This is also a cool line#This line loves you {{Heart}}"
demoDescObj.Name = EID:getDescriptionEntry("MCM","demoObjectName")
demoDescObj.Transformation = EID:getDescriptionEntry("MCM","demoObjectTransformation")
demoDescObj.Description = EID:getDescriptionEntry("MCM","demoObjectText")
EID:displayPermanentText(demoDescObj)
end
-- get list of all defined fonts per language file
local fonts = {}
local fontNames = {}
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
for _,font in ipairs(fontNames) do
if font == fontToAdd.name then
exists = true
break
end
end
if not exists then
table.insert(fonts, fontToAdd)
table.insert(fontNames, fontToAdd.name)
end
end
end
@@ -306,6 +308,48 @@ if MCMLoaded then
Info = {"Default = 45"}
}
)
-- Line Height
MCM.AddSetting(
"EID",
"General",
{
Type = ModConfigMenu.OptionType.NUMBER,
CurrentSetting = function()
return EID.lineHeight
end,
Minimum = 1,
Maximum = 100,
Display = function()
return "Line Height: " .. EID.lineHeight
end,
OnChange = function(currentNum)
EID.lineHeight = currentNum
end,
Info = {"Default = 11","Lineheight will automatically change when changing a font/language"}
}
)
-- Textbox Width
MCM.AddSetting(
"EID",
"General",
{
Type = ModConfigMenu.OptionType.NUMBER,
CurrentSetting = function()
return EID.Config["TextboxWidth"]
end,
Minimum = 1,
Maximum = 500,
ModifyBy = 5,
Display = function()
return "Textbox Width: " .. EID.Config["TextboxWidth"]
end,
OnChange = function(currentNum)
EID.Config["TextboxWidth"] = currentNum
end,
Info = {"Default = 100","Width of the EID textbox, in pixels"}
}
)
MCM.AddSpace("EID", "General")
@@ -957,16 +1001,17 @@ if MCMLoaded then
{
Type = ModConfigMenu.OptionType.NUMBER,
CurrentSetting = function()
return AnIndexOf(fonts, EID.Config["FontType"])
return AnIndexOf(fontNames, EID.Config["FontType"])
end,
Minimum = 1,
Maximum = #fonts,
Maximum = #fontNames,
Display = function()
EID.MCMCompat_isDisplayingEIDTab = "Visuals";
return "Font Type: " .. EID.Config["FontType"]
end,
OnChange = function(currentNum)
EID.Config["FontType"] = fonts[currentNum]
EID.Config["FontType"] = fontNames[currentNum]
EID.lineHeight = fonts[currentNum].lineHeight
EID:fixDefinedFont()
local fontFile = EID.Config["FontType"] or "default"
EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt")
@@ -1598,7 +1643,6 @@ if MCMLoaded then
Maximum = 1000,
Display = function()
if EID.Config["ModIndicatorTextColor"] == nil then EID.Config["TextColor"] = EID.DefaultConfig["ModIndicatorTextColor"] end
EID.MCMCompat_isDisplayingEIDTab = "Visuals";
return "Mod Indicator: " .. string.gsub(EID.Config["ModIndicatorTextColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ModIndicatorTextColor"]).."/"..#colorNameArray..")"
end,
OnChange = function(currentNum)