NDui_Plus

NDui_Plus

390k Downloads

请求帮忙~~~

nanjuekaien1 opened this issue · 4 comments

commented

-- 離開和進入戰鬥,大文字提示
local _, ns = ...
--如需要显示中文,请注意文件编码格式UTF-8
ns.setting = {
EnableCombat = true, --开启进入/脱离战斗提示
}

ns.texts = {
EnterCombat = {
"进 入 戦 斗!",
--"戦斗开始!!",
--"看你不爽,兄弟一起上!",
--"有刺客,快护驾!朕重重有赏!!",
},
LeaveCombat = {
"脱 离 戦 斗!",
--"十步杀一人,千里不留行!",
--"事了拂衣去,深藏身与名!!",
--"拭去手上鲜血,转身离去。。",
},
}

local MyAddon = CreateFrame("Frame")
local imsg = CreateFrame("Frame", "CombatAlert")
imsg:SetSize(420, 70)
imsg:SetPoint("TOP", 0, -210)
imsg:Hide()
imsg.bg = imsg:CreateTexture(nil, 'BACKGROUND')
imsg.bg:SetTexture([[Interface\LevelUp\LevelUpTex]])
imsg.bg:SetPoint('BOTTOM')
imsg.bg:SetSize(326, 103)
imsg.bg:SetTexCoord(0.00195313, 0.63867188, 0.03710938, 0.23828125)
imsg.bg:SetVertexColor(1, 1, 1, 0.5)

imsg.lineTop = imsg:CreateTexture(nil, 'BACKGROUND')
imsg.lineTop:SetDrawLayer('BACKGROUND', 2)
imsg.lineTop:SetTexture([[Interface\LevelUp\LevelUpTex]])
imsg.lineTop:SetPoint("TOP")
imsg.lineTop:SetSize(420, 7)
imsg.lineTop:SetTexCoord(0.00195313, 0.81835938, 0.01953125, 0.03320313)

imsg.lineBottom = imsg:CreateTexture(nil, 'BACKGROUND')
imsg.lineBottom:SetDrawLayer('BACKGROUND', 2)
imsg.lineBottom:SetTexture([[Interface\LevelUp\LevelUpTex]])
imsg.lineBottom:SetPoint("BOTTOM")
imsg.lineBottom:SetSize(420, 7)
imsg.lineBottom:SetTexCoord(0.00195313, 0.81835938, 0.01953125, 0.03320313)

imsg.text = imsg:CreateFontString(nil, 'ARTWORK', 'GameFont_Gigantic')
imsg.text:SetPoint("BOTTOM", 0, 4)
imsg.text:SetTextColor(1, 0.82, 0)
imsg.text:SetJustifyH("CENTER")
imsg.text:SetFont("fonts\ARKai_T.TTF", 40, "OUTLINE") -- 字体设置
CombatAlert:SetScale(0.9)

local flag = 0
ExecuteThreshold = ns.setting.ExecuteThreshold
local function ShowAlert(texts)
CombatAlert.text:SetText(texts[math.random(1,table.getn(texts))])
CombatAlert:Show()
end

if ns.setting.EnableCombat then
MyAddon:RegisterEvent("PLAYER_REGEN_ENABLED")
MyAddon:RegisterEvent("PLAYER_REGEN_DISABLED")
end

MyAddon:SetScript("OnEvent", function(self, event)
if event == "PLAYER_REGEN_DISABLED" then
ShowAlert(ns.texts.EnterCombat)
flag = 0
elseif event == "PLAYER_REGEN_ENABLED" then
ShowAlert(ns.texts.LeaveCombat)
flag = 0
end
end)

local timer = 0
imsg:SetScript("OnShow", function(self)
timer = 0
self:SetScript("OnUpdate", function(self, elasped)
timer = timer + elasped
if (timer<0.5) then self:SetAlpha(timer*2) end
if (timer>1 and timer<2) then self:SetAlpha(1-(timer-1)*2) end
if (timer>=2 ) then self:Hide() end
end)
end)

今天更新后出现以下报错
Interface/AddOns/CombatAlert/CombatAlert.lua:85: bad argument #1 to 'SetAlpha' (Usage: self:SetAlpha(alpha))
Count: 53

Call Stack:
[string "=[C]"]: ?
[string "=[C]"]: in function `SetAlpha'
[string "@Interface/AddOns/CombatAlert/CombatAlert.lua"]:85: in function <Interface/AddOns/CombatAlert/CombatAlert.lua:82>
怎么修改。。。。

commented

ImprovedMacroFrame.zip
ImprovedMacroFrame 这个也出错,宏窗口的扩展。。。用了N年了。。。都习惯这界面

commented

self:SetAlpha(1-(timer-1)*2)
改成
self:SetAlpha(2-timer)
报错的原因是参数是负数

宏命令面板扩展,怀旧服的NDui_Plus有这个功能,有空会加到正式服里

commented

谢了。

commented

10.0.0的API改动里,SetAlpha的参数必须0-1否则会抛出error