Move font to base label config. Add in status bar to main update logic

Sasky [03-25-15 - 05:56]
Move font to base label config. Add in status bar to main update logic
Filename
CyrHUD.lua
classes/Battle.lua
classes/Info.lua
classes/Label.lua
classes/ScoringBar.lua
diff --git a/CyrHUD.lua b/CyrHUD.lua
index 915ddfe..1706b80 100644
--- a/CyrHUD.lua
+++ b/CyrHUD.lua
@@ -102,6 +102,11 @@ end

 function CyrHUD:printAll()
     local i = 1
+    for _,status in ipairs(self.statusBars) do
+        self:getUIRow(i):update(status)
+        i = i + 1
+    end
+
     for _,battle in pairs(self.battles) do
         self:getUIRow(i):update(battle)
         i = i + 1
@@ -140,6 +145,10 @@ function CyrHUD:updateAll()
         --Update in-place
         self.battles[i]:update()
     end
+
+    for _,status in pairs(self.statusBars) do
+        status:update()
+    end
 end

 function CyrHUD:scanKeeps()
@@ -170,6 +179,8 @@ function CyrHUD:init()
     self.battles = {}
     self.battleContext = BGQUERY_LOCAL
     self.campaign = GetCurrentCampaignId()
+    self.statusBars = {}
+    table.insert(self.statusBars, self.ScoringBar())
     self:scanKeeps()

     --Add events
diff --git a/classes/Battle.lua b/classes/Battle.lua
index 6e9d88c..441cc12 100644
--- a/classes/Battle.lua
+++ b/classes/Battle.lua
@@ -90,19 +90,14 @@ function CyrHUD.Battle:configureLabel(label)
     ua:SetDrawLayer(1)
     ua:SetTexture(CyrHUD.info.underAttack)

-    local fontMain = "EsoUI/Common/Fonts/univers67.otf|18|soft-shadow-thick"
     --Objective name
     label:positionControl(L_NAME, 150, 30, 35, 5)
-    label:getControl(L_NAME):SetFont(fontMain)
     --Defensive siege count
     label:positionControl(L_DEF_SIEGE, 30, 30, 220, 5)
-    label:getControl(L_DEF_SIEGE):SetFont(fontMain)
     --Attacker siege count
     label:positionControl(L_ATT_SIEGE, 30, 30, 190, 5)
-    label:getControl(L_ATT_SIEGE):SetFont(fontMain)
     --Time
     label:positionControl(L_TIME, 30, 30, 250, 5)
-    label:getControl(L_TIME):SetFont(fontMain)
 end

 function CyrHUD.Battle:updateLabel(label)
diff --git a/classes/Info.lua b/classes/Info.lua
index ea592eb..f9d20d7 100644
--- a/classes/Info.lua
+++ b/classes/Info.lua
@@ -29,6 +29,7 @@ CyrHUD.info.newAttackColor = ZO_ColorDef:New(.5, 0, 0, .3)
 CyrHUD.info.endAttackColor = ZO_ColorDef:New(.5, .5, .5, .3)
 CyrHUD.info.defaultBGColor = ZO_ColorDef:New(0, 0, 0, .3)
 CyrHUD.info.invisColor = ZO_ColorDef:New(0,0,0,0)
+CyrHUD.info.fontMain = "EsoUI/Common/Fonts/univers67.otf|18|soft-shadow-thick"
 CyrHUD.info[ALLIANCE_NONE] = {}
 CyrHUD.info[ALLIANCE_NONE].color = ZO_ColorDef:New(.8, .8, .8, 1)
 CyrHUD.info[ALLIANCE_NONE][KEEPTYPE_KEEP] = "/esoui/art/mappins/ava_largekeep_neutral.dds"
diff --git a/classes/Label.lua b/classes/Label.lua
index c6523cc..9007926 100644
--- a/classes/Label.lua
+++ b/classes/Label.lua
@@ -55,6 +55,11 @@ function Label.new()
     entry.txt2 = WINDOW_MANAGER:CreateControl(self.entryName .. "txt2", self.main, CT_LABEL)
     entry.txt3 = WINDOW_MANAGER:CreateControl(self.entryName .. "txt3", self.main, CT_LABEL)
     entry.txt4 = WINDOW_MANAGER:CreateControl(self.entryName .. "txt4", self.main, CT_LABEL)
+
+    entry.txt1:SetFont(CyrHUD.info.fontMain)
+    entry.txt2:SetFont(CyrHUD.info.fontMain)
+    entry.txt3:SetFont(CyrHUD.info.fontMain)
+    entry.txt4:SetFont(CyrHUD.info.fontMain)
     return self
 end

diff --git a/classes/ScoringBar.lua b/classes/ScoringBar.lua
index 5913e1a..9507a70 100644
--- a/classes/ScoringBar.lua
+++ b/classes/ScoringBar.lua
@@ -50,18 +50,21 @@ local TEXT_TIME = "txt4"
 local ICON_DC, ICON_EP, ICON_AD = "img1", "img2", "img3"
 local TEXT_DC, TEXT_EP, TEXT_AD = "txt1", "txt2", "txt3"
 function bar:configureLabel(label)
+    d("Configuring label for status bar")
     label:exposeControls(3,4)
     label:getControl(ICON_DC):SetTexture(CyrHUD.info[DC].flag)
     label:getControl(ICON_EP):SetTexture(CyrHUD.info[EP].flag)
     label:getControl(ICON_AD):SetTexture(CyrHUD.info[AD].flag)
-    label:positionControl(TEXT_TIME,  10, 5, 70, 40)
-    label:positionControl(ICON_DC,  80, 5, 20, 40)
-    label:positionControl(TEXT_DC, 100, 5, 50, 40)
-    label:positionControl(ICON_EP, 150, 5, 20, 40)
-    label:positionControl(TEXT_EP, 170, 5, 50, 40)
-    label:positionControl(ICON_AD, 220, 5, 20, 40)
-    label:positionControl(TEXT_AD, 240, 5, 50, 40)
-    --TODO: Set font
+    label:positionControl(TEXT_TIME, 90, 40, 10, 5)
+    label:positionControl(ICON_DC, 20, 40,  80, 5)
+    label:positionControl(TEXT_DC, 50, 40, 100, 5)
+    label:positionControl(ICON_EP, 20, 40, 150, 5)
+    label:positionControl(TEXT_EP, 50, 40, 170, 5)
+    label:positionControl(ICON_AD, 20, 40, 220, 5)
+    label:positionControl(TEXT_AD, 50, 40, 240, 5)
+    label:getControl(TEXT_DC):SetColor(CyrHUD.info[DC].color:UnpackRGBA())
+    label:getControl(TEXT_EP):SetColor(CyrHUD.info[EP].color:UnpackRGBA())
+    label:getControl(TEXT_AD):SetColor(CyrHUD.info[AD].color:UnpackRGBA())
     if CyrHUD.cfg.showPopBars then
         label:getControl(ICON_DC):SetColor(CyrHUD.info[DC].color:UnpackRGBA())
         label:getControl(ICON_EP):SetColor(CyrHUD.info[EP].color:UnpackRGBA())
@@ -72,7 +75,7 @@ end
 function bar:updateLabel(label)
     local pre = "+"
     local time = GetSecondsUntilCampaignScoreReevaluation(self.campaign)
-    label:getControl(TEXT_TIME):SetText(CyrHUD.formatTime(time), true)
+    label:getControl(TEXT_TIME):SetText(CyrHUD.formatTime(time, true))
     label:getControl(TEXT_DC):SetText(pre .. self.dc_points)
     label:getControl(TEXT_EP):SetText(pre .. self.ep_points)
     label:getControl(TEXT_AD):SetText(pre .. self.ad_points)