Port the social window's frame and contacts page
FriendsFrame in camelot's layout (385 x 424): the metal frame with the battle.net portrait, the bottom tabs, and the Contacts page with top Friends / Ignore sub-tabs: online friends, a divider, offline ones (level, class, area, status), the selected row lit, the friend menu on a right click. Our window lies over FriendsFrame, which stays the panel; its tabs, sub-tabs and buttons click the client's, so FriendsFrame.lua runs as it does. The Who, Guild and Raid tabs show the client's window until they are ported. 1.12: four friend buttons (two rows; camelot has two and a menu); GetNumFriends answers the total, online friends are counted here; no status icons, AFK and DND as the client writes them. Verified in addon_harness with a stub (5 friends, 3 online, 2 ignored): 6 rows with the divider fourth, "Тралл, Шаман 60-го уровня" (the ruRU positional template), clicking the second row selected friend 3 (online first), the Ignore sub-tab titled the list and swapped the buttons, the Who tab gave back the client window. Captures of both sub-tabs. Classic style: the client's lists and tabs as they are. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
<Script file="ProfessionsBook.lua"/>
|
||||
<Script file="Crafting.lua"/>
|
||||
<Script file="Chat.lua"/>
|
||||
<Script file="Social.lua"/>
|
||||
|
||||
<Script file="Forever.lua"/>
|
||||
</Ui>
|
||||
|
||||
@@ -0,0 +1,433 @@
|
||||
-- After data/addon/ForeverUI/Social.lua: the social window (FriendsFrame) in camelot's layout
|
||||
-- (385 x 424, friendsframe.xml): the metal frame with the battle.net portrait, the bottom tabs and
|
||||
-- the Contacts page, friends and ignored players on top sub-tabs. G holds camelot's numbers.
|
||||
-- FriendsFrame stays the client panel (ToggleFriendsFrame, the micro button, Escape, its tab and
|
||||
-- list state); our window lies over it and its buttons click the client's, so FriendsFrame.lua
|
||||
-- runs as it does. The Who, Guild and Raid pages are not ported yet: on those tabs the client's
|
||||
-- window shows as it is.
|
||||
-- 1.12: four friend buttons (Add, Send Message, Group Invite, Remove; camelot has the first two
|
||||
-- and a menu), so they stand in two rows; GetNumFriends answers the total only and the online
|
||||
-- friends are counted here; there are no status icons, the AFK and DND flags show as the client
|
||||
-- writes them (FRIENDS_LIST_TEMPLATE); no friend tooltip.
|
||||
|
||||
if not MoonWellUI_IsForever() then
|
||||
return
|
||||
end
|
||||
|
||||
local Tpl = ForeverUI.Templates
|
||||
|
||||
local S = {}
|
||||
ForeverUI.Social = S
|
||||
|
||||
local G = {
|
||||
width = 385, height = 424,
|
||||
portrait = "Interface\\ForeverUI\\friendsframe\\battlenet-portrait-hd",
|
||||
portraitSide = 60, portraitX = -5, portraitY = 7,
|
||||
inset = { 4, -83, -6, 26 }, twoRows = 49,
|
||||
list = { 8, -87, -22, 2, noBar = -4 },
|
||||
button = { 134, 21, bottom = 4, left = 4, right = -6, row = 23 },
|
||||
tab = { x = 5, y = 2, gap = 3 },
|
||||
subTab = { x = 18, y = -60, h = 24, min = 100, max = 150, gap = 1 },
|
||||
friendRow = 34, shortRow = 16,
|
||||
nameX = 10, nameY = -4, infoY = -3,
|
||||
highlight = "Interface\\QuestFrame\\UI-QuestLogTitleHighlight",
|
||||
ignoreHighlight = "Interface\\QuestFrame\\UI-QuestTitleHighlight",
|
||||
highlightTint = { 0.243, 0.570, 1 },
|
||||
divider = "common-framedivider",
|
||||
-- FRIENDS_WOW_BACKGROUND_COLOR, FRIENDS_OFFLINE_BACKGROUND_COLOR, FRIENDS_WOW_NAME_COLOR,
|
||||
-- FRIENDS_GRAY_COLOR (camelot)
|
||||
onlineBackground = { 1.0, 0.824, 0.0, 0.05 }, offlineBackground = { 0.588, 0.588, 0.588, 0.05 },
|
||||
onlineName = { 0.996, 0.882, 0.361 }, gray = { 0.486, 0.518, 0.541 },
|
||||
}
|
||||
|
||||
-- 1.12's tabs: FriendsFrameTab<id>
|
||||
local TABS = { { id = 1, text = FRIENDS }, { id = 2, text = WHO }, { id = 3, text = GUILD }, { id = 4, text = RAID } }
|
||||
-- the Contacts sub-tabs, the client's FriendsFrameToggleTab<id>
|
||||
local SUB_TABS = { { id = 1, text = FRIENDS, title = FRIENDS_LIST }, { id = 2, text = IGNORE, title = IGNORE_LIST } }
|
||||
|
||||
-- the client window's own art and widgets, hidden while our window shows
|
||||
local CLIENT = { "FriendsFrameTab1", "FriendsFrameTab2", "FriendsFrameTab3", "FriendsFrameTab4",
|
||||
"FriendsFrameCloseButton" }
|
||||
|
||||
-- ------------------------------------------------------------ top tabs
|
||||
|
||||
-- TabSystemButtonArtTemplate with isTabOnTop: the bottom tab's art turned over
|
||||
local TOP = {
|
||||
activeLeft = "uiframe-activetab-left", activeMiddle = "_uiframe-activetab-center", activeRight = "uiframe-activetab-right",
|
||||
left = "uiframe-tab-left-c60", middle = "_uiframe-tab-center-c60", right = "uiframe-tab-right-c60",
|
||||
}
|
||||
|
||||
local function flipped(b, layer, name)
|
||||
local t = b:CreateTexture(nil, layer)
|
||||
ForeverUI.SetAtlas(t, name)
|
||||
local e = ForeverUI.AtlasEntry(name)
|
||||
if e then t:SetTexCoord(e[3], e[2], e[5], e[4]) end
|
||||
t:SetHeight(G.subTab.h)
|
||||
return t
|
||||
end
|
||||
|
||||
local function topTab(parent, name)
|
||||
local b = CreateFrame("Button", name, parent)
|
||||
b:SetHeight(G.subTab.h)
|
||||
local a = {}
|
||||
a.activeLeft = flipped(b, "BACKGROUND", TOP.activeLeft)
|
||||
a.activeRight = flipped(b, "BACKGROUND", TOP.activeRight)
|
||||
a.activeMiddle = flipped(b, "BACKGROUND", TOP.activeMiddle)
|
||||
a.left = flipped(b, "BACKGROUND", TOP.left)
|
||||
a.right = flipped(b, "BACKGROUND", TOP.right)
|
||||
a.middle = flipped(b, "BACKGROUND", TOP.middle)
|
||||
a.hoverLeft = flipped(b, "HIGHLIGHT", TOP.left)
|
||||
a.hoverRight = flipped(b, "HIGHLIGHT", TOP.right)
|
||||
a.hoverMiddle = flipped(b, "HIGHLIGHT", TOP.middle)
|
||||
for _, t in ipairs({ a.hoverLeft, a.hoverRight, a.hoverMiddle }) do
|
||||
t:SetBlendMode("ADD")
|
||||
t:SetAlpha(0.4)
|
||||
end
|
||||
-- HandleRotation: turned over, the right piece goes left
|
||||
a.activeRight:SetPoint("BOTTOMLEFT", b, "BOTTOMLEFT", -7, 0)
|
||||
a.activeLeft:SetPoint("BOTTOMRIGHT", b, "BOTTOMRIGHT", 0, 0)
|
||||
a.right:SetPoint("BOTTOMLEFT", b, "BOTTOMLEFT", -6, 0)
|
||||
a.left:SetPoint("BOTTOMRIGHT", b, "BOTTOMRIGHT", 0, 0)
|
||||
a.activeMiddle:SetPoint("TOPLEFT", a.activeRight, "TOPRIGHT", 0, 0)
|
||||
a.activeMiddle:SetPoint("BOTTOMRIGHT", a.activeLeft, "BOTTOMLEFT", 0, 0)
|
||||
a.middle:SetPoint("TOPLEFT", a.right, "TOPRIGHT", 0, 0)
|
||||
a.middle:SetPoint("BOTTOMRIGHT", a.left, "BOTTOMLEFT", 0, 0)
|
||||
a.hoverLeft:SetPoint("TOPRIGHT", a.left, "TOPRIGHT", 0, 0)
|
||||
a.hoverRight:SetPoint("TOPLEFT", a.right, "TOPLEFT", 0, 0)
|
||||
a.hoverMiddle:SetPoint("TOPLEFT", a.middle, "TOPLEFT", 0, 0)
|
||||
a.hoverMiddle:SetPoint("BOTTOMRIGHT", a.middle, "BOTTOMRIGHT", 0, 0)
|
||||
b.art = a
|
||||
b.text = b:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
|
||||
b.text:SetHeight(10)
|
||||
return b
|
||||
end
|
||||
|
||||
-- SetTabSelected: the active art, the text raised, the chosen tab disabled; TabSystemButtonMixin:
|
||||
-- UpdateTabWidth, 100 to 150 wide
|
||||
local function selectTopTab(b, selected)
|
||||
local a = b.art
|
||||
for _, t in ipairs({ a.activeLeft, a.activeMiddle, a.activeRight }) do Tpl.SetShown(t, selected) end
|
||||
for _, t in ipairs({ a.left, a.middle, a.right }) do Tpl.SetShown(t, not selected) end
|
||||
b.text:SetFontObject(selected and GameFontHighlightSmall or GameFontNormalSmall)
|
||||
b.text:ClearAllPoints()
|
||||
b.text:SetPoint("CENTER", b, "CENTER", 0, selected and 0 or -3)
|
||||
if selected then b:Disable() else b:Enable() end
|
||||
local e1, e2 = ForeverUI.AtlasEntry(TOP.left), ForeverUI.AtlasEntry(TOP.right)
|
||||
local l = (e1 and e1[6] or 35) + (e2 and e2[6] or 37) + 20
|
||||
local text = b.text:GetStringWidth() or 0
|
||||
if l < text then l = text + 10 end
|
||||
b:SetWidth(math.max(G.subTab.min, math.min(G.subTab.max, l)))
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------ list
|
||||
|
||||
local rows = {}
|
||||
|
||||
local function createRow(n)
|
||||
local l = CreateFrame("Button", "ForeverUISocialRow" .. n, S.list)
|
||||
l:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
l.background = l:CreateTexture(nil, "BACKGROUND")
|
||||
l.background:SetPoint("TOPLEFT", l, "TOPLEFT", 0, -1)
|
||||
l.background:SetPoint("BOTTOMRIGHT", l, "BOTTOMRIGHT", 0, 1)
|
||||
l.name = l:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
l.name:SetJustifyH("LEFT")
|
||||
l.name:SetHeight(12)
|
||||
l.info = l:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
||||
l.info:SetJustifyH("LEFT")
|
||||
l.info:SetHeight(10)
|
||||
l.info:SetPoint("TOPLEFT", l.name, "BOTTOMLEFT", 0, G.infoY)
|
||||
l.info:SetPoint("TOPRIGHT", l.name, "BOTTOMRIGHT", 0, G.infoY)
|
||||
l.line = l:CreateTexture(nil, "ARTWORK")
|
||||
ForeverUI.SetAtlas(l.line, G.divider, true)
|
||||
l.line:SetHeight(2)
|
||||
l.line:SetPoint("LEFT", l, "LEFT", 4, 0)
|
||||
l.line:SetPoint("RIGHT", l, "RIGHT", -4, 0)
|
||||
l:SetHighlightTexture(G.highlight)
|
||||
local s = l:GetHighlightTexture()
|
||||
s:SetBlendMode("ADD")
|
||||
s:ClearAllPoints()
|
||||
s:SetPoint("TOPLEFT", l, "TOPLEFT", 0, -1)
|
||||
s:SetPoint("BOTTOMRIGHT", l, "BOTTOMRIGHT", 0, 1)
|
||||
l:SetScript("OnClick", function() S.Click(this, arg1) end)
|
||||
return l
|
||||
end
|
||||
|
||||
-- a row for its entry: a friend, the online / offline divider or an ignored player
|
||||
local function fillRow(l, e)
|
||||
local friend, ignore = e.kind == "friend", e.kind == "ignore"
|
||||
l.kind, l.id = e.kind, e.index
|
||||
l:SetHeight(friend and G.friendRow or G.shortRow)
|
||||
Tpl.SetShown(l.background, friend)
|
||||
Tpl.SetShown(l.name, friend or ignore)
|
||||
Tpl.SetShown(l.info, friend)
|
||||
Tpl.SetShown(l.line, e.kind == "line")
|
||||
l:EnableMouse(friend or ignore)
|
||||
l:UnlockHighlight()
|
||||
local s = l:GetHighlightTexture()
|
||||
l.name:ClearAllPoints()
|
||||
if friend then
|
||||
l.name:SetPoint("TOPLEFT", l, "TOPLEFT", G.nameX, G.nameY)
|
||||
l.name:SetPoint("TOPRIGHT", l, "TOPRIGHT", -4, G.nameY)
|
||||
s:SetTexture(G.highlight)
|
||||
s:SetVertexColor(G.highlightTint[1], G.highlightTint[2], G.highlightTint[3])
|
||||
-- FriendsList_Update's texts: name, level and class, area and status
|
||||
local name, level, class, area, connected, status = GetFriendInfo(e.index)
|
||||
l.friendName, l.connected = name or UNKNOWN, connected
|
||||
if connected then
|
||||
l.background:SetTexture(G.onlineBackground[1], G.onlineBackground[2], G.onlineBackground[3], G.onlineBackground[4])
|
||||
local text = l.friendName .. ", " .. format(FRIENDS_LEVEL_TEMPLATE, level or 0, class or "")
|
||||
if status and status ~= "" then text = text .. " " .. status end
|
||||
l.name:SetText(text)
|
||||
l.name:SetTextColor(G.onlineName[1], G.onlineName[2], G.onlineName[3])
|
||||
l.info:SetText(area or "")
|
||||
else
|
||||
l.background:SetTexture(G.offlineBackground[1], G.offlineBackground[2], G.offlineBackground[3], G.offlineBackground[4])
|
||||
l.name:SetText(l.friendName)
|
||||
l.name:SetTextColor(G.gray[1], G.gray[2], G.gray[3])
|
||||
l.info:SetText(UNKNOWN)
|
||||
end
|
||||
l.info:SetTextColor(G.gray[1], G.gray[2], G.gray[3])
|
||||
if GetSelectedFriend() == e.index then l:LockHighlight() end
|
||||
elseif ignore then
|
||||
-- FriendsFrameIgnoreButtonTemplate: GameFontNormal at (10, 1)
|
||||
l.name:SetPoint("LEFT", l, "LEFT", 10, 1)
|
||||
l.name:SetPoint("RIGHT", l, "RIGHT", -4, 1)
|
||||
s:SetTexture(G.ignoreHighlight)
|
||||
s:SetVertexColor(1, 1, 1)
|
||||
l.name:SetText(GetIgnoreName(e.index) or UNKNOWN)
|
||||
l.name:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
|
||||
if GetSelectedIgnore() == e.index then l:LockHighlight() end
|
||||
end
|
||||
end
|
||||
|
||||
local function subTab()
|
||||
return FriendsFrame.showFriendsList and 1 or 2
|
||||
end
|
||||
|
||||
-- what the list shows: ignored players, or online friends, a divider, offline friends
|
||||
local function entries()
|
||||
local list = {}
|
||||
if subTab() == 2 then
|
||||
for i = 1, GetNumIgnores() or 0 do table.insert(list, { kind = "ignore", index = i }) end
|
||||
return list
|
||||
end
|
||||
local online, offline = {}, {}
|
||||
for i = 1, GetNumFriends() or 0 do
|
||||
local _, _, _, _, connected = GetFriendInfo(i)
|
||||
table.insert(connected and online or offline, { kind = "friend", index = i })
|
||||
end
|
||||
for _, e in ipairs(online) do table.insert(list, e) end
|
||||
if table.getn(online) > 0 and table.getn(offline) > 0 then table.insert(list, { kind = "line" }) end
|
||||
for _, e in ipairs(offline) do table.insert(list, e) end
|
||||
return list
|
||||
end
|
||||
|
||||
local function heightOf(e)
|
||||
return e.kind == "friend" and G.friendRow or G.shortRow
|
||||
end
|
||||
|
||||
-- the rows that fit from S.offset (friend rows are taller)
|
||||
function S.LayoutList()
|
||||
local list = S.content or {}
|
||||
local room = S.list:GetHeight() or 0
|
||||
if room <= 0 then room = G.height + G.list[2] - G.inset[4] end
|
||||
local total = table.getn(list)
|
||||
S.offset = math.max(0, math.min(S.offset or 0, total - 1))
|
||||
local y, rank, n = 0, 0, S.offset + 1
|
||||
while n <= total do
|
||||
local h = heightOf(list[n])
|
||||
if y + h > room then break end
|
||||
rank = rank + 1
|
||||
local l = rows[rank] or createRow(rank)
|
||||
rows[rank] = l
|
||||
l:ClearAllPoints()
|
||||
l:SetPoint("TOPLEFT", S.list, "TOPLEFT", 0, -y)
|
||||
l:SetPoint("TOPRIGHT", S.list, "TOPRIGHT", 0, -y)
|
||||
fillRow(l, list[n])
|
||||
l:Show()
|
||||
y = y + h
|
||||
n = n + 1
|
||||
end
|
||||
for i = rank + 1, table.getn(rows) do rows[i]:Hide() end
|
||||
S.visible = rank
|
||||
S.bar:Configure(total, rank, S.offset)
|
||||
end
|
||||
|
||||
-- FriendsFrameFriendButton_OnClick and FriendsFrameIgnoreButton_OnClick
|
||||
function S.Click(l, button)
|
||||
if l.kind == "friend" then
|
||||
if button == "RightButton" then
|
||||
FriendsFrame_ShowDropdown(l.friendName, l.connected)
|
||||
else
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
SetSelectedFriend(l.id)
|
||||
FriendsList_Update()
|
||||
end
|
||||
elseif l.kind == "ignore" then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
SetSelectedIgnore(l.id)
|
||||
IgnoreList_Update()
|
||||
end
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------ update
|
||||
|
||||
-- our buttons follow the client's, which FriendsList_Update and IgnoreList_Update enable
|
||||
local function updateButtons()
|
||||
local ignore = subTab() == 2
|
||||
for _, b in ipairs(S.friendButtons) do Tpl.SetShown(b, not ignore) end
|
||||
for _, b in ipairs(S.ignoreButtons) do Tpl.SetShown(b, ignore) end
|
||||
for _, b in ipairs(S.allButtons) do
|
||||
local e = b.client:IsEnabled()
|
||||
b:Activate(e and e ~= 0)
|
||||
end
|
||||
local I = G.inset
|
||||
S.inset:ClearAllPoints()
|
||||
S.inset:SetPoint("TOPLEFT", S.frame, "TOPLEFT", I[1], I[2])
|
||||
S.inset:SetPoint("BOTTOMRIGHT", S.frame, "BOTTOMRIGHT", I[3], ignore and I[4] or G.twoRows)
|
||||
end
|
||||
|
||||
function S.Update()
|
||||
local f = S.frame
|
||||
if not f:IsShown() then return end
|
||||
local sub = subTab()
|
||||
f.skin.title:SetText(SUB_TABS[sub].title)
|
||||
for _, o in ipairs(S.subTabs) do selectTopTab(o.button, o.id == sub) end
|
||||
for _, o in ipairs(S.tabs) do
|
||||
local client = getglobal("FriendsFrameTab" .. o.id)
|
||||
Tpl.SelectTab(o.button, o.id == FriendsFrame.selectedTab)
|
||||
if o.id ~= FriendsFrame.selectedTab then
|
||||
local e = client:IsEnabled()
|
||||
if e and e ~= 0 then o.button:Enable() else o.button:Disable() end
|
||||
end
|
||||
end
|
||||
updateButtons()
|
||||
S.content = entries()
|
||||
S.LayoutList()
|
||||
end
|
||||
|
||||
-- the client's own window: hidden under ours on the Contacts tab, as it is on the others
|
||||
local function showClient(yes)
|
||||
for _, r in ipairs({ FriendsFrame:GetRegions() }) do
|
||||
local kind = r:GetObjectType()
|
||||
if kind == "Texture" or kind == "FontString" then r:SetAlpha(yes and 1 or 0) end
|
||||
end
|
||||
for _, name in ipairs(CLIENT) do
|
||||
local c = getglobal(name)
|
||||
c:SetAlpha(yes and 1 or 0)
|
||||
c:EnableMouse(yes)
|
||||
end
|
||||
end
|
||||
|
||||
-- after FriendsFrame_Update: the Contacts tab takes our window, the others the client's
|
||||
function S.Apply()
|
||||
if not FriendsFrame:IsShown() then return end
|
||||
local contacts = FriendsFrame.selectedTab == 1
|
||||
showClient(not contacts)
|
||||
Tpl.SetShown(S.frame, contacts)
|
||||
if contacts then
|
||||
FriendsListFrame:Hide()
|
||||
IgnoreListFrame:Hide()
|
||||
S.Update()
|
||||
end
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------ window
|
||||
|
||||
local function build()
|
||||
local f = CreateFrame("Frame", "ForeverUISocialFrame", FriendsFrame)
|
||||
f:SetWidth(G.width)
|
||||
f:SetHeight(G.height)
|
||||
f:SetPoint("TOPLEFT", FriendsFrame, "TOPLEFT", 0, 0)
|
||||
f:SetFrameLevel(FriendsFrame:GetFrameLevel() + 5)
|
||||
f:EnableMouse(true)
|
||||
f:Hide()
|
||||
S.frame = f
|
||||
f.skin = Tpl.PortraitWindow(f, { portrait = G.portrait, portraitSide = G.portraitSide,
|
||||
portraitX = G.portraitX, portraitY = G.portraitY })
|
||||
local close = CreateFrame("Button", "ForeverUISocialCloseButton", f)
|
||||
Tpl.CloseButton(close, f)
|
||||
close:SetFrameLevel(f:GetFrameLevel() + 22)
|
||||
close:SetScript("OnClick", function() HideUIPanel(FriendsFrame) end)
|
||||
S.inset = Tpl.Inset(f, 0, 0, "TOPLEFT", 0, 0, "BOTTOMRIGHT")
|
||||
-- the list and its bar; without the bar the list reaches the inset's edge
|
||||
local Li = G.list
|
||||
local list = CreateFrame("Frame", "ForeverUISocialList", f)
|
||||
list:SetPoint("TOPLEFT", f, "TOPLEFT", Li[1], Li[2])
|
||||
list:SetPoint("BOTTOMRIGHT", S.inset, "BOTTOMRIGHT", Li[3], Li[4])
|
||||
list:EnableMouseWheel(true)
|
||||
list:SetScript("OnMouseWheel", function()
|
||||
S.offset = math.max(0, math.min((S.offset or 0) - arg1, table.getn(S.content or {}) - (S.visible or 0)))
|
||||
S.LayoutList()
|
||||
end)
|
||||
S.list = list
|
||||
S.bar = ForeverUI.CreateScrollBar("ForeverUISocialScrollBar", f, list)
|
||||
S.bar.onScroll = function(offset)
|
||||
S.offset = offset
|
||||
S.LayoutList()
|
||||
end
|
||||
S.bar.onVisibility = function(hasBar)
|
||||
list:SetPoint("BOTTOMRIGHT", S.inset, "BOTTOMRIGHT", hasBar and Li[3] or Li.noBar, Li[4])
|
||||
end
|
||||
-- the bottom tabs click the client's (PanelTemplates_Tab_OnClick, FriendsFrame_OnShow)
|
||||
S.tabs = {}
|
||||
for i, def in ipairs(TABS) do
|
||||
local b = Tpl.Tab(f, "ForeverUISocialTab" .. i)
|
||||
b:SetID(def.id)
|
||||
b.text:SetText(def.text)
|
||||
if i == 1 then
|
||||
b:SetPoint("TOPLEFT", f, "BOTTOMLEFT", G.tab.x, G.tab.y)
|
||||
else
|
||||
b:SetPoint("TOPLEFT", S.tabs[i - 1].button, "TOPRIGHT", G.tab.gap, 0)
|
||||
end
|
||||
b:SetScript("OnClick", function() getglobal("FriendsFrameTab" .. this:GetID()):Click() end)
|
||||
S.tabs[i] = { id = def.id, button = b }
|
||||
end
|
||||
-- the sub-tabs click the client's toggle tabs (FriendsFrame.showFriendsList)
|
||||
S.subTabs = {}
|
||||
for i, def in ipairs(SUB_TABS) do
|
||||
local b = topTab(f, "ForeverUISocialSubTab" .. i)
|
||||
b:SetFrameLevel(f:GetFrameLevel() + 2)
|
||||
b:SetID(def.id)
|
||||
b.text:SetText(def.text)
|
||||
if i == 1 then
|
||||
b:SetPoint("TOPLEFT", f, "TOPLEFT", G.subTab.x, G.subTab.y)
|
||||
else
|
||||
b:SetPoint("TOPLEFT", S.subTabs[i - 1].button, "TOPRIGHT", G.subTab.gap, 0)
|
||||
end
|
||||
b:SetScript("OnClick", function()
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
S.offset = 0
|
||||
getglobal("FriendsFrameToggleTab" .. this:GetID()):Click()
|
||||
end)
|
||||
S.subTabs[i] = { id = def.id, button = b }
|
||||
end
|
||||
-- the buttons click the client's: friends in two rows, ignore in one
|
||||
local B = G.button
|
||||
local function button(client, point, x, y)
|
||||
local b = ForeverUI.CreatePanelButton(f, client:GetText(), B[1], B[2], nil, "GameFontNormal")
|
||||
b:SetPoint(point, f, point, x, y)
|
||||
b.client = client
|
||||
b:SetScript("OnClick", function() if this.active then this.client:Click() end end)
|
||||
table.insert(S.allButtons, b)
|
||||
return b
|
||||
end
|
||||
S.allButtons = {}
|
||||
S.friendButtons = {
|
||||
button(FriendsFrameAddFriendButton, "BOTTOMLEFT", B.left, B.bottom),
|
||||
button(FriendsFrameSendMessageButton, "BOTTOMRIGHT", B.right, B.bottom),
|
||||
button(FriendsFrameGroupInviteButton, "BOTTOMLEFT", B.left, B.bottom + B.row),
|
||||
button(FriendsFrameRemoveFriendButton, "BOTTOMRIGHT", B.right, B.bottom + B.row),
|
||||
}
|
||||
S.ignoreButtons = {
|
||||
button(FriendsFrameIgnorePlayerButton, "BOTTOMLEFT", B.left, B.bottom),
|
||||
button(FriendsFrameStopIgnoreButton, "BOTTOMRIGHT", B.right, B.bottom),
|
||||
}
|
||||
Tpl.Panel(FriendsFrame)
|
||||
ForeverUI.HookGlobal("FriendsFrame_Update", S.Apply)
|
||||
ForeverUI.HookGlobal("FriendsList_Update", function() if f:IsShown() then S.Update() end end)
|
||||
ForeverUI.HookGlobal("IgnoreList_Update", function() if f:IsShown() then S.Update() end end)
|
||||
ForeverUI.HookScript(FriendsFrame, "OnHide", function() f:Hide() end)
|
||||
end
|
||||
|
||||
build()
|
||||
@@ -59,6 +59,7 @@ API 1.12 и поставляют отдельным патчем, без пра
|
||||
| `ProfessionsBook.lua` | книга профессий camelot 673 × 594 и её кнопка в микроменю (после портрета): карточки основных профессий с полосой навыка в цветах профессии, заклинаниями и кнопкой «Отказаться», три колонки вспомогательных (кулинария, рыбная ловля, первая помощь) с текстом-приглашением, если навыка нет; боковые вкладки: обзор и профессии с окном ремесла (вкладка применяет открывающее его заклинание). В 1.12 нет `GetSpellInfo` и номеров заклинаний в книге: профессия узнаётся по названию строки навыка (SkillLine.dbc, enUS и ruRU), её заклинания — по значку на вкладке «Общее» (Spell.dbc / SpellIcon.dbc); книга не двигается; вкладки стоят рядом с ней или с открытым окном ремесла |
|
||||
| `Crafting.lua` | окно ремесла camelot 673 × 594 для обоих окон 1.12: `TradeSkillFrame` (ремёсла) и `CraftFrame` (наложение чар и дрессировка питомца, у которой вместо полосы навыка — очки обучения): список рецептов с заголовками, значками шанса повысить навык, поиском и фильтром (повышает навык, есть материалы, ячейки), полоса навыка в цветах профессии, карточка рецепта (результат с рамкой качества, инструменты или требование к уровню питомца, восстановление или стоимость в очках, описание, реагенты), кнопки «Создать», «Создать все» и счётчик; в 1.12 нет фильтров по имени и наличию материалов, ссылок на рецепты и `GetStringHeight`: поиск (с кириллицей без учёта регистра) и фильтры работают здесь, высота текста считается по ширине; открытие одного окна ремесла закрывает книгу и другое окно |
|
||||
| `Chat.lua` | окна чата camelot: вместо стрелок — тонкая полоса прокрутки и кнопка «вниз», мигающая, пока чат не в самом низу; фон шире справа, под полосу; кнопка меню чата внизу колонки слева, кнопка друзей camelot над ней (открывает окно друзей); в покое видны только сообщения, колонка, полоса и кнопка проявляются при наведении; колесо мыши прокручивает чат (Shift — до конца, Ctrl — страница), как в camelot (в 1.12 колесо отдано камере); вкладки — клиентские, их рисунок совпадает с camelot; копирование выделением (Alt) из исходника не перенесено: ему нужны `GetStringHeight` и строки сообщений, которых 1.12 не даёт |
|
||||
| `Social.lua` | окно друзей camelot 385 × 424: металлическая рамка с портретом battle.net, нижние вкладки, страница контактов с верхними вкладками «Друзья» и «Черный список»: друзья в сети, разделитель, не в сети (уровень, класс, зона, статус), выделение строки, меню по правому клику; кнопки нажимают клиентские, так что работает стоковый `FriendsFrame.lua`; в 1.12 у друзей четыре кнопки (добавить, сообщение, пригласить, удалить) — два ряда, `GetNumFriends` отдаёт только общее число (кто в сети, считается здесь), значков статуса нет — «отсутствует» и «не беспокоить» пишутся текстом; страницы «Кто», «Гильдия» и «Рейд» пока стоковые |
|
||||
|
||||
`Compat.lua` — наши помощники: `HookScript`, `HookGlobal`/`HookMethod` вместо `hooksecurefunc`,
|
||||
сила через `UnitMana`, тексты полос по `statusBarText`.
|
||||
|
||||
Reference in New Issue
Block a user