Skip to content

Commit

Permalink
Add tuto for command bar settings on first record
Browse files Browse the repository at this point in the history
  • Loading branch information
Neogeekmo committed Aug 30, 2024
1 parent 0068f12 commit f14a721
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions APR-Recorder.toc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ helper/spells.lua
Commands.lua
Event.lua

frames/TutoFrame.lua
frames/autocomplete.lua
frames/CommandsBar.lua
frames/CommandsBarSetting.lua
Expand Down
1 change: 1 addition & 0 deletions Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function AprRC.settings:InitializeSettings()
commandBarFrame = {
rotation = "HORIZONTAL",
position = {},
tutorialShown = true
},
commandBarSettingFrame = {},
--debug
Expand Down
11 changes: 11 additions & 0 deletions frames/CommandsBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local LibWindow = LibStub("LibWindow-1.1")

AprRC.CommandBar = AprRC:NewModule('CommandBar')
AprRC.CommandBar.btnList = {}
AprRC.CommandBar.settingTutoFrameID = nil

local FRAME_WIDTH = 80
local FRAME_HEIGHT = 35
Expand Down Expand Up @@ -56,7 +57,9 @@ function AprRC.CommandBar:UpdateFrame()
end
AprRC.CommandBar.btnList = {}

-- Check if the commands are still the default commands
AprRCData.CommandBarCommands = AprRCData.CommandBarCommands or defaultCommands

for _, commandData in ipairs(AprRCData.CommandBarCommands) do
local btn = CreateButton(CommandBarFrame, commandData.texture, commandData.label, function()
AprRC.command:SlashCmd(commandData.command)
Expand Down Expand Up @@ -84,12 +87,19 @@ function AprRC.CommandBar:UpdateFrame()
local settingsBtn = CreateButton(CommandBarFrame, "Interface\\AddOns\\APR-Recorder\\assets\\icons\\settings",
"Commands Settings", function()
AprRC.CommandBarSetting:Show()
AprRC.settings.profile.commandBarFrame.tutorialShown = false
AprRC.TutoFrame:HideCustomTutorialFrame(AprRC.CommandBar.settingTutoFrameID)
end)

tinsert(AprRC.CommandBar.btnList, zoneDoneSaveBtn)
tinsert(AprRC.CommandBar.btnList, rotationBtn)
tinsert(AprRC.CommandBar.btnList, settingsBtn)
AprRC.CommandBar:AdjustBarRotation(CommandBarFrame)
-- Show the tutorial if we are using the default commands
if AprRC.settings.profile.commandBarFrame.tutorialShown then
AprRC.CommandBar.settingTutoFrameID = AprRC.TutoFrame:ShowCustomTutorialFrame(
"You can add more commands in the Commands Settings panel", TutorialPointerFrame.Direction.UP, settingsBtn)
end
end

---------------------------------------------------------------------------------------
Expand All @@ -110,6 +120,7 @@ end
function AprRC.CommandBar:RefreshFrameAnchor()
if not AprRC.settings.profile.enableAddon or not AprRC.settings.profile.recordBarFrame.isRecording or C_PetBattles.IsInBattle() then
CommandBarFrame:Hide()
AprRC.TutoFrame:HideCustomTutorialFrame(AprRC.CommandBar.settingTutoFrameID)
return
end
CommandBarFrame:Show()
Expand Down
11 changes: 11 additions & 0 deletions frames/TutoFrame.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
AprRC.TutoFrame = AprRC:NewModule('TutoFrame')

function AprRC.TutoFrame:ShowCustomTutorialFrame(message, direction, anchor)
return TutorialPointerFrame:Show(message, direction, anchor, 0, 10)
end

function AprRC.TutoFrame:HideCustomTutorialFrame(frameID)
if frameID then
TutorialPointerFrame:Hide(frameID)
end
end

0 comments on commit f14a721

Please sign in to comment.