diff --git a/modules/gui.lua b/modules/gui.lua index eb8f0679..69e1cc46 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -82,7 +82,7 @@ pfUI:RegisterModule("gui", function () pfUI.uf.player, pfUI.uf.target, pfUI.uf.targettarget, pfUI.uf.pet, pfUI.bars.shapeshift, pfUI.bars.bottomleft, pfUI.bars.bottomright, pfUI.bars.vertical, pfUI.bars.pet, pfUI.bars.bottom, - pfUI.panel.minimap, pfUI.panel.microbutton, + pfUI.panel.minimap, pfUI.panel.microbutton, pfUI.panel.clock.timerFrame, pfUI.uf.group[1], pfUI.uf.group[2], pfUI.uf.group[3], pfUI.uf.group[4], pfUI.uf.raid[1], pfUI.uf.raid[2], pfUI.uf.raid[3], pfUI.uf.raid[4], pfUI.uf.raid[5], pfUI.uf.raid[6], pfUI.uf.raid[7], pfUI.uf.raid[8], pfUI.uf.raid[9], pfUI.uf.raid[10], diff --git a/modules/panel.lua b/modules/panel.lua index c4e23d7e..d0cb9dba 100644 --- a/modules/panel.lua +++ b/modules/panel.lua @@ -41,11 +41,63 @@ pfUI:RegisterModule("panel", function () end) pfUI.panel.clock = CreateFrame("Frame",nil,UIParent) + + pfUI.panel.clock.timerFrame = CreateFrame("Frame", "pfUITimer", UIParent) + pfUI.panel.clock.timerFrame:Hide() + pfUI.panel.clock.timerFrame:SetWidth(120) + pfUI.panel.clock.timerFrame:SetHeight(35) + pfUI.panel.clock.timerFrame:SetPoint("TOP", 0, -100) + pfUI.utils:loadPosition(pfUI.panel.clock.timerFrame) + + pfUI.panel.clock.timerFrame.text = pfUI.panel.clock.timerFrame:CreateFontString("Status", "LOW", "GameFontNormal") + pfUI.panel.clock.timerFrame.text:SetFontObject(GameFontWhite) + pfUI.panel.clock.timerFrame.text:SetFont("Interface\\AddOns\\pfUI\\fonts\\" .. pfUI_config.global.font_default .. ".ttf", pfUI_config.global.font_size, "OUTLINE") + pfUI.panel.clock.timerFrame.text:SetAllPoints(pfUI.panel.clock.timerFrame) + + pfUI.panel.clock.timerFrame:SetScript("OnUpdate", function() + if not pfUI.panel.clock.timerFrame.Snapshot then pfUI.panel.clock.timerFrame.Snapshot = GetTime() end + pfUI.panel.clock.timerFrame.curTime = SecondsToTime(floor(GetTime() - pfUI.panel.clock.timerFrame.Snapshot)) + if pfUI.panel.clock.timerFrame.curTime ~= "" then + pfUI.panel.clock.timerFrame.text:SetText("|c33cccccc" .. pfUI.panel.clock.timerFrame.curTime) + else + pfUI.panel.clock.timerFrame.text:SetText("|cffff3333 --- NEW TIMER ---") + end + end) + pfUI.panel.clock:SetScript("OnUpdate",function(s,e) if not pfUI.panel.clock.tick then pfUI.panel.clock.tick = GetTime() - 1 end if GetTime() >= pfUI.panel.clock.tick + 1 then + -- time date + local tooltip = function () + local posX, posY = GetPlayerMapPosition("player") + local real = GetRealZoneText() + local sub = GetSubZoneText() + GameTooltip:ClearLines() + GameTooltip:SetOwner(this, "ANCHOR_NONE") + GameTooltip:AddLine("|cff555555Timer") + GameTooltip:AddDoubleLine("Left Click", "|cffffffffShow/Hide Timer") + GameTooltip:AddDoubleLine("Right Click", "|cffffffffReset Timer") + GameTooltip:Show() + end + + local click = function () + this:RegisterForClicks("LeftButtonUp", "RightButtonUp") + if arg1 == "LeftButton" then + if pfUI.panel.clock.timerFrame:IsShown() then + pfUI.panel.clock.timerFrame:Hide() + else + pfUI.panel.clock.timerFrame:Show() + end + elseif arg1 == "RightButton" then + pfUI.panel.clock.timerFrame.Snapshot = GetTime() + end + + end + pfUI.panel.clock.tick = GetTime() - pfUI.panel:OutputPanel("time", date("%H:%M:%S")) + pfUI.panel:OutputPanel("time", date("%H:%M:%S"), tooltip, click) + + -- lag fps local _, _, lag = GetNetStats() local fps = floor(GetFramerate()) pfUI.panel:OutputPanel("fps", floor(GetFramerate()) .. " fps & " .. lag .. " ms")