-
Notifications
You must be signed in to change notification settings - Fork 6
/
GUIConfig.lua
164 lines (127 loc) · 4.44 KB
/
GUIConfig.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
161
162
163
164
local addonName, addonTable = ...;
local L = addonTable["Locale"];
function CatchTheWindConfigMenuButton_OnClick(self, button)
for num, button in pairs(self:GetParent().menuButtonsTable) do
button:Enable();
end
PlaySound("igMainMenuOptionCheckBoxOn");
self:Disable();
self.func();
end
function CatchTheWindConfigCheckButton_OnClick(self, button)
if(self:GetChecked()) then
self.text:SetTextColor(0.4, 1, 0.4);
else
self.text:SetTextColor(1, 0.4, 0.4);
end
PlaySound("igMainMenuOptionCheckBoxOn");
self.func(self:GetChecked());
end
function CatchTheWindConfig_OnLoad(self)
self.cameraMenuButton.text:SetText(L.CAMERA);
self.questMenuButton.text:SetText(L.QUEST);
self.creditsMenuButton.text:SetText(L.CREDITS);
self.menuButtonsTable = {
self.cameraMenuButton,
self.questMenuButton,
self.creditsMenuButton,
};
end
function CatchTheWindConfig_OnShow()
--shows the first tab
CatchTheWindConfigMenuButton_OnClick(CatchTheWindConfigCameraMenuButton);
--load savedVariables and update buttons
local menu = CatchTheWindConfigCameraMenu;
menu.toggleCamera:SetChecked(CatchTheWindSV[UnitName("player")]["CameraEnabled"]);
if(CatchTheWindSV[UnitName("player")]["CameraEnabled"]) then
menu.toggleCamera.text:SetTextColor(0.4, 1, 0.4);
else
menu.toggleCamera.text:SetTextColor(1, 0.4, 0.4);
--if the camera is not enable, disable "Save View" and "Custom View" button
menu.saveView:Disable();
menu.customView:Disable();
return;
end
menu.saveView:SetChecked(CatchTheWindSV[UnitName("player")]["SaveView"]);
if(CatchTheWindSV[UnitName("player")]["SaveView"]) then
menu.saveView.text:SetTextColor(0.4, 1, 0.4);
else
menu.saveView.text:SetTextColor(1, 0.4, 0.4);
end
menu.customView:SetChecked(CatchTheWindSV[UnitName("player")]["CustomView"]);
if(CatchTheWindSV[UnitName("player")]["CustomView"]) then
menu.customView.text:SetTextColor(0.4, 1, 0.4);
else
menu.customView.text:SetTextColor(1, 0.4, 0.4);
end
end
function CatchTheWindConfigCameraMenuToggleCamera_OnLoad(self)
self.text:SetText(L.ENABLE_CAMERA_ZOOM);
self.tooltipText = L.ENABLE_CAMERA_ZOOM_TOOLTIP;
self.func = function(newValue)
CatchTheWindSV[UnitName("player")]["CameraEnabled"] = newValue;
if(newValue == nil) then
self:GetParent().saveView:Disable();
CatchTheWindSV[UnitName("player")]["SaveView"] = nil;
self:GetParent().customView:Disable();
CatchTheWindSV[UnitName("player")]["CustomView"] = nil;
self:GetParent().customView.func();
else
self:GetParent().saveView:Enable();
self:GetParent().customView:Enable();
end
end
end
function CatchTheWindConfigCameraMenuSaveView_OnLoad(self)
self.text:SetText(L.SAVE_YOUR_VIEW);
self.tooltipText = L.SAVE_YOUR_VIEW_TOOLTIP;
self.func = function(newValue)
CatchTheWindSV[UnitName("player")]["SaveView"] = newValue;
end
end
function CatchTheWindConfigCameraMenuCustomView_OnLoad(self)
self.text:SetText(L.CUSTOM_VIEW);
self.tooltipText = L.CUSTOM_VIEW_TOOLTIP;
self.func = function(newValue)
if(newValue) then
SaveView(2);
else
SetView(2);
ResetView(2);
ResetView(2);
SaveView(2);
end
CatchTheWindSV[UnitName("player")]["CustomView"] = newValue;
end
end
function CatchTheWindConfigQuestMenuPreviousText_OnLoad(self)
self.text:SetText(L.SHOW_PREVIOUS_TEXT);
self.tooltipText = L.SHOW_PREVIOUS_TEXT_TOOLTIP;
self.func = function(newValue)
CatchTheWindSV[UnitName("player")]["ShowPreviousText"] = newValue;
end
end
function CatchTheWindConfigQuestMenuTextSpeed_OnLoad(self)
self.text:SetText(L.CHANGE_TEXT_SPEED);
self.tooltipText = L.CHANGE_TEXT_SPEED_TOOLTIP;
self.tooltipRequirement = L.CHANGE_TEXT_SPEED_TOOLTIP2;
self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
end
function CatchTheWindConfigQuestMenuQuestSound_OnLoad(self)
self.text:SetText(L.ENABLE_QUEST_SOUND);
self.tooltipText = L.ENABLE_QUEST_SOUND_TOOLTIP;
self.func = function(newValue)
CatchTheWindSV[UnitName("player")]["QuestSoundEnabled"] = newValue;
end
end
local creditsText =
[[|cffff9966CatchTheWind|r created by |cff6699ffLanrutcon|r
|cffff9966Quest Reward Panel|r suggested by |cff6699ffKrainz|r
|cffff9966Previous Quest Text|r suggested by |cff6699ffMattOzone|r
|cffff9966Modifier NPC Interaction|r suggested by |cff6699ffihithim|r
|cffff9966Quest Sound|r suggested by |cff6699ffRaffiq|r
|cffff9966French translation|r made by |cff6699ffRaffiq|r
|cff99ff66Special Thanks|r to |cff6699ffJV|r]];
function CatchTheWindConfigCreditsMenu_OnLoad(self)
self.creditsText:SetText(creditsText);
end