-
Notifications
You must be signed in to change notification settings - Fork 0
/
TutorialUI.lua
256 lines (240 loc) · 11.7 KB
/
TutorialUI.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
local PileSeller = _G.PileSeller
local tutorialIndex = 0
local tutorials = {}
--function ClickAll(open, ui)
-- if open then
-- if ui.btnSaved:GetText() == "+" then ui.btnSaved:Click() end
-- if ui.btnToSell:GetText() == "+" then ui.btnToSell:Click() end
-- else
-- if ui.btnSaved:GetText() == "-" then ui.btnSaved:Click() end
-- if ui.btnToSell:GetText() == "-" then ui.btnToSell:Click() end
-- end
--end
local negative = false
local glow_timer = 0
local glows_done = 0
local glowing = true
function PileSeller:CreateRing(button)
button.glow = PileSeller.UIConfig.tutorial:CreateTexture()
button.glow:SetTexture([[Interface\Garrison\Garr_TimerFill]])
button.glow:SetVertexColor(1,1,1,0)
button.glow:SetSize(65,65)
button.glow:SetPoint("CENTER", PileSeller.UIConfig.tutorial, "CENTER")
button:SetScript("OnUpdate", function(self, elapsed)
glow_timer = glow_timer + elapsed
if glowing then
if not psTutorialDone and PileSeller.UIConfig:IsVisible() and button.glow:IsVisible() then
if glow_timer < 1 then
if negative then
button.glow:SetVertexColor(1, 1, 1, 1 - glow_timer)
else button.glow:SetVertexColor(1, 1, 1, glow_timer) end
else
if not negative and glow_timer > 2 then
glow_timer = 0
if negative then negative = false else negative = true end
elseif negative and glow_timer > 1 then
glow_timer = 0
if negative then negative = false else negative = true end
end
end
end
else
if glow_timer > 120 then
glowing = true
glow_timer = 0
end
end
end
)
end
function PileSeller:ToggleTutorial(ui)
if not ui.TutorialFrame then
CreateTeacher(ui)
tutorials = {
[0] = {
title = "|cFF" .. PileSeller.color .. "Pile|rSeller",
text = "In this short tutorial I will teach you the basics of the UI.",
},
[1] = {
title = "Start tracking!",
text = "By clicking here you can start manually a tracking session.\nThis will also start when you will enter alone in any instanced content.",
glow = ui.toggleTracking,
},
[2] = {
title = "Selling",
text = "Whenever you will open a merchant I will sell all the items tracked during the session.",
},
[3] = {
title = "Selling",
text = "The sell process takes a little while. Please be patient and wait 'til the border of the selling bar becomes white (like it is now).",
white = true,
},
[4] = {
title = "|cFF" .. PileSeller.color .. "Pile|rSeller",
text = "Sometimes the game will glitch and it won't sell some items.\nDon't worry tho, it won't be too much.",
},
[5] = {
title = "Settings",
text = "Remember that you will always be able to access the settings by clicking this button!",
glow = ui.switch,
},
[6] = {
title = "Saved items",
text = "This is where you can store the items that you want to keep.\nFor example you can add mounts or transmog items.",
glow = ui.savedScroll.lblTitle,
},
[7] = {
title = "Saved items",
text = "Here you will be able to see a list of the saved items.\nRemember that you can click on them to gather more informations.",
glow = ui.savedScroll.content,
},
[8] = {
title = "Saved items",
text = "Here you can add items.\nYou can link them from chat, from the dungeon journal or even by typing the item's ID",
glow = ui.btnAddSavedItem,
},
[8] = {
title = "Items to sell",
text = "This is where you will find a list of all the items you will sell.",
glow = ui.toSellScroll.lblTitle,
},
[9] = {
title = "Items to sell",
text = "Like the saved items list here you will be able to click any item.",
glow = ui.toSellScroll.content,
},
[10] = {
title = "Specific item",
text = "By clicking an item in one of the lists something like this will appear.",
glow = ui.itemInfos,
showItemInfos = true,
},
[11] = {
title = "Specific item",
text = "By clicking this button (which will appear just for the saved items) you can set an alert whenever it will drop.",
glow = ui.itemInfos.item.toggleAlert,
showItemInfos = true,
},
[12] = {
title = "Specific item",
text = "By clicking this button you will be able to preview the item (if possible). Remember that you can do that also by control-clicking from the list.",
glow = ui.itemInfos.item.tryIt,
showItemInfos = true,
},
[13] = {
title = "Specific item",
text = "By clicking this button you will remove the clicked item from its list (both the saved items and the items to sell).",
glow = ui.itemInfos.item.removeFromList,
showItemInfos = true,
},
[14] = {
title = "Ignoring",
text = "Here you can ignore certain zones such as an instance or a region.",
glow = ui.ignoredScroll.lblTitle
},
[15] = {
title = "Ignoring",
text = "By typing the name of the zone you will be able to either add or remove an element from the list.",
glow = ui.btnAddIgnoreZone
},
[16] = {
title = "Ignoring",
text = "For example if you are ignoring Firelands all you'll have to do is to write Firelands into the text box and you will remove it.",
glow = ui.btnAddIgnoreZone
},
[17] = {
title = "|cFF" .. PileSeller.color .. "Pile|rSeller",
text = "Lastly you you can type in the chat /pileseller or /ps for some easy commands.\nAnd now what are you waiting for? Go farm something!",
},
[18] = {
title = "Contact",
text = "Feel free to contact me via the curse page or wowinterface or even ingame to Zavian-The Maelstrom, and please report any bugs in either of comment sections"
}
}
WriteLesson(tutorials[tutorialIndex], ui)
elseif ui.TutorialFrame:IsVisible() then
ui.TutorialFrame:Hide()
else ui.TutorialFrame:Show() end
end
function WriteLesson(tut, ui)
if not ui.TutorialFrame:IsVisible() then ui.TutorialFrame:Show() end
ui.TutorialFrame:SetPoint("BOTTOM", ui, 0, -ui.TutorialFrame:GetHeight() - 5)
ui.TutorialFrame.title:SetText(tut.title)
ui.TutorialFrame.text:SetText(tut.text)
ui.TutorialFrame.next:SetEnabled(tutorialIndex ~= #tutorials)
ui.TutorialFrame.prev:SetEnabled(tutorialIndex ~= 0)
if tut.glow then
if not ui.TutorialFrame.glow then ui.TutorialFrame.glow = CreateFrame("FRAME", nil, tut.TutorialFrame); ui.TutorialFrame.glow:SetParent(ui.TutorialFrame) end
ui.TutorialFrame.glow:SetSize(36, 36)
ui.TutorialFrame.glow:SetPoint("RIGHT", tut.glow, 50, 0)
ui.TutorialFrame.glow.tex = ui.TutorialFrame.glow:CreateTexture()
ui.TutorialFrame.glow.tex:SetTexture("Interface\\ICONS\\misc_arrowleft")
ui.TutorialFrame.glow.tex:SetVertexColor(1,1,1,1)
ui.TutorialFrame.glow.tex:SetAllPoints()
ui.TutorialFrame.glow:Show()
if tut.showItemInfos then
PileSeller:SetItemInfo(PileSeller.UIConfig.itemInfos.item, select(2, GetItemInfo(19019)))
ui.itemInfos.item.toggleAlert:Show()
else ui.itemInfos:Hide() end
else
if ui.TutorialFrame.glow then
ui.TutorialFrame.glow:Hide()
end
if tut.title == "Selling" then
PileSeller.sFrame:Show()
if tut.white then
PileSeller.sFrame.statusBar.border:SetBackdropBorderColor(1,1,1)
PileSeller.sFrame.statusBar:SetValue(NUM_BAG_SLOTS + 1)
else
PileSeller.sFrame.statusBar.border:SetBackdropBorderColor(0,0,0)
PileSeller.sFrame.statusBar:SetValue(0)
end
else PileSeller.sFrame:Hide() end
end
end
function CreateTeacher(ui)
ui.TutorialFrame = CreateFrame("Frame", nil, ui, "GlowBoxTemplate")
ui.TutorialFrame:SetSize(275, 150)
ui.TutorialFrame:SetFrameStrata("DIALOG")
ui.TutorialFrame:SetParent(ui)
--ui.TutorialFrame:SetScript("OnShow", function() ClickAll(true, ui) end)
--ui.TutorialFrame:SetScript("OnHide", function() ClickAll(false, ui) end)
ui.TutorialFrame.close = CreateFrame("Button", "PileSeller_TutorialFrame_CloseButton", ui, "UIPanelCloseButton")
ui.TutorialFrame.close:SetPoint("TOPRIGHT", ui.TutorialFrame)
ui.TutorialFrame.close:SetSize(26, 26)
ui.TutorialFrame.close:SetParent(ui.TutorialFrame)
ui.TutorialFrame.next = CreateFrame("Button", "PileSeller_TutorialFrame_Next", ui.TutorialFrame)
ui.TutorialFrame.next:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
ui.TutorialFrame.next:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down")
ui.TutorialFrame.next:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled")
ui.TutorialFrame.next:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight", "ADD")
ui.TutorialFrame.next:SetSize(26, 26)
ui.TutorialFrame.next:SetPoint("BOTTOMRIGHT", ui.TutorialFrame, 0, 0)
ui.TutorialFrame.next:SetScript("OnClick", function()
tutorialIndex = tutorialIndex + 1;
WriteLesson(tutorials[tutorialIndex], ui)
end
)
ui.TutorialFrame.prev = CreateFrame("Button", "PileSeller_TutorialFrame_Prev", ui.TutorialFrame)
ui.TutorialFrame.prev:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up")
ui.TutorialFrame.prev:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Down")
ui.TutorialFrame.prev:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Disabled")
ui.TutorialFrame.prev:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight", "ADD")
ui.TutorialFrame.prev:SetSize(26, 26)
ui.TutorialFrame.prev:SetPoint("LEFT", ui.TutorialFrame.next, -24 , 0)
ui.TutorialFrame.prev:SetEnabled(false)
ui.TutorialFrame.prev:SetScript("OnClick", function()
tutorialIndex = tutorialIndex - 1;
WriteLesson(tutorials[tutorialIndex], ui)
end
)
ui.TutorialFrame.title = ui.TutorialFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
ui.TutorialFrame.title:SetPoint("TOPLEFT", ui.TutorialFrame, 10, -10)
ui.TutorialFrame.title:SetJustifyH("LEFT")
ui.TutorialFrame.text = ui.TutorialFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
ui.TutorialFrame.text:SetPoint("TOPLEFT", ui.TutorialFrame, 10, -30)
ui.TutorialFrame.text:SetSize( ui.TutorialFrame:GetWidth() - 15 , ui.TutorialFrame:GetHeight() - 15)
ui.TutorialFrame.text:SetJustifyH("LEFT")
ui.TutorialFrame.text:SetJustifyV("TOP")
ui.TutorialFrame:Hide()
end