api: allow specific order for firstrun

This commit is contained in:
shagu
2017-01-06 23:35:45 +01:00
parent a4a51cca69
commit 96143c25c2
2 changed files with 15 additions and 9 deletions
Vendored
+2 -2
View File
@@ -275,7 +275,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox)
pfUI.api:SkinButton(question.yes)
question.yes:SetWidth(100)
question.yes:SetHeight(20)
question.yes:SetText("Okay")
question.yes:SetText("Yes")
question.yes:SetScript("OnClick", function()
if yes then yes() end
this:GetParent():Hide()
@@ -291,7 +291,7 @@ function pfUI.api:CreateQuestionDialog(text, yes, no, editbox)
pfUI.api:SkinButton(question.no)
question.no:SetWidth(85)
question.no:SetHeight(20)
question.no:SetText("Cancel")
question.no:SetText("No")
question.no:SetScript("OnClick", function()
if no then no() end
this:GetParent():Hide()
+13 -7
View File
@@ -118,11 +118,15 @@ pfUI.firstrun:SetScript("OnEvent", function() pfUI.firstrun:NextStep() end)
function pfUI.firstrun:AddStep(name, yfunc, nfunc, descr, cmpnt)
if not name then return end
pfUI.firstrun.steps[name] = {}
if yfunc then pfUI.firstrun.steps[name].yfunc = yfunc end
if nfunc then pfUI.firstrun.steps[name].nfunc = nfunc end
if descr then pfUI.firstrun.steps[name].descr = descr end
if cmpnt then pfUI.firstrun.steps[name].cmpnt = cmpnt end
local step = {}
step.name = name
step.yfunc = yfunc or nil
step.nfunc = nfunc or nil
step.descr = descr or nil
step.cmpnt = cmpnt or nil
table.insert(pfUI.firstrun.steps, step)
end
function pfUI.firstrun:NextStep()
@@ -140,14 +144,16 @@ function pfUI.firstrun:NextStep()
pfUI.api:CreateQuestionDialog("Welcome to |cff33ffccpf|cffffffffUI|r!\n\n"..
"I'm the first run wizzard that will guide you through some basic configuration.\n"..
"You'll now be prompted for several questions. To get a default installation,\n"..
"you might want to click \"Okay\" everywhere. A few settings are client settings\n"..
"you might want to click \"Yes\" everywhere. A few settings are client settings\n"..
"(e.g chat questions) so if you don't want to lose your chat configurations, you\n"..
"should be careful with your choices.\n\n"..
"Visit |cff33ffcchttp://shagu.org|r to check for the latest version.", yes, no)
return
end
for name, step in pairs(pfUI.firstrun.steps) do
for _, step in pairs(pfUI.firstrun.steps) do
local name = step.name
if not pfUI_init[name] then
local function yes()
pfUI_init[name] = true