local _, addon = ... local SpeechFrame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate") SpeechFrame:Hide() addon.SpeechFrame = SpeechFrame function SpeechFrame:Init() local frame = self frame:SetHeight(50) frame:SetMovable(true) frame:EnableMouse(true) frame:RegisterForDrag("LeftButton") frame:SetScript("OnDragStart", function() frame:StartMoving() end) frame:SetScript("OnDragStop", function(self) frame:StopMovingOrSizing() local finalLeft = self:GetLeft() local finalBottom = self:GetBottom() CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_X = math.floor(finalLeft) CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_Y = math.floor(finalBottom) end) frame:UpdateSettings() end function SpeechFrame:UpdateSettings() self:SetWidth(CzechQuestsAddon_Store.config.SPEECH_FRAME_WIDTH) -- Set position self:SetPoint( "BOTTOMLEFT", UIParent, "BOTTOMLEFT", CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_X, CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_Y ) end function SpeechFrame:CreateMessage(message) local frame = self local MessageFrame = CreateFrame("Frame", nil, frame) MessageFrame:SetSize(frame:GetWidth(), 1) MessageFrame.Message = addon.API.CreateCzechFont( MessageFrame, CzechQuestsAddon_Store.config.SPEECH_TEXT_FONT_NAME, CzechQuestsAddon_Store.config.SPEECH_TEXT_FONT_SIZE, "THICK" ) MessageFrame.Message:SetTextColor(1, 1, 1) MessageFrame.Message:SetPoint("TOPLEFT", MessageFrame, "TOPLEFT", 5, -5) MessageFrame.Message:SetPoint("BOTTOMRIGHT", MessageFrame, "BOTTOMRIGHT", -5, 5) -- Create Texture MessageFrame.Texture = MessageFrame:CreateTexture(nil, "ARTWORK") MessageFrame.Texture:SetTexture("Interface\\Buttons\\WHITE8x8") MessageFrame.Texture:SetVertexColor(0, 0, 0, CzechQuestsAddon_Store.config.SPEECH_MESSAGE_TEXTURE_ALPHA / 100) MessageFrame.Texture:SetPoint("TOPLEFT", MessageFrame ,"TOPLEFT", 0, 0) MessageFrame.Texture:SetPoint("BOTTOMRIGHT", MessageFrame ,"BOTTOMRIGHT", 0, 0) MessageFrame.Message:SetText(message) MessageFrame:SetHeight(MessageFrame.Message:GetHeight() + 10) return MessageFrame end