vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | simpleMinimap_Skins = simpleMinimap:NewModule("skins") |
2 | local L = AceLibrary("AceLocale-2.1"):GetInstance("simpleMinimap_Skins", true) |
||
3 | |||
4 | function simpleMinimap_Skins:OnInitialize() |
||
5 | self.db = simpleMinimap:AcquireDBNamespace("skins") |
||
6 | self.skins = { |
||
7 | { |
||
8 | shape="circle", |
||
9 | texture="Interface\\Minimap\\UI-Minimap-Border", |
||
10 | mask="textures\\MinimapMask" |
||
11 | },{ |
||
12 | shape="circle", |
||
13 | texture=nil, |
||
14 | mask="textures\\MinimapMask" |
||
15 | },{ |
||
16 | shape="square", |
||
17 | texture="Interface\\AddOns\\simpleMinimap_Skins\\skins\\SquareMinimap", |
||
18 | mask="Interface\\AddOns\\simpleMinimap_Skins\\skins\\SquareMinimapMask" |
||
19 | },{ |
||
20 | shape="square", |
||
21 | texture=nil, |
||
22 | mask="Interface\\AddOns\\simpleMinimap_Skins\\skins\\SquareMinimapMask" |
||
23 | },{ |
||
24 | shape="square", |
||
25 | texture="Interface\\AddOns\\simpleMinimap_Skins\\skins\\dLxTopRight", |
||
26 | mask="Interface\\AddOns\\simpleMinimap_Skins\\skins\\dLxTopRightMask" |
||
27 | },{ |
||
28 | shape="square", |
||
29 | texture=nil, |
||
30 | mask="Interface\\AddOns\\simpleMinimap_Skins\\skins\\dLxTopRightMask" |
||
31 | } |
||
32 | } |
||
33 | self.defaults = { enabled=true, skin=1 } |
||
34 | self.options = { |
||
35 | type="group", name=L.skins, desc=L.skins_desc, |
||
36 | args={ |
||
37 | title={ |
||
38 | type="header", order=1, name="simpleMinimap |cFFFFFFCC"..L.skins |
||
39 | }, |
||
40 | spacer1={ |
||
41 | type="header", order=2 |
||
42 | }, |
||
43 | enabled={ |
||
44 | type="toggle", order=3, name=L.enabled, desc=L.enabled_desc, |
||
45 | get=function() return(self.db.profile.enabled) end, |
||
46 | set=function(x) self.db.profile.enabled=x simpleMinimap:ToggleModuleActive(self, x) end |
||
47 | }, |
||
48 | spacer2={ |
||
49 | type="header", order=4, name="---" |
||
50 | }, |
||
51 | skin={ |
||
52 | type="group", order=10, name=L.skin, desc=L.skin_desc, |
||
53 | args={ |
||
54 | ["1"]={ |
||
55 | type="toggle", order=1, name="1 :: "..L.skin1, desc=L.skin1, |
||
56 | get=function() return(self.db.profile.skin==1) end, |
||
57 | set=function() self.db.profile.skin = 1 self:OnEnable() end |
||
58 | }, |
||
59 | ["2"]={ |
||
60 | type="toggle", order=2, name="2 :: "..L.skin2, desc=L.skin2, |
||
61 | get=function() return(self.db.profile.skin==2) end, |
||
62 | set=function() self.db.profile.skin = 2 self:OnEnable() end |
||
63 | }, |
||
64 | ["3"]={ |
||
65 | type="toggle", order = 3, name = "3 :: "..L.skin3, desc = L.skin3, |
||
66 | get = function() return(self.db.profile.skin==3) end, |
||
67 | set = function() self.db.profile.skin = 3 self:OnEnable() end |
||
68 | }, |
||
69 | ["4"]={ |
||
70 | type="toggle", order=4, name="4 :: "..L.skin4, desc=L.skin4, |
||
71 | get=function() return(self.db.profile.skin==4) end, |
||
72 | set=function() self.db.profile.skin = 4 self:OnEnable() end |
||
73 | }, |
||
74 | ["5"]={ |
||
75 | type="toggle", order=5, name="5 :: "..L.skin5, desc=L.skin5, |
||
76 | get=function() return(self.db.profile.skin==5) end, |
||
77 | set=function() self.db.profile.skin=5 self:OnEnable() end |
||
78 | }, |
||
79 | ["6"]={ |
||
80 | type="toggle", order=6, name="6 :: "..L.skin6, desc=L.skin6, |
||
81 | get=function() return(self.db.profile.skin==6) end, |
||
82 | set=function() self.db.profile.skin=6 self:OnEnable() end |
||
83 | } |
||
84 | } |
||
85 | } |
||
86 | } |
||
87 | } |
||
88 | simpleMinimap.options.args.modules.args.skins = self.options |
||
89 | simpleMinimap:RegisterDefaults("skins", "profile", self.defaults) |
||
90 | end |
||
91 | -- |
||
92 | function simpleMinimap_Skins:OnEnable() |
||
93 | if(self.db.profile.enabled) then |
||
94 | simpleMinimap:UpdateScreen() |
||
95 | else |
||
96 | simpleMinimap:ToggleModuleActive(self, false) |
||
97 | end |
||
98 | end |
||
99 | -- |
||
100 | function simpleMinimap_Skins:OnDisable() |
||
101 | simpleMinimap:UpdateScreen() |
||
102 | end |
||
103 | -- |
||
104 | function simpleMinimap_Skins:GetButtonPos(vector) |
||
105 | local x, y |
||
106 | if(simpleMinimap:IsModuleActive(self) and self:GetShape() == "square") then |
||
107 | x = math.max(-81, math.min(110 * cos(vector), 81)) |
||
108 | y = math.max(-81, math.min(110 * sin(vector), 81)) |
||
109 | else |
||
110 | x = 81 * cos(vector) |
||
111 | y = 81 * sin(vector) |
||
112 | end |
||
113 | return 52 - x, y - 54 |
||
114 | end |
||
115 | -- |
||
116 | function simpleMinimap_Skins:UpdateScreen() |
||
117 | if(simpleMinimap:IsModuleActive(self)) then |
||
118 | MinimapBorder:SetTexture(self.skins[self.db.profile.skin]["texture"]) |
||
119 | Minimap:SetMaskTexture(self.skins[self.db.profile.skin]["mask"]) |
||
120 | else |
||
121 | MinimapBorder:SetTexture("Interface\\Minimap\\UI-Minimap-Border") |
||
122 | Minimap:SetMaskTexture("textures\\MinimapMask") |
||
123 | end |
||
124 | end |
||
125 | -- |
||
126 | function simpleMinimap_Skins:GetShape() |
||
127 | if(simpleMinimap:IsModuleActive(self)) then return(self.skins[self.db.profile.skin].shape) end |
||
128 | end |