Merge pull request #376 from Buurazu/master
Text position modifiers update
This commit is contained in:
4 files changed
+77
-50
No files matched your search
+17
-10
@@ -404,8 +404,8 @@ function EID:getAdjustedSubtype(Type, Variant, SubType)
|
||||
return 9999
|
||||
end
|
||||
local pool = game:GetItemPool()
|
||||
if REPENTANCE and EID.player.SubType == PlayerType.PLAYER_THESOUL_B then
|
||||
SubType = pool:GetPillEffect(SubType, EID.player:GetOtherTwin()) + 1
|
||||
if REPENTANCE and EID.player:GetPlayerType() == PlayerType.PLAYER_THESOUL_B then
|
||||
SubType = pool:GetPillEffect(SubType, EID.player:GetOtherTwin() or EID.player) + 1
|
||||
else SubType = pool:GetPillEffect(SubType, EID.player) + 1 end
|
||||
end
|
||||
return SubType
|
||||
@@ -742,6 +742,19 @@ function EID:filterColorMarkup(text, baseKColor)
|
||||
return textPartsTable
|
||||
end
|
||||
|
||||
-- A simple function to replace all markup {{ }} with placeholder strings, to use in fitTextToWidth
|
||||
function EID:replaceAllMarkupWithSpaces(text)
|
||||
for word in string.gmatch(text, "{{.-}}") do
|
||||
local lookup = EID:getIcon(word)
|
||||
if lookup[1] ~= "ERROR" then
|
||||
text = string.gsub(text, word, EID:generatePlaceholderString(lookup[3]), 1)
|
||||
else
|
||||
text = string.gsub(text, word, "", 1)
|
||||
end
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
-- Fits a given string to a specific width
|
||||
-- returns the string as a table of lines
|
||||
function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
|
||||
@@ -815,14 +828,8 @@ function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
|
||||
|
||||
-- we can break after str[cursor]
|
||||
local word = sub(str, word_begin_index, cursor)
|
||||
|
||||
local colorFiltered = EID:filterColorMarkup(word, EID:getTextColor())
|
||||
local filteredWord = {}
|
||||
for _, filtered in ipairs(colorFiltered) do
|
||||
table.insert(filteredWord, filtered[1])
|
||||
end
|
||||
local strFiltered, spriteTable = EID:filterIconMarkup(table.concat(filteredWord), 0, 0)
|
||||
local wordLength = EID:getStrWidth(strFiltered)
|
||||
local wordFiltered = EID:replaceAllMarkupWithSpaces(word)
|
||||
local wordLength = EID:getStrWidth(wordFiltered)
|
||||
|
||||
if curLength + wordLength <= textboxWidth or curLength < 17 then
|
||||
table.insert(text, word)
|
||||
|
||||
Reference in new issue
Block a user