Mercurial > wow > buffalo2
view TimeManager/TimeManager.lua @ 54:ed74c5cabe98
Core
- updated comment notes
Objectives
- force hide blocks when their tracker is hidden
Clock
- convert clock into its own module
- display zone coordinates alongside time
author | Nenue |
---|---|
date | Wed, 01 Jun 2016 20:48:14 -0400 |
parents | 1a322b92dbfa |
children | dd9b5f59632c |
line wrap: on
line source
-------------------------------------------- -- Veneer -- Clock/Coordinate multi-tool -- mouseover reveals coordinates by map yards, right-click toggles display -- Krakyn -- @project-revision@ @project-hash@ -- @file-revision@ @file-hash@ -- Created: 4/27/2016 1:02 AM -------------------------------------------- local B = select(2,...).frame local _G = _G local clock = B:RegisterModule("Clock", _G.VeneerClock) local print = B.print('XML') -- debug hook -- weekday abbreviations used in display local weekDays = {'Su', 'M', 'T', 'W', 'R' ,'F', 'Sa' } -- runs when visible clock.OnUpdate = function(self) local weekday, month, day, year = _G.CalendarGetDate() local hour, min = _G.GetGameTime() if hour > 12 then hour = hour - 12 end local posFunc, posF = _G.GetPlayerMapPosition, 100 local posFormat = "|cFF00FFFF%0.1f %0.1f|r" if self:IsMouseOver() then posFunc = _G.UnitPosition posFormat = "|cFFFFFF00%d %d|r" posF = 1 end local posX, posY = posFunc('player') self.time:SetFormattedText(posFormat.. " |cAAFFFFFF%s|r |cFF44FFFF%s|r|c88FFFFFF/|r|cFF44FFFF%s|r %d:%02d", posX * posF, posY * posF, weekDays[weekday], month, day, hour, min) end -- hide/show toggler clock.OnMouseUp = function(self, button) if button == 'RightButton' then if self:IsVisible() then self:Hide() else self:Show() end end end -- runs once per login function clock:OnInitialize() print('clock thing') self:Show() end -- runs once per ui load clock.OnEnable = function(self) self:SetParent(_G.UIParent) self:SetPoint('TOPRIGHT', _G.UIParent, 'TOPRIGHT', -100, -2) self:SetScript('OnUpdate', clock.OnUpdate) self:Show() self.time:SetText('Clock stuff') end