forked from Swater96/VanillaGuide
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFrame_AboutFrame.lua
160 lines (143 loc) · 4.85 KB
/
Frame_AboutFrame.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
--[[--------------------------------------------------
----- VanillaGuide -----
------------------
Frame_AboutFrame.lua
Authors: mrmr
Version: 1.04.3
------------------------------------------------------
Description:
About Frame Object
1.00
-- Initial Ace2 release
1.99a
-- Ally addition starter version
1.03
-- No Changes. Just adjusting "version".
1.99x for a beta release was a weird choise.
1.04.1
-- About Frame object
1.04.2
-- no changes in here for this revision
1.04.3
-- no changes in here for this revision
------------------------------------------------------
Connection:
--]]--------------------------------------------------
--local VGuide = VGuide
Dv(" VGuide Frame_AboutFrame.lua Start")
objAboutFrame = {}
objAboutFrame.__index = objAboutFrame
--function objAboutFrame:new(fParent, tTexture, sCharInfo)
function objAboutFrame:new(fParent, tTexture, oSettings)
fParent = fParent or nil
local obj = {}
setmetatable(obj, self)
--local version = GetAddOnMetadata("VanillaGuide", "Version")
local version = GetAddOnMetadata("VanillaGuide", "Version")
local sAboutTextHorde = "|cccff1919Vanilla|ccceeeeeeGuide" ..
" |ccca1a1a1v|ccc4a4aa1" .. version .. "|r" ..
"\n\n\n|ccca1a1a1A 'remake' of the original|r" ..
"\n|cccff1919J|ccceeeeeeoana`s |cccff1919Horde|ccceeeeee Leveling Guide.|r" ..
"\n|ccca1a1a1in an in-game addon.\n" ..
"\n Made in |ccca11919mrmr|r|ccca1a1a1!|r"
local sAboutTextAlliance = "|cccff1919Vanilla|ccceeeeeeGuide" ..
" |ccca1a1a1v|ccc4a4aa1" .. version .. "|r" ..
"\n\n\n|ccca1a1a1A 'remake' of the original|r" ..
"\n|ccc3939aaB|ccceeeeeerian |ccc3939aaKopps|ccceeeeee Leveling Guide.|r" ..
"\n|ccca1a1a1in an in-game addon.\n" ..
"\n Made in |ccca11919mrmr|r|ccca1a1a1!|r"
local sAboutText = ""
local tCharInfo = oSettings:GetSettingsCharInfo()
if tCharInfo.Faction == "Horde" then
sAboutText = sAboutTextHorde
else
sAboutText = sAboutTextAlliance
end
local function Render_AF(fParent, tTexture, sName)
local frame = CreateFrame("Frame", sName)
frame:SetFrameStrata("TOOLTIP")
frame:SetFrameLevel(8)
frame:SetWidth(195)
frame:SetHeight(125)
frame:SetScale(1)
frame:SetPoint("BOTTOMLEFT", fParent, "TOPLEFT", 0, 10)
frame:SetBackdrop(tTexture.BACKDROP)
frame:SetBackdropColor(.01, .01, .01, .99)
frame:SetMovable(true)
frame:EnableMouse(true)
frame:SetClampedToScreen(true)
frame:RegisterForDrag("LeftButton")
return frame
end
local function Render_AFCloseButton(tParent, tTexture, sName)
local btn = CreateFrame("Button", sName, tParent)
btn:SetWidth(16)
btn:SetHeight(16)
btn:SetNormalTexture(tTexture.B_CLOSE.NORMAL)
btn:SetPushedTexture(tTexture.B_CLOSE.PUSHED)
btn:SetHighlightTexture(tTexture.B_CLOSE.HIGHLIGHT)
btn:SetPoint("TOPRIGHT", tParent, "TOPRIGHT", -5, -5)
return btn
end
local function Render_AFLabel(tParent, sName, sText)
local fs = tParent:CreateFontString(sName, "ARTWORK", "GameFontNormalSmall")
fs:SetPoint("CENTER", tParent, "CENTER", 0, 0)
fs:SetTextColor(.91, .79, .11, 1)
fs:SetJustifyH("CENTER")
fs:SetJustifyV("CENTER")
fs:SetText(sText)
return fs
end
-------------------------------
--- Creation
-------------------------------
obj.tWidgets = {}
-- About Frame
obj.tWidgets.frame_AboutFrame = Render_AF(fParent, tTexture, "VG_AboutFrame")
obj.tWidgets.button_CloseButton = Render_AFCloseButton(obj.tWidgets.frame_AboutFrame, tTexture, nil)
obj.tWidgets.fs_AboutFrame = Render_AFLabel(obj.tWidgets.frame_AboutFrame, nil, sAboutText)
-------------------------------
--- UI Events Handling
-------------------------------
obj.tWidgets.frame_AboutFrame:SetScript("OnMouseDown", function()
if arg1 == "LeftButton" and not this.isMoving then
this:StartMoving();
this.isMoving = true;
end
end)
obj.tWidgets.frame_AboutFrame:SetScript("OnMouseUp", function()
if arg1 == "LeftButton" and this.isMoving then
this:StopMovingOrSizing();
this.isMoving = false;
end
end)
obj.tWidgets.frame_AboutFrame:SetScript("OnHide", function()
if this.isMoving then
this:StopMovingOrSizing();
this.isMoving = false;
end
end)
obj.tWidgets.button_CloseButton:SetScript("OnClick", function()
local frame = this:GetParent()
frame:Hide()
end)
-------------------------------
--- Initialization
-------------------------------
obj.tWidgets.frame_AboutFrame:Hide()
--obj.tWidgets.frame_AboutFrame:Show()
obj.ShowFrame = function(self)
local f = obj.tWidgets.frame_AboutFrame
if not f:IsVisible() then
f:Show()
end
end
obj.HideFrame = function(self)
local f = obj.tWidgets.frame_AboutFrame
if f:IsVisible() then
f:Hide()
end
end
return obj
end
Dv(" VGuide Frame_AboutFrame.lua End")