diff --git a/Changelog b/Changelog
index 441291c..8dfa6ba 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,19 @@
-------------------------------------------------------------------------------
Memento bar
-------------------------------------------------------------------------------
+Version 1.6.0 (24-02-2018)
+- Added checkbox to disable sound, when hovering the buttons
+- Refactored visibility and added checkboxes:
+-- Show bar in menu (default: false)
+-- Show bar on hud (default: true)
+--- Is the default hud
+-- Show bar on hudui (default: true)
+--- Activated with In-Game Cursor
+- Tooltips updated for consistency
+- Added checkbox to hide the cooldown
+- Added options to customize the cooldown color and font
+-- Added a cooldown example text, the changes are only visible after a change (didn't wan't to change the library)
+
Version 1.5.0 (20-01-2018)
- Added functionality: Unlock the bar (the bar is by default locked)
-- An overlay will appear on the bar, showing the size and position (X,Y top left).
diff --git a/MementoBar.lua b/MementoBar.lua
index 6989d1a..a8943f4 100644
--- a/MementoBar.lua
+++ b/MementoBar.lua
@@ -21,16 +21,16 @@ end
function MementoBar:Initialize()
-- Load saved values..
MementoBar.Saved = ZO_SavedVars:New("MementoBar_Character", MementoBar.Addon.Version, nil, MementoBar.Default)
+
if MementoBar.Saved.UseAccountSettings then
MementoBar.Saved = ZO_SavedVars:NewAccountWide("MementoBar_Account", MementoBar.Addon.Version, nil, MementoBar.Default)
end
MementoBar_Frame:SetHandler("OnMoveStop", MementoBar.OnMoveStop)
-
MementoBar:RestorePanel()
MementoBar:HoykeyCreateSelections()
MementoBar:CreateSettingsWindow()
-
+
EVENT_MANAGER:UnregisterForEvent(MementoBar.Addon.Name, EVENT_ADD_ON_LOADED)
end
@@ -42,28 +42,24 @@ function MementoBar:GetVersion(showMinor)
if showMinor == false or ADDON_MINOR_VERSION == nil then
return tostring(MementoBar.Addon.Version)
end
+
return tostring(MementoBar.Addon.Version) .. "." .. tostring(MementoBar.Addon.MinorVersion)
end
function MementoBar:RestorePanel()
- MementoBar:SetFragmentBehaviour()
-
MementoBar:SetButtonFrameWidth()
-
MementoBar:HotkeyUpdate()
-
MementoBar:InitializeButtons()
-
- MementoBar:ButtonsBackdropColor()
-
+ MementoBar:RestoreButtons()
MementoBar:RestorePosition()
-
MementoBar:UpdateMoveFrame()
+ MementoBar:SetFragmentBehaviour()
end
function MementoBar:RestorePosition()
local Top = MementoBar.Saved.Top
local Left = MementoBar.Saved.Left
+
MementoBar_Frame:ClearAnchors()
MementoBar_Frame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, Left, Top)
end
diff --git a/MementoBar.txt b/MementoBar.txt
index 250b6a3..3892643 100644
--- a/MementoBar.txt
+++ b/MementoBar.txt
@@ -4,9 +4,9 @@
; States and/or other countries. All rights reserved.
; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
-## APIVersion: 100021 100022
+## APIVersion: 100022
## Title: Memento Bar
-## Version: 1.5.0
+## Version: 1.6.0
## Author: Jarth
## Description: Show a hotbar with selected memento's. Activate by button press!
##
diff --git a/MementoBar.xml b/MementoBar.xml
index 595bafc..b4a7124 100644
--- a/MementoBar.xml
+++ b/MementoBar.xml
@@ -7,7 +7,7 @@
<Controls>
<Backdrop name="$(parent)Backdrop" alpha="1">
</Backdrop>
- <Label name="$(parent)Timer" font="ZoFontHeader2" alpha="1">
+ <Label name="$(parent)Timer" alpha="1">
<Anchor point="CENTER" relativeTo="$(parent)" relativePoint="CENTER" />
</Label>
<Label name="$(parent)Binding" font="ZoFontGameSmall" alpha="1">
diff --git a/MementoBar_Buttons.lua b/MementoBar_Buttons.lua
index 1e1b3a5..ed33a1b 100644
--- a/MementoBar_Buttons.lua
+++ b/MementoBar_Buttons.lua
@@ -15,8 +15,12 @@ local MementoBar = MementoBar
function MementoBar.ButtonHighlightEnter(frame)
local highlightColor = MementoBar.Saved.HighlightColor
local buttonBackdrop = GetControl(frame, "Backdrop")
+
if buttonBackdrop ~= nil then
- PlaySound(SOUNDS.QUICKSLOT_MOUSEOVER)
+ if MementoBar.Saved.IsAudioEnabled then
+ PlaySound(SOUNDS.QUICKSLOT_MOUSEOVER)
+ end
+
buttonBackdrop:SetEdgeColor(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a)
end
end
@@ -24,13 +28,15 @@ end
function MementoBar.ButtonHighlightExit(frame)
local edgeColor = MementoBar.Saved.EdgeColor
local buttonBackdrop = GetControl(frame, "Backdrop")
+
if buttonBackdrop ~= nil then
buttonBackdrop:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
end
end
-function MementoBar.ButtonOnClicked(button)
+function MementoBar.ButtonOnClicked(button)
local id = button:GetId()
+
if id > 0 then
local cooldownRemaining, cooldownDuration = GetCollectibleCooldownAndDuration(id)
if cooldownRemaining == 0 then
@@ -52,6 +58,7 @@ end
function MementoBar:SetupButtonBinding(button, key, left, top)
local buttonBinding = GetControl(button, "Binding")
+
if buttonBinding ~= nil then
MementoBar:HotkeyUpdateColor(buttonBinding)
buttonBinding:SetText(MementoBar:HoykeyGetKey(button, key))
@@ -59,6 +66,7 @@ function MementoBar:SetupButtonBinding(button, key, left, top)
buttonBinding:ClearAnchors()
buttonBinding:SetAnchor(MementoBar.Saved.KeyBindingLocation, button, MementoBar.Saved.KeyBindingLocation, 0, 0)
end
+
if buttonBinding ~= nil then
buttonBinding:SetHidden(not MementoBar.Saved.ShowKeyBinding)
end
@@ -66,6 +74,7 @@ end
function MementoBar:SetupButtonTexture(button, key, left, top)
local buttonTexture = GetControl(button, "Texture")
+
if buttonTexture ~= nil then
button:SetHandler("OnClicked", MementoBar.ButtonOnClicked)
buttonTexture:SetDrawLevel(3)
@@ -79,6 +88,7 @@ end
function MementoBar:SetupButtonBackdrop(button, key, left, top)
local buttonBackdrop = GetControl(button, "Backdrop")
+
if buttonBackdrop ~= nil then
buttonBackdrop:SetDrawLevel(2)
buttonBackdrop:SetEdgeTexture(nil, 1, 1, MementoBar.Saved.Margin)
@@ -118,14 +128,17 @@ end
function MementoBar:InitializeButtons()
local index = 1
+
for _, _value in ipairs(MementoBar.OrderedMementos) do
local id = _value.Id
local left, top = MementoBar:GetButtonPosition(index)
+
if MementoBar.Saved.SelectedMementos[id] and IsCollectibleUnlocked(id) then
if MementoBar.Buttons[id] == nil then
- MementoBar.Buttons[id] = WINDOW_MANAGER:CreateControlFromVirtual("MementoBar_Button", MementoBar_Frame, "MementoBar_Button", id)
+ MementoBar.Buttons[id] = MementoBar.WM:CreateControlFromVirtual("MementoBar_Button", MementoBar_Frame, "MementoBar_Button", id)
MementoBar.Buttons[id]:SetId(id)
end
+
MementoBar:SetupButton(MementoBar.Buttons[id], left, top)
MementoBar:SetupButtonBinding(MementoBar.Buttons[id], id, left, top)
MementoBar:SetupButtonBackdrop(MementoBar.Buttons[id], id, left, top)
@@ -142,23 +155,37 @@ end
function MementoBar:GetButtonPosition(index)
local left = MementoBar.Saved.Width * ((index - 1) % MementoBar.Saved.BarDepth)
local top = MementoBar.Saved.Height * (math.floor((index - 1) / MementoBar.Saved.BarDepth))
+
if MementoBar.Saved.Horizontal then
left = MementoBar.Saved.Height * (math.floor((index - 1) / MementoBar.Saved.BarDepth))
top = MementoBar.Saved.Width * ((index - 1) % MementoBar.Saved.BarDepth)
end
+
return left, top
end
-function MementoBar:ButtonsBackdropColor()
+function MementoBar:RestoreButtons()
local centerColor = MementoBar.Saved.CenterColor
local edgeColor = MementoBar.Saved.EdgeColor
+ local timerIsTimerEnabled = MementoBar.Saved.IsTimerEnabled
+ local timerFont = MementoBar.Saved.TimerFont
+ local timerFontColor = MementoBar.Saved.TimerFontColor
for _, _value in ipairs(MementoBar.OrderedMementos) do
if MementoBar.Buttons[_value.Id] ~= nil then
- local buttonBackdrop = GetControl(MementoBar.Buttons[_value.Id], "Backdrop")
- if buttonBackdrop ~= nil then
- buttonBackdrop:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
- buttonBackdrop:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
+ local backdrop = GetControl(MementoBar.Buttons[_value.Id], "Backdrop")
+
+ if backdrop ~= nil then
+ backdrop:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
+ backdrop:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
+ end
+
+ local label = GetControl(MementoBar.Buttons[_value.Id], "Timer")
+
+ if label ~= nil then
+ label:SetHidden(not timerIsTimerEnabled)
+ label:SetFont(timerFont)
+ label:SetColor(timerFontColor.r, timerFontColor.g, timerFontColor.b, timerFontColor.a)
end
end
end
@@ -176,6 +203,7 @@ end
function MementoBar.Update()
local cooldownRemaining, cooldownDuration = GetCollectibleCooldownAndDuration(MementoBar.CountDown.CollectibleId)
+
if cooldownRemaining > 0 then
MementoBar:UpdateLabel(cooldownRemaining)
elseif (cooldownDuration > 0 and (GetTimeStamp() < (MementoBar.CountDown.StartTime + math.floor(cooldownDuration / 1000)))) then
@@ -190,8 +218,10 @@ function MementoBar:UpdateLabel(remaining)
if type(remaining) == "number" and remaining > 0 then
remaining = string.format("%.1fs", (math.floor(remaining / 100) / 10))
end
+
for collectibleId in pairs(MementoBar.Saved.SelectedMementos) do
local buttonTimer = GetControl(MementoBar.Buttons[collectibleId], "Timer")
+
if buttonTimer and MementoBar.Mementos[collectibleId] then
buttonTimer:SetText(remaining)
end
diff --git a/MementoBar_Constants.lua b/MementoBar_Constants.lua
index 880db7e..3e2c873 100644
--- a/MementoBar_Constants.lua
+++ b/MementoBar_Constants.lua
@@ -11,7 +11,7 @@ MementoBar = {}
MementoBar.Addon = {
Name = "MementoBar",
DisplayName = "Memento bar",
- Version = 1.5,
+ Version = 1.6,
MinorVersion = 0,
SlashCommand = "/mb",
Author = "Jarth",
@@ -28,8 +28,10 @@ MementoBar.Default = {
HighlightColor = {r = 0.9, g = 0.9, b = 0.9, a = 0.9},
FontColor = {r = 0.9, g = 0.9, b = 0.9, a = 0.9},
UseAccountSettings = true,
- HideBarInMenu = true,
Horizontal = true,
+ ShowBarInMenu = false,
+ ShowBarOnHud = true,
+ ShowBarOnHudUI = true,
Margin = 2,
Height = 60,
Width = 60,
@@ -44,7 +46,11 @@ MementoBar.Default = {
[5] = 0
},
KeyBindingLocation = BOTTOM,
- ShowKeyBinding = true
+ ShowKeyBinding = true,
+ IsAudioEnabled = true,
+ IsTimerEnabled = true,
+ TimerFontColor = {r = 0.9, g = 0.9, b = 0.9, a = 0.9},
+ TimerFont = "ZoFontHeader2"
}
MementoBar.Mementos = {}
MementoBar.OrderedMementos = {}
@@ -52,7 +58,27 @@ MementoBar.Global = {
IsMoveEnabled = false,
TopLevelIndex = 7,
ReverseKeyBindings = {},
- ChoisesKeyBindingLocation = {"bottom","bottomleft","bottomright","center","left","right","top","topleft","topright"}
+ ChoisesKeyBindingLocation = {
+ "bottom",
+ "bottomleft",
+ "bottomright",
+ "center",
+ "left",
+ "right",
+ "top",
+ "topleft",
+ "topright"
+ },
+ TimerFonts = {
+ "ZoFontGameSmall",
+ "ZoFontGameLarge",
+ "ZoFontGameLargeBold",
+ "ZoFontGameLargeBoldShadow",
+ "ZoFontHeader",
+ "ZoFontHeader2",
+ "ZoFontHeader3",
+ "ZoFontHeader4"
+ }
}
MementoBar.Global.CategoryName,
diff --git a/MementoBar_Fragments.lua b/MementoBar_Fragments.lua
index e52d09e..befc98b 100644
--- a/MementoBar_Fragments.lua
+++ b/MementoBar_Fragments.lua
@@ -11,32 +11,46 @@ local MementoBar = MementoBar
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function MementoBar:SetFragmentBehaviour(menuOpen)
- if MementoBar.Fragment == nil then
- MementoBar.Fragment = ZO_HUDFadeSceneFragment:New(MementoBar_Frame)
+function MementoBar:SetFragmentBehaviour()
+ local base = MementoBar
+ local frame = MementoBar_Frame
+ local saved = base.Saved
+ local fragment = base.Fragment
+ local currentScene = SCENE_MANAGER:GetCurrentScene()
+ local frameIsHidden = true
+
+ if fragment == nil then
+ base.Fragment = ZO_HUDFadeSceneFragment:New(frame)
+ fragment = base.Fragment
end
- if MementoBar.Saved.HideBarInMenu then
- MementoBar:AddControlToFrame(menuOpen)
+ if saved.ShowBarInMenu then
+ SCENE_MANAGER:GetScene("gameMenuInGame"):AddFragment(fragment)
+
+ -- Case where the user changes visibility in the settings
+ if currentScene ~= nil and currentScene:GetName() == "gameMenuInGame" then
+ frameIsHidden = false
+ end
else
- MementoBar:RemoveControlToFrame(menuOpen)
+ SCENE_MANAGER:GetScene("gameMenuInGame"):RemoveFragment(fragment)
end
-end
-function MementoBar:AddControlToFrame(menuOpen)
- if menuOpen then
- MementoBar_Frame:SetHidden(true)
- end
+ if saved.ShowBarOnHud then
+ HUD_SCENE:AddFragment(fragment)
- SCENE_MANAGER:GetScene("hud"):AddFragment(MementoBar.Fragment)
- SCENE_MANAGER:GetScene("hudui"):AddFragment(MementoBar.Fragment)
-end
+ -- Case when landing on a scene, before a transition
+ if currentScene == nil then
+ frameIsHidden = false
+ end
+ else
+ HUD_SCENE:RemoveFragment(fragment)
+ end
-function MementoBar:RemoveControlToFrame(menuOpen)
- if menuOpen then
- MementoBar_Frame:SetHidden(false)
+ if saved.ShowBarOnHudUI then
+ HUD_UI_SCENE:AddFragment(fragment)
+ else
+ HUD_UI_SCENE:RemoveFragment(fragment)
end
- SCENE_MANAGER:GetScene("hud"):RemoveFragment(MementoBar.Fragment)
- SCENE_MANAGER:GetScene("hudui"):RemoveFragment(MementoBar.Fragment)
+ frame:SetHidden(frameIsHidden)
end
diff --git a/MementoBar_Hotkeys.lua b/MementoBar_Hotkeys.lua
index 510755c..0381801 100644
--- a/MementoBar_Hotkeys.lua
+++ b/MementoBar_Hotkeys.lua
@@ -13,6 +13,7 @@ local MementoBar = MementoBar
-------------------------------------------------------------------------------------------------
function MementoBar_KeyBindingPressed(keyId)
local control = MementoBar.WM:GetMouseOverControl()
+
if control ~= nil then
for collectibleId, _ in pairs(MementoBar.Saved.SelectedMementos) do
if MementoBar.Buttons[collectibleId] == control then
@@ -39,6 +40,7 @@ end
function MementoBar:HotkeyUpdate(newKeyId, newCollectibleId)
MementoBar.Global.ReverseKeyBindings = {}
+
for keyId, collectibleId in ipairs(MementoBar.Saved.KeyBindings) do
if newCollectibleId and newKeyId == keyId then
MementoBar.Saved.KeyBindings[keyId] = newCollectibleId
@@ -56,6 +58,7 @@ end
function MementoBar:HoykeyGetKey(button, collectibleId)
local result = ""
local keyId = MementoBar.Global.ReverseKeyBindings[collectibleId]
+
if keyId then
local keyBindingTable = {GetHighestPriorityActionBindingInfoFromName("MementoBar_" .. keyId)}
for _, keyValue in pairs(keyBindingTable) do
@@ -64,6 +67,7 @@ function MementoBar:HoykeyGetKey(button, collectibleId)
end
end
end
+
return result
end
@@ -75,16 +79,19 @@ function MementoBar:HotkeyGetKeyName(result, keyValue)
result = GetKeyName(keyValue)
end
end
+
return result
end
function MementoBar:HotkeyUpdateColor(frame)
local fontColor = MementoBar.Saved.FontColor
+
frame:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
end
function MementoBar:HotKeyGetLocationValue(value)
local result
+
if value == "bottom" then
result = BOTTOM
elseif value == "bottomleft" then
@@ -104,11 +111,13 @@ function MementoBar:HotKeyGetLocationValue(value)
elseif value == "topright" then
result = TOPRIGHT
end
+
return result
end
function MementoBar:HotKeyGetLocationText(value)
local result
+
if value == BOTTOM then
result = "bottom"
elseif value == BOTTOMLEFT then
@@ -128,5 +137,6 @@ function MementoBar:HotKeyGetLocationText(value)
elseif value == TOPRIGHT then
result = "topright"
end
+
return result
end
diff --git a/MementoBar_Menu.lua b/MementoBar_Menu.lua
index 3af10f4..9270ec8 100644
--- a/MementoBar_Menu.lua
+++ b/MementoBar_Menu.lua
@@ -35,7 +35,7 @@ function MementoBar:CreateSettingsWindow()
},
[2] = {
type = "description",
- text = string.format("Here you can adjust the %s works.\nSlash command: %s", MementoBar.Addon.DisplayName, MementoBar.Addon.SlashCommand)
+ text = string.format("Here you can setup %s.\nSlash command: %s", MementoBar.Addon.DisplayName, MementoBar.Addon.SlashCommand)
},
[3] = {
type = "checkbox",
@@ -57,53 +57,43 @@ function MementoBar:CreateSettingsWindow()
end
},
[4] = {
- type = "checkbox",
- name = "Bar orientation horizontal",
- tooltip = "When ON the bar will orientate horizontally.",
- default = MementoBar.Default.Horizontal,
- getFunc = function()
- return MementoBar.Saved.Horizontal
- end,
- setFunc = function(newValue)
- MementoBar.Saved.Horizontal = newValue
- MementoBar:RestorePanel()
- end
+ type = "submenu",
+ name = MementoBar.Global.CategoryName .. " (Total: " .. MementoBar.Global.CategoryTotal .. " Unlocked: " .. MementoBar.Global.CategoryNumUnlocked .. ")",
+ tooltip = "Choose what memento's you want on the bar.",
+ controls = {
+ [1] = {
+ type = "slider",
+ name = "Choose bar depth (number of rows/columns)", -- or string id or function returning a string
+ default = MementoBar.Default.BarDepth,
+ getFunc = function()
+ return MementoBar.Saved.BarDepth
+ end,
+ setFunc = function(value)
+ MementoBar.Saved.BarDepth = value
+ MementoBar:RestorePanel()
+ end,
+ min = 1,
+ max = MementoBar.Global.CategoryNumUnlocked
+ },
+ [2] = {
+ type = "description",
+ text = "Choose what memento's you want enabled."
+ }
+ }
},
[5] = {
- type = "checkbox",
- name = "Hide bar in menu",
- tooltip = "When ON the bar will hide when a menu is opened.",
- default = MementoBar.Default.HideBarInMenu,
- getFunc = function()
- return MementoBar.Saved.HideBarInMenu
- end,
- setFunc = function(newValue)
- MementoBar.Saved.HideBarInMenu = newValue
- MementoBar:SetFragmentBehaviour(true)
- end
- },
- [6] = {
type = "submenu",
name = "Position and size",
- tooltip = "Settings regarding position and size.",
+ tooltip = "Setup position and size.",
controls = {
[1] = {
+ type = "description",
+ text = "Here you can setup position and size \n(Unlock to move the bar)."
+ },
+ [2] = {
type = "checkbox",
- name = "Show bar position",
+ name = "Unlock movement of bar",
tooltip = "When ON the bar will show the X,Y position of the top left corner, when the mouse enters and drags the panel around.",
- -- disabled = function()
- -- local count = 0
- -- if IsCollectibleUnlocked(267) and MementoBar.Saved.ShowAssistants[267] then
- -- count = count + 1
- -- end
- -- if IsCollectibleUnlocked(300) and MementoBar.Saved.ShowAssistants[300] then
- -- count = count + 1
- -- end
- -- if IsCollectibleUnlocked(301) and MementoBar.Saved.ShowAssistants[301] then
- -- count = count + 1
- -- end
- -- return count == 0
- -- end,
default = function()
return MementoBar.Global.IsMoveEnabled
end,
@@ -115,7 +105,20 @@ function MementoBar:CreateSettingsWindow()
MementoBar:RestorePanel()
end
},
- [2] = {
+ [3] = {
+ type = "checkbox",
+ name = "Bar orientation horizontal",
+ tooltip = "When ON the bar will orientate horizontally.",
+ default = MementoBar.Default.Horizontal,
+ getFunc = function()
+ return MementoBar.Saved.Horizontal
+ end,
+ setFunc = function(newValue)
+ MementoBar.Saved.Horizontal = newValue
+ MementoBar:RestorePanel()
+ end
+ },
+ [4] = {
type = "slider",
name = "Choose button margin",
default = MementoBar.Default.Margin,
@@ -129,7 +132,7 @@ function MementoBar:CreateSettingsWindow()
min = 1,
max = 50
},
- [3] = {
+ [5] = {
type = "slider",
name = "Choose button height",
default = MementoBar.Default.Height,
@@ -143,7 +146,7 @@ function MementoBar:CreateSettingsWindow()
min = 1,
max = 100
},
- [4] = {
+ [6] = {
type = "slider",
name = "Choose button width",
default = MementoBar.Default.Width,
@@ -157,7 +160,7 @@ function MementoBar:CreateSettingsWindow()
min = 1,
max = 100
},
- [5] = {
+ [7] = {
type = "slider",
name = "Choose snap size when moving",
default = MementoBar.Default.SnapSize,
@@ -171,10 +174,10 @@ function MementoBar:CreateSettingsWindow()
min = 1,
max = 10
},
- [6] = {
+ [8] = {
type = "checkbox",
name = "Show hotkey's on bar",
- tooltip = "When ON the bar will hide when a menu is opened.",
+ tooltip = "When ON the hotkey's will be shown on the bar.",
default = MementoBar.Default.ShowKeyBinding,
getFunc = function()
return MementoBar.Saved.ShowKeyBinding
@@ -185,7 +188,7 @@ function MementoBar:CreateSettingsWindow()
end,
width = "half"
},
- [7] = {
+ [9] = {
type = "dropdown",
name = "Hotkey label location",
tooltip = "Select hotkey label location",
@@ -202,39 +205,25 @@ function MementoBar:CreateSettingsWindow()
MementoBar:RestorePanel()
end,
width = "half"
- },
- [8] = {
- type = "colorpicker",
- name = "Font Color",
- default = MementoBar.Default.FontColor,
- tooltip = "Changes of the move frame font.",
- getFunc = function()
- return MementoBar.Saved.FontColor.r, MementoBar.Saved.FontColor.g, MementoBar.Saved.FontColor.b, MementoBar.Saved.FontColor.a
- end,
- setFunc = function(r, g, b, a)
- MementoBar.Saved.FontColor = {r = r, g = g, b = b, a = a}
- MementoBar:RestorePanel()
- end,
- width = "half"
}
}
},
- [7] = {
+ [6] = {
type = "submenu",
name = "Colors",
- tooltip = "Allows you to change colors.",
+ tooltip = "Setup button and frame font colors.",
controls = {
[1] = {
type = "description",
- text = "Here you can adjust the colors."
+ text = "Here you can setup the button and frame font colors."
},
[2] = {
type = "colorpicker",
name = "Button background Color",
+ tooltip = "Changes the background color of the buttons.",
default = function()
return MementoBar.Default.CenterColor
end,
- tooltip = "Changes the background color of the buttons.",
getFunc = function()
return MementoBar.Saved.CenterColor.r, MementoBar.Saved.CenterColor.g, MementoBar.Saved.CenterColor.b, MementoBar.Saved.CenterColor.a
end,
@@ -247,10 +236,10 @@ function MementoBar:CreateSettingsWindow()
[3] = {
type = "colorpicker",
name = "Button edge Color",
+ tooltip = "Changes the edge color of the buttons.",
default = function()
return MementoBar.Default.EdgeColor
end,
- tooltip = "Changes the edgecolor of the buttons.",
getFunc = function()
return MementoBar.Saved.EdgeColor.r, MementoBar.Saved.EdgeColor.g, MementoBar.Saved.EdgeColor.b, MementoBar.Saved.EdgeColor.a
end,
@@ -263,10 +252,10 @@ function MementoBar:CreateSettingsWindow()
[4] = {
type = "colorpicker",
name = "Button highlight Color",
+ tooltip = "Changes the highlight color of the buttons.",
default = function()
return MementoBar.Default.HighlightColor
end,
- tooltip = "Changes the highlight color of the buttons.",
getFunc = function()
return MementoBar.Saved.HighlightColor.r, MementoBar.Saved.HighlightColor.g, MementoBar.Saved.HighlightColor.b, MementoBar.Saved.HighlightColor.a
end,
@@ -275,31 +264,163 @@ function MementoBar:CreateSettingsWindow()
MementoBar:RestorePanel()
end,
width = "half"
+ },
+ [5] = {
+ type = "colorpicker",
+ name = "Frame font Color",
+ tooltip = "Changes of the frame font color.",
+ default = MementoBar.Default.FontColor,
+ getFunc = function()
+ return MementoBar.Saved.FontColor.r, MementoBar.Saved.FontColor.g, MementoBar.Saved.FontColor.b, MementoBar.Saved.FontColor.a
+ end,
+ setFunc = function(r, g, b, a)
+ MementoBar.Saved.FontColor = {r = r, g = g, b = b, a = a}
+ MementoBar:RestorePanel()
+ end,
+ width = "half"
+ }
+ }
+ },
+ [7] = {
+ type = "submenu",
+ name = "Audio",
+ tooltip = "Setup audio.",
+ controls = {
+ [1] = {
+ type = "description",
+ text = "Here you can setup the audio."
+ },
+ [2] = {
+ type = "checkbox",
+ name = "Play hover audio",
+ tooltip = "When ON hover events on the bar, will play audio.",
+ default = function()
+ return MementoBar.Saved.IsAudioEnabled
+ end,
+ getFunc = function()
+ return MementoBar.Saved.IsAudioEnabled
+ end,
+ setFunc = function(newValue)
+ MementoBar.Saved.IsAudioEnabled = newValue
+ end
}
}
},
[8] = {
type = "submenu",
- name = MementoBar.Global.CategoryName .. " (Total: " .. MementoBar.Global.CategoryTotal .. " Unlocked: " .. MementoBar.Global.CategoryNumUnlocked .. ")",
- tooltip = "Choose what memento's you want on the bar.",
+ name = "Cooldown",
+ tooltip = "Setup cooldown",
controls = {
[1] = {
- type = "slider",
- name = "Choose bar depth (number of rows/columns)", -- or string id or function returning a string
- default = MementoBar.Default.BarDepth,
+ type = "description",
+ text = "Here you can setup the cooldown"
+ },
+ [2] = {
+ type = "checkbox",
+ name = "Display cooldown",
+ tooltip = "When ON cooldown will be displayed.",
+ default = function()
+ return MementoBar.Saved.IsTimerEnabled
+ end,
getFunc = function()
- return MementoBar.Saved.BarDepth
+ return MementoBar.Saved.IsTimerEnabled
+ end,
+ setFunc = function(newValue)
+ MementoBar.Saved.IsTimerEnabled = newValue
+ MementoBar:RestoreButtons()
+ end
+ },
+ [3] = {
+ type = "colorpicker",
+ name = "Cooldown font color",
+ tooltip = "Changes of the cooldown font color.",
+ disabled = function()
+ return not MementoBar.Saved.IsTimerEnabled
+ end,
+ default = function()
+ return MementoBar.Default.TimerFontColor
+ end,
+ getFunc = function()
+ MementoBar:UpdateCooldownExampleText()
+ return MementoBar.Saved.TimerFontColor.r, MementoBar.Saved.TimerFontColor.g, MementoBar.Saved.TimerFontColor.b, MementoBar.Saved.TimerFontColor.a
+ end,
+ setFunc = function(r, g, b, a)
+ MementoBar.Saved.TimerFontColor = {r = r, g = g, b = b, a = a}
+ MementoBar:RestoreButtons()
+ MementoBar:UpdateCooldownExampleText()
+ end,
+ width = "half"
+ },
+ [4] = {
+ type = "dropdown",
+ name = "Cooldown font",
+ tooltip = "Select the cooldown font.",
+ choices = MementoBar.Global.TimerFonts,
+ disabled = function()
+ return not MementoBar.Saved.IsTimerEnabled
+ end,
+ default = MementoBar.Default.TimerFont,
+ getFunc = function()
+ MementoBar:UpdateCooldownExampleText()
+ return MementoBar.Saved.TimerFont
end,
setFunc = function(value)
- MementoBar.Saved.BarDepth = value
- MementoBar:RestorePanel()
+ MementoBar.Saved.TimerFont = value
+ MementoBar:RestoreButtons()
+ MementoBar:UpdateCooldownExampleText()
end,
- min = 1,
- max = MementoBar.Global.CategoryNumUnlocked
+ width = "half"
},
- [2] = {
+ [5] = {
type = "description",
- text = "Choose what memento's you want enabled."
+ title = "Example text: 20.9s\n(Update a value to see an example)",
+ reference = MementoBar.Addon.DisplayName .. "ExampleTextControl"
+ }
+ }
+ },
+ [9] = {
+ type = "submenu",
+ name = "Visibility",
+ tooltip = "Setup visibility",
+ controls = {
+ [1] = {
+ type = "checkbox",
+ name = "Show bar in menu",
+ tooltip = "When ON the bar will show when a menu is opened.",
+ default = MementoBar.Default.ShowBarInMenu,
+ getFunc = function()
+ return MementoBar.Saved.ShowBarInMenu
+ end,
+ setFunc = function(newValue)
+ MementoBar.Saved.ShowBarInMenu = newValue
+ MementoBar:SetFragmentBehaviour()
+ end
+ },
+ [2] = {
+ type = "checkbox",
+ name = "Show bar on hud",
+ tooltip = "When ON the bar will show the bar on the hud.",
+ default = MementoBar.Default.ShowBarOnHud,
+ getFunc = function()
+ return MementoBar.Saved.ShowBarOnHud
+ end,
+ setFunc = function(newValue)
+ MementoBar.Saved.ShowBarOnHud = newValue
+ MementoBar:SetFragmentBehaviour()
+ end
+ },
+ [3] = {
+ type = "checkbox",
+ name = "Show bar in hudui",
+ tooltip = "When ON the bar will show the bar on the hudui.",
+ default = MementoBar.Default.ShowBarOnHudUI,
+ getFunc = function()
+ return MementoBar.Saved.ShowBarOnHudUI
+ end,
+ setFunc = function(newValue)
+ MementoBar.Saved.ShowBarOnHudUI = newValue
+ MementoBar:SetFragmentBehaviour()
+ end
}
}
}
@@ -324,8 +445,22 @@ function MementoBar:CreateSettingsWindow()
MementoBar:RestorePanel()
end
}
- table.insert(optionsData[8].controls, index + 2, line)
+ table.insert(optionsData[4].controls, index + 2, line)
end
LAM2:RegisterOptionControls(MementoBar.Addon.Name, optionsData)
end
+
+function MementoBar:UpdateCooldownExampleText()
+ local control = GetControl(MementoBar.Addon.DisplayName .. "ExampleTextControl")
+ local fontColor = MementoBar.Saved.TimerFontColor
+
+ if control ~= nil and control.desc ~= nil then
+ control.desc:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
+ control.desc:SetFont(MementoBar.Saved.TimerFont)
+ end
+ if control ~= nil and control.title ~= nil then
+ control.title:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
+ control.title:SetFont(MementoBar.Saved.TimerFont)
+ end
+end
diff --git a/MementoBar_Move.lua b/MementoBar_Move.lua
index d114b6c..5f33bf3 100644
--- a/MementoBar_Move.lua
+++ b/MementoBar_Move.lua
@@ -15,6 +15,7 @@ local MementoBar = MementoBar
function MementoBar:UpdateMoveFrame()
local moveFrame = MementoBar.MoveFrame
local onMouseEnter, onMouseExit, onMouseDown, onMouseUp = nil, nil, nil, nil
+
if MementoBar.Global.IsMoveEnabled then
moveFrame = MementoBar:GetOrCreateMoveFrame()
onMouseEnter = MementoBar.MoveFrameOnEnter
@@ -46,6 +47,7 @@ function MementoBar:GetOrCreateMoveFrame(show)
if MementoBar.MoveFrame == nil then
local newMoveFrame = MementoBar.WM:CreateControlFromVirtual(nil, GuiRoot, "MementoBar_MoveFrame")
local targetFrame = MementoBar_Frame
+
--Variable is used to define what savedVariable the Frame refers to.
newMoveFrame.TargetFrame = targetFrame
@@ -115,7 +117,9 @@ end
function MementoBar.MoveFrameUpdateText(frame, position)
local labelTextTopLeft = ""
+
frame.labelCenter:SetText(string.format("%s,%s", frame:GetWidth(), frame:GetHeight()))
+
if (position) then
labelTextTopLeft = string.format("%s,%s", frame.TargetFrame:GetLeft(), frame.TargetFrame:GetTop())
end
@@ -142,6 +146,7 @@ function MementoBar.MoveFrameUpdateColor(frame)
local centerColor = MementoBar.Saved.CenterColor
local edgeColor = MementoBar.Saved.EdgeColor
local fontColor = MementoBar.Saved.FontColor
+
frame.overlay:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
frame.overlay:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
frame.labelCenter:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)