forked from Road-block/RogueFocus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRogueFocusOptions.lua
More file actions
123 lines (104 loc) · 3.61 KB
/
RogueFocusOptions.lua
File metadata and controls
123 lines (104 loc) · 3.61 KB
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
----------------------------------------------------------------------------------------------------
-- Rogue Focus: Options
----------------------------------------------------------------------------------------------------
RogueFocusOptions = { };
local _G = getfenv(0);
----------------------------------------------------------------------------------------------------
-- Widgets Handlers
----------------------------------------------------------------------------------------------------
function RogueFocusOptions:Handler()
if(RogueFocusOptionsFrame:IsVisible()) then
HideUIPanel(RogueFocusOptionsFrame);
else
ShowUIPanel(RogueFocusOptionsFrame);
end
end
----------------------------------------------------------------------------------------------------
-- Scaling
----------------------------------------------------------------------------------------------------
local function RogueFocusOptionsScaleSlider_Init()
if(not RogueFocusOptions.scaleSliderLoaded) then
local Text, Low, Full;
Text = _G[this:GetName().."Text"];
Low = _G[this:GetName().."Low"];
High = _G[this:GetName().."High"];
Text:SetText(ROGUEFOCUS_SCALE);
Low:SetText(ROGUEFOCUS_LOW);
High:SetText(ROGUEFOCUS_HIGH);
this:SetMinMaxValues(1.0, 2.0);
this:SetValueStep(.1);
RogueFocusOptions.scaleSliderLoaded = true;
end
local value = format("%.1f", RogueFocusConfig.Scale);
_G[this:GetName().."Value"]:SetText(value);
RogueFocusFrame:SetScale(RogueFocusConfig.Scale);
end
function RogueFocusOptions:ScaleSlider_OnShow()
RogueFocusOptionsScaleSlider_Init();
this:SetValue(RogueFocusConfig.Scale);
end
function RogueFocusOptions:ScaleSlider_OnValueChanged()
RogueFocusConfig.Scale = this:GetValue();
RogueFocusOptionsScaleSlider_Init();
end
----------------------------------------------------------------------------------------------------
-- Combat
----------------------------------------------------------------------------------------------------
function RogueFocusOptions:CombatCheckButton_OnShow()
this:SetChecked(RogueFocusConfig.InCombat);
end
function RogueFocusOptions:StealthCheckButton_OnShow()
this:SetChecked(RogueFocusConfig.InStealth);
end
function RogueFocusOptions:OtherCheckButton_OnShow()
this:SetChecked(RogueFocusConfig.InOther);
end
function RogueFocusOptions:CombatCheckButton_OnClick()
if(1 == this:GetChecked()) then
RogueFocusConfig.InCombat = true;
else
RogueFocusConfig.InCombat = false;
end
RogueFocus:Toggle();
end
function RogueFocusOptions:StealthCheckButton_OnClick()
if(1 == this:GetChecked()) then
RogueFocusConfig.InStealth = true;
else
RogueFocusConfig.InStealth = false;
end
RogueFocus:Toggle();
end
function RogueFocusOptions:OtherCheckButton_OnClick()
if(1 == this:GetChecked()) then
RogueFocusConfig.InOther = true;
else
RogueFocusConfig.InOther = false;
end
RogueFocus:Toggle();
end
----------------------------------------------------------------------------------------------------
-- Audio & Locking
----------------------------------------------------------------------------------------------------
function RogueFocusOptions:AudioCheckButton_OnShow()
this:SetChecked(RogueFocusConfig.Audible);
end
function RogueFocusOptions:AudioCheckButton_OnClick()
if(1 == this:GetChecked()) then
RogueFocusConfig.Audible = true;
else
RogueFocusConfig.Audible = false;
end
RogueFocus:Toggle();
end
function RogueFocusOptions:LockCheckButton_OnShow()
this:SetChecked(RogueFocusConfig.Locked);
end
function RogueFocusOptions:LockCheckButton_OnClick()
if(1 == this:GetChecked()) then
RogueFocusConfig.Locked = true;
else
RogueFocusConfig.Locked = false;
end
RogueFocus:Toggle();
end