4c8aabd65e
The column laid out a fixed list of buttons, so the client's MoonWellGraphics addon button (GameMenuButtonMoonWellGraphics, anchored under UI Options) kept its own anchor and sat over Edit Mode. Any other shown button of GameMenuFrame now joins the column after the button its first anchor names, read when first seen, before the layout moves it; one without a known anchor goes before Log Out. Verified with an offline capture at 2560x1440, the button created as the addon creates it: Options, MoonWell Graphics, Edit Mode, Support, Macros, Interface Style, then the Log Out section, no overlap. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
125 lines
3.6 KiB
Lua
125 lines
3.6 KiB
Lua
-- After data/addon/ForeverUI/GameMenu.lua: the Esc menu (GameMenuFrame) in camelot's style
|
|
-- (MainMenuFrameTemplate: the column 48 from the top, 34 from the bottom, 28 at the sides; a
|
|
-- section adds 20 above its first button), the DiamondMetal frame and header, the buttons as
|
|
-- 128-RedButton three-slices 200 x 36.
|
|
-- The client's buttons stay, in their order, with benilla's (Edit Mode, Support) and the
|
|
-- Interface Style rung (MoonWellUI\GameMenu.lua); a button another layer or addon adds (the
|
|
-- client's MoonWellGraphics) takes the place it anchored itself to. The column is laid out on
|
|
-- every show, after their own layout.
|
|
|
|
if not MoonWellUI_IsForever() then
|
|
return
|
|
end
|
|
|
|
local Tpl = ForeverUI.Templates
|
|
|
|
local M = {}
|
|
ForeverUI.GameMenu = M
|
|
|
|
local N = {
|
|
top = 48, down = 34, side = 28,
|
|
button = { 200, 36 },
|
|
section = 20,
|
|
prefix = "128-redbutton",
|
|
}
|
|
|
|
-- camelot's GameFontNormalMed1: 13, shadow (1, -1), yellow
|
|
local headerFont = CreateFont("ForeverUIGameMenuHeaderFont")
|
|
headerFont:SetFont((GameFontNormal:GetFont()), 13)
|
|
headerFont:SetShadowOffset(1, -1)
|
|
headerFont:SetShadowColor(0, 0, 0, 1)
|
|
headerFont:SetTextColor(1, 0.82, 0)
|
|
|
|
-- the buttons, top to bottom; section: a gap above the button
|
|
local function entries()
|
|
return {
|
|
{ GameMenuButtonOptions },
|
|
{ GameMenuButtonSoundOptions },
|
|
{ GameMenuButtonUIOptions },
|
|
{ GameMenuButtonKeybindings },
|
|
{ getglobal("BenillaGameMenuButtonEditMode") },
|
|
{ getglobal("BenillaGameMenuButtonSupport") },
|
|
{ GameMenuButtonMacros },
|
|
{ getglobal("MoonWellUIGameMenuButtonStyle") },
|
|
{ GameMenuButtonLogout, section = true },
|
|
{ GameMenuButtonQuit },
|
|
{ GameMenuButtonContinue, section = true },
|
|
}
|
|
end
|
|
|
|
local FONTS = { GameFontHighlightLarge, GameFontHighlightLarge, GameFontDisableLarge }
|
|
|
|
local function skinButton(b)
|
|
b:SetWidth(N.button[1])
|
|
b:SetHeight(N.button[2])
|
|
Tpl.RedButton(b, N.prefix, FONTS)
|
|
Tpl.PaintRed(b, false)
|
|
end
|
|
|
|
-- The known buttons, with each other shown button of the menu after the one its first anchor
|
|
-- names (read when first seen, before this layout moves it), else before Log Out
|
|
local function column()
|
|
local list = entries()
|
|
local known = {}
|
|
for _, e in ipairs(list) do
|
|
if e[1] then known[e[1]] = true end
|
|
end
|
|
for _, b in ipairs({ GameMenuFrame:GetChildren() }) do
|
|
if not known[b] and b:GetObjectType() == "Button" and b:IsShown() then
|
|
if b.foreverAfter == nil then
|
|
local _, relative = b:GetPoint(1)
|
|
b.foreverAfter = (type(relative) == "table" and relative) or false
|
|
end
|
|
local at
|
|
for i, e in ipairs(list) do
|
|
if e[1] == b.foreverAfter then
|
|
at = i + 1
|
|
elseif not at and e[1] == GameMenuButtonLogout then
|
|
at = i
|
|
end
|
|
end
|
|
table.insert(list, at or table.getn(list) + 1, { b })
|
|
known[b] = true
|
|
end
|
|
end
|
|
return list
|
|
end
|
|
|
|
-- each shown button in its place, then the menu's size
|
|
function M.Layout()
|
|
local f = GameMenuFrame
|
|
local y = N.top
|
|
local queued = false
|
|
for _, e in ipairs(column()) do
|
|
local b = e[1]
|
|
if e.section then
|
|
queued = true
|
|
end
|
|
if b and b:IsShown() then
|
|
skinButton(b)
|
|
if queued then
|
|
y = y + N.section
|
|
queued = false
|
|
end
|
|
b:ClearAllPoints()
|
|
b:SetPoint("TOPLEFT", f, "TOPLEFT", N.side, -y)
|
|
y = y + N.button[2]
|
|
end
|
|
end
|
|
f:SetWidth(N.side + N.button[1] + N.side)
|
|
f:SetHeight(y + N.down)
|
|
end
|
|
|
|
local f = GameMenuFrame
|
|
f:SetBackdrop(nil)
|
|
GameMenuFrameHeader:SetAlpha(0)
|
|
-- the client's title has no name: it is the frame's MAIN_MENU text
|
|
for _, r in ipairs({ f:GetRegions() }) do
|
|
if r:GetObjectType() == "FontString" and r:GetText() == MAIN_MENU then
|
|
r:SetAlpha(0)
|
|
end
|
|
end
|
|
Tpl.DialogFrame(f)
|
|
M.header = Tpl.Header(f, MAIN_MENU, headerFont)
|
|
ForeverUI.HookScript(f, "OnShow", M.Layout)
|