Files
moon-well-ui/vanilla/Interface/FrameXML/MoonWellUI/GameMenu.lua
T
sindoring 7859163776 Character models SD / HD: a game menu rung and a selector at creation
The MoonWell launcher mounts the install's HD pack or leaves it out,
switched by a restart, and gives the interface
MoonWell_GetCharacterModels / MoonWell_SetCharacterModels. Both pieces
here show only when those answer a mode (a client with the HD pack):

- game menu, both styles: "Character Models: HD" (or SD) under
  Interface Style, made once the launcher's functions are there (they
  arrive after the interface loads), with a confirmation popup before
  the client restarts; Forever UI's column takes it;
- character creation, step 1: SD and HD round buttons in a bronze frame
  mirroring the body types on the other side of the top, the running
  mode selected, a glue dialog confirming the restart.

Verified with offline captures of MoonWell.exe at 2560x1440 with
patch-3 in Data: the create screen shows the selector with HD selected
($MOONWELL_MODELS=hd) and SD selected (=sd), the model HD and SD
accordingly; the Forever game menu shows "Модели персонажей: HD" after
Interface Style. Not seen: the classic menu (the capture rendered an
empty frame with the HD pack three times; without it the classic scene
renders but the rung, needing the pack, does not show) and the restart
itself (captures save no state).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-26 11:57:24 +04:00

83 lines
3.4 KiB
Lua

-- The game menu's "Interface Style" rung, under Macros, which reopens the chooser. Added at
-- VARIABLES_LOADED, after benilla's layer has laid out GameMenuFrame, and kept clear of its
-- layout: it takes Macros' rung gap and Logout keeps the gap it had above it.
local function MoonWellUIGameMenu_AddRung()
if MoonWellUIGameMenuButtonStyle then
return
end
local button = CreateFrame("Button", "MoonWellUIGameMenuButtonStyle", GameMenuFrame,
"GameMenuButtonTemplate")
button:SetText(MOONWELLUI_TEXT.MENU_BUTTON)
local _, _, _, _, rungGap = GameMenuButtonMacros:GetPoint(1)
local _, _, _, logoutX, logoutGap = GameMenuButtonLogout:GetPoint(1)
button:SetPoint("TOP", GameMenuButtonMacros, "BOTTOM", 0, rungGap or -1)
GameMenuButtonLogout:ClearAllPoints()
GameMenuButtonLogout:SetPoint("TOP", button, "BOTTOM", logoutX or 0, logoutGap or -1)
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + button:GetHeight() - (rungGap or -1))
button:SetScript("OnClick", function()
PlaySound("igMainMenuOption")
HideUIPanel(GameMenuFrame)
MoonWellUIChoice_Open()
end)
end
-- The character models rung, under Interface Style: SD or HD, the MoonWell launcher's choice
-- (MoonWell_GetCharacterModels / MoonWell_SetCharacterModels). The launcher adds those after the
-- interface loads, so the rung is made once they are there, and only with the HD pack.
local function MoonWellUIGameMenu_Models()
return MoonWell_GetCharacterModels and MoonWell_GetCharacterModels()
end
StaticPopupDialogs["MOONWELLUI_MODELS"] = {
text = MOONWELLUI_TEXT.MODELS_CONFIRM,
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function()
local target = (MoonWellUIGameMenu_Models() == "hd") and "sd" or "hd"
MoonWell_SetCharacterModels(target)
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
}
local function MoonWellUIGameMenu_AddModelsRung()
local mode = MoonWellUIGameMenu_Models()
if MoonWellUIGameMenuButtonModels or not mode or not MoonWellUIGameMenuButtonStyle then
return
end
local button = CreateFrame("Button", "MoonWellUIGameMenuButtonModels", GameMenuFrame,
"GameMenuButtonTemplate")
button:SetText(format(MOONWELLUI_TEXT.MODELS_BUTTON, string.upper(mode)))
local _, _, _, _, rungGap = MoonWellUIGameMenuButtonStyle:GetPoint(1)
local _, _, _, logoutX, logoutGap = GameMenuButtonLogout:GetPoint(1)
button:SetPoint("TOP", MoonWellUIGameMenuButtonStyle, "BOTTOM", 0, rungGap or -1)
GameMenuButtonLogout:ClearAllPoints()
GameMenuButtonLogout:SetPoint("TOP", button, "BOTTOM", logoutX or 0, logoutGap or -1)
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + button:GetHeight() - (rungGap or -1))
button:SetScript("OnClick", function()
PlaySound("igMainMenuOption")
HideUIPanel(GameMenuFrame)
local target = (MoonWellUIGameMenu_Models() == "hd") and "SD" or "HD"
StaticPopup_Show("MOONWELLUI_MODELS", target)
end)
-- Forever UI lays its column out on show, before this rung existed
if ForeverUI and ForeverUI.GameMenu then
ForeverUI.GameMenu.Layout()
end
end
local MoonWellUIGameMenu_Loader = CreateFrame("Frame")
MoonWellUIGameMenu_Loader:RegisterEvent("VARIABLES_LOADED")
MoonWellUIGameMenu_Loader:SetScript("OnEvent", function()
MoonWellUIGameMenu_AddRung()
-- every frame until the launcher's functions are there (a client without them: never)
this:SetScript("OnUpdate", function()
if MoonWell_GetCharacterModels then
MoonWellUIGameMenu_AddModelsRung()
this:SetScript("OnUpdate", nil)
end
end)
end)