view TimeManager/TimeManager.lua @ 51:4586229986e6

disambiguate local module names
author Nenue
date Fri, 29 Apr 2016 10:52:57 -0400
parents 1a322b92dbfa
children ed74c5cabe98
line wrap: on
line source
--------------------------------------------
-- Veneer
-- Krakyn
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 4/27/2016 1:02 AM
--------------------------------------------

local B, _G = select(2,...).frame, _G
local clock = B:RegisterModule("Clock", VeneerClock)
local weekDays = {'Su', 'M', 'T', 'W', 'R' ,'F', 'Sa' }

local print = B.print('XML')

clock.OnUpdate = function(self)
  local weekday, month, day, year = CalendarGetDate()
  local hour, min = GetGameTime()
  if hour > 12 then
    hour = hour - 12
  end
  self.time:SetFormattedText("|cAAFFFFFF%s|r |cFF44FFFF%s|r|c88FFFFFF/|r|cFF44FFFF%s|r %d:%02d", weekDays[weekday], month, day, hour, min)
end

clock.OnMouseUp = function(self, button)
  if button == 'RightButton' then
    if self:IsVisible() then
      self:Hide()
    else
      self:Show()
    end
  end
end

function clock:OnInitialize()
  print('clock thing')
  self:Show()
end