CWDG论坛-专业魔兽插件's Archiver

taciya 发表于 2007-10-3 23:04

小队debuff无法显示前4个的问题.

我用同样的方法创建小队成员buff和debuff按钮.
buff CreateFrame("Button", "PartyMemberFrame"..i.."Buff"..j, getglobal(party), "PartyBuffButtonTemplate")
debff CreateFrame("Button", "PartyMemberFrame"..i.."Debuff"..j, getglobal(party), "PartyBuffButtonTemplate")

可以肯定的是,对象都创建成功.定位也没问题.
但一直有个奇怪的现象.就是buff按钮完全可以正常显示,可debuff只能显示第5个以后的,也就是前4个怎么也不显示,
可在定位位置上看,那些确实已经赋值成功,只是不显示.
以下是相关代码.麻烦版主以及各位达人请教.
for i = 1,4 do
    local party = "PartyMemberFrame"..i
    local temp
    for j=1,15 do
        temp = CreateFrame("Button", party.."Buff"..j, getglobal(party), "PartyBuffButtonTemplate")
        temp:SetID(j)
        temp:SetScript("OnEnter",function()
                GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT", 15, -25)
                GameTooltip:SetUnitBuff("party"..i,j)
        end)
        if j == 1 then
            temp:SetPoint("TOPLEFT", party, "TOPLEFT", 48, -32)
        elseif j == 10 then
            temp:SetPoint("TOP",party.."Buff4","BOTTOM",0,0)
        else
            temp:SetPoint("LEFT", party.."Buff"..(j-1), "RIGHT", 0, 0)
        end
    end
    for j = 1,6 do
        temp = CreateFrame("Button", party.."Debuff"..j, getglobal(party), "PartyBuffButtonTemplate")
        temp:SetID(j)
        temp:SetScript("OnEnter",function()
                GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT", 15, -25)
                GameTooltip:SetUnitDebuff("party"..i, j)
        end)
        temp:SetPoint("CENTER",party.."Portrait","CENTER",30*math.cos(j*0.65+0.35),30*math.sin(j*0.65+0.35));
    end   
    getglobal(party):SetScript("OnEnter",UnitFrame_OnEnter)
end
--重写 RefreshBuffs
local TUI_RefreshBuffs = RefreshBuffs
function RefreshBuffs(button, showBuffs, unit)   
    TUI_RefreshBuffs(button,nil, unit)
    local icon
    if string.find(unit, "party") and string.len(unit) == 6 then
        for i=1,15 do
            _,_,icon = UnitBuff(unit, i, false)
            if ( icon ) then
                getglobal(button:GetName().."Buff"..i.."Icon"):SetTexture(icon)
                getglobal(button:GetName().."Buff"..i):Show()
            else
                getglobal(button:GetName().."Buff"..i):Hide()
            end
        end
        for i=1,6 do
            _,_,icon = UnitDebuff(unit, i, false)
            if ( icon ) then
                getglobal(button:GetName().."Debuff"..i.."Icon"):SetTexture(icon)
                getglobal(button:GetName().."Debuff"..i):Show()
            else
                getglobal(button:GetName().."Debuff"..i):Hide()
            end
        end        
    end   
   
end

taciya 发表于 2007-10-4 23:15

问题已经解决了.
不用回复了.

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.