fix: keyring icon
This commit is contained in:
+18
-6
@@ -1604,13 +1604,19 @@ end
|
|||||||
function Guda_BagFrame_HighlightBagButton(bagID)
|
function Guda_BagFrame_HighlightBagButton(bagID)
|
||||||
if not bagID then return end
|
if not bagID then return end
|
||||||
|
|
||||||
-- Bag 0 (backpack) has no button in the toolbar, only bags 1-4
|
local buttonName
|
||||||
if bagID == 0 then return end
|
if bagID == -2 then
|
||||||
|
-- Keyring button
|
||||||
|
buttonName = "Guda_BagFrame_Toolbar_KeyringButton"
|
||||||
|
elseif bagID >= 1 and bagID <= 4 then
|
||||||
|
-- Bag buttons 1-4
|
||||||
|
buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
|
||||||
|
else
|
||||||
|
-- Bag 0 (backpack) has no button in the toolbar
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Bag buttons are named: Guda_BagFrame_Toolbar_BagSlot1 through BagSlot4
|
|
||||||
local buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
|
|
||||||
local button = getglobal(buttonName)
|
local button = getglobal(buttonName)
|
||||||
|
|
||||||
if button then
|
if button then
|
||||||
-- Set the button's pushed texture to highlight it
|
-- Set the button's pushed texture to highlight it
|
||||||
button:LockHighlight()
|
button:LockHighlight()
|
||||||
@@ -1619,7 +1625,7 @@ end
|
|||||||
|
|
||||||
-- Clear bag button highlighting
|
-- Clear bag button highlighting
|
||||||
function Guda_BagFrame_ClearBagButtonHighlight()
|
function Guda_BagFrame_ClearBagButtonHighlight()
|
||||||
-- Clear highlight from all bag buttons (1-4, no button for bag 0)
|
-- Clear highlight from all bag buttons (1-4)
|
||||||
for bagID = 1, 4 do
|
for bagID = 1, 4 do
|
||||||
local buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
|
local buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
|
||||||
local button = getglobal(buttonName)
|
local button = getglobal(buttonName)
|
||||||
@@ -1627,6 +1633,12 @@ function Guda_BagFrame_ClearBagButtonHighlight()
|
|||||||
button:UnlockHighlight()
|
button:UnlockHighlight()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Clear keyring button highlight
|
||||||
|
local keyringButton = getglobal("Guda_BagFrame_Toolbar_KeyringButton")
|
||||||
|
if keyringButton then
|
||||||
|
keyringButton:UnlockHighlight()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initialize
|
-- Initialize
|
||||||
|
|||||||
+20
-19
@@ -434,7 +434,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- Keyring Button -->
|
<!-- Keyring Button -->
|
||||||
<Button name="$parent_KeyringButton">
|
<Button name="$parent_KeyringButton" inherits="ItemButtonTemplate">
|
||||||
<Size>
|
<Size>
|
||||||
<AbsDimension x="24" y="24"/>
|
<AbsDimension x="24" y="24"/>
|
||||||
</Size>
|
</Size>
|
||||||
@@ -445,33 +445,34 @@
|
|||||||
</Offset>
|
</Offset>
|
||||||
</Anchor>
|
</Anchor>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
<Layers>
|
|
||||||
<Layer level="ARTWORK">
|
|
||||||
<Texture name="$parent_Icon">
|
|
||||||
<Size>
|
|
||||||
<AbsDimension x="20" y="20"/>
|
|
||||||
</Size>
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="CENTER"/>
|
|
||||||
</Anchors>
|
|
||||||
<Color r="0.8" g="0.8" b="0.8"/>
|
|
||||||
</Texture>
|
|
||||||
</Layer>
|
|
||||||
</Layers>
|
|
||||||
<Scripts>
|
<Scripts>
|
||||||
<OnLoad>
|
<OnLoad>
|
||||||
local icon = getglobal(this:GetName().."_Icon")
|
-- Hide borders (same as bag slots)
|
||||||
if icon then
|
local normalTexture = getglobal(this:GetName().."NormalTexture")
|
||||||
icon:SetTexture("Interface\\Icons\\INV_Misc_Key_03")
|
if normalTexture then
|
||||||
icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
|
normalTexture:SetTexture(nil)
|
||||||
|
normalTexture:Hide()
|
||||||
end
|
end
|
||||||
|
local iconBorder = getglobal(this:GetName().."IconBorder")
|
||||||
|
if iconBorder then
|
||||||
|
iconBorder:Hide()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set keyring icon using SetItemButtonTexture (same as bag slots)
|
||||||
|
SetItemButtonTexture(this, "Interface\\Icons\\INV_Misc_Key_03")
|
||||||
|
|
||||||
|
-- Optionally tint it cyan to distinguish it
|
||||||
|
SetItemButtonTextureVertexColor(this, 0.7, 1.0, 1.0)
|
||||||
</OnLoad>
|
</OnLoad>
|
||||||
<OnClick>
|
<OnClick>
|
||||||
Guda_BagFrame_ToggleKeyring()
|
Guda_BagFrame_ToggleKeyring()
|
||||||
</OnClick>
|
</OnClick>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
GameTooltip:SetOwner(this, "ANCHOR_TOP")
|
GameTooltip:SetOwner(this, "ANCHOR_TOP")
|
||||||
GameTooltip:SetText("Toggle Keyring")
|
GameTooltip:SetText("Keyring", 1.0, 1.0, 1.0)
|
||||||
|
local numSlots = GetContainerNumSlots(-2) or 0
|
||||||
|
GameTooltip:AddLine(string.format("%d Slots", numSlots), 0.8, 0.8, 0.8)
|
||||||
|
GameTooltip:AddLine("(Click to toggle)", 0.5, 0.8, 0.5)
|
||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
Guda_BagFrame_HighlightBagSlots(-2)
|
Guda_BagFrame_HighlightBagSlots(-2)
|
||||||
</OnEnter>
|
</OnEnter>
|
||||||
|
|||||||
Reference in New Issue
Block a user