comparison TimeManager/TimeManager.lua @ 55:dd9b5f59632c v1.0a-release

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 Fri, 10 Jun 2016 20:52:27 -0400
parents ed74c5cabe98
children 07ef62fe201f
comparison
equal deleted inserted replaced
54:ed74c5cabe98 55:dd9b5f59632c
12 local _G = _G 12 local _G = _G
13 local clock = B:RegisterModule("Clock", _G.VeneerClock) 13 local clock = B:RegisterModule("Clock", _G.VeneerClock)
14 local print = B.print('XML') -- debug hook 14 local print = B.print('XML') -- debug hook
15 -- weekday abbreviations used in display 15 -- weekday abbreviations used in display
16 local weekDays = {'Su', 'M', 'T', 'W', 'R' ,'F', 'Sa' } 16 local weekDays = {'Su', 'M', 'T', 'W', 'R' ,'F', 'Sa' }
17 local months = {'JA', 'FB', 'MR', 'AP', 'MY', 'JN', 'JL', 'AG', 'SP', 'OC', 'NV', 'DC'}
17 18
18 -- runs when visible 19 -- runs when visible
19 clock.OnUpdate = function(self) 20 clock.OnUpdate = function(self)
20 local weekday, month, day, year = _G.CalendarGetDate() 21 local weekday, month, day, year = _G.CalendarGetDate()
21 local hour, min = _G.GetGameTime() 22 local hour, min = _G.GetGameTime()
24 end 25 end
25 local posFunc, posF = _G.GetPlayerMapPosition, 100 26 local posFunc, posF = _G.GetPlayerMapPosition, 100
26 local posFormat = "|cFF00FFFF%0.1f %0.1f|r" 27 local posFormat = "|cFF00FFFF%0.1f %0.1f|r"
27 if self:IsMouseOver() then 28 if self:IsMouseOver() then
28 posFunc = _G.UnitPosition 29 posFunc = _G.UnitPosition
29 posFormat = "|cFFFFFF00%d %d|r" 30 posFormat = "yds |cFFFFFF00%d %d|r"
30 posF = 1 31 posF = 1
31 end 32 end
33
32 local posX, posY = posFunc('player') 34 local posX, posY = posFunc('player')
33 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) 35 self.coords:SetFormattedText(posFormat, posX * posF, posY * posF)
36 self.time:SetFormattedText("%s |cFF44FFFF%s|r|c88FFFFFF%s|r %d:%02d", weekDays[weekday], day, months[month], hour, min)
34 end 37 end
35 38
36 -- hide/show toggler 39 -- hide/show toggler
37 clock.OnMouseUp = function(self, button) 40 clock.OnMouseUp = function(self, button)
38 if button == 'RightButton' then 41 if button == 'RightButton' then
56 self:SetPoint('TOPRIGHT', _G.UIParent, 'TOPRIGHT', -100, -2) 59 self:SetPoint('TOPRIGHT', _G.UIParent, 'TOPRIGHT', -100, -2)
57 self:SetScript('OnUpdate', clock.OnUpdate) 60 self:SetScript('OnUpdate', clock.OnUpdate)
58 self:Show() 61 self:Show()
59 self.time:SetText('Clock stuff') 62 self.time:SetText('Clock stuff')
60 end 63 end
64
65 clock.Open = function(self)
66 end
67 clock.Close = function(self)
68 end