mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
actionbars
This commit is contained in:
@@ -105,9 +105,7 @@ function AB:PositionAndSizeBar(barName)
|
|||||||
lastColumnButton = bar.buttons[i-buttonsPerRow]
|
lastColumnButton = bar.buttons[i-buttonsPerRow]
|
||||||
button:ClearAllPoints()
|
button:ClearAllPoints()
|
||||||
|
|
||||||
if barName == "bar1" then
|
button:SetParent(bar)
|
||||||
button:SetParent(bar)
|
|
||||||
end
|
|
||||||
|
|
||||||
button:SetWidth(size)
|
button:SetWidth(size)
|
||||||
button:SetHeight(size)
|
button:SetHeight(size)
|
||||||
@@ -153,6 +151,12 @@ function AB:PositionAndSizeBar(barName)
|
|||||||
button:SetScale(1)
|
button:SetScale(1)
|
||||||
button:SetAlpha(1)
|
button:SetAlpha(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.db[barName].mouseover then
|
||||||
|
button:SetAlpha(0)
|
||||||
|
else
|
||||||
|
button:SetAlpha(self.db[barName].alpha)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.db[barName].enabled or not bar.initialized then
|
if self.db[barName].enabled or not bar.initialized then
|
||||||
@@ -187,17 +191,64 @@ function AB:CreateBar(id)
|
|||||||
bar.buttons = {}
|
bar.buttons = {}
|
||||||
self:HookScript(bar, "OnEnter", "Bar_OnEnter")
|
self:HookScript(bar, "OnEnter", "Bar_OnEnter")
|
||||||
self:HookScript(bar, "OnLeave", "Bar_OnLeave")
|
self:HookScript(bar, "OnLeave", "Bar_OnLeave")
|
||||||
for i = 1, NUM_ACTIONBAR_BUTTONS do
|
|
||||||
local button = _G[self["barDefaults"]["bar"..id].name.."Button"..i]
|
|
||||||
bar.buttons[i] = button
|
|
||||||
bar.buttons[i].id = id
|
|
||||||
|
|
||||||
self:HookScript(button, "OnEnter", "Button_OnEnter")
|
if id == 1 then
|
||||||
self:HookScript(button, "OnLeave", "Button_OnLeave")
|
bar.actionButtons = {}
|
||||||
end
|
bar.bonusButtons = {}
|
||||||
|
|
||||||
if id ~= 1 then
|
local button
|
||||||
_G[self["barDefaults"]["bar"..id].name]:SetParent(bar)
|
for i = 1, NUM_ACTIONBAR_BUTTONS do
|
||||||
|
button = _G["ActionButton"..i]
|
||||||
|
button:SetParent(bar)
|
||||||
|
bar.actionButtons[i] = button
|
||||||
|
self:HookScript(button, "OnEnter", "Button_OnEnter")
|
||||||
|
self:HookScript(button, "OnLeave", "Button_OnLeave")
|
||||||
|
|
||||||
|
button = _G["BonusActionButton"..i]
|
||||||
|
button:SetParent(bar)
|
||||||
|
bar.bonusButtons[i] = button
|
||||||
|
self:HookScript(button, "OnEnter", "Button_OnEnter")
|
||||||
|
self:HookScript(button, "OnLeave", "Button_OnLeave")
|
||||||
|
end
|
||||||
|
|
||||||
|
MainMenuBar:SetParent(bar)
|
||||||
|
BonusActionBarFrame:SetParent(bar)
|
||||||
|
|
||||||
|
bar.buttons = bar.actionButtons
|
||||||
|
|
||||||
|
bar:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
|
||||||
|
bar:SetScript("OnEvent", function()
|
||||||
|
if GetBonusBarOffset() > 0 then
|
||||||
|
bar.lastBonusBar = GetBonusBarOffset()
|
||||||
|
|
||||||
|
for i = 1, NUM_ACTIONBAR_BUTTONS do
|
||||||
|
bar.buttons[i]:SetParent(E.HiddenFrame)
|
||||||
|
end
|
||||||
|
|
||||||
|
bar.buttons = bar.bonusButtons
|
||||||
|
|
||||||
|
ShowBonusActionBar()
|
||||||
|
else
|
||||||
|
HideBonusActionBar()
|
||||||
|
|
||||||
|
for i = 1, NUM_ACTIONBAR_BUTTONS do
|
||||||
|
bar.buttons[i]:SetParent(E.HiddenFrame)
|
||||||
|
end
|
||||||
|
|
||||||
|
bar.buttons = bar.actionButtons
|
||||||
|
end
|
||||||
|
|
||||||
|
AB:PositionAndSizeBar("bar1")
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
for i = 1, NUM_ACTIONBAR_BUTTONS do
|
||||||
|
local button = _G[self["barDefaults"]["bar"..id].name.."Button"..i]
|
||||||
|
bar.buttons[i] = button
|
||||||
|
bar.buttons[i].id = id
|
||||||
|
|
||||||
|
self:HookScript(button, "OnEnter", "Button_OnEnter")
|
||||||
|
self:HookScript(button, "OnLeave", "Button_OnLeave")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self["handledBars"]["bar"..id] = bar
|
self["handledBars"]["bar"..id] = bar
|
||||||
@@ -303,29 +354,36 @@ function AB:Bar_OnLeave()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function AB:Button_OnEnter()
|
function AB:Button_OnEnter()
|
||||||
local bar = self["handledBars"]["bar"..this.id]
|
local bar = (this:GetParent() == BonusActionBarFrame or this:GetParent() == MainMenuBarArtFrame) and ElvUI_Bar1 or this:GetParent()
|
||||||
if bar.mouseover then
|
if bar.mouseover then
|
||||||
UIFrameFadeIn(bar, 0.2, bar:GetAlpha(), bar.db.alpha)
|
UIFrameFadeIn(bar, 0.2, bar:GetAlpha(), bar.db.alpha)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function AB:Button_OnLeave()
|
function AB:Button_OnLeave()
|
||||||
local bar = self["handledBars"]["bar"..this.id]
|
local bar = (this:GetParent() == BonusActionBarFrame or this:GetParent() == MainMenuBarArtFrame) and ElvUI_Bar1 or this:GetParent()
|
||||||
if bar.mouseover then
|
if bar.mouseover then
|
||||||
UIFrameFadeOut(bar, 0.2, bar:GetAlpha(), 0)
|
UIFrameFadeOut(bar, 0.2, bar:GetAlpha(), 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function AB:DisableBlizzard()
|
function AB:DisableBlizzard()
|
||||||
MainMenuBar:SetScale(0.00001)
|
|
||||||
MainMenuBar:EnableMouse(false)
|
MainMenuBar:EnableMouse(false)
|
||||||
|
E:Kill(MainMenuExpBar)
|
||||||
|
E:Kill(MainMenuBarMaxLevelBar)
|
||||||
|
E:Kill(MainMenuBarPerformanceBarFrame)
|
||||||
|
|
||||||
|
BonusActionBarFrame:EnableMouse(false)
|
||||||
|
BonusActionBarFrame:DisableDrawLayer("OVERLAY")
|
||||||
|
|
||||||
PetActionBarFrame:EnableMouse(false)
|
PetActionBarFrame:EnableMouse(false)
|
||||||
|
|
||||||
ShapeshiftBarFrame:EnableMouse(false)
|
ShapeshiftBarFrame:EnableMouse(false)
|
||||||
|
|
||||||
local elements = {
|
local elements = {
|
||||||
MainMenuBar,
|
--MainMenuBar,
|
||||||
MainMenuBarArtFrame,
|
MainMenuBarArtFrame,
|
||||||
BonusActionBarFrame,
|
--BonusActionBarFrame,
|
||||||
PetActionBarFrame,
|
PetActionBarFrame,
|
||||||
ShapeshiftBarFrame,
|
ShapeshiftBarFrame,
|
||||||
ShapeshiftBarLeft,
|
ShapeshiftBarLeft,
|
||||||
@@ -410,6 +468,29 @@ function AB:Initialize()
|
|||||||
|
|
||||||
if E.private.actionbar.enable ~= true then return end
|
if E.private.actionbar.enable ~= true then return end
|
||||||
|
|
||||||
|
function ActionButton_GetPagedID(button)
|
||||||
|
if button.isBonus and CURRENT_ACTIONBAR_PAGE == 1 then
|
||||||
|
local offset = GetBonusBarOffset()
|
||||||
|
if offset == 0 and ElvUI_Bar1 and ElvUI_Bar1.lastBonusBar then
|
||||||
|
offset = ElvUI_Bar1.lastBonusBar
|
||||||
|
end
|
||||||
|
return button:GetID() + ((NUM_ACTIONBAR_PAGES + offset - 1) * NUM_ACTIONBAR_BUTTONS)
|
||||||
|
end
|
||||||
|
|
||||||
|
local parentName = button:GetParent():GetName()
|
||||||
|
if parentName == "ElvUI_Bar5" then
|
||||||
|
return button:GetID() + ((BOTTOMLEFT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
|
||||||
|
elseif parentName == "ElvUI_Bar2" then
|
||||||
|
return button:GetID() + ((BOTTOMRIGHT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
|
||||||
|
elseif parentName == "ElvUI_Bar4" then
|
||||||
|
return button:GetID() + ((LEFT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
|
||||||
|
elseif parentName == "ElvUI_Bar3" then
|
||||||
|
return button:GetID() + ((RIGHT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
|
||||||
|
else
|
||||||
|
return button:GetID() + ((CURRENT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:DisableBlizzard()
|
self:DisableBlizzard()
|
||||||
|
|
||||||
self:SetupMicroBar()
|
self:SetupMicroBar()
|
||||||
|
|||||||
@@ -8,16 +8,13 @@ local E, L, V, P, G = unpack(ElvUI)
|
|||||||
|
|
||||||
local _G = getfenv()
|
local _G = getfenv()
|
||||||
local UPDATE_DELAY = 0.1
|
local UPDATE_DELAY = 0.1
|
||||||
local ATTACK_BUTTON_FLASH_TIME = ATTACK_BUTTON_FLASH_TIME
|
|
||||||
|
|
||||||
local ActionButton_GetPagedID = ActionButton_GetPagedID
|
|
||||||
local ActionButton_IsFlashing = ActionButton_IsFlashing
|
|
||||||
local ActionHasRange = ActionHasRange
|
local ActionHasRange = ActionHasRange
|
||||||
local IsActionInRange = IsActionInRange
|
local IsActionInRange = IsActionInRange
|
||||||
local IsUsableAction = IsUsableAction
|
local IsUsableAction = IsUsableAction
|
||||||
local HasAction = HasAction
|
local HasAction = HasAction
|
||||||
|
|
||||||
local tullaRange = CreateFrame("Frame", "tullaRange", UIParent); tullaRange:Hide()
|
local tullaRange = CreateFrame("Frame", "tullaRange", UIParent)
|
||||||
|
|
||||||
function tullaRange:Load()
|
function tullaRange:Load()
|
||||||
self:SetScript("OnUpdate", self.OnUpdate)
|
self:SetScript("OnUpdate", self.OnUpdate)
|
||||||
@@ -91,8 +88,7 @@ function tullaRange:UpdateButtons(elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function tullaRange:UpdateButton(button, elapsed)
|
function tullaRange:UpdateButton(button, elapsed)
|
||||||
tullaRange.UpdateButtonUsable(button)
|
tullaRange:UpdateButtonUsable(button)
|
||||||
tullaRange.UpdateFlash(button, elapsed)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function tullaRange:UpdateButtonStatus()
|
function tullaRange:UpdateButtonStatus()
|
||||||
@@ -121,16 +117,16 @@ function tullaRange.OnButtonHide()
|
|||||||
tullaRange:UpdateButtonStatus(this)
|
tullaRange:UpdateButtonStatus(this)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tullaRange.OnUpdateButtonUsable()
|
function tullaRange:OnUpdateButtonUsable()
|
||||||
this.tullaRangeColor = nil
|
this.tullaRangeColor = nil
|
||||||
tullaRange.UpdateButtonUsable(this)
|
tullaRange:UpdateButtonUsable(this)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tullaRange.OnButtonUpdate()
|
function tullaRange.OnButtonUpdate()
|
||||||
tullaRange:UpdateButtonStatus(this)
|
tullaRange:UpdateButtonStatus(this)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tullaRange.UpdateButtonUsable(button)
|
function tullaRange:UpdateButtonUsable(button)
|
||||||
local action = ActionButton_GetPagedID(button)
|
local action = ActionButton_GetPagedID(button)
|
||||||
local isUsable, notEnoughMana = IsUsableAction(action)
|
local isUsable, notEnoughMana = IsUsableAction(action)
|
||||||
|
|
||||||
@@ -158,29 +154,6 @@ function tullaRange.SetButtonColor(button, colorType)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function tullaRange.UpdateFlash(button, elapsed)
|
|
||||||
if ActionButton_IsFlashing(button) then
|
|
||||||
local flashtime = button.flashtime - elapsed
|
|
||||||
|
|
||||||
if flashtime <= 0 then
|
|
||||||
local overtime = -flashtime
|
|
||||||
if overtime >= ATTACK_BUTTON_FLASH_TIME then
|
|
||||||
overtime = 0
|
|
||||||
end
|
|
||||||
flashtime = ATTACK_BUTTON_FLASH_TIME - overtime
|
|
||||||
|
|
||||||
local flashTexture = _G[button:GetName() .. "Flash"]
|
|
||||||
if flashTexture:IsShown() then
|
|
||||||
flashTexture:Hide()
|
|
||||||
else
|
|
||||||
flashTexture:Show()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
button.flashtime = flashtime
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function tullaRange:LoadDefaults()
|
function tullaRange:LoadDefaults()
|
||||||
TULLARANGE_COLORS = {
|
TULLARANGE_COLORS = {
|
||||||
["OOR"] = E:GetColorTable(E.db.actionbar.noRangeColor),
|
["OOR"] = E:GetColorTable(E.db.actionbar.noRangeColor),
|
||||||
|
|||||||
Reference in New Issue
Block a user