comparison ObjectiveFrame.lua @ 12:8238cddaddb1

ObjectiveUI - fillers for 'Hidden' objective widgets
author Nenue
date Sat, 02 Apr 2016 05:01:54 -0400
parents f03c75f63566
children 9455693fc290
comparison
equal deleted inserted replaced
11:fb80e365bab3 12:8238cddaddb1
31 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]] 31 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
32 local titleSize, textSize = 15, 15 32 local titleSize, textSize = 15, 15
33 local titleOutline, textOutline = "OUTLINE", "OUTLINE" 33 local titleOutline, textOutline = "OUTLINE", "OUTLINE"
34 local titleSpacing, textSpacing = 4, 3 34 local titleSpacing, textSpacing = 4, 3
35 local textIndent = 5 35 local textIndent = 5
36 local wrapperMaxWidth, wrapperMaxHeight = 280, 490 -- these are the hard bounds, actual *Height variables are changed 36 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
37 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' 37 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
38 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24 38 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
39 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2 39 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
40 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0} 40 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0}
41 41
125 return 125 return
126 end 126 end
127 127
128 --- xp bar 128 --- xp bar
129 XPBar:SetWidth(wrapperWidth - Wrapper.close:GetWidth()) 129 XPBar:SetWidth(wrapperWidth - Wrapper.close:GetWidth())
130 XPBar.bg:SetAllPoints(XPBar) 130 XPBar.statusbg:SetAllPoints(XPBar)
131 XPBar:RegisterEvent('DISABLE_XP_GAIN') 131 XPBar:RegisterEvent('DISABLE_XP_GAIN')
132 XPBar:RegisterEvent('ENABLE_XP_GAIN') 132 XPBar:RegisterEvent('ENABLE_XP_GAIN')
133 XPBar:SetScript('OnEvent', mod.UpdateXP) 133 XPBar:SetScript('OnEvent', mod.UpdateXP)
134 134
135 if not IsXPUserDisabled() then 135 if not IsXPUserDisabled() then
143 143
144 mod.EnableXP = function(self) 144 mod.EnableXP = function(self)
145 self:RegisterEvent('PLAYER_XP_UPDATE') 145 self:RegisterEvent('PLAYER_XP_UPDATE')
146 self:RegisterEvent('PLAYER_LEVEL_UP') 146 self:RegisterEvent('PLAYER_LEVEL_UP')
147 self:RegisterEvent('PLAYER_UPDATE_RESTING') 147 self:RegisterEvent('PLAYER_UPDATE_RESTING')
148 self.bg:SetTexture(0,0,0,.25) 148 self.statusbg:SetTexture(0,0,0,.25)
149 self:Show() 149 self:Show()
150 end 150 end
151 151
152 mod.DisableXP = function(self) 152 mod.DisableXP = function(self)
153 self:UnregisterEvent('PLAYER_XP_UPDATE') 153 self:UnregisterEvent('PLAYER_XP_UPDATE')
154 self:UnregisterEvent('PLAYER_LEVEL_UP') 154 self:UnregisterEvent('PLAYER_LEVEL_UP')
155 self:UnregisterEvent('PLAYER_UPDATE_RESTING') 155 self:UnregisterEvent('PLAYER_UPDATE_RESTING')
156 self.bg:SetTexture(0.5,0.5,0.5,0.5) 156 self.statusbg:SetTexture(0.5,0.5,0.5,0.5)
157 self:Hide() 157 self:Hide()
158 end 158 end
159 159
160 mod.UpdateXP = function(self, event) 160 mod.UpdateXP = function(self, event)
161 if event == 'DISABLE_XP_GAIN' then 161 if event == 'DISABLE_XP_GAIN' then
167 if not IsXPUserDisabled() then 167 if not IsXPUserDisabled() then
168 168
169 local xp = UnitXP('player') 169 local xp = UnitXP('player')
170 local xpmax = UnitXPMax('player') 170 local xpmax = UnitXPMax('player')
171 local rest = GetXPExhaustion() 171 local rest = GetXPExhaustion()
172 self.fg:SetWidth((xp/xpmax) * self:GetWidth()) 172 self.foreground:SetWidth((xp/xpmax) * self:GetWidth())
173 if rest then 173 if rest then
174 self.rested:ClearAllPoints() 174 self.rested:ClearAllPoints()
175 if xp == 0 then 175 if xp == 0 then
176 self.rested:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 0) 176 self.rested:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 0)
177 else 177 else
188 else 188 else
189 self.rested:Hide() 189 self.rested:Hide()
190 end 190 end
191 191
192 if IsResting() then 192 if IsResting() then
193 self.bg:SetTexture(.2,.8,.2,.5) 193 self.statusbg:SetTexture(.2,.8,.2,.5)
194 else 194 else
195 self.bg:SetTexture(0,0,0,.25) 195 self.statusbg:SetTexture(0,0,0,.25)
196 end 196 end
197 self.xpText:SetText(xp .. '/'.. xpmax .. (rest and (' ('..tostring(rest)..')') or '')) 197 self.xpText:SetText(xp .. '/'.. xpmax .. (rest and (' ('..tostring(rest)..')') or ''))
198 end 198 end
199 end 199 end
200 200