Lua - 魔兽世界 API Debuff 框体
2018-4-14 19:2:8
收藏:0
阅读:103
评论:1
我遇到一个奇怪的问题,使用这个插件会显示当前的 Debuff 框体。我想它只显示第一个,如果有另一个应用它就会覆盖第一个。我该如何使它显示新的 Debuff 次于旧的 Debuff 呢?
这是代码:
function WCCPlayer_OnLoad()
this:SetHeight(40)
this:SetWidth(40)
this:SetPoint("CENTER", 0, 0)
this:RegisterEvent("UNIT_AURA")
this:RegisterEvent("PLAYER_AURAS_CHANGED")
this.texture = this:CreateTexture(this, "BACKGROUND")
this.texture:SetAllPoints(this)
this.cooldown = CreateFrame("Model", "Cooldown", this, "CooldownFrameTemplate")
this.cooldown:SetAllPoints(this)
this.maxExpirationTime = 0
this:Hide()
end
function WCCPlayer_OnEvent()
local spellFound = false
for i=1, 16 do -- 16 表示由于 HARMFUL 过滤器,足够了。
local texture = UnitDebuff("player", i)
WCCTooltip:ClearLines()
WCCTooltip:SetUnitDebuff("player", i)
local buffName = WCCTooltipTextLeft1:GetText()
if spellIds[buffName] then
spellFound = true
for j=0, 31 do
local buffTexture = GetPlayerBuffTexture(j)
if texture == buffTexture then
local expirationTime = GetPlayerBuffTimeLeft(j)
this:Show()
this.texture:SetTexture(buffTexture)
this.cooldown:SetModelScale(1)
if this.maxExpirationTime <= expirationTime then
CooldownFrame_SetTimer(this.cooldown, GetTime(), expirationTime, 1)
this.maxExpirationTime = expirationTime
end
return
end
end
end
end
if spellFound == false then
this.maxExpirationTime = 0
this:Hide()
end
end
function WCCTarget_OnLoad()
end
function WCCTarget_OnEvent()
end
点赞
评论区的留言会收到邮件通知哦~
推荐文章
- Lua 虚拟机加密load(string.dump(function)) 后执行失败问题如何解决
- 我想创建一个 Nginx 规则,禁止访问
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?

我认为这一切都是关于框体位置,就像你说的一样,新框体显示在旧框体的上面。
你需要让新框体紧挨在旧框体旁边,这样每次运行你的**WCCPlayer_OnLoad()**函数时都会将X坐标增加框体的宽度。
首先在函数外声明一个本地变量**setPointX**,然后每次函数运行时将该变量增加框体的宽度(在你的情况下是40);
local setPointX, setPointY = 0,0 -- x和y变量 function WCCPlayer_OnLoad() this:SetHeight(40) this:SetWidth(40) this:SetPoint('CENTER', setPointX, setPointY) -- 使用变量设置框体点 this:RegisterEvent('UNIT_AURA') this:RegisterEvent('PLAYER_AURAS_CHANGED') this.texture = this:CreateTexture(this, 'BACKGROUND') this.texture:SetAllPoints(this) this.cooldown = CreateFrame('Model', 'Cooldown', this, 'CooldownFrameTemplate') this.cooldown:SetAllPoints(this) this.maxExpirationTime = 0 this:Hide() setPointX = setPointX + 40 -- 将X变量增加框体的宽度 end我没有编程背景(只是尝试自学Java和Lua),因此肯定会有更好的和更高效/有效的方法来解决您的问题。