-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example.luau
296 lines (242 loc) · 8.48 KB
/
Example.luau
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
local Library = loadstring(game:HttpGetAsync("https://github.com/ActualMasterOogway/Fluent-Renewed/releases/latest/download/Fluent.luau"))()
local SaveManager = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/ActualMasterOogway/Fluent-Renewed/master/Addons/SaveManager.luau"))()
local InterfaceManager = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/ActualMasterOogway/Fluent-Renewed/master/Addons/InterfaceManager.luau"))()
local Window = Library:CreateWindow{
Title = `Fluent {Library.Version}`,
SubTitle = "by Actual Master Oogway",
TabWidth = 160,
Size = UDim2.fromOffset(830, 525),
Resize = true, -- Resize this ^ Size according to a 1920x1080 screen, good for mobile users but may look weird on some devices
MinSize = Vector2.new(470, 380),
Acrylic = true, -- The blur may be detectable, setting this to false disables blur entirely
Theme = "Dark",
MinimizeKey = Enum.KeyCode.RightControl -- Used when theres no MinimizeKeybind
}
-- Fluent Renewed provides ALL 1470 Lucide 0.395.0 Icons https://lucide.dev/icons/ for the tabs, icons are optional
local Tabs = {
Main = Window:CreateTab{
Title = "Main",
Icon = "circle-user-round"
},
Settings = Window:CreateTab{
Title = "Settings",
Icon = "settings"
}
}
local Options = Library.Options
Library:Notify{
Title = "Notification",
Content = "This is a notification",
SubContent = "SubContent", -- Optional
Duration = 5 -- Set to nil to make the notification not disappear
}
local Paragraph = Tabs.Main:CreateParagraph("Paragraph", {
Title = "Paragraph",
Content = "This is a paragraph.\nSecond line!"
})
print(Paragraph.Value)
Paragraph:SetValue("This paragraph text is changed!")
print(Paragraph.Value)
Tabs.Main:CreateParagraph("Aligned Paragraph", {
Title = "Paragraph",
Content = "This is a paragraph with a center alignment!",
TitleAlignment = "Middle",
ContentAlignment = Enum.TextXAlignment.Center
})
Tabs.Main:CreateButton{
Title = "Button",
Description = "Very important button",
Callback = function()
Window:Dialog{
Title = "Title",
Content = "This is a dialog",
Buttons = {
{
Title = "Confirm",
Callback = function()
print("Confirmed the dialog.")
end
},
{
Title = "Cancel",
Callback = function()
print("Cancelled the dialog.")
end
}
}
}
end
}
local Toggle = Tabs.Main:CreateToggle("MyToggle", {Title = "Toggle", Default = false })
Toggle:OnChanged(function()
print("Toggle changed:", Options.MyToggle.Value)
end)
Options.MyToggle:SetValue(false)
local Slider = Tabs.Main:CreateSlider("Slider", {
Title = "Slider",
Description = "This is a slider",
Default = 2,
Min = 0,
Max = 5,
Rounding = 1,
Callback = function(Value)
print("Slider was changed:", Value)
end
})
Slider:OnChanged(function(Value)
print("Slider changed:", Value)
end)
Slider:SetValue(3)
local Dropdown = Tabs.Main:CreateDropdown("Dropdown", {
Title = "Dropdown",
Values = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen"},
Multi = false,
Default = 1,
})
Dropdown:SetValue("four")
Dropdown:OnChanged(function(Value)
print("Dropdown changed:", Value)
end)
local MultiDropdown = Tabs.Main:CreateDropdown("MultiDropdown", {
Title = "Dropdown",
Description = "You can select multiple values.",
Values = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen"},
Multi = true,
Default = {"seven", "twelve"},
})
MultiDropdown:SetValue{
three = true,
five = true,
seven = false
}
MultiDropdown:SetValues{"fifteen", "sixteen", "seventeen"}
MultiDropdown:OnChanged(function(Value)
local Values = {}
for Value, State in next, Value do
table.insert(Values, Value)
end
print("Mutlidropdown changed:", table.concat(Values, ", "))
end)
local MultiInstanceDropdown = Tabs.Main:CreateDropdown("MultiInstanceDropdown", {
Title = "Instance Dropdown",
Description = "You can select multiple values and any instance or any other value!",
Values = {workspace, 5, Enum.JoinSource, Enum.MarketplaceBulkPurchasePromptStatus.Error},
Multi = true,
Default = {workspace},
})
MultiInstanceDropdown:OnChanged(function(Value)
local Values = {}
for Value, State in next, Value do
table.insert(Values, typeof(Value))
end
print("Mutlidropdown with instance selection changed:", table.concat(Values, ", "))
end)
local Colorpicker = Tabs.Main:CreateColorpicker("Colorpicker", {
Title = "Colorpicker",
Default = Color3.fromRGB(96, 205, 255)
})
Colorpicker:OnChanged(function()
print("Colorpicker changed:", Colorpicker.Value)
end)
Colorpicker:SetValueRGB(Color3.fromRGB(0, 255, 140))
local TColorpicker = Tabs.Main:CreateColorpicker("TransparencyColorpicker", {
Title = "Colorpicker",
Description = "but you can change the transparency.",
Transparency = 0,
Default = Color3.fromRGB(96, 205, 255)
})
TColorpicker:OnChanged(function()
print(
"TColorpicker changed:", TColorpicker.Value,
"Transparency:", TColorpicker.Transparency
)
end)
local Keybind = Tabs.Main:CreateKeybind("Keybind", {
Title = "KeyBind",
Mode = "Toggle", -- Always, Toggle, Hold
Default = "LeftControl", -- String as the name of the keybind (MB1, MB2 for mouse buttons)
-- Occurs when the keybind is clicked, Value is `true`/`false`
Callback = function(Value)
print("Keybind clicked!", Value)
end,
-- Occurs when the keybind itself is changed, `New` is a KeyCode Enum OR a UserInputType Enum
ChangedCallback = function(New)
print("Keybind changed!", New)
end
})
-- OnClick is only fired when you press the keybind and the mode is Toggle
-- Otherwise, you will have to use Keybind:GetState()
Keybind:OnClick(function()
print("Keybind clicked:", Keybind:GetState())
end)
Keybind:OnChanged(function()
print("Keybind changed:", Keybind.Value)
end)
task.spawn(function()
while true do
wait(1)
-- example for checking if a keybind is being pressed
local state = Keybind:GetState()
if state then
print("Keybind is being held down")
end
if Library.Unloaded then break end
end
end)
Keybind:SetValue("MB2", "Toggle") -- Sets keybind to MB2, mode to Hold
local Input = Tabs.Main:CreateInput("Input", {
Title = "Input",
Default = "Default",
Placeholder = "Placeholder",
Numeric = false, -- Only allows numbers
Finished = false, -- Only calls callback when you press enter
Callback = function(Value)
print("Input changed:", Value)
end
})
Input:OnChanged(function()
print("Input updated:", Input.Value)
end)
Tabs.Main:CreateButton{
Title = "Really Really big Dropdown",
Description = "",
Callback = function()
local Values = {}
for i = 1, 1000 do
Values[i] = i
end
Tabs.Main:AddDropdown("BIGDropdown", {
Title = "Big Dropdown",
Values = Values,
Multi = false,
Default = 1,
})
end
}
-- Addons:
-- SaveManager (Allows you to have a configuration system)
-- InterfaceManager (Allows you to have a interface managment system)
-- Hand the library over to our managers
SaveManager:SetLibrary(Library)
InterfaceManager:SetLibrary(Library)
-- Ignore keys that are used by ThemeManager.
-- (we dont want configs to save themes, do we?)
SaveManager:IgnoreThemeSettings()
-- You can add indexes of elements the save manager should ignore
SaveManager:SetIgnoreIndexes{}
-- use case for doing it this way:
-- a script hub could have themes in a global folder
-- and game configs in a separate folder per game
InterfaceManager:SetFolder("FluentScriptHub")
SaveManager:SetFolder("FluentScriptHub/specific-game")
InterfaceManager:BuildInterfaceSection(Tabs.Settings)
SaveManager:BuildConfigSection(Tabs.Settings)
Window:SelectTab(1)
Library:Notify{
Title = "Fluent",
Content = "The script has been loaded.",
Duration = 8
}
-- You can use the SaveManager:LoadAutoloadConfig() to load a config
-- which has been marked to be one that auto loads!
SaveManager:LoadAutoloadConfig()