ZoneWatcher:RegisterEvent("ZONE_CHANGED_NEW_AREA") |
ZoneWatcher:SetScript("OnEvent", ZoneCheck) |
|
local frame = CreateFrame("Frame","DeathNoteFrame") |
frame:Hide() |
frame:SetBackdrop(GameTooltip:GetBackdrop()) |
frame:SetBackdropColor(0,0,0) |
frame:SetBackdropBorderColor(0.2,0.2,0.2) |
frame:SetWidth(240) |
frame:SetHeight(155) |
frame:SetPoint("CENTER",0,0) |
tinsert(UISpecialFrames,"DeathNoteFrame") |
|
local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
title:SetPoint("TOPLEFT", 10, -10) |
title:SetText("DeathNote") |
|
local subtitle1 = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") |
subtitle1:SetPoint("TOPLEFT", title, "TOPLEFT", 10, -20) |
subtitle1:SetText("Who to add?") |
|
local editbox1 = CreateFrame('EditBox', "DeathNoteEditbox1", frame) |
editbox1:Show() |
editbox1:SetAutoFocus(false) |
editbox1:SetHeight(32) |
editbox1:SetWidth(200) |
editbox1:SetFontObject('GameFontHighlightSmall') |
editbox1:SetPoint("TOPLEFT",subtitle1,"TOPLEFT",0,-8) |
|
local left = editbox1:CreateTexture(nil, "BACKGROUND") |
left:SetWidth(8) left:SetHeight(20) |
left:SetPoint("LEFT", -5, 0) |
left:SetTexture("Interface\\Common\\Common-Input-Border") |
left:SetTexCoord(0, 0.0625, 0, 0.625) |
|
local right = editbox1:CreateTexture(nil, "BACKGROUND") |
right:SetWidth(8) right:SetHeight(20) |
right:SetPoint("RIGHT", 0, 0) |
right:SetTexture("Interface\\Common\\Common-Input-Border") |
right:SetTexCoord(0.9375, 1, 0, 0.625) |
|
local center = editbox1:CreateTexture(nil, "BACKGROUND") |
center:SetHeight(20) |
center:SetPoint("RIGHT", right, "LEFT", 0, 0) |
center:SetPoint("LEFT", left, "RIGHT", 0, 0) |
center:SetTexture("Interface\\Common\\Common-Input-Border") |
center:SetTexCoord(0.0625, 0.9375, 0, 0.625) |
|
editbox1:SetScript("OnShow", function(self) |
self:SetText("") |
end) |
editbox1:SetScript("OnEnterPressed", function(self) |
self:ClearFocus() |
self:HighlightText(0,0) |
DeathNoteEditbox2:SetFocus() |
DeathNoteEditbox2:HighlightText() |
end) |
editbox1:SetScript("OnEscapePressed", editbox1.ClearFocus) |
editbox1:SetScript("OnEditFocusLost", function(self) |
self:ClearFocus() |
self:HighlightText(0,0) |
end) |
editbox1:SetScript("OnEditFocusGained", function(self) |
self:HighlightText() |
end) |
|
local subtitle2 = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") |
subtitle2:SetPoint("TOPLEFT", editbox1, "TOPLEFT", 0, -40) |
subtitle2:SetText("Reason for adding?") |
|
local editbox2 = CreateFrame('EditBox', "DeathNoteEditbox2", frame) |
editbox2:Show() |
editbox2:SetAutoFocus(false) |
editbox2:SetHeight(32) |
editbox2:SetWidth(200) |
editbox2:SetFontObject('GameFontHighlightSmall') |
editbox2:SetPoint("TOPLEFT",subtitle2,"TOPLEFT",0,-8) |
|
local left = editbox2:CreateTexture(nil, "BACKGROUND") |
left:SetWidth(8) left:SetHeight(20) |
left:SetPoint("LEFT", -5, 0) |
left:SetTexture("Interface\\Common\\Common-Input-Border") |
left:SetTexCoord(0, 0.0625, 0, 0.625) |
|
local right = editbox2:CreateTexture(nil, "BACKGROUND") |
right:SetWidth(8) right:SetHeight(20) |
right:SetPoint("RIGHT", 0, 0) |
right:SetTexture("Interface\\Common\\Common-Input-Border") |
right:SetTexCoord(0.9375, 1, 0, 0.625) |
|
local center = editbox2:CreateTexture(nil, "BACKGROUND") |
center:SetHeight(20) |
center:SetPoint("RIGHT", right, "LEFT", 0, 0) |
center:SetPoint("LEFT", left, "RIGHT", 0, 0) |
center:SetTexture("Interface\\Common\\Common-Input-Border") |
center:SetTexCoord(0.0625, 0.9375, 0, 0.625) |
|
editbox2:SetScript("OnShow", function(self) |
self:SetText("") |
end) |
editbox2:SetScript("OnEnterPressed", function(self) |
self:ClearFocus() |
self:HighlightText(0,0) |
DeathNoteOkay:Click() |
end) |
editbox2:SetScript("OnEscapePressed", editbox2.ClearFocus) |
editbox2:SetScript("OnEditFocusLost", function(self) |
self:ClearFocus() |
self:HighlightText(0,0) |
end) |
editbox2:SetScript("OnEditFocusGained", function(self) |
self:HighlightText() |
end) |
|
local button = CreateFrame("Button", "DeathNoteClose", frame, "UIPanelCloseButton") |
button:SetHeight(25) |
button:SetWidth(25) |
button:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0) |
button:SetScript("OnClick", function() |
frame:Hide() |
end) |
|
local butt = CreateFrame("Button", "DeathNoteOkay", frame) |
butt:SetWidth(80) butt:SetHeight(22) |
butt:SetDisabledFontObject(GameFontDisable) |
butt:SetHighlightFontObject(GameFontHighlight) |
butt:SetNormalFontObject(GameFontNormal) |
|
-- Textures -- |
butt:SetNormalTexture("Interface\\Buttons\\UI-Panel-Button-Up") |
butt:SetPushedTexture("Interface\\Buttons\\UI-Panel-Button-Down") |
butt:SetHighlightTexture("Interface\\Buttons\\UI-Panel-Button-Highlight") |
butt:SetDisabledTexture("Interface\\Buttons\\UI-Panel-Button-Disabled") |
butt:GetNormalTexture():SetTexCoord(0, 0.625, 0, 0.6875) |
butt:GetPushedTexture():SetTexCoord(0, 0.625, 0, 0.6875) |
butt:GetHighlightTexture():SetTexCoord(0, 0.625, 0, 0.6875) |
butt:GetDisabledTexture():SetTexCoord(0, 0.625, 0, 0.6875) |
butt:GetHighlightTexture():SetBlendMode("ADD") |
butt:SetText("Okay") |
butt:SetPoint("BOTTOM","DeathNoteFrame","BOTTOM",0,10) |
butt:SetScript("OnClick", function() |
local okay1,okay2 |
if DeathNoteEditbox1:GetText() == "" or DeathNoteEditbox1:GetText() == "You need to add a name!" then |
DeathNoteEditbox1:SetText("You need to add a name!") |
DeathNoteEditbox1:HighlightText() |
else |
okay1 = true |
end |
if DeathNoteEditbox2:GetText() == "" or DeathNoteEditbox2:GetText() == "You need to add a comment!" then |
DeathNoteEditbox2:SetText("You need to add a comment!") |
DeathNoteEditbox2:HighlightText() |
else |
okay2 = true |
end |
if okay1 and okay2 then |
frame:Hide() |
end |
end) |
|
--[[ |
local deathnote_note,deathnote_target |
StaticPopupDialogs["DEATHNOTE_TARGET"] = { |
hasEditBox = 1, |
maxLetters = 50, |
whileDead = 1, |
timeout = 0, |
text = "What's the name of the target?", |
hideOnEscape = 1, |
exclusive = 1, |
text = "Name:", |
button1 = "Set", |
button2 = "Cancel", |
exclusive = 1, |
OnShow = function() |
getglobal(this:GetName().."EditBox"):SetText("") |
getglobal(this:GetName().."EditBox"):SetFocus() |
OnShow = function(self) |
self.editBox:SetText("") |
self.editBox:SetFocus(); |
end, |
OnAccept = function() |
deathnote_target = getglobal(this:GetParent():GetName().."EditBox"):GetText() |
OnAccept = function(self) |
if not self.editBox:GetText() or self.editBox:GetText() == "" then |
return |
else |
deathnote_target = self.editBox:GetText() |
StaticPopup_Show("DEATHNOTE_NOTE") |
end |
end, |
OnCancel = function() |
this:GetParent():Hide() |
EditBoxOnEnterPressed = function(self) |
local parent = self:GetParent() |
if not parent.editBox:GetText() or parent.editBox:GetText() == "" then |
return |
else |
deathnote_target = parent.editBox:GetText() |
StaticPopup_Show("DEATHNOTE_NOTE") |
end |
end, |
EditBoxOnEnterPressed = function() |
StaticPopupDialogs["DEATHNOTE_TARGET"].OnAccept() |
this:GetParent():Hide() |
StaticPopup_Show("DEATHNOTE_NOTE") |
|
EditBoxOnEscapePressed = function(self) |
self:GetParent():Hide() |
end, |
EditBoxOnEscapePressed = function() |
StaticPopupDialogs["DEATHNOTE_TARGET"].OnCancel() |
end, |
}; |
|
StaticPopupDialogs["DEATHNOTE_NOTE"] = { |