-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelp.lua
More file actions
218 lines (205 loc) · 10.3 KB
/
Copy pathHelp.lua
File metadata and controls
218 lines (205 loc) · 10.3 KB
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
local _, ns = ...
local UI = ns.UI
local COLORS = UI.COLORS
local TOPICS = {
{
title = "Welcome",
summary = "What it adds",
body = "Resonance adds optional layers around confirmed spell moments. Blizzard's original spell audio stays unchanged.\n\n|cff2ec2b3FLOW|r\nChoose a preset → adjust a moment → layer sounds → save.",
},
{
title = "Start with a preset",
summary = "Three starting points",
body = "|cff4594d1Subtle|r layers signature moments.\n\n|cff4594d1Medium|r adds character without covering every global cooldown.\n\n|cff4594d1Expressive|r uses richer, more frequent layers.\n\nEvery control remains editable.",
},
{
title = "Spell moments",
summary = "Cast, Release, Casting",
body = "|cff2ec2b3Cast|r follows a successful spell.\n\n|cff2ec2b3Release|r follows a completed empower.\n\n|cff2ec2b3Casting|r begins with a real cast, channel, or empower bar and fades when it ends. Instant spells have no Casting moment.\n\nThe play button previews Resonance layers only.",
},
{
title = "Generic sounds",
summary = "Shared across your specs",
body = "The first tab covers common character actions: skyriding, travel, and Recuperate.\n\nOwned Hearthstone toys appear in themed groups. This sound set belongs to your character, so it follows every specialization.",
},
{
title = "Layers & delay",
summary = "Build a small sound phrase",
body = "Each enabled row plays one layer.\n\n|cff2ec2b30 ms|r plays immediately. Try |cff2ec2b360–180 ms|r for an echo, impact, or tail.\n\nUse |cff4594d1+ layer|r for more texture. Extra rows can be removed.",
},
{
title = "Sound library",
summary = "Find, hear, and favorite",
body = "Browse a category or search labels, sources, and categories. Click a card to preview it, then choose Okay.\n\nSearch supports |cff2ec2b3AND|r, |cff2ec2b3OR|r, the vertical bar, and quoted phrases. Favorites stay easy to find. Right-click a swatch to preview its layer.",
},
{
title = "Save & share",
summary = "Sets belong to a character and tab",
body = "Your first edit creates a |cff2ec2b3Personal set|r named for your character and realm.\n\nBuilt-in presets are read-only. Editing one moves the change into your Personal set. Choose |cff4594d1Save changes|r after editing. Switching sets warns before unsaved changes are lost.\n\nExport creates a share code. Import it on the same specialization or Generic tab. RES1 codes remain supported.",
},
{
title = "Safety & limits",
summary = "What the addon deliberately avoids",
body = "Resonance reacts only to confirmed player spell events. It does not automate gameplay or track unavailable combat data such as cooldown-ready, proc, or resource-gain events.\n\nIt uses sounds already installed with WoW. Solo added sounds is for auditioning.",
},
}
function ns:CreateHelpWindow()
if self.HelpWindow then return end
local window = CreateFrame("Frame", "ResonanceHelpWindow", UIParent, "BackdropTemplate")
window:SetSize(760, 555)
local function FitToScreen()
local uiWidth, uiHeight = UIParent:GetSize()
window:SetScale(math.max(0.50, math.min(1, (uiWidth - 30) / 760, (uiHeight - 30) / 555)))
end
FitToScreen()
window:SetPoint("CENTER")
window:SetFrameStrata("FULLSCREEN_DIALOG")
window:SetFrameLevel(850)
window:SetToplevel(true)
window:SetMovable(true)
window:SetClampedToScreen(true)
window:EnableMouse(true)
UI.ApplyBackdrop(window, COLORS.window, COLORS.border)
UI.AddArcaneTrim(window, "window")
UI.SkinShell(window, { bottomBar = 52 })
self.HelpWindow = window
local close = UI.CreateCloseButton(window)
close:SetPoint("TOPRIGHT", -8, -8)
local title = UI.CreateText(window, "GameFontNormalHuge", "Help")
title:SetPoint("TOPLEFT", 20, -18)
title:SetTextColor(unpack(COLORS.text))
local subtitle = UI.CreateText(window, "GameFontHighlightSmall", "Quick answers and a short interactive walkthrough.")
subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -5)
subtitle:SetTextColor(unpack(COLORS.muted))
local drag = CreateFrame("Frame", nil, window)
drag:SetPoint("TOPLEFT"); drag:SetPoint("TOPRIGHT"); drag:SetHeight(58)
drag:EnableMouse(true); drag:RegisterForDrag("LeftButton")
drag:SetScript("OnDragStart", function() window:StartMoving() end)
drag:SetScript("OnDragStop", function() window:StopMovingOrSizing() end)
local rail = CreateFrame("Frame", nil, window, "BackdropTemplate")
rail:SetPoint("TOPLEFT", 18, -76)
rail:SetPoint("BOTTOMLEFT", 18, 62)
rail:SetWidth(190)
UI.ApplyBackdrop(rail, COLORS.panel, COLORS.border)
UI.AddArcaneTrim(rail, "panel")
UI.SkinPanel(rail, { inset = true })
window.topicButtons = {}
for index, topic in ipairs(TOPICS) do
local button = UI.CreateButton(rail, topic.title, 174, function() window:ShowTopic(index) end)
button:SetHeight(42)
button:SetPoint("TOPLEFT", 8, -8 - (index - 1) * 47)
button:GetFontString():ClearAllPoints()
button:GetFontString():SetPoint("LEFT", 10, 0)
button:GetFontString():SetJustifyH("LEFT")
button.activeMark = CreateFrame("Frame", nil, button)
button.activeMark:SetPoint("TOPLEFT", 2, -4)
button.activeMark:SetPoint("BOTTOMLEFT", 2, 4)
button.activeMark:SetWidth(2)
local activeTexture = button.activeMark:CreateTexture(nil, "ARTWORK")
activeTexture:SetAllPoints()
activeTexture:SetColorTexture(unpack(COLORS.teal))
UI.TrackAccentTexture(activeTexture)
button.activeMark:Hide()
button:HookScript("OnLeave", function(self)
if window.topic == index and not self._resonanceEUI then
self:SetBackdropColor(unpack(COLORS.tealDim))
self:SetBackdropBorderColor(unpack(COLORS.teal))
end
end)
window.topicButtons[index] = button
end
local content = CreateFrame("Frame", nil, window, "BackdropTemplate")
content:SetPoint("TOPLEFT", rail, "TOPRIGHT", 12, 0)
content:SetPoint("BOTTOMRIGHT", window, "BOTTOMRIGHT", -18, 62)
UI.ApplyBackdrop(content, COLORS.paper, COLORS.border)
UI.AddArcaneTrim(content, "section")
UI.SkinPanel(content, { inset = true })
content.title = UI.CreateText(content, "GameFontNormalHuge", "")
content.title:SetPoint("TOPLEFT", 22, -22)
content.title:SetTextColor(unpack(COLORS.teal))
UI.TrackAccentText(content.title)
content.summary = UI.CreateText(content, "GameFontHighlight", "")
content.summary:SetPoint("TOPLEFT", content.title, "BOTTOMLEFT", 0, -6)
content.summary:SetTextColor(unpack(COLORS.muted))
content.rule = content:CreateTexture(nil, "ARTWORK")
content.rule:SetTexture("Interface\\Buttons\\WHITE8X8")
content.rule:SetPoint("TOPLEFT", content.summary, "BOTTOMLEFT", 0, -14)
content.rule:SetPoint("RIGHT", content, "RIGHT", -22, 0)
content.rule:SetHeight(1)
content.rule:SetVertexColor(unpack(COLORS.border))
content.body = UI.CreateText(content, "GameFontHighlight", "")
content.body:SetPoint("TOPLEFT", content.rule, "BOTTOMLEFT", 0, -20)
content.body:SetPoint("BOTTOMRIGHT", content, "BOTTOMRIGHT", -22, 22)
content.body:SetJustifyH("LEFT")
content.body:SetJustifyV("TOP")
content.body:SetWordWrap(true)
content.body:SetSpacing(3)
content.body:SetTextColor(0.84, 0.85, 0.91, 1)
window.content = content
function window:ShowTopic(index)
self.topic = index
local topic = TOPICS[index]
content.title:SetText(topic.title)
content.summary:SetText(topic.summary)
local body = topic.body:gsub("|cff4594d1", UI.AccentTag())
body = body:gsub("|cff2ec2b3", UI.AccentTag())
content.body:SetText(body)
for buttonIndex, button in ipairs(self.topicButtons) do
local selected = buttonIndex == index
button.activeMark:SetShown(selected)
if button._resonanceEUI then
button:GetFontString():SetTextColor(unpack(selected and COLORS.teal or COLORS.text))
elseif selected then
button:SetBackdropColor(unpack(COLORS.tealDim))
button:SetBackdropBorderColor(unpack(COLORS.teal))
else
button:SetBackdropColor(unpack(COLORS.raised))
button:SetBackdropBorderColor(unpack(COLORS.border))
end
end
end
window.tutorial = UI.CreateButton(window, "Start interactive tutorial", 190, function()
window:Hide()
ns:StartTutorial(false)
end, true)
window.tutorial:SetPoint("BOTTOMLEFT", 18, 18)
local restart = UI.CreateButton(window, "Restart tutorial", 125, function()
window:Hide()
ns:StartTutorial(true)
end)
restart:SetPoint("LEFT", window.tutorial, "RIGHT", 8, 0)
local done = UI.CreateButton(window, "Close", 90, function() window:Hide() end)
done:SetPoint("BOTTOMRIGHT", -18, 18)
window:SetScript("OnShow", function()
FitToScreen()
window:Raise()
local progress = ns.DB and ns.DB.tutorial
local resumable = ns.Tutorial and ns.Tutorial.active or (progress and tonumber(progress.lastStep) and progress.lastStep > 1)
window.tutorial:SetText(resumable and "Resume interactive tutorial" or "Start interactive tutorial")
end)
window:SetScript("OnHide", function() window:StopMovingOrSizing() end)
window:ShowTopic(1)
window:Hide()
local displayEvents = CreateFrame("Frame")
displayEvents:RegisterEvent("DISPLAY_SIZE_CHANGED")
displayEvents:RegisterEvent("UI_SCALE_CHANGED")
displayEvents:SetScript("OnEvent", function() if window:IsShown() then FitToScreen() end end)
if UISpecialFrames then UISpecialFrames[#UISpecialFrames + 1] = window:GetName() end
end
function ns:OpenHelp(topicIndex)
self:CreateHelpWindow()
self.HelpWindow:ShowTopic(math.max(1, math.min(#TOPICS, tonumber(topicIndex) or 1)))
self.HelpWindow:Show()
self.HelpWindow:Raise()
end
function ns:ToggleHelp(topicIndex)
self:CreateHelpWindow()
if self.HelpWindow:IsShown() then
self.HelpWindow:Hide()
return
end
self:OpenHelp(topicIndex)
end
function ns:CloseHelp()
if self.HelpWindow then self.HelpWindow:Hide() end
end