Skip to content

Commit

Permalink
Updated game menu skinning
Browse files Browse the repository at this point in the history
Significant changes have been made to the way the game menu is skinned. The previous method of reskinning all esc/menu buttons has been replaced with a more efficient approach. A new button, 'SUI_GameMenuButton', has been created and added to the GameMenuFrame. This button triggers the toggle options function when clicked.

The code now also adjusts the position of other buttons in relation to this new button, ensuring proper layout. Additionally, some adjustments were made to the GameMenuFrame's height and header properties for better visual appeal.

Commented out sections of code indicate potential areas for future enhancements or modifications.
  • Loading branch information
Wutname1 committed Jul 29, 2024
1 parent 6b195c5 commit 647134f
Showing 1 changed file with 67 additions and 29 deletions.
96 changes: 67 additions & 29 deletions Core/Skins/Blizzard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,78 @@ local SUI = SUI

local function OnEnable()
if SUI:IsAddonDisabled('Skinner') and SUI:IsAddonDisabled('ConsolePortUI_Menu') then
-- reskin all esc/menu buttons
for _, Button in pairs({ GameMenuFrame:GetChildren() }) do
if Button.IsObjectType and Button:IsObjectType('Button') then
SUI.Skins.SkinObj('Button', Button)
local point, relativeTo, relativePoint, xOfs, yOfs = Button:GetPoint()
if point then
-- Shift Button Down
Button:ClearAllPoints()
Button:SetPoint(point, relativeTo, relativePoint, (xOfs or 0), (yOfs or 0) - 2)
end
local suiButton = CreateFrame('Button', 'SUI_GameMenuButton', GameMenuFrame, 'MainMenuFrameButtonTemplate')
suiButton:SetScript('OnClick', function()
---@diagnostic disable-next-line: undefined-field
SUI:GetModule('Handler.Options'):ToggleOptions()
if not InCombatLockdown() then HideUIPanel(GameMenuFrame) end
end)
suiButton:SetSize(200, 35)

GameMenuFrame.SUI = suiButton
GameMenuFrame.MenuButtons = {}

local gameMenuLastButtons = {
[_G['GAMEMENU_OPTIONS']] = 1,
[_G['BLIZZARD_STORE']] = 2,
}
local anchorIndex = (C_StorePublic.IsEnabled and C_StorePublic.IsEnabled() and 2) or 1
for button in GameMenuFrame.buttonPool:EnumerateActive() do
local text = button:GetText()
print(text)
GameMenuFrame.MenuButtons[text] = button -- export these

local lastIndex = gameMenuLastButtons[text]
if button:GetText() == _G['BLIZZARD_STORE'] and GameMenuFrame.SUI then
GameMenuFrame.SUI:SetPoint('TOPLEFT', button, 'BOTTOMLEFT', 0, -10)
elseif not lastIndex then
local point, anchor, point2, x, y = button:GetPoint()
button:SetPoint(point, anchor, point2, x, y - 35)
end
end

-- hooksecurefunc('GameMenuFrame_UpdateVisibleButtons', function()
-- SUI.Skins.RemoveAllTextures(GameMenuFrame)
-- SUI.Skins.SkinObj('Frame', GameMenuFrame, 'Dark')
-- if GameMenuFrame.Header then
-- SUI.Skins.RemoveTextures(GameMenuFrame.Header)
-- GameMenuFrame.Header:ClearAllPoints()
-- GameMenuFrame.Header:SetPoint('TOP', GameMenuFrame, 0, 0)
-- GameMenuFrame.Header:SetSize(GameMenuFrame:GetWidth(), 25)
-- GameMenuFrame.Header.Text:ClearAllPoints()
-- GameMenuFrame.Header.Text:SetPoint('CENTER', GameMenuFrame.Header)
-- GameMenuFrame.Header.Text:SetTextColor(1, 1, 1)
-- SUI.Skins.SkinObj('Frame', GameMenuFrame.Header)
-- end
-- if GameMenuFrameHeader then
-- SUI.Skins.RemoveTextures(GameMenuFrameHeader)
-- GameMenuFrameHeader:SetTexture()
-- GameMenuFrameHeader:SetPoint('TOP', GameMenuFrame, 0, 0)
-- GameMenuFrameHeader:SetSize(GameMenuFrame:GetWidth(), 25)
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 35)

GameMenuFrame.Header:ClearAllPoints()
GameMenuFrame.Header:SetPoint('TOP', GameMenuFrame, 0, 0)
GameMenuFrame.Header:SetSize(GameMenuFrame:GetWidth(), 25)
GameMenuFrame.Header.Text:ClearAllPoints()
GameMenuFrame.Header.Text:SetPoint('CENTER', GameMenuFrame.Header)
GameMenuFrame.Header.Text:SetTextColor(1, 1, 1)

GameMenuFrame:SetScale(0.8)
-- SUI.Skins.RemoveAllTextures(GameMenuFrame)
-- GameMenuFrame.Header:ClearAllPoints()
-- GameMenuFrame.Header:SetPoint('TOP', GameMenuFrame, 0, 0)
-- GameMenuFrame.Header:SetSize(GameMenuFrame:GetWidth(), 25)
-- GameMenuFrame.Header.Text:ClearAllPoints()
-- GameMenuFrame.Header.Text:SetPoint('CENTER', GameMenuFrame.Header)
-- GameMenuFrame.Header.Text:SetTextColor(1, 1, 1)

-- SUI.Skins.SkinObj('Frame', GameMenuFrame, 'Dark')
-- -- GameMenuFrame:CreateBackdrop('Transparent')

-- hooksecurefunc(GameMenuFrame, 'InitButtons', function(menu)
-- if not menu.buttonPool then return end

-- for Button in menu.buttonPool:EnumerateActive() do
-- if not Button.IsSkinned then
-- -- S:HandleButton(button, nil, nil, nil, true)
-- if not Button.SetBackdrop then
-- _G.Mixin(Button, _G.BackdropTemplateMixin)
-- Button:HookScript('OnSizeChanged', Button.OnBackdropSizeChanged)
-- end
-- SUI.Skins.SkinObj('Button', Button)

-- local point, relativeTo, relativePoint, xOfs, yOfs = Button:GetPoint()
-- if point then
-- -- Shift Button Down
-- Button:ClearAllPoints()
-- Button:SetPoint(point, relativeTo, relativePoint, (xOfs or 0), (yOfs or 0) - 2)
-- end
-- end
-- end
-- end)
GameMenuFrame:SetScale(0.8)
end
end

Expand Down

0 comments on commit 647134f

Please sign in to comment.