annotate ObjectiveTracker/Widgets.lua @ 33:64f2a9bbea79

- implementing structural revisions in bonus objectives - prevent instances of nil arithmetic - decide on where to keep style values - start widgets with dummy values for operability
author Nenue
date Fri, 15 Apr 2016 17:01:06 -0400
parents c33c17dd97e7
children 9856ebc63fa4
rev   line source
Nenue@28 1 local B = select(2,...).frame
Nenue@28 2 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@28 3 local print = B.print('WidgetFactory')
Nenue@28 4 local _G, UIParent = _G, UIParent
Nenue@28 5 local GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown = GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown
Nenue@28 6 local CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll = CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll
Nenue@28 7 local tremove, tContains, pairs, ipairs, setmetatable, floor = tremove, tContains, pairs, ipairs, setmetatable, floor
Nenue@28 8 local SetItemButtonTexture, SetItemButtonCount = SetItemButtonTexture, SetItemButtonCount
Nenue@28 9 local ToggleWorldMap, GetTrackedAchievements, GetTasksTable = ToggleWorldMap, GetTrackedAchievements, GetTasksTable
Nenue@28 10 -- GLOBALS: Veneer_QuestObjectiveItem_UpdateCooldown, Veneer_QuestObjectiveItem_OnUpdate
Nenue@28 11 --- frame refs
Nenue@28 12 local Wrapper = _G.VeneerObjectiveWrapper
Nenue@28 13 local Scroller = Wrapper.scrollArea
Nenue@28 14 local CloseButton = Wrapper.CloseButton
Nenue@28 15 local QuestMapButton = Wrapper.QuestMapButton
Nenue@28 16 local Scroll = _G.VeneerObjectiveScroll
Nenue@28 17 local usedButtons = T.Quest.itemButtons
Nenue@28 18 local freeButtons = T.Quest.freeButtons
Nenue@28 19
Nenue@28 20 T.buttons = {
Nenue@28 21 CloseButton = {
Nenue@28 22 closedSwatch = {
Nenue@28 23 [[Interface\Buttons\UI-Panel-QuestHideButton]],
Nenue@28 24 [[Interface\Buttons\UI-Panel-QuestHideButton]],
Nenue@28 25 0, 0.5, 0.5, 1,
Nenue@28 26 0.5, 1, 0.5, 1,
Nenue@28 27 },
Nenue@28 28 openSwatch = {
Nenue@28 29 [[Interface\Buttons\UI-Panel-QuestHideButton]],
Nenue@28 30 [[Interface\Buttons\UI-Panel-QuestHideButton]],
Nenue@28 31 0.5, 1, 0.5, 1,
Nenue@28 32 0, 0.5, 0.5, 1,
Nenue@28 33 },
Nenue@28 34 parent = 'VeneerObjectiveWrapper'
Nenue@28 35 },
Nenue@28 36 QuestMapButton = {
Nenue@28 37 closedSwatch = {
Nenue@28 38 [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
Nenue@28 39 [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
Nenue@28 40 0, 1, 0.5, 1,
Nenue@28 41 0, 1, 0, 0.5,
Nenue@28 42 },
Nenue@28 43 openSwatch = {
Nenue@28 44 [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
Nenue@28 45 [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
Nenue@28 46 0, 1, 0, 0.5,
Nenue@28 47 0, 1, 0.5, 1,
Nenue@28 48 }
Nenue@28 49 }
Nenue@28 50 }
Nenue@28 51
Nenue@28 52 local Scroller_OnShow = function()
Nenue@28 53 Wrapper.watchMoneyReasons = 0;
Nenue@28 54 --T:Update()
Nenue@28 55 --T:OnInitialize()
Nenue@28 56 for i, region in ipairs(Wrapper.headerComplex) do
Nenue@28 57 region:Show()
Nenue@28 58 end
Nenue@28 59 end
Nenue@28 60
Nenue@28 61 local Scroller_OnHide = function()
Nenue@28 62 local self = Wrapper
Nenue@28 63 Wrapper:UnregisterAllEvents()
Nenue@28 64 Wrapper:SetScript('OnEvent', nil)
Nenue@28 65 for i, region in ipairs(Wrapper.headerComplex) do
Nenue@28 66 region:Hide()
Nenue@28 67 end
Nenue@28 68 end
Nenue@28 69
Nenue@28 70 local Scroller_OnMouseWheel = function(self, delta)
Nenue@28 71 local r = Scroll:GetHeight() - Scroller:GetHeight()
Nenue@28 72 local s = B.Conf.ObjectiveScroll - delta * floor(r/5+.5)
Nenue@28 73 local from = self:GetVerticalScroll()
Nenue@28 74 print('|cFF00FF00OnMouseWheel', 'scroll =', s)
Nenue@28 75 if s >= r then
Nenue@28 76 s = r
Nenue@28 77 elseif s < 1 then
Nenue@28 78 s = 0
Nenue@28 79 end
Nenue@28 80 self:SetVerticalScroll(s)
Nenue@28 81 B.Conf.ObjectiveScroll = s
Nenue@28 82 print('|cFF00FF00OnMouseWheel', 'from = ', from, 'scroll =', s, ' range =', r, 'current =', self:GetVerticalScroll())
Nenue@28 83
Nenue@28 84 T.UpdateActionButtons('SCROLLING')
Nenue@28 85 end
Nenue@28 86
Nenue@28 87 local UpdatePanelButton = function (self, state)
Nenue@28 88 state = state or true
Nenue@28 89 local swatch = (state == true) and self.openSwatch or self.closedSwatch
Nenue@28 90 print((state ~= true) and 'closedSwatch' or 'openSwatch')
Nenue@28 91 self:SetNormalTexture(swatch[1])
Nenue@28 92 self:SetPushedTexture(swatch[2])
Nenue@28 93 if #swatch >= 6 then
Nenue@28 94 self:GetNormalTexture():SetTexCoord(swatch[3], swatch[4], swatch[5], swatch[6])
Nenue@28 95 end
Nenue@28 96 if #swatch == 10 then
Nenue@28 97 self:GetPushedTexture():SetTexCoord(swatch[7], swatch[8], swatch[9], swatch[10])
Nenue@28 98 end
Nenue@28 99
Nenue@28 100 end
Nenue@28 101
Nenue@28 102 local OnClick = {}
Nenue@28 103 OnClick.CloseButton = function(self)
Nenue@28 104 T:SetEnabled()
Nenue@28 105 UpdatePanelButton(self, T.Conf.enabled)
Nenue@28 106 end
Nenue@28 107
Nenue@28 108 OnClick.QuestMapButton = function()
Nenue@28 109 ToggleWorldMap()
Nenue@28 110 end
Nenue@28 111
Nenue@28 112
Nenue@28 113 T.InitializeWidgets = function()
Nenue@28 114 local panelButtons = T.buttons
Nenue@28 115 --- tracker scroll
Nenue@28 116 Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel)
Nenue@28 117 Scroller:SetScript('OnShow', Scroller_OnShow)
Nenue@28 118 Scroller:SetScript('OnHide', Scroller_OnHide)
Nenue@28 119 for name, swatch in pairs(panelButtons) do
Nenue@28 120 local source = swatch and swatch or panelButtons.CloseButton
Nenue@28 121 local button = Wrapper[name]
Nenue@28 122 button.parent = swatch.parent
Nenue@28 123 button.openSwatch = source.openSwatch
Nenue@28 124 button.closedSwatch = source.closedSwatch
Nenue@28 125 if OnClick[name] then
Nenue@28 126 button:SetScript('OnClick', OnClick[name])
Nenue@28 127 end
Nenue@28 128 UpdatePanelButton(button, T.Conf.enabled)
Nenue@28 129 end
Nenue@28 130 end
Nenue@28 131
Nenue@28 132 ----------------------------------------------------------------------------------------
Nenue@28 133 --- modified version of the itemButton initializer used by Barjack's 'QuestKing 2' addon,
Nenue@28 134 --- url: http://mods.curse.com/addons/wow/questking
Nenue@28 135 ----------------------------------------------------------------------------------------
Nenue@28 136 T.SetItemButton = function(block, info)
Nenue@28 137 local itemInfo = info.specialItem
Nenue@28 138 if not itemInfo then
Nenue@28 139 return
Nenue@28 140 end
Nenue@28 141
Nenue@28 142 local itemButton
Nenue@28 143 if not info.itemButton then
Nenue@28 144 if #freeButtons >= 1 then
Nenue@28 145 print(' |cFF00FFFFfound a free button')
Nenue@28 146 itemButton = freeButtons[#freeButtons]
Nenue@28 147 freeButtons[#freeButtons] = nil
Nenue@28 148 if itemButton.block then
Nenue@28 149 itemButton.block.itemButton = nil
Nenue@28 150 itemButton.block = nil
Nenue@28 151 end
Nenue@28 152 else
Nenue@28 153 local buttonIndex = T.Quest.numButtons + #freeButtons + 1
Nenue@28 154 itemButton = CreateFrame('Button', 'VeneerQuestItemButton' .. buttonIndex, UIParent, 'VeneerItemButtonTemplate')
Nenue@28 155 itemButton.buttonIndex = buttonIndex
Nenue@28 156 itemButton:SetSize(36, 36)
Nenue@28 157 itemButton:GetNormalTexture():SetSize(36 * (5/3), 36 * (5/3))
Nenue@28 158 print(' |cFFFF4400starting new button', itemButton:GetName())
Nenue@28 159 end
Nenue@28 160 T.Quest.numButtons = T.Quest.numButtons + 1
Nenue@28 161 else
Nenue@28 162 itemButton = info.itemButton
Nenue@28 163 print(' |cFF00FF00found assigned button', itemButton:GetName())
Nenue@28 164
Nenue@28 165 end
Nenue@28 166 -- set values
Nenue@28 167
Nenue@28 168 info.itemButton = itemButton
Nenue@28 169 usedButtons[info.questID] = itemButton
Nenue@28 170 print(' |cFF8800FFassigning|r', itemButton:GetName(), 'to quest|cFF00FF00', info.questID, '|rat|cFFFFFF00', block:GetName(),'|r')
Nenue@28 171
Nenue@28 172 for k,v in pairs(usedButtons) do
Nenue@28 173 print('|cFFFF44DD'..k..'|r', v:GetName())
Nenue@28 174 end
Nenue@28 175
Nenue@28 176 itemButton:SetAttribute("type", "item")
Nenue@28 177 itemButton:SetAttribute("item", itemInfo.link)
Nenue@28 178
Nenue@28 179 itemButton.questID = info.questID
Nenue@28 180 itemButton.questLogIndex = info.questLogIndex
Nenue@28 181 itemButton.charges = itemInfo.charges
Nenue@28 182 itemButton.rangeTimer = -1
Nenue@28 183 itemButton.block = block
Nenue@28 184
Nenue@28 185 SetItemButtonTexture(itemButton, itemInfo.icon)
Nenue@28 186 SetItemButtonCount(itemButton, itemInfo.charges)
Nenue@28 187 Veneer_QuestObjectiveItem_UpdateCooldown(itemButton);
Nenue@28 188
Nenue@28 189 return itemButton
Nenue@28 190 end
Nenue@28 191 --- Clear an itemButton from the given block
Nenue@28 192 T.FreeItemButtons = function(block)
Nenue@28 193
Nenue@28 194 if block.itemButton then
Nenue@28 195 local itemButton = block.itemButton
Nenue@28 196 if itemButton.questID ~= block.info.questID then
Nenue@28 197 block.itemButton = nil
Nenue@28 198 itemButton.block = T.Quest.InfoBlock[itemButton.questID]
Nenue@28 199 else
Nenue@28 200 itemButton.block = nil
Nenue@28 201 itemButton:Hide()
Nenue@28 202
Nenue@28 203 usedButtons[itemButton.questID] = nil
Nenue@28 204 freeButtons[#freeButtons + 1] = itemButton
Nenue@28 205 T.Quest.numButtons = T.Quest.numButtons - 1
Nenue@28 206 print('|cFFFF0088released', itemButton:GetName(),'and', block:GetName())
Nenue@28 207 end
Nenue@28 208 end
Nenue@28 209 end
Nenue@28 210
Nenue@28 211 function Veneer_QuestObjectiveItem_OnUpdate (self, elapsed)
Nenue@28 212 -- Handle range indicator
Nenue@28 213 local rangeTimer = self.rangeTimer
Nenue@28 214 if (rangeTimer) then
Nenue@28 215 rangeTimer = rangeTimer - elapsed
Nenue@28 216 if (rangeTimer <= 0) then
Nenue@28 217 local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex)
Nenue@28 218 if ((not charges) or (charges ~= self.charges)) then
Nenue@28 219 T:Update()
Nenue@28 220 return
Nenue@28 221 end
Nenue@28 222
Nenue@28 223 local count = self.HotKey
Nenue@28 224 local valid = IsQuestLogSpecialItemInRange(self.questLogIndex)
Nenue@28 225 if (valid == 0) then
Nenue@28 226 count:Show()
Nenue@28 227 count:SetVertexColor(1.0, 0.1, 0.1)
Nenue@28 228 elseif (valid == 1) then
Nenue@28 229 count:Show()
Nenue@28 230 count:SetVertexColor(0.6, 0.6, 0.6)
Nenue@28 231 else
Nenue@28 232 count:Hide()
Nenue@28 233 end
Nenue@28 234 rangeTimer = TOOLTIP_UPDATE_TIME
Nenue@28 235 end
Nenue@28 236
Nenue@28 237 self.rangeTimer = rangeTimer
Nenue@28 238 end
Nenue@28 239 end
Nenue@28 240
Nenue@28 241 function Veneer_QuestObjectiveItem_UpdateCooldown (itemButton)
Nenue@28 242 local start, duration, enable = GetQuestLogSpecialItemCooldown(itemButton.questLogIndex)
Nenue@28 243 if (start) then
Nenue@28 244 CooldownFrame_SetTimer(itemButton.Cooldown, start, duration, enable)
Nenue@28 245 if (duration > 0 and enable == 0) then
Nenue@28 246 SetItemButtonTextureVertexColor(itemButton, 0.4, 0.4, 0.4)
Nenue@28 247 else
Nenue@28 248 SetItemButtonTextureVertexColor(itemButton, 1, 1, 1)
Nenue@28 249 end
Nenue@28 250 end
Nenue@28 251 end
Nenue@28 252
Nenue@28 253 -----------------------------------------
Nenue@28 254 -- Criteria frames
Nenue@28 255
Nenue@28 256 --[[
Nenue@28 257 text = description,
Nenue@28 258 type = type,
Nenue@28 259 finished = completed,
Nenue@28 260 quantity = quantity,
Nenue@28 261 requiredQuantity = requiredQuantity,
Nenue@28 262 characterName = characterName,
Nenue@28 263 flags = flags,
Nenue@28 264 assetID = assetID,
Nenue@28 265 quantityString = quantityString,
Nenue@28 266 criteriaID = criteriaID,
Nenue@28 267 ]]
Nenue@28 268 local newWidgetID = 0
Nenue@28 269 T.WidgetRegistry = {}
Nenue@28 270 local wr = T.WidgetRegistry
Nenue@28 271
Nenue@28 272 --- Get a usable widget for the given achievement criteria set.
Nenue@28 273 -- Returns a frame object with dimensioning parameters needed to size the receiving tracker block
Nenue@28 274 T.SetWidget = function(line, data, objectiveType, objectiveKey)
Nenue@28 275 local print = B.print('ObjectiveWidgets')
Nenue@28 276 local widgetType = objectiveType
Nenue@28 277 local widget
Nenue@28 278 if wr[widgetType] and wr[widgetType].used[objectiveKey] then
Nenue@28 279 widget = wr[widgetType].used[objectiveKey]
Nenue@28 280 print('|cFF00FF00Updating ('..objectiveKey..')', widget)
Nenue@28 281 elseif not wr[widgetType] or #wr[widgetType].free == 0 then
Nenue@28 282 widget = CreateFrame('Frame', 'VeneerObjective' .. widgetType .. (wr[widgetType] and (wr[widgetType].lastn+1) or (1)), VeneerObjectiveScroll, 'VeneerObjectiveCriteria' .. widgetType)
Nenue@28 283
Nenue@28 284 print('|cFFFF0088Creating `'..widget:GetName()..'` id', wr[widgetType].lastn)
Nenue@28 285 else
Nenue@28 286 widget = tremove(wr[widgetType].free)
Nenue@28 287 print('|cFFFFFF00Acquiring released widget', widget:GetName())
Nenue@28 288 end
Nenue@28 289
Nenue@28 290
Nenue@28 291 wr[widgetType].used[objectiveKey] = widget
Nenue@28 292 widget.line = line
Nenue@28 293 widget.objective = data
Nenue@28 294 widget.key = objectiveKey
Nenue@28 295 T.InitializeWidget(widget)
Nenue@28 296 return widget
Nenue@28 297 end
Nenue@28 298
Nenue@28 299 --- WidgetTemplate 'OnLoad'
Nenue@28 300 T.RegisterWidget = function(frame)
Nenue@28 301 local print = B.print('ObjectiveWidgets')
Nenue@28 302 local widgetType = frame.widgetType
Nenue@28 303 if not wr[frame.widgetType] then
Nenue@28 304 print('|cFFFF4400[[WidgetTemplate]]|r', widgetType)
Nenue@28 305 wr[widgetType] = { lastn = 1, free = {}, used = {}, usedIndex = {}, freeIndex = {} }
Nenue@28 306 else
Nenue@28 307 print('|cFF0088FF+ [[WidgetTemplate]]r', widgetType, wr[widgetType].lastn)
Nenue@28 308 wr[widgetType].lastn = wr[widgetType].lastn + 1
Nenue@28 309 end
Nenue@28 310 end
Nenue@28 311 --- WidgetTemplate 'OnShow'
Nenue@33 312 local wrapperWidth, textIndent
Nenue@28 313 T.InitializeWidget = setmetatable({}, {
Nenue@28 314 __call = function(t, frame)
Nenue@28 315 -- todo: config pull
Nenue@33 316 if not wrapperWidth then
Nenue@33 317 wrapperWidth = T.Conf.Wrapper.Width
Nenue@33 318 textIndent = T.Conf.Wrapper.TextIndent
Nenue@33 319 end
Nenue@28 320
Nenue@33 321 frame:SetWidth(wrapperWidth - textIndent * 2)
Nenue@28 322 frame:SetScript('OnEvent', T.UpdateWidget[frame.widgetType])
Nenue@28 323 frame:RegisterEvent('TRACKED_ACHIEVEMENT_UPDATE')
Nenue@28 324 frame:RegisterEvent('TRACKED_ACHIEVEMENT_LIST_CHANGED')
Nenue@28 325 frame:RegisterEvent('CRITERIA_UPDATE')
Nenue@28 326 frame:RegisterEvent('CRITERIA_COMPLETE')
Nenue@28 327 frame:RegisterEvent('CRITERIA_EARNED')
Nenue@28 328 t[frame.widgetType](frame)
Nenue@28 329 T.UpdateWidget[frame.widgetType](frame)
Nenue@28 330 end,
Nenue@28 331 })
Nenue@28 332
Nenue@28 333 --- WidgetTemplate 'OnEvent'
Nenue@28 334 T.UpdateWidget = setmetatable({}, {
Nenue@28 335 __call = function(t, frame)
Nenue@28 336 if not frame.widgetType then
Nenue@28 337 error('Invalid widget template, needs .widgetType')
Nenue@28 338 return
Nenue@28 339 end
Nenue@28 340
Nenue@28 341 return t[frame.widgetType](frame)
Nenue@28 342 end
Nenue@28 343 })
Nenue@28 344
Nenue@28 345 --- WidgetTemplate 'OnHide'
Nenue@28 346 T.ReleaseWidget = function(frame)
Nenue@28 347 --[[
Nenue@28 348 local print = B.print('ObjectiveWidgets')
Nenue@28 349 local reg = wr[frame.widgetType]
Nenue@28 350 if reg and reg.used[frame.key] then
Nenue@28 351 reg.used[frame.key] = nil
Nenue@28 352 frame.line = nil
Nenue@28 353 frame.info = nil
Nenue@28 354 frame:UnregisterAllEvents()
Nenue@28 355 tinsert(reg.free, frame)
Nenue@28 356 print('|cFFBBBBBBreleased from service', frame:GetName())
Nenue@28 357 end
Nenue@28 358 ]]
Nenue@28 359 end
Nenue@28 360
Nenue@28 361 --- RemoveTrackedAchievement post-hook
Nenue@28 362 T.CleanWidgets = function()
Nenue@28 363 local print = B.print('ObjectiveWidgets')
Nenue@28 364 local tracked = {GetTrackedAchievements() }
Nenue@28 365 local tasks = GetTasksTable()
Nenue@28 366 for type, reg in pairs(T.WidgetRegistry) do
Nenue@28 367 print('collecting', type)
Nenue@28 368 for key, frame in pairs(reg.used) do
Nenue@28 369 if frame.objective.cheevID then
Nenue@28 370 local id = frame.objective.cheevID
Nenue@28 371
Nenue@28 372 if id and not tContains(tracked, id) then
Nenue@28 373
Nenue@28 374 print(' untracked achievement', id, 'associated with', key, frame:GetName())
Nenue@28 375 frame:Hide()
Nenue@28 376 end
Nenue@28 377 elseif frame.objective.questID then
Nenue@28 378 -- do something for quest task
Nenue@28 379 end
Nenue@28 380 end
Nenue@28 381 end
Nenue@28 382 end
Nenue@28 383
Nenue@28 384
Nenue@28 385
Nenue@28 386 T.defaults.WidgetStyle = {
Nenue@28 387
Nenue@28 388 }
Nenue@28 389
Nenue@28 390 local progressHeight = 16
Nenue@28 391 local progressBorder = 1
Nenue@28 392 local progressIndent = 3
Nenue@28 393 local progressFont = _G.VeneerCriteriaFontNormal
Nenue@28 394
Nenue@28 395
Nenue@28 396 T.InitializeWidget.ProgressBar = function(self)
Nenue@28 397 local c = T.Conf.Wrapper
Nenue@28 398 self.height = progressHeight + c.TextSpacing
Nenue@28 399 self.width = c.Width - c.TextSpacing
Nenue@28 400 self.indent = progressIndent
Nenue@33 401 self.value = 1
Nenue@33 402 self.maxValue = 1
Nenue@28 403
Nenue@28 404 self:SetHeight(progressHeight)
Nenue@28 405 self.bg:SetHeight(progressHeight)
Nenue@28 406 self.bg:SetWidth(self.width)
Nenue@28 407 self.fg:ClearAllPoints()
Nenue@28 408 self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', progressBorder, progressBorder)
Nenue@28 409 self.fg:SetHeight(progressHeight - progressBorder * 2)
Nenue@28 410 self.status:SetFontObject(progressFont)
Nenue@28 411 self.status:SetText(self.objective.quantityString)
Nenue@28 412 end
Nenue@28 413
Nenue@28 414 T.UpdateWidget.ProgressBar = function (self)
Nenue@33 415 local quantity, requiredQuantity = self.value, self.maxValue
Nenue@28 416 print('update vals:')
Nenue@28 417 for k,v in pairs(self.line) do
Nenue@28 418 print(k, v)
Nenue@28 419 end
Nenue@28 420
Nenue@28 421 if self.line.format then
Nenue@28 422 self.status:SetFormattedText(self.line.format, quantity, requiredQuantity)
Nenue@28 423 end
Nenue@28 424
Nenue@28 425 local progress = (quantity / requiredQuantity)
Nenue@28 426 if progress >= 1 then
Nenue@28 427 self.fg:Show()
Nenue@28 428 self.fg:SetWidth(self.width - progressBorder * 2)
Nenue@28 429 elseif progress > 0 then
Nenue@28 430 self.fg:Show()
Nenue@28 431 print('color:', 1-progress*2 , progress*2 - 1,0,1)
Nenue@28 432 print('width:', (self.width -progressBorder * 2) * progress)
Nenue@28 433 self.fg:SetTexture(1-progress*2 , progress*2,0,1)
Nenue@28 434 self.fg:SetWidth((self.width -progressBorder * 2) * progress)
Nenue@28 435 else
Nenue@28 436 self.fg:Hide()
Nenue@28 437 end
Nenue@28 438 end
Nenue@28 439
Nenue@28 440
Nenue@28 441 T.InitializeWidget.Hidden = function (self)
Nenue@28 442 self.height = 0
Nenue@28 443 end
Nenue@28 444 T.UpdateWidget.Hidden = function (self)
Nenue@28 445 self.height= 0
Nenue@28 446 end