Mercurial > wow > buffalo2
comparison Templates.lua @ 102:1e511e9aaca5
- clean up handler loading inconsistencies; exclude free frames from anchor cluster iterations, and remove extraneous PLAYER_LOGIN handling
- added a Setup method to the handler template that creates and reconciles a SavedVariables table for that module
| author | Nenue |
|---|---|
| date | Wed, 25 Jan 2017 23:11:27 -0500 |
| parents | 74d6d97a2d24 |
| children | 8df154a2bfd6 |
comparison
equal
deleted
inserted
replaced
| 101:f32b63c93275 | 102:1e511e9aaca5 |
|---|---|
| 3 -- Created: 10/24/2016 9:16 AM | 3 -- Created: 10/24/2016 9:16 AM |
| 4 -- %file-revision% | 4 -- %file-revision% |
| 5 -- | 5 -- |
| 6 -- Mover Widget base | 6 -- Mover Widget base |
| 7 local print = DEVIAN_WORKSPACE and function(...) _G.print('VnTemplate', ...) end or nop | 7 local print = DEVIAN_WORKSPACE and function(...) _G.print('VnTemplate', ...) end or nop |
| 8 local debugTemplates = {} | |
| 8 | 9 |
| 9 VeneerConfigLayerMixin = {} | 10 VeneerConfigLayerMixin = {} |
| 10 VeneerAnimationMixin = {} | 11 VeneerAnimationMixin = {} |
| 11 VeneerHandlerMixin = { anchorPoint = 'CENTER' } | 12 VeneerHandlerMixin = { |
| 13 anchorPoint = 'CENTER', | |
| 14 data = {}, | |
| 15 } | |
| 12 | 16 |
| 13 function VeneerConfigLayerMixin:OnLoad() | 17 function VeneerConfigLayerMixin:OnLoad() |
| 14 local handler = self:GetParent() | 18 local handler = self:GetParent() |
| 15 print(handler:GetName(), 'configLayers') | 19 print(handler:GetName(), 'configLayers') |
| 16 handler.ConfigLayers = handler.ConfigLayers or {} | 20 handler.ConfigLayers = handler.ConfigLayers or {} |
| 51 Veneer:DynamicReanchor() | 55 Veneer:DynamicReanchor() |
| 52 end | 56 end |
| 53 function VeneerHandlerMixin:Reanchor (anchorAll) | 57 function VeneerHandlerMixin:Reanchor (anchorAll) |
| 54 Veneer:DynamicReanchor() | 58 Veneer:DynamicReanchor() |
| 55 end | 59 end |
| 60 function VeneerHandlerMixin:Setup() | |
| 61 local configName = self:GetName():gsub('^Veneer', '') | |
| 62 VeneerData[configName] = VeneerData[configName] or {} | |
| 63 | |
| 64 -- reconcile any data accumulated before login trigger | |
| 65 for k,v in pairs(self.data) do | |
| 66 if not VeneerData[configName][k] then | |
| 67 print('reconciling pre-data:', k, v) | |
| 68 VeneerData[configName][k] = v | |
| 69 end | |
| 70 end | |
| 71 | |
| 72 self.data = VeneerData[configName] | |
| 73 print('data table loaded:', configName) | |
| 74 self.initialized = true | |
| 75 end | |
| 56 | 76 |
| 57 function VeneerHandlerMixin:Print(...) | 77 function VeneerHandlerMixin:Print(...) |
| 58 local txt = '|cFFFFFF00'..self:GetName()..'|r:' | 78 local txt = '|cFFFFFF00'..self:GetName()..'|r:' |
| 59 for i = 1, select('#', ...) do | 79 for i = 1, select('#', ...) do |
| 60 txt = txt .. ' '.. tostring(select(i, ...)) | 80 txt = txt .. ' '.. tostring(select(i, ...)) |
| 61 end | 81 end |
| 62 | 82 |
| 83 | |
| 84 | |
| 63 DEFAULT_CHAT_FRAME:AddMessage(txt) | 85 DEFAULT_CHAT_FRAME:AddMessage(txt) |
| 64 end | 86 end |
