-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40877ce
commit af47825
Showing
4 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,47 @@ | ||
local MyTemplate = MyTemplate | ||
local MyTemplate = MyTemplate or {} | ||
|
||
function MyTemplate.CreateMenu(savedVars, defaults) | ||
|
||
local LAM = LibStub:GetLibrary("LibAddonMenu-2.0") | ||
|
||
local panelData = { | ||
type = "panel", | ||
name = MyTemplate.name, | ||
displayName = name, | ||
author = MyTemplate.author, | ||
version = MyTemplate.version, | ||
registerForRefresh = true, | ||
slashCommand = "/MyTemplate", } | ||
registerForDefaults = true, | ||
slashCommand = "/MyTemplate", | ||
} | ||
|
||
LAM:RegisterAddonPanel("MyTemplate_OptionsPanel", panelData) | ||
|
||
local optionsData = { -- optionsData | ||
|
||
{ -- checkbox: use global settings | ||
type = "checkbox", | ||
name = "use global settings", | ||
getFunc = function() return MyTemplate.settings.useGlobalSettings end, | ||
setFunc = function(value) MyTemplate.set("useGlobalSettings", value, true) end, | ||
}, | ||
|
||
--[[ | ||
{ -- button 1 | ||
type = "button", | ||
name = "button1", | ||
func = MyTemplate.button1, | ||
}, | ||
{ -- checkbox 1 | ||
type = "checkbox", | ||
name = "checkbox1", | ||
getFunc = function() return MyTemplate.get("checkbox1") end, | ||
setFunc = function(value) MyTemplate.set("checkbox1", value) end, | ||
}, | ||
]] | ||
|
||
}, | ||
|
||
LAM:RegisterOptionControls("MyTemplate_OptionsPanel", optionsData) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
local MyTemplate = MyTemplate or {} | ||
|
||
local function getSettings() | ||
if MyTemplate.settings.useGlobalSettings then return MyTemplate.globalSettings end | ||
return MyTemplate.settings | ||
end | ||
|
||
function MyTemplate.button1() | ||
|
||
end | ||
|
||
|
||
function MyTemplate.get(key) | ||
if nil == key then return end | ||
return getSettings()[key] | ||
end | ||
|
||
function MyTemplate.set(key, value) | ||
if nil == key then return end | ||
getSettings()[key] = value | ||
end |