Mercurial > wow > buffalo2
comparison Templates.lua @ 115:8c94bee4fdfc
- AddHandler simplified
- Centralized combat start/stop hooks
- WorldState removed
author | Nenue |
---|---|
date | Tue, 28 Mar 2017 07:02:26 -0400 |
parents | 26938ae258b7 |
children | 1f68c46bc4de |
comparison
equal
deleted
inserted
replaced
114:6748c98a6c6c | 115:8c94bee4fdfc |
---|---|
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 ADDON, Veneer = ... | 7 local ADDON, Veneer = ... |
8 local print = DEVIAN_WORKSPACE and function(...) _G.print('VnTemplate', ...) end or nop | 8 local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop |
9 local PlaySoundKitID = DEVIAN_WORKSPACE and PlaySoundKitID or nop | 9 local PlaySoundKitID = DEVIAN_WORKSPACE and PlaySoundKitID or nop |
10 local ipairs, pairs = ipairs, pairs | 10 local ipairs, pairs = ipairs, pairs |
11 local pack, unpack = pack, unpack | 11 local pack, unpack = pack, unpack |
12 | 12 |
13 local Handler, ConfigLayer, Animation = {}, {}, {} | 13 local Handler, ConfigLayer, Animation = {}, {}, {} |
28 print(handler:GetName(), 'configLayers') | 28 print(handler:GetName(), 'configLayers') |
29 handler.ConfigLayers = handler.ConfigLayers or {} | 29 handler.ConfigLayers = handler.ConfigLayers or {} |
30 for i, region in ipairs(handler.ConfigLayers) do | 30 for i, region in ipairs(handler.ConfigLayers) do |
31 region:SetShown(Veneer.ConfigMode) | 31 region:SetShown(Veneer.ConfigMode) |
32 end | 32 end |
33 | |
33 end | 34 end |
34 | 35 |
35 function ConfigLayer:OnUpdate() | 36 function ConfigLayer:OnUpdate() |
36 local handler = self:GetParent() | 37 local handler = self:GetParent() |
37 handler.ConfigLayers = handler.ConfigLayers or {} | 38 handler.ConfigLayers = handler.ConfigLayers or {} |
69 Veneer:DynamicReanchor() | 70 Veneer:DynamicReanchor() |
70 end | 71 end |
71 | 72 |
72 -- Replace if module needs to do more than reconcile SavedVariables pointers | 73 -- Replace if module needs to do more than reconcile SavedVariables pointers |
73 function Handler:Setup() | 74 function Handler:Setup() |
75 print(self:GetName(), '|cFF00FF88Setup()') | |
74 local configName = self:GetName():gsub('^Veneer', '') | 76 local configName = self:GetName():gsub('^Veneer', '') |
75 VeneerData[configName] = VeneerData[configName] or self.defaultSettings or {} | 77 VeneerData[configName] = VeneerData[configName] or self.defaultSettings or {} |
76 | 78 |
77 for k,v in pairs(self.data) do | 79 for k,v in pairs(self.data) do |
78 if not VeneerData[configName][k] then | 80 if not VeneerData[configName][k] then |
79 print('reconciling pre-data:', k, v) | 81 print('reconciling pre-data:', k, v) |
80 VeneerData[configName][k] = v | 82 VeneerData[configName][k] = v |
81 end | 83 end |
82 end | 84 end |
85 | |
86 if self.EventList then | |
87 for _, event in ipairs(self.EventList) do | |
88 print(self:GetName(), event, 'registered') | |
89 self:RegisterEvent(event) | |
90 end | |
91 end | |
92 | |
83 local guid = UnitGUID('player') | 93 local guid = UnitGUID('player') |
84 self.data = VeneerData[configName] | 94 self.data = VeneerData[configName] |
85 self.data[guid] = self.data[guid] or {} | 95 self.data[guid] = self.data[guid] or {} |
86 self.profile = self.data[guid] | 96 self.profile = self.data[guid] |
87 print('data table loaded:', configName) | 97 print('data table loaded:', configName) |