diff --git a/AutoInvite.lua b/AutoInvite.lua
index 7b7715b..75df7f1 100644
--- a/AutoInvite.lua
+++ b/AutoInvite.lua
@@ -251,6 +251,7 @@ AutoInvite.init = function()
autoKick = false,
kickDelay = 300,
watchStr = "",
+ showPanel = true,
}
AutoInvite.cfg = ZO_SavedVars:NewAccountWide("AutoInviteSettings", 1.0, "config", def)
EVENT_MANAGER:RegisterForEvent(AutoInvite.AddonId, EVENT_GROUP_MEMBER_LEFT, AutoInvite.playerLeave)
diff --git a/AutoInvite.txt b/AutoInvite.txt
index da0db49..392722e 100644
--- a/AutoInvite.txt
+++ b/AutoInvite.txt
@@ -1,6 +1,6 @@
## APIVersion: 100007
## Title: AutoInvite
-## Version: 1.4.0
+## Version: 1.5.0
## Author: Sasky
## SavedVariables: AutoInviteSettings
## OptionalDependsOn: LibAddonMenu-2.0
diff --git a/AutoInviteUI.lua b/AutoInviteUI.lua
index 97fbf13..d7bc5f1 100644
--- a/AutoInviteUI.lua
+++ b/AutoInviteUI.lua
@@ -20,8 +20,8 @@ local ui = AutoInviteUI
local wm = WINDOW_MANAGER
function AutoInviteUI.create()
- local pre = "AAAAutoInviteUI"
- ui.main = wm:CreateTopLevelWindow(pre .. "Panel")
+ local pre = "AutoInviteUI"
+ ui.main = wm:CreateControl(nil, ZO_GroupList, CT_CONTROL)
ui.main:SetAnchor(TOPRIGHT, ZO_SharedRightBackground, TOPLEFT, -50, 50)
ui.main:SetDimensions(280,450)
@@ -83,19 +83,6 @@ function AutoInviteUI.create()
})
ui.max:SetAnchor(TOPLEFT, ui.text, BOTTOMLEFT, 0, 10)
--- ui.expr = LAMCreateControl.header(ui, {
--- type = "header",
--- name = "Experimental",
--- width = "half"
--- })
--- ui.expr:SetAnchor(TOPLEFT, ui.max, TOPLEFT, 0, 65)
--- ui.expr:SetWidth(270)
--- ui.expr.divider:ClearAnchors()
--- ui.expr.divider:SetAnchor(BOTTOM)
--- ui.expr.header:ClearAnchors()
--- ui.expr.header:SetAnchor(TOPLEFT)
--- ui.expr.header:SetColor(1.0, 0.3, 0.3, 1.0)
-
ui.restart = LAMCreateControl.checkbox(ui, {
type = "checkbox",
name = "Restart",
@@ -150,21 +137,35 @@ function AutoInviteUI.create()
})
ui.note:SetAnchor(TOPLEFT, ui.kickTime, BOTTOMLEFT, 0, 25)
ui.note.desc:SetColor(.7,.7,.7,1)
-end
-function AutoInviteUI.menuShow()
- AutoInviteUI.showIfGroup()
- AutoInviteUI.refresh()
- EVENT_MANAGER:RegisterForUpdate("AutoInviteMenuCheck", 100, AutoInviteUI.showIfGroup)
+ ui.hide = wm:CreateControlFromVirtual(nil, ui.main, "ZO_DefaultButton")
+ ui.hide:SetAnchor(TOPRIGHT, ui.main, TOPRIGHT, 7, 2)
+ ui.hide:SetWidth(40)
+ ui.hide:SetText("X")
+ ui.hide:SetScale(0.8)
+ ui.hide:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
+ ui.hide:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
+ ui.hide:SetHandler("OnClicked", AutoInviteUI.menuHide)
+
+ ui.show = wm:CreateControlFromVirtual(nil, ZO_GroupList, "ZO_DefaultButton")
+ ui.show:SetAnchor(TOPLEFT, ZO_GroupList, TOPLEFT, 120, -40)
+ ui.show:SetWidth(160)
+ ui.show:SetText("AutoInvite Settings")
+ ui.show:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
+ ui.show:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
+ ui.show:SetHandler("OnClicked", AutoInviteUI.menuShow)
end
-function AutoInviteUI.showIfGroup()
- ui.main:SetHidden(ZO_GroupList:IsHidden())
+function AutoInviteUI.menuShow()
+ ui.main:SetHidden(false)
+ ui.show:SetHidden(true)
+ AutoInvite.cfg.showPanel = true
end
function AutoInviteUI.menuHide()
ui.main:SetHidden(true)
- EVENT_MANAGER:UnregisterForUpdate("AutoInviteMenuCheck")
+ ui.show:SetHidden(false)
+ AutoInvite.cfg.showPanel = false
end
function AutoInviteUI.refresh()
@@ -179,11 +180,11 @@ function AutoInviteUI.init()
if ui.created then return end
ui.created = true
AutoInviteUI.create()
- ui.main:SetHidden(true)
-
- --Register events
- EVENT_MANAGER:RegisterForEvent('AutoInvite', EVENT_ACTION_LAYER_POPPED, AutoInviteUI.menuHide)
- EVENT_MANAGER:RegisterForEvent('AutoInvite', EVENT_ACTION_LAYER_PUSHED, AutoInviteUI.menuShow)
+ if AutoInvite.cfg.showPanel then
+ ui.show:SetHidden(true)
+ else
+ ui.main:SetHidden(true)
+ end
end
SLASH_COMMANDS["/zzg"] = function()