
Сообщение от
alexdubovyck
Хорошая идея, в
арена спектатре там слишком сложно, долго разбираться в чужом коде, я даже писал разработчику в скайпе. Ему некогда мне помогать. Spell Flash тебе в помощь.
Решил попробовать написать свой с нуля, вот что вышло. Одних иконок мало, добавил и текст. тут используется ScrollFrame и TextString.
Пока не умею менять снизу вверх как у меня, на горизонталь как тут
arena_spectator_-_Поиск_в_Google_-_Google_Chrome_2016-01-14_18-33-24.jpg.
Ты трекер аур пытаешься сделать или всплывающий комбат лог?
- - - Updated - - -
Сделай по типу аур на UNIT_SPELLCAST_SUCCIDDED
- - - Updated - - -
А ну да я немного лажанул со спектатром ... Там сервер передает все в виде ивентов , а аддон только "расшифровывает" эти ивенты.
По идее не сложно сделать ... сейчас гляну.
- - - Updated - - -
Изи катка
PHP код:
local anchor = CreateFrame("frame", nil, UIParent)
anchor.unit = "player"
anchor.size = 60
anchor.hold = 4
anchor:SetPoint("CENTER", UIParent, 0, 0)
anchor:SetSize(anchor.size, anchor.size)
local OnUpdate = function(self, elapsed)
self.hold = self.hold - elapsed
if self.hold < 0 then
self:Hide()
else
self:SetAlpha(self.hold)
end
end
local CreateIcon = function(self)
local icon = CreateFrame("frame", nil, self)
icon:Hide()
icon:SetSize(self.size, self.size)
local tex = icon:CreateTexture()
tex:SetAllPoints()
icon.tex = tex
icon.hold = 0
icon.parent = self
icon:SetScript("OnUpdate", OnUpdate)
table.insert(self, icon)
return icon
end
local sort = function(a, b)
if a and b then
return a.hold > b.hold
end
end
local UpdatePosition = function(self)
table.sort(self, sort)
for i = 1, #self do
local icon = self[i]
if not icon then return end
icon:ClearAllPoints()
if i == 1 then
icon:SetPoint("CENTER", self, 0, 0)
else
icon:SetPoint("LEFT", self[i-1], "RIGHT", 2, 0)
end
end
end
local UpdateIcons = function(self, unit, limit, texture)
local index = 1
local icon
for i = 1 , limit do
local tmp = self[i] or CreateIcon(self)
if tmp:IsShown() then
index = index + 1
else
icon = self[index]
end
end
icon.tex:SetTexture(texture)
icon.hold = self.hold
icon:SetAlpha(1)
icon:Show()
UpdatePosition(self)
end
anchor:SetScript("OnEvent", function(self, event, unit, spell, rank)
if unit ~= self.unit then return end
local name, rank, texture = GetSpellInfo(spell, rank)
UpdateIcons(self, unit, 10, texture)
end)
anchor:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")