虽然我明白最好从基础开始,但我喜欢尝试。不过,这让我很难受。在WoW中,我使用ElvUI和MyRolePlay (MRP),结果是增强工具提示的一个问题。我对代码做了相当多的编辑,剩下的唯一的事情就是正确地获得最后一行的格式--一行上的全部(3个变量)。我不明白什么是gtal (或"L"),但它似乎创造了一个新的行。是否有一种方法来组合gtal线条,同时分别保留RGB颜色?我一直试图保持代码风格(因为我在引入新代码时遇到困难),但由于作者如何在变量上调用颜色,我无法在不创建全新行的情况下获得最终的%s自己的颜色值。
local dC = GetQuestDifficultyColor(level);
local cC = RAID_CLASS_COLORS[ classunloc ];我能想到的最好不过了,
gtal( format( L["|r%s|cffffffff %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, class), dC.r, dC.g, dC.b )
gtal( format( L["|r%s"], class), cC.r, cC.g, cC.b ) 我在国防部或其他任何地方都找不到任何关于gtal的信息。我听说作者是不可能接近的。但我希望有人能想到这个主意。
两格线的结果完美,如果最后一个字是在它的线上!
如果有帮助的话,这一切都在里面
local dC = GetQuestDifficultyColor(level);
local cC = RAID_CLASS_COLORS[ classunloc ];
if level ~= nil and level < 0 then
e = L["|cffffffff(Boss)"]
else
e = format( L["|r%d|cffffffff"], level )
end
if mspsupported then
gtal( format( L["|r%s|cffffffff %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, class), dC.r, dC.g, dC.b )
gtal( format( L["|r%s"], class), cC.r, cC.g, cC.b )
n = nil
t = nil
if f.FR and f.FR ~= "" and f.FR ~= "0" then
n = mrp.DisplayTooltip.FR( f.FR ) .. " "
end最后,这就是最初的gtal样子。
gtal( format( L["%s %s |r%s|cffffffff (Player)"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, class), r, g, b )
r, g, b = 1.0, 1.0, 1.0更新-这就是这里的工作内容,因为如果这对其他人有帮助的话:
local dC = GetQuestDifficultyColor(level);
local cC = RAID_CLASS_COLORS[ classunloc ];
if level ~= nil and level < 0 then
e = L["|cffffffff(Boss)"]
else
e = format( L["|r%d|cffffffff"], level )
end
if mspsupported then
local classStr = format("|cff%02x%02x%02x%s|r", cC.r * 255, cC.g * 255, cC.b * 255, class)
local str = format( L["|r%s |cffffffff%s|r %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, classStr)
gtal(str, dC.r, dC.g, dC.b)发布于 2015-03-06 18:58:51
gtal在UI_Tooltip.lua中定义
--[[
EPIC KLUDGE!
Special local functions to overwrite and add the current tooltip.
]]
-- Single string
local function gtal( n, r, g, b )
local l = GameTooltip.mrpLines + 1
GameTooltip.mrpLines = l
r, g, b = (r or 1.0), (g or 1.0), (b or 1.0)
--if GameTooltip.mrpLines <= GameTooltip.orgLines then
-- Replace original line with ours, or add a new one if not there
if _G["GameTooltipTextLeft"..tostring(l)] then
if _G["GameTooltipTextLeft"..tostring(l)]:IsVisible() then
if _G["GameTooltipTextRight"..tostring(l)] then
_G["GameTooltipTextRight"..tostring(l)]:Hide()
end
_G["GameTooltipTextLeft"..tostring(l)]:SetText( n )
_G["GameTooltipTextLeft"..tostring(l)]:SetTextColor( r, g, b )
else
GameTooltip:AddLine( n, r, g, b )
end
else
GameTooltip:AddLine( n, r, g, b )
end
endL通常是您的本地化表查找,在这里使用,以防您想要一种不同语言的不同格式字符串。
在这种情况下,看起来gtal总是添加一行,所以您需要在同一行中完成您的工作。幸运的是,WoW为您提供了可以使用的内联颜色重写!参见UI逃逸序列 --这就是|cxxxxxxxx和字符串中所做的事情。你可能想要这样的东西:
-- Build a color-formatted class string
local classStr = format("|c%02x%02x%02x%s|r", cC.r, cC.g, cC.b, class)
-- Build your tooltip line, which consists of `$e $race $class`
local str = format( L["|r%s |cffffffff%s|r %s"], e, emptynil( mrp.DisplayTooltip.RA( f.RA ) ) or race, classStr)
-- Add the line to the tooltip
gtal(str, dC.r, dC.g, dC.b)https://stackoverflow.com/questions/28904858
复制相似问题