update GUI to save last placed positions in configs/class..spec.json
main
Ofrex 2 years ago
parent efc4108aff
commit 66a84289d6
  1. 64
      src/GUI/Gui.lua
  2. 6
      src/_bastion.lua

@ -1,12 +1,5 @@
local Tinkr, Bastion = ...
--local Command = Bastion.Command:New('bastion')
--UI Co-ordinates
local GUI = { points = {"CENTER"}, }
local SETTINGS = { points = {"CENTER"}, }
local BUTTONS = { points = {"CENTER"}, }
Tinkr:require('scripts.bastion.libs.LibStub.LibStub', Bastion)
Tinkr:require("scripts.bastion.libs.StdUi.StdUi", Bastion)
Tinkr:require("scripts.bastion.libs.StdUi.StdUiConfig", Bastion)
@ -35,8 +28,20 @@ Tinkr:require("scripts.bastion.libs.StdUi.widgets.Tab", Bastion)
Tinkr:require("scripts.bastion.libs.StdUi.widgets.Spell", Bastion)
Tinkr:require("scripts.bastion.libs.StdUi.widgets.ContextMenu", Bastion)
local class = UnitClass('player')
local spec = GetSpecialization()
local guiconf = Tinkr.Util.Config:New(class .. spec)
local mainmenufirstloadcheck = guiconf:Read("mainmenue")
if not mainmenufirstloadcheck then
guiconf:Write("mainmenua", 'CENTER')
end
local settingsmenufirstloadcheck = guiconf:Read("settingsmenue")
if not settingsmenufirstloadcheck then
guiconf:Write("settingsmenua", 'CENTER')
end
--Initial Frame Setup
function Bastion.settingstemplate(config, title, width, height, newr, newg, newb)
--UI Co-ordinates
local StdUi = LibStub('StdUi'):NewInstance()
StdUi.config = {
font = {
@ -81,19 +86,26 @@ function Bastion.settingstemplate(config, title, width, height, newr, newg, newb
}
local settingsframe = StdUi:Window(UIParent, width, height, title)
settingsmenua = guiconf:Read("settingsmenua")
settingsmenuc = guiconf:Read("settingsmenuc")
settingsmenud = guiconf:Read("settingsmenud")
settingsmenue = guiconf:Read("settingsmenue")
settingsframe:Hide()
settingsframe:SetPoint(SETTINGS.points[1], SETTINGS.points[2], SETTINGS.points[3], SETTINGS.points[4], SETTINGS.points[5])
settingsframe:SetPoint(settingsmenua, nil, settingsmenuc, settingsmenud, settingsmenue)
StdUi:BuildWindow(settingsframe, config)
StdUi:EasyLayout(settingsframe, { padding = { top = 40 } })
settingsframe:SetScript("OnMouseUp", function(self)
self:StopMovingOrSizing()
settingsframe:SetScript("OnDragStop", function(self)
local a,b,c,d,e = self:GetPoint()
SETTINGS.points = {a, nil, c, d, e}
Bastion:Print(a,b,c,d,e)
self:StopMovingOrSizing()
guiconf:Write("settingsmenua", a)
guiconf:Write("settingsmenuc", c)
guiconf:Write("settingsmenud", d)
guiconf:Write("settingsmenue", e)
end)
--Main Menu (Settings, Enable Rotation, etc)
_G.buttons = {}
local enabled = false
buttons.aoeenabled = false
buttons.buffsenabled = false
buttons.cooldownsenabled = false
@ -101,10 +113,13 @@ function Bastion.settingstemplate(config, title, width, height, newr, newg, newb
buttons.dpsenabled = false
buttons.healenabled = false
buttons.rotationenabled = false
mainmenua = guiconf:Read("mainmenua")
mainmenuc = guiconf:Read("mainmenuc")
mainmenud = guiconf:Read("mainmenud")
mainmenue = guiconf:Read("mainmenue")
_G.mainmenu = StdUi:Window(nil, 150, 280, title)
mainmenu:Hide()
mainmenu:SetPoint(GUI.points[1], GUI.points[2], GUI.points[3], GUI.points[4], GUI.points[5])
mainmenu:SetUserPlaced(true)
mainmenu:SetPoint(mainmenua, nil, mainmenuc, mainmenud, mainmenue)
local aoebutton = StdUi:HighlightButton(mainmenu, 130, 20, 'AOE')
StdUi:GlueTop(aoebutton, mainmenu, 10, -40, 'LEFT')
local buffsbutton = StdUi:HighlightButton(mainmenu, 130, 20, 'Buffs')
@ -121,11 +136,16 @@ function Bastion.settingstemplate(config, title, width, height, newr, newg, newb
StdUi:GlueTop(enablebutton, healbutton, 0, -30, 'LEFT')
local settingsbutton = StdUi:Button(mainmenu, 130, 20, 'Settings')
StdUi:GlueTop(settingsbutton, enablebutton, 0, -30, 'LEFT')
mainmenu:SetScript("OnMouseUp", function(self)
self:StopMovingOrSizing()
mainmenu:SetScript("OnDragStop", function(self)
local a,b,c,d,e = self:GetPoint()
GUI.points = {a, nil, c, d, e}
Bastion:Print(a,b,c,d,e)
self:StopMovingOrSizing()
guiconf:Write("mainmenua", a)
guiconf:Write("mainmenuc", c)
guiconf:Write("mainmenud", d)
guiconf:Write("mainmenue", e)
end)
--Open/Hide Settings Window OnClick
settingsbutton:SetScript('OnClick', function ()
if settingsframe:IsShown() then
@ -205,14 +225,6 @@ function Bastion.settingstemplate(config, title, width, height, newr, newg, newb
Eval('RunMacroText("/bastion toggle")', 'bastion')
buttons.rotationenabled = false
end
end)
-- --Toggle Main Menu
-- Command:Register('interface', 'Opens interface menu', function()
-- if mainmenu:IsShown() then
-- mainmenu:Hide()
-- else
-- mainmenu:Show()
-- end
-- end)
end)
end

@ -225,6 +225,12 @@ Command:Register('interface', 'Opens interface menu', function()
if UnitClass('player') == 'Priest' and GetSpecialization() == 3 then
Tinkr:require("scripts/bastion/scripts/shadowpriest", Bastion)
Eval('RunMacroText("/bastion module shadow")', 'bastion')
elseif UnitClass('player') == 'Priest' and GetSpecialization() == 2 then
Tinkr:require("scripts/bastion/scripts/holypriest", Bastion)
Eval('RunMacroText("/bastion module holypriest")', 'bastion')
elseif UnitClass('player') == 'Druid' and GetSpecialization() == 3 then
Tinkr:require("scripts/bastion/scripts/guardiandruid", Bastion)
Eval('RunMacroText("/bastion module guardian")', 'bastion')
elseif UnitClass('player') == 'Druid' and GetSpecialization() == 4 then
Tinkr:require("scripts/bastion/scripts/restodruid", Bastion)
Eval('RunMacroText("/bastion module resto_druid")', 'bastion')

Loading…
Cancel
Save