mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
1
This commit is contained in:
@@ -23,8 +23,8 @@ local lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
|
||||
if not lib then return end
|
||||
|
||||
-- //////////////////////////////////////////////////////////////
|
||||
L_UIDROPDOWNMENU_MINBUTTONS = 8;
|
||||
L_UIDROPDOWNMENU_MAXBUTTONS = 8;
|
||||
L_UIDROPDOWNMENU_MINBUTTONS = 32;
|
||||
L_UIDROPDOWNMENU_MAXBUTTONS = 32;
|
||||
L_UIDROPDOWNMENU_MAXLEVELS = 2;
|
||||
L_UIDROPDOWNMENU_BUTTON_HEIGHT = 16;
|
||||
L_UIDROPDOWNMENU_BORDER_HEIGHT = 15;
|
||||
@@ -171,7 +171,6 @@ info.text = [STRING] -- The text of the button
|
||||
info.value = [ANYTHING] -- The value that L_UIDROPDOWNMENU_MENU_VALUE is set to when the button is clicked
|
||||
info.func = [function()] -- The function that is called when you click the button
|
||||
info.checked = [nil, true, function] -- Check the button if true or function returns true
|
||||
info.isNotRadio = [nil, true] -- Check the button uses radial image if false check box image if true
|
||||
info.isTitle = [nil, true] -- If it's a title the button is disabled and the font color is set to yellow
|
||||
info.disabled = [nil, true] -- Disable the button and show an invisible button that still traps the mouseover event so menu doesn't time out
|
||||
info.tooltipWhileDisabled = [nil, 1] -- Show the tooltip, even when the button is disabled.
|
||||
@@ -196,7 +195,6 @@ info.tooltipOnButton = [nil, 1] -- Show the tooltip attached to the button inste
|
||||
info.justifyH = [nil, "CENTER"] -- Justify button text
|
||||
info.arg1 = [ANYTHING] -- This is the first argument used by info.func
|
||||
info.arg2 = [ANYTHING] -- This is the second argument used by info.func
|
||||
info.fontObject = [FONT] -- font object replacement for Normal and Highlight
|
||||
info.menuTable = [TABLE] -- This contains an array of info tables to be displayed as a child menu
|
||||
info.noClickSound = [nil, 1] -- Set to 1 to suppress the sound when clicking the button. The sound only plays if .func is set.
|
||||
info.padding = [nil, NUMBER] -- Number of pixels to pad the text on the right side
|
||||
@@ -312,20 +310,20 @@ function L_UIDropDownMenu_AddButton(info, level)
|
||||
local invisibleButton = _G[button:GetName().."InvisibleButton"];
|
||||
|
||||
-- Default settings
|
||||
button:SetDisabledFontObject(GameFontDisableSmallLeft);
|
||||
button:SetDisabledTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
|
||||
invisibleButton:Hide();
|
||||
button:Enable();
|
||||
|
||||
-- If not clickable then disable the button and set it white
|
||||
if ( info.notClickable ) then
|
||||
info.disabled = true;
|
||||
button:SetDisabledFontObject(GameFontHighlightSmallLeft);
|
||||
button:SetDisabledTextColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
|
||||
end
|
||||
|
||||
-- Set the text color and disable it if its a title
|
||||
if ( info.isTitle ) then
|
||||
info.disabled = true;
|
||||
button:SetDisabledFontObject(GameFontNormalSmallLeft);
|
||||
button:SetDisabledTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
|
||||
end
|
||||
|
||||
-- Disable the button if disabled and turn off the color code
|
||||
@@ -351,11 +349,7 @@ function L_UIDropDownMenu_AddButton(info, level)
|
||||
|
||||
-- Set icon
|
||||
if ( info.icon ) then
|
||||
icon:SetSize(16,16);
|
||||
icon:SetTexture(info.icon);
|
||||
icon:ClearAllPoints();
|
||||
icon:SetPoint("RIGHT");
|
||||
|
||||
if ( info.tCoordLeft ) then
|
||||
icon:SetTexCoord(info.tCoordLeft, info.tCoordRight, info.tCoordTop, info.tCoordBottom);
|
||||
else
|
||||
@@ -365,15 +359,6 @@ function L_UIDropDownMenu_AddButton(info, level)
|
||||
else
|
||||
icon:Hide();
|
||||
end
|
||||
|
||||
-- Check to see if there is a replacement font
|
||||
if ( info.fontObject ) then
|
||||
button:SetNormalFontObject(info.fontObject);
|
||||
button:SetHighlightFontObject(info.fontObject);
|
||||
else
|
||||
--button:SetNormalFontObject(STANDARD_TEXT_FONT);
|
||||
--button:SetHighlightFontObject(STANDARD_TEXT_FONT);
|
||||
end
|
||||
else
|
||||
button:SetText("");
|
||||
icon:Hide();
|
||||
@@ -496,21 +481,9 @@ function L_UIDropDownMenu_AddButton(info, level)
|
||||
if ( info.disabled ) then
|
||||
_G[listFrameName.."Button"..index.."Check"]:SetDesaturated(true);
|
||||
_G[listFrameName.."Button"..index.."Check"]:SetAlpha(0.5);
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:SetDesaturated(true);
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:SetAlpha(0.5);
|
||||
else
|
||||
_G[listFrameName.."Button"..index.."Check"]:SetDesaturated(false);
|
||||
_G[listFrameName.."Button"..index.."Check"]:SetAlpha(1);
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:SetDesaturated(false);
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:SetAlpha(1);
|
||||
end
|
||||
|
||||
if info.isNotRadio then
|
||||
_G[listFrameName.."Button"..index.."Check"]:SetTexCoord(0.0, 0.5, 0.0, 0.5);
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:SetTexCoord(0.5, 1.0, 0.0, 0.5);
|
||||
else
|
||||
_G[listFrameName.."Button"..index.."Check"]:SetTexCoord(0.0, 0.5, 0.5, 1.0);
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:SetTexCoord(0.5, 1.0, 0.5, 1.0);
|
||||
end
|
||||
|
||||
-- Checked can be a function now
|
||||
@@ -523,15 +496,12 @@ function L_UIDropDownMenu_AddButton(info, level)
|
||||
if ( checked ) then
|
||||
button:LockHighlight();
|
||||
_G[listFrameName.."Button"..index.."Check"]:Show();
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:Hide();
|
||||
else
|
||||
button:UnlockHighlight();
|
||||
_G[listFrameName.."Button"..index.."Check"]:Hide();
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:Show();
|
||||
end
|
||||
else
|
||||
_G[listFrameName.."Button"..index.."Check"]:Hide();
|
||||
_G[listFrameName.."Button"..index.."UnCheck"]:Hide();
|
||||
end
|
||||
button.checked = info.checked;
|
||||
|
||||
@@ -607,7 +577,7 @@ function L_UIDropDownMenu_GetButtonWidth(button)
|
||||
end
|
||||
|
||||
function L_UIDropDownMenu_Refresh(frame, useValue, dropdownLevel)
|
||||
local button, checked, checkImage, uncheckImage, normalText, width;
|
||||
local button, checked, checkImage, normalText, width;
|
||||
local maxWidth = 0;
|
||||
local somethingChecked = nil;
|
||||
if ( not dropdownLevel ) then
|
||||
@@ -644,7 +614,6 @@ function L_UIDropDownMenu_Refresh(frame, useValue, dropdownLevel)
|
||||
if not button.notCheckable and button:IsShown() then
|
||||
-- If checked show check image
|
||||
checkImage = _G["L_DropDownList"..dropdownLevel.."Button"..i.."Check"];
|
||||
uncheckImage = _G["L_DropDownList"..dropdownLevel.."Button"..i.."UnCheck"];
|
||||
if ( checked ) then
|
||||
somethingChecked = true;
|
||||
local icon = _G[frame:GetName().."Icon"];
|
||||
@@ -659,11 +628,9 @@ function L_UIDropDownMenu_Refresh(frame, useValue, dropdownLevel)
|
||||
end
|
||||
button:LockHighlight();
|
||||
checkImage:Show();
|
||||
uncheckImage:Hide();
|
||||
else
|
||||
button:UnlockHighlight();
|
||||
checkImage:Hide();
|
||||
uncheckImage:Show();
|
||||
end
|
||||
end
|
||||
|
||||
@@ -769,48 +736,46 @@ function L_UIDropDownMenu_GetSelectedValue(frame)
|
||||
return frame.selectedValue;
|
||||
end
|
||||
|
||||
function L_UIDropDownMenuButton_OnClick(self)
|
||||
local checked = self.checked;
|
||||
function L_UIDropDownMenuButton_OnClick()
|
||||
local checked = this.checked;
|
||||
if ( type (checked) == "function" ) then
|
||||
checked = checked(self);
|
||||
checked = checked(this);
|
||||
end
|
||||
|
||||
|
||||
if ( self.keepShownOnClick ) then
|
||||
if not self.notCheckable then
|
||||
if ( this.keepShownOnClick ) then
|
||||
if not this.notCheckable then
|
||||
if ( checked ) then
|
||||
_G[self:GetName().."Check"]:Hide();
|
||||
_G[self:GetName().."UnCheck"]:Show();
|
||||
_G[this:GetName().."Check"]:Hide();
|
||||
checked = false;
|
||||
else
|
||||
_G[self:GetName().."Check"]:Show();
|
||||
_G[self:GetName().."UnCheck"]:Hide();
|
||||
_G[this:GetName().."Check"]:Show();
|
||||
checked = true;
|
||||
end
|
||||
end
|
||||
else
|
||||
self:GetParent():Hide();
|
||||
this:GetParent():Hide();
|
||||
end
|
||||
|
||||
if ( type (self.checked) ~= "function" ) then
|
||||
self.checked = checked;
|
||||
if ( type (this.checked) ~= "function" ) then
|
||||
this.checked = checked;
|
||||
end
|
||||
|
||||
-- saving this here because func might use a dropdown, changing this self's attributes
|
||||
local playSound = true;
|
||||
if ( self.noClickSound ) then
|
||||
if ( this.noClickSound ) then
|
||||
playSound = false;
|
||||
end
|
||||
|
||||
local func = self.func;
|
||||
local func = this.func;
|
||||
if ( func ) then
|
||||
func(self, self.arg1, self.arg2, checked);
|
||||
func(this.arg1, this.arg2, checked);
|
||||
else
|
||||
return;
|
||||
end
|
||||
|
||||
if ( playSound ) then
|
||||
PlaySound(PlaySoundKitID and "UChatScrollButton" or SOUNDKIT.U_CHAT_SCROLL_BUTTON);
|
||||
PlaySound("UChatScrollButton");
|
||||
end
|
||||
end
|
||||
|
||||
@@ -823,6 +788,7 @@ function L_ToggleDropDownMenu(level, value, dropDownFrame, anchorName, xOffset,
|
||||
if ( not level ) then
|
||||
level = 1;
|
||||
end
|
||||
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes-index", 0);
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes", true);
|
||||
@@ -862,7 +828,7 @@ function L_ToggleDropDownMenu(level, value, dropDownFrame, anchorName, xOffset,
|
||||
-- Display stuff
|
||||
-- Level specific stuff
|
||||
if ( level == 1 ) then
|
||||
--UIDropDownMenuDelegate:SetAttribute("openmenu", dropDownFrame);
|
||||
L_UIDROPDOWNMENU_OPEN_MENU = dropDownFrame;
|
||||
listFrame:ClearAllPoints();
|
||||
-- If there's no specified anchorName then use left side of the dropdown menu
|
||||
if ( not anchorName ) then
|
||||
@@ -1107,15 +1073,13 @@ function L_UIDropDownMenu_ClearAll(frame)
|
||||
frame.selectedValue = nil;
|
||||
L_UIDropDownMenu_SetText(frame, "");
|
||||
|
||||
local button, checkImage, uncheckImage;
|
||||
local button, checkImage;
|
||||
for i=1, L_UIDROPDOWNMENU_MAXBUTTONS do
|
||||
button = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL.."Button"..i];
|
||||
button:UnlockHighlight();
|
||||
|
||||
checkImage = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL.."Button"..i.."Check"];
|
||||
checkImage:Hide();
|
||||
uncheckImage = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL.."Button"..i.."UnCheck"];
|
||||
uncheckImage:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,37 +2,35 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Button name="L_UIDropDownMenuButtonTemplate" virtual="true">
|
||||
<Size x="100" y="16"/>
|
||||
<Size>
|
||||
<AbsDimension x="128" y="16"/>
|
||||
</Size>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="$parentHighlight" file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD" setAllPoints="true" hidden="true"/>
|
||||
</Layer>
|
||||
<Layer level="ARTWORK">
|
||||
<Texture name="$parentCheck" file="Interface\Buttons\UI-CheckBox-Check">
|
||||
<Size x="16" y="16"/>
|
||||
<Size>
|
||||
<AbsDimension x="24" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT">
|
||||
<Offset x="0" y="0"/>
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0" right="0.5" top="0.5" bottom="1.0"/>
|
||||
</Texture>
|
||||
<Texture name="$parentUnCheck" file="Interface\Buttons\UI-CheckBox-Check">
|
||||
<Size x="16" y="16"/>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT">
|
||||
<Offset x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0.5" right="1.0" top="0.5" bottom="1.0"/>
|
||||
</Texture>
|
||||
<Texture name="$parentIcon" hidden="true">
|
||||
<Size>
|
||||
<AbsDimension x="16" y="16"/>
|
||||
<AbsDimension x="15" y="15"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="RIGHT">
|
||||
<Offset x="0" y="0"/>
|
||||
<Offset>
|
||||
<AbsDimension x="-5" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
@@ -69,17 +67,17 @@
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
securecall("CloseMenus");
|
||||
L_UIDropDownMenuButton_OpenColorPicker(this:GetParent());
|
||||
CloseMenus()
|
||||
L_UIDropDownMenuButton_OpenColorPicker(this:GetParent())
|
||||
</OnClick>
|
||||
<OnEnter>
|
||||
L_CloseDropDownMenus(this:GetParent():GetParent():GetID() + 1);
|
||||
getglobal(this:GetName().."SwatchBg"):SetVertexColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent():GetParent());
|
||||
L_CloseDropDownMenus(this:GetParent():GetParent():GetID() + 1)
|
||||
getglobal(this:GetName().."SwatchBg"):SetVertexColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent():GetParent())
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
getglobal(this:GetName().."SwatchBg"):SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent():GetParent());
|
||||
getglobal(this:GetName().."SwatchBg"):SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent():GetParent())
|
||||
</OnLeave>
|
||||
</Scripts>
|
||||
<NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\ChatFrameColorSwatch"/>
|
||||
@@ -97,23 +95,23 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
L_ToggleDropDownMenu(this:GetParent():GetParent():GetID() + 1, this:GetParent().value, nil, nil, nil, nil, this:GetParent().menuList, this);
|
||||
L_ToggleDropDownMenu(this:GetParent():GetParent():GetID() + 1, this:GetParent().value, nil, nil, nil, nil, this:GetParent().menuList, this)
|
||||
</OnClick>
|
||||
<OnEnter>
|
||||
local level = this:GetParent():GetParent():GetID() + 1;
|
||||
local listFrame = getglobal("L_DropDownList"..level);
|
||||
if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= this ) then
|
||||
L_ToggleDropDownMenu(level, this:GetParent().value, nil, nil, nil, nil, this:GetParent().menuList, this);
|
||||
local level = this:GetParent():GetParent():GetID() + 1
|
||||
local listFrame = getglobal("L_DropDownList"..level)
|
||||
if not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= this then
|
||||
L_ToggleDropDownMenu(level, this:GetParent().value, nil, nil, nil, nil, this:GetParent().menuList, this)
|
||||
end
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent():GetParent());
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent():GetParent())
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent():GetParent());
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent():GetParent())
|
||||
</OnLeave>
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\ChatFrame\ChatFrameExpandArrow"/>
|
||||
</Button>
|
||||
<Button name="$parentInvisibleButton" hidden="true" parentKey="invisibleButton">
|
||||
<Button name="$parentInvisibleButton" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"/>
|
||||
<Anchor point="BOTTOMLEFT"/>
|
||||
@@ -125,76 +123,64 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnEnter>
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent():GetParent());
|
||||
L_CloseDropDownMenus(this:GetParent():GetParent():GetID() + 1);
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent():GetParent())
|
||||
L_CloseDropDownMenus(this:GetParent():GetParent():GetID() + 1)
|
||||
local parent = this:GetParent();
|
||||
if ( parent.tooltipTitle and parent.tooltipWhileDisabled) then
|
||||
if ( parent.tooltipOnButton ) then
|
||||
GameTooltip:SetOwner(parent, "ANCHOR_RIGHT");
|
||||
GameTooltip:AddLine(parent.tooltipTitle, 1.0, 1.0, 1.0);
|
||||
GameTooltip:AddLine(parent.tooltipText, nil, nil, nil, true);
|
||||
GameTooltip:Show();
|
||||
if parent.tooltipTitle and parent.tooltipWhileDisabled then
|
||||
if parent.tooltipOnButton then
|
||||
GameTooltip:SetOwner(parent, "ANCHOR_RIGHT")
|
||||
GameTooltip:AddLine(parent.tooltipTitle, 1.0, 1.0, 1.0)
|
||||
GameTooltip:AddLine(parent.tooltipText, nil, nil, nil, true)
|
||||
GameTooltip:Show()
|
||||
else
|
||||
GameTooltip_AddNewbieTip(parent, parent.tooltipTitle, 1.0, 1.0, 1.0, parent.tooltipText, 1);
|
||||
GameTooltip_AddNewbieTip(parent, parent.tooltipTitle, 1.0, 1.0, 1.0, parent.tooltipText, 1)
|
||||
end
|
||||
end
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent():GetParent());
|
||||
GameTooltip:Hide();
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent():GetParent())
|
||||
GameTooltip:Hide()
|
||||
</OnLeave>
|
||||
</Scripts>
|
||||
</Button>
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
this:SetFrameLevel(this:GetParent():GetFrameLevel()+2);
|
||||
this:SetFrameLevel(this:GetParent():GetFrameLevel()+2)
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
L_UIDropDownMenuButton_OnClick(this, arg1, arg2);
|
||||
L_UIDropDownMenuButton_OnClick(this, arg1, arg2)
|
||||
</OnClick>
|
||||
<OnEnter>
|
||||
if ( this.hasArrow ) then
|
||||
local level = this:GetParent():GetID() + 1;
|
||||
local listFrame = getglobal("L_DropDownList"..level);
|
||||
if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= this ) then
|
||||
L_ToggleDropDownMenu(this:GetParent():GetID() + 1, this.value, nil, nil, nil, nil, this.menuList, this);
|
||||
if this.hasArrow then
|
||||
local level = this:GetParent():GetID() + 1
|
||||
local listFrame = getglobal("L_DropDownList"..level)
|
||||
if not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= this then
|
||||
L_ToggleDropDownMenu(this:GetParent():GetID() + 1, this.value, nil, nil, nil, nil, this.menuList, this)
|
||||
end
|
||||
else
|
||||
L_CloseDropDownMenus(this:GetParent():GetID() + 1);
|
||||
L_CloseDropDownMenus(this:GetParent():GetID() + 1)
|
||||
end
|
||||
getglobal(this:GetName().."Highlight"):Show();
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent());
|
||||
if ( this.tooltipTitle ) then
|
||||
if ( this.tooltipOnButton ) then
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
|
||||
GameTooltip:AddLine(this.tooltipTitle, 1.0, 1.0, 1.0);
|
||||
GameTooltip:AddLine(this.tooltipText, nil, nil, nil, true);
|
||||
GameTooltip:Show();
|
||||
getglobal(this:GetName().."Highlight"):Show()
|
||||
L_UIDropDownMenu_StopCounting(this:GetParent())
|
||||
if this.tooltipTitle then
|
||||
if this.tooltipOnButton then
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
|
||||
GameTooltip:AddLine(this.tooltipTitle, 1.0, 1.0, 1.0)
|
||||
GameTooltip:AddLine(this.tooltipText, nil, nil, nil, true)
|
||||
GameTooltip:Show()
|
||||
else
|
||||
GameTooltip_AddNewbieTip(this, this.tooltipTitle, 1.0, 1.0, 1.0, this.tooltipText, 1);
|
||||
GameTooltip_AddNewbieTip(this, this.tooltipTitle, 1.0, 1.0, 1.0, this.tooltipText, 1)
|
||||
end
|
||||
end
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
getglobal(this:GetName().."Highlight"):Hide();
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent());
|
||||
GameTooltip:Hide();
|
||||
getglobal(this:GetName().."Highlight"):Hide()
|
||||
L_UIDropDownMenu_StartCounting(this:GetParent())
|
||||
GameTooltip:Hide()
|
||||
</OnLeave>
|
||||
<OnEnable>
|
||||
this.invisibleButton:Hide();
|
||||
</OnEnable>
|
||||
<OnDisable>
|
||||
this.invisibleButton:Show();
|
||||
</OnDisable>
|
||||
</Scripts>
|
||||
<ButtonText name="$parentNormalText">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT">
|
||||
<Offset x="-5" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</ButtonText>
|
||||
<ButtonText name="$parentNormalText"/>
|
||||
<NormalFont inherits="GameFontHighlightSmall" justifyH="LEFT"/>
|
||||
<HighlightFont inherits="GameFontHighlightSmall" justifyH="LEFT"/>
|
||||
<DisabledFont inherits="GameFontDisableSmall" justifyH="LEFT"/>
|
||||
|
||||
@@ -186,6 +186,10 @@ function DT:AssignPanelToDataText(panel, data)
|
||||
|
||||
if data["events"] then
|
||||
for _, event in pairs(data["events"]) do
|
||||
-- random error 132
|
||||
if event == "PLAYER_ENTERING_WORLD" then
|
||||
event = "PLAYER_LOGIN"
|
||||
end
|
||||
panel:RegisterEvent(event)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
local E, L, V, P, G = unpack(ElvUI)
|
||||
local DT = E:GetModule("DataTexts")
|
||||
|
||||
local type, pairs, select = type, pairs, select
|
||||
local sort, wipe = table.sort, wipe
|
||||
local format, find, join, gsub = string.format, string.find, string.join, string.gsub
|
||||
|
||||
local UnitIsAFK = UnitIsAFK
|
||||
local UnitIsDND = UnitIsDND
|
||||
local SendChatMessage = SendChatMessage
|
||||
local InviteUnit = InviteUnit
|
||||
local SetItemRef = SetItemRef
|
||||
local GetFriendInfo = GetFriendInfo
|
||||
local GetNumFriends = GetNumFriends
|
||||
local GetQuestDifficultyColor = GetQuestDifficultyColor
|
||||
local UnitInParty = UnitInParty
|
||||
local UnitInRaid = UnitInRaid
|
||||
local ToggleFriendsFrame = ToggleFriendsFrame
|
||||
local L_EasyMenu = L_EasyMenu
|
||||
local AFK = AFK
|
||||
local DND = DND
|
||||
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
|
||||
local LOCALIZED_CLASS_NAMES_FEMALE = LOCALIZED_CLASS_NAMES_FEMALE
|
||||
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
|
||||
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
|
||||
|
||||
local function GetNumberFriends()
|
||||
local numFriends = GetNumFriends()
|
||||
local onlineFriends = 0
|
||||
local _, online
|
||||
|
||||
for i = 1, numFriends do
|
||||
_, _, _, _, online = GetFriendInfo(i)
|
||||
|
||||
if online then
|
||||
onlineFriends = onlineFriends + 1
|
||||
end
|
||||
end
|
||||
|
||||
return numFriends, onlineFriends
|
||||
end
|
||||
|
||||
local menuFrame = CreateFrame("Frame", "FriendDatatextRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate")
|
||||
local menuList = {
|
||||
{text = "OPTIONS_MENU", isTitle = true, notCheckable = true},
|
||||
{text = "INVITE", hasArrow = true, notCheckable = true},
|
||||
{text = "CHAT_MSG_WHISPER_INFORM", hasArrow = true, notCheckable= true},
|
||||
{text = "PLAYER_STATUS", hasArrow = true, notCheckable = true,
|
||||
menuList = {
|
||||
{text = "|cff2BC226" .. "AVAILABLE" .. "|r", notCheckable = true, func = function() end},
|
||||
{text = "|cffE7E716" .. "AFK" .. "|r", notCheckable = true, func = function() end},
|
||||
{text = "|cffFF0000" .. "DND" .. "|r", notCheckable = true, func = function() end}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local function inviteClick(name)
|
||||
menuFrame:Hide()
|
||||
|
||||
if(type(name) ~= "number") then
|
||||
InviteUnit(name)
|
||||
end
|
||||
end
|
||||
|
||||
local function whisperClick(name)
|
||||
menuFrame:Hide()
|
||||
|
||||
SetItemRef("player:" .. name, format("|Hplayer:%1$s|h[%1$s]|h", name), "LeftButton")
|
||||
end
|
||||
|
||||
local lastPanel
|
||||
local levelNameString = "|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r"
|
||||
local levelNameClassString = "|cff%02x%02x%02x%d|r %s%s"
|
||||
local worldOfWarcraftString = WORLD_OF_WARCRAFT
|
||||
local totalOnlineString = join("", GUILD_ONLINE_LABEL, ": %s/%s")
|
||||
local tthead = {r = 0.4, g = 0.78, b = 1}
|
||||
local activezone, inactivezone = {r = 0.3, g = 1.0, b = 0.3}, {r = 0.65, g = 0.65, b = 0.65}
|
||||
local displayString = ""
|
||||
local groupedTable = {"|cffaaaaaa*|r", ""}
|
||||
local friendTable = {}
|
||||
local friendOnline, friendOffline = gsub(ERR_FRIEND_ONLINE_SS, "\124Hplayer:%%s\124h%[%%s%]\124h", ""), gsub(ERR_FRIEND_OFFLINE_S, "%%s", "")
|
||||
local dataValid = false
|
||||
|
||||
local function SortAlphabeticName(a, b)
|
||||
if(a[1] and b[1]) then
|
||||
return a[1] < b[1]
|
||||
end
|
||||
end
|
||||
|
||||
local function BuildFriendTable(total)
|
||||
wipe(friendTable)
|
||||
local name, level, class, area, connected, status, note
|
||||
for i = 1, total do
|
||||
name, level, class, area, connected, status, note = GetFriendInfo(i)
|
||||
|
||||
if status == "<" .. "AFK" .. ">" then
|
||||
status = "|cffFFFFFF[|r|cffFF0000" .. L["AFK"] .. "|r|cffFFFFFF]|r"
|
||||
elseif status == "<" .. "DND" .. ">" then
|
||||
status = "|cffFFFFFF[|r|cffFF0000" .. L["DND"] .. "|r|cffFFFFFF]|r"
|
||||
end
|
||||
|
||||
if(connected) then
|
||||
for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if(class == v) then class = k end end
|
||||
for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do if(class == v) then class = k end end
|
||||
friendTable[i] = {name, level, class, area, connected, status, note}
|
||||
end
|
||||
end
|
||||
sort(friendTable, SortAlphabeticName)
|
||||
end
|
||||
|
||||
local function OnEvent(self, event, ...)
|
||||
local _, onlineFriends = GetNumberFriends()
|
||||
|
||||
if event == "CHAT_MSG_SYSTEM" then
|
||||
local message = arg1
|
||||
if not (find(message, friendOnline) or find(message, friendOffline)) then return end
|
||||
end
|
||||
dataValid = false
|
||||
|
||||
self.text:SetText(format(displayString, L["Friends"], onlineFriends))
|
||||
|
||||
lastPanel = self
|
||||
end
|
||||
|
||||
local function OnClick(_, btn)
|
||||
DT.tooltip:Hide()
|
||||
|
||||
if btn == "RightButton" then
|
||||
local menuCountWhispers = 0
|
||||
local menuCountInvites = 0
|
||||
local classc, levelc, info
|
||||
|
||||
menuList[2].menuList = {}
|
||||
menuList[3].menuList = {}
|
||||
|
||||
if getn(friendTable) > 0 then
|
||||
for i = 1, getn(friendTable) do
|
||||
info = friendTable[i]
|
||||
if (info[5]) then
|
||||
menuCountInvites = menuCountInvites + 1
|
||||
menuCountWhispers = menuCountWhispers + 1
|
||||
|
||||
classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[3]], GetQuestDifficultyColor(info[2])
|
||||
classc = classc or GetQuestDifficultyColor(info[2])
|
||||
|
||||
menuList[2].menuList[menuCountInvites] = {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[2],classc.r*255,classc.g*255,classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = inviteClick}
|
||||
menuList[3].menuList[menuCountWhispers] = {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[2],classc.r*255,classc.g*255,classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = whisperClick}
|
||||
end
|
||||
end
|
||||
end
|
||||
L_EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2)
|
||||
else
|
||||
ToggleFriendsFrame(1)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnEnter(self)
|
||||
DT:SetupTooltip(self)
|
||||
|
||||
local numberOfFriends, onlineFriends = GetNumberFriends()
|
||||
if onlineFriends == 0 then return end
|
||||
|
||||
if not dataValid then
|
||||
if numberOfFriends > 0 then BuildFriendTable(numberOfFriends) end
|
||||
dataValid = true
|
||||
end
|
||||
|
||||
local zonec, classc, levelc, info
|
||||
DT.tooltip:AddDoubleLine(L["Friends List"], format(totalOnlineString, onlineFriends, numberOfFriends), tthead.r, tthead.g, tthead.b, tthead.r, tthead.g, tthead.b)
|
||||
if onlineFriends > 0 then
|
||||
DT.tooltip:AddLine(" ")
|
||||
DT.tooltip:AddLine(worldOfWarcraftString)
|
||||
for i = 1, getn(friendTable) do
|
||||
info = friendTable[i]
|
||||
if info[5] then
|
||||
if(GetRealZoneText() == info[4]) then zonec = activezone else zonec = inactivezone end
|
||||
classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[3]], GetQuestDifficultyColor(info[2])
|
||||
|
||||
classc = classc or GetQuestDifficultyColor(info[2])
|
||||
|
||||
DT.tooltip:AddDoubleLine(format(levelNameClassString, levelc.r*255,levelc.g*255,levelc.b*255, info[2], info[1], " " .. info[6]), info[4], classc.r,classc.g,classc.b, zonec.r,zonec.g,zonec.b)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DT.tooltip:Show()
|
||||
end
|
||||
|
||||
local function ValueColorUpdate(hex)
|
||||
displayString = join("", "%s: ", hex, "%d|r")
|
||||
|
||||
if lastPanel ~= nil then
|
||||
OnEvent(lastPanel, "ELVUI_COLOR_UPDATE")
|
||||
end
|
||||
end
|
||||
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
|
||||
|
||||
DT:RegisterDatatext("Friends", {"PLAYER_LOGIN", "FRIENDLIST_UPDATE", "CHAT_MSG_SYSTEM"}, OnEvent, nil, OnClick, OnEnter, nil, L["Friends"])
|
||||
@@ -3,6 +3,7 @@
|
||||
<Script file="Armor.lua"/>
|
||||
<Script file="Avoidance.lua"/>
|
||||
<Script file="Durability.lua"/>
|
||||
<Script file="Friends.lua"/>
|
||||
<Script file="Gold.lua"/>
|
||||
<Script file="Guild.lua"/>
|
||||
<Script file="System.lua"/>
|
||||
|
||||
Reference in New Issue
Block a user