Skip to content

Commit

Permalink
1.0.8
Browse files Browse the repository at this point in the history
Added Confirmation window when removing player.
  • Loading branch information
Limmek committed Dec 20, 2019
1 parent 79192d0 commit ad53d0c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -42,5 +42,5 @@ luac.out
#Skip Release
.release
/.release/
classictag.sh
luacheck.sh
pushtag.sh
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
CHANGELOG

###### 1.0.8
- Added confirmation window when removing player.
- UI improvements.

###### 1.0.7
- Updated for 1.13.3
- Settings Enable/Disable Menu icon
Expand Down
44 changes: 31 additions & 13 deletions Shitlist/Shitlist.lua
Expand Up @@ -52,21 +52,21 @@ Shitlist:SetScript("OnEvent", function(self, event)
if _G.ShitlistDB["MenuOptions"] ~= nil then
config.MenuOptions = _G.ShitlistDB["MenuOptions"]
end

-- Set global settings values
SettingsTooltipTitleEditBox:SetText(config.TooltipTitle)
SettingsTooltipTitleEditBox:SetCursorPosition(0)

UIDropDownMenu_Initialize(SettingsTooltipTitleColorDropDown, initializeColors)
UIDropDownMenu_SetSelectedID(SettingsTooltipTitleColorDropDown, config.TooltipTitleColorID)

SettingsSoundCheckBox:SetChecked(config.AlertEnable)
SettingsSoundEditBox:SetText(config.IgnoreTime)
SettingsSoundEditBox:SetCursorPosition(0)

UIDropDownMenu_Initialize(SettingsSoundDropDown, initializeSounds)
UIDropDownMenu_SetSelectedID(SettingsSoundDropDown, config.SoundID)

SettingsPartyCheckBox:SetChecked(config.PartyAlertEnable)
SettingsPartyEditBox:SetText(config.PartyIgnoreTime)
SettingsPartyEditBox:SetCursorPosition(0)
Expand Down Expand Up @@ -116,13 +116,13 @@ function ShowPlayerTooltip(self)
if config.ListedPlayers[name] and type(next(config.ListedPlayers)) ~= "nil" then
self:AddLine(config.TooltipTitle, config.Colors[config.TooltipTitleColor].red, config.Colors[config.TooltipTitleColor].green, config.Colors[config.TooltipTitleColor].blue, true)
for i,value in ipairs(config.ListedPlayers[name]) do
if i == 1 then
if i == 1 then
self:AddLine(value, config.Colors[config.ReasonColor].red, config.Colors[config.ReasonColor].green, config.Colors[config.ReasonColor].blue, true)
else
self:AddLine(value, config.Colors[config.DefaultColor].red, config.Colors[config.DefaultColor].green, config.Colors[config.DefaultColor].blue, true)
end
end

-- Play sound efect
if config.AlertEnable and time() >= config.Start and config.AlertLastSentName ~= name then
--PlaySound(8959, "Master", forceNoDuplicates, runFinishCallback)
Expand Down Expand Up @@ -153,11 +153,29 @@ function ShitlistDropdownMenuButtonKlick(self)
if not config.ListedPlayers[name] then
Shitlist:Toggle()
else
print("Removed " .. name)
config.ListedPlayers[name] = nil
StaticPopupDialogs["CONFIRM_REMOVE_PLAYER"] = {
text = "Do you want to remove ".. name .."?",
button1 = "Yes",
button2 = "No",
OnAccept = function()
Remove_Player_Confirmation(name)
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3, -- avoid some UI taint, see http://www.wowace.com/announcements/how-to-avoid-some-ui-taint/
}
if name ~= nil and config.ListedPlayers[name] then
StaticPopup_Show ("CONFIRM_REMOVE_PLAYER")
end
end
end

function Remove_Player_Confirmation(name)
print("Removed " .. name)
config.ListedPlayers[name] = nil
end

function ShitlistDropdownMenuButton(name)
local info = UIDropDownMenu_CreateInfo()
info.owner = which
Expand Down Expand Up @@ -206,7 +224,7 @@ function Shitlist:CreateUI()
edgeSize = 16,
insets = { left = 8, right = 6, top = 8, bottom = 8 },
})
shitlistUI:SetBackdropBorderColor(getConfigColors("Light_Blue")) -- darkblue
shitlistUI:SetBackdropBorderColor(config.getConfigColors("White"))
shitlistUI:SetMovable(true)
shitlistUI:EnableMouse(true)
shitlistUI:RegisterForDrag("LeftButton")
Expand All @@ -217,14 +235,14 @@ function Shitlist:CreateUI()
--title:SetFontObject("GameFontHighlight")
title:SetPoint("CENTER", shitlistUI, "TOP", 0, -20)
title:SetFont("Interface\\AddOns\\Shitlist\\Fonts\\Inconsolata-Bold.ttf", 12)
title:SetTextColor(getConfigColors("White"))
title:SetTextColor(config.getConfigColors("White"))
title:SetText("Add new player notice")

-- Title
playerText = shitlistUI:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
playerText:SetPoint("TOP", shitlistUI, 0, -35)
playerText:SetFont("Interface\\AddOns\\Shitlist\\Fonts\\Inconsolata-Bold.ttf", 16)
playerText:SetTextColor(getConfigColors("Gold"))
playerText:SetTextColor(config.getConfigColors("Gold"))
playerText:SetText(name)

-- Reasons drop-down menu
Expand Down Expand Up @@ -259,11 +277,11 @@ function Shitlist:CreateUI()
noticeEditBox:SetTextInsets(4, 0, 0, 0)
noticeEditBox:SetBackdrop({
bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile="Interface\\PVPFrame\\UI-Character-PVP-Highlight",
edgeFile="Interface\\PVPFrame\\UI-Character-PVP-Highlight",
tile = false, tileSize = 0, edgeSize = 8,
insets = { left = 2, right = 2, top = 2, bottom = 2 }
})
noticeEditBox:SetBackdropBorderColor(getConfigColors("Light_Blue"))
noticeEditBox:SetBackdropBorderColor(config.getConfigColors("White"))
noticeEditBox:SetMultiLine(false)
noticeEditBox:SetMaxLetters(255)
noticeEditBox:SetAutoFocus(false) -- dont automatically focus
Expand Down

0 comments on commit ad53d0c

Please sign in to comment.