Repository navigation
Expand file tree
/
Copy pathDivineUI.lua
More file actions
1572 lines (1454 loc) · 61.5 KB
/
Copy pathDivineUI.lua
File metadata and controls
1572 lines (1454 loc) · 61.5 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
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- =====================================================================
-- DivineUI | iOS 18 Dark Glass - Biblioteca Completa v1.1
-- Autor: Divine Hub
-- Base: Template iOS 18 Dark Glass -> Evoluido para lib WindUI-like
-- Uso: local DivineUI = loadstring(game:HttpGet("https://raw.githubusercontent.com/Ryanabcraft/DivineUI/main/DivineUI.lua"))()
-- =====================================================================
local DivineUI = {}
DivineUI.__index = DivineUI
DivineUI.Version = "1.2.7"
DivineUI.ConfigFolder = "DivineUI_Configs"
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local LP = Players.LocalPlayer
local Theme = {
Bg = Color3.fromRGB(24, 20, 32),
BgTrans = 0.12,
Card = Color3.fromRGB(36, 30, 48),
CardTrans = 0.38,
CardStroke = Color3.fromRGB(75, 60, 95),
Accent = Color3.fromRGB(175, 82, 222),
Accent2 = Color3.fromRGB(147, 51, 234),
AccentLight = Color3.fromRGB(216, 180, 254),
Text = Color3.fromRGB(255, 255, 255),
SubText = Color3.fromRGB(180, 175, 195),
Muted = Color3.fromRGB(120, 115, 135),
SwitchOff = Color3.fromRGB(58, 52, 70),
Separator = Color3.fromRGB(60, 50, 80),
Success = Color3.fromRGB(52, 211, 153),
Warning = Color3.fromRGB(251, 191, 36),
Error = Color3.fromRGB(248, 113, 113),
}
-- Lucide-like icon map (ImageLabel) - fallback to text if not found
local ICONS = {
["egg"] = "rbxassetid://6031075938",
["eye"] = "rbxassetid://6031090997",
["paw-print"] = "rbxassetid://6031094677",
["wrench"] = "rbxassetid://6031094678",
["user"] = "rbxassetid://6031090997",
["settings"] = "rbxassetid://6031090997",
["zap"] = "rbxassetid://6031090997",
["sprout"] = "rbxassetid://6031090997",
["flame"] = "rbxassetid://6031090997",
["moon"] = "rbxassetid://6031090997",
["sun"] = "rbxassetid://6031090997",
["map"] = "rbxassetid://6031090997",
["x"] = "rbxassetid://6031090997",
["chevron-down"] = "rbxassetid://6031090997",
["chevron-up"] = "rbxassetid://6031090997",
}
local function getGuiParent()
if gethui then return gethui() end
local ok, core = pcall(function() return game:GetService("CoreGui") end)
if ok and core then return core end
return LP:WaitForChild("PlayerGui")
end
local function corner(parent, radius)
local c = Instance.new("UICorner")
c.CornerRadius = radius
c.Parent = parent
return c
end
local function stroke(parent, color, thickness, trans)
local s = Instance.new("UIStroke")
s.Color = color
s.Thickness = thickness or 1
s.Transparency = trans or 0
s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
s.Parent = parent
return s
end
local function padding(parent, l, t, r, b)
local p = Instance.new("UIPadding")
p.PaddingLeft = UDim.new(0, l or 0)
p.PaddingTop = UDim.new(0, t or 0)
p.PaddingRight = UDim.new(0, r or 0)
p.PaddingBottom = UDim.new(0, b or 0)
p.Parent = parent
return p
end
local function tween(obj, info, props)
pcall(function()
TweenService:Create(obj, info, props):Play()
end)
end
local function toHex(c)
return string.format("#%02X%02X%02X", math.floor(c.R*255), math.floor(c.G*255), math.floor(c.B*255))
end
local function fromHex(hex)
hex = hex:gsub("#","")
if #hex ~= 6 then return nil end
local r = tonumber(hex:sub(1,2),16)
local g = tonumber(hex:sub(3,4),16)
local b = tonumber(hex:sub(5,6),16)
if r and g and b then return Color3.fromRGB(r,g,b) end
return nil
end
local function keyToString(key)
if typeof(key) == "EnumItem" then return key.Name end
return tostring(key)
end
local function ensureFolder(folder)
if makefolder and not pcall(function() return isfolder(folder) end) then
pcall(makefolder, folder)
elseif makefolder then
local ok, exists = pcall(isfolder, folder)
if ok and not exists then pcall(makefolder, folder) end
end
end
-- =====================================================================
-- WINDOW
-- =====================================================================
function DivineUI:CreateWindow(opts)
opts = opts or {}
local IsMobile = UserInputService.TouchEnabled and not UserInputService.MouseEnabled
if UserInputService.TouchEnabled and UserInputService.KeyboardEnabled then
-- Studio with keyboard, still check mouse
IsMobile = UserInputService.TouchEnabled and not UserInputService.MouseEnabled
end
if opts.ForceMobile or (getgenv and getgenv().DivineUI_ForceMobile) then
IsMobile = true
end
if opts.ForceDesktop then
IsMobile = false
end
-- Fallback for PC with touch screen
if UserInputService.TouchEnabled and UserInputService.MouseEnabled and not opts.ForceMobile and not (getgenv and getgenv().DivineUI_ForceMobile) then
IsMobile = false
end
local defaultSize = IsMobile and UDim2.fromOffset(360, 380) or UDim2.fromOffset(560, 420)
local defaultSideBar = IsMobile and 110 or 150
local title = opts.Title or "Divine Hub"
local subtitle = opts.Subtitle or "iOS 18 EDITION"
local size = opts.Size or defaultSize
if IsMobile and size.X.Offset >= 500 then
size = UDim2.fromOffset(360, 380)
end
local pos = opts.Position or UDim2.new(0.5, -size.X.Offset/2, 0.5, -size.Y.Offset/2)
local platformScale = IsMobile and 0.9 or 1
local accentObjects = {}
local parent = getGuiParent()
if parent:FindFirstChild("DivineHub_UI") then
parent.DivineHub_UI:Destroy()
end
local Gui = Instance.new("ScreenGui")
Gui.Name = "DivineHub_UI"
Gui.ResetOnSpawn = false
Gui.IgnoreGuiInset = true
Gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
Gui.DisplayOrder = 999
pcall(function() Gui.Parent = parent end)
if not Gui.Parent then Gui.Parent = LP:WaitForChild("PlayerGui") end
if platformScale ~= 1 then
local sc = Instance.new("UIScale")
sc.Scale = platformScale
sc.Parent = Gui
end
local Main = Instance.new("Frame")
Main.Name = "MainFrame"
Main.Size = size
Main.Position = pos
Main.BackgroundColor3 = Theme.Bg
Main.BackgroundTransparency = Theme.BgTrans
Main.BorderSizePixel = 0
Main.ClipsDescendants = true
Main.Parent = Gui
corner(Main, UDim.new(0, 22))
local MainStroke = stroke(Main, Theme.Accent, 1.2, 0.35)
table.insert(accentObjects, {obj=MainStroke, prop="Color"})
local fullSize = size
local miniSize = UDim2.new(fullSize.X.Scale, fullSize.X.Offset, 0, 54)
local Header = Instance.new("Frame")
Header.Name = "Header"
Header.Size = UDim2.new(1, 0, 0, 54)
Header.BackgroundTransparency = 1
Header.Parent = Main
local TitleLbl = Instance.new("TextLabel")
TitleLbl.Name = "Title"
TitleLbl.Text = title
TitleLbl.Font = Enum.Font.GothamBold
TitleLbl.TextSize = 16
TitleLbl.TextColor3 = Theme.Text
TitleLbl.BackgroundTransparency = 1
TitleLbl.Position = UDim2.new(0, 18, 0, 12)
TitleLbl.Size = UDim2.new(0, 220, 0, 16)
TitleLbl.TextXAlignment = Enum.TextXAlignment.Left
TitleLbl.Parent = Header
local SubLbl = Instance.new("TextLabel")
SubLbl.Name = "Subtitle"
SubLbl.Text = string.upper(subtitle)
SubLbl.Font = Enum.Font.GothamMedium
SubLbl.TextSize = 9
SubLbl.TextColor3 = Theme.AccentLight
SubLbl.BackgroundTransparency = 1
SubLbl.Position = UDim2.new(0, 18, 0, 30)
SubLbl.Size = UDim2.new(0, 280, 0, 12)
SubLbl.TextXAlignment = Enum.TextXAlignment.Left
SubLbl.Parent = Header
local CloseBtn = Instance.new("TextButton")
CloseBtn.Name = "Close"
CloseBtn.Text = "X"
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.TextSize = 12
CloseBtn.TextColor3 = Color3.fromRGB(200, 200, 210)
CloseBtn.BackgroundColor3 = Color3.fromRGB(50, 45, 60)
CloseBtn.BackgroundTransparency = 0.25
CloseBtn.Position = UDim2.new(1, -38, 0, 14)
CloseBtn.Size = UDim2.new(0, 26, 0, 26)
CloseBtn.AutoButtonColor = false
CloseBtn.Parent = Header
corner(CloseBtn, UDim.new(1, 0))
local MinBtn = Instance.new("TextButton")
MinBtn.Name = "Minimize"
MinBtn.Text = "-"
MinBtn.Font = Enum.Font.GothamBold
MinBtn.TextSize = 12
MinBtn.TextColor3 = Color3.fromRGB(200, 200, 210)
MinBtn.BackgroundColor3 = Color3.fromRGB(50, 45, 60)
MinBtn.BackgroundTransparency = 0.25
MinBtn.Position = UDim2.new(1, -70, 0, 14)
MinBtn.Size = UDim2.new(0, 26, 0, 26)
MinBtn.AutoButtonColor = false
MinBtn.Parent = Header
corner(MinBtn, UDim.new(1, 0))
local sideBarWidth = opts.SideBarWidth
if sideBarWidth == nil then sideBarWidth = defaultSideBar end
if IsMobile and sideBarWidth > 110 then
sideBarWidth = 110
end
local isSideBar = sideBarWidth and sideBarWidth > 0
local TabsBar = Instance.new("Frame")
TabsBar.Name = "TabsBar"
if isSideBar then
TabsBar.Size = UDim2.new(0, sideBarWidth, 1, -70)
TabsBar.Position = UDim2.new(0, 14, 0, 60)
else
TabsBar.Size = UDim2.new(1, -28, 0, 34)
TabsBar.Position = UDim2.new(0, 14, 0, 56)
end
TabsBar.BackgroundColor3 = Theme.Card
TabsBar.BackgroundTransparency = 0.35
TabsBar.BorderSizePixel = 0
TabsBar.Parent = Main
corner(TabsBar, UDim.new(0, 12))
stroke(TabsBar, Theme.CardStroke, 1, 0.5)
padding(TabsBar, 4, 4, 4, 4)
local TabsLayout = Instance.new("UIListLayout")
TabsLayout.FillDirection = isSideBar and Enum.FillDirection.Vertical or Enum.FillDirection.Horizontal
TabsLayout.Padding = UDim.new(0, 4)
TabsLayout.SortOrder = Enum.SortOrder.LayoutOrder
TabsLayout.Parent = TabsBar
local ContentWrap = Instance.new("Frame")
ContentWrap.Name = "ContentWrap"
if isSideBar then
ContentWrap.Size = UDim2.new(1, -sideBarWidth -28, 1, -70)
ContentWrap.Position = UDim2.new(0, 14 + sideBarWidth + 10, 0, 60)
else
ContentWrap.Size = UDim2.new(1, -28, 1, -102)
ContentWrap.Position = UDim2.new(0, 14, 0, 96)
end
ContentWrap.BackgroundColor3 = Theme.Card
ContentWrap.BackgroundTransparency = Theme.CardTrans
ContentWrap.BorderSizePixel = 0
ContentWrap.ClipsDescendants = true
ContentWrap.Parent = Main
corner(ContentWrap, UDim.new(0, 16))
stroke(ContentWrap, Theme.CardStroke, 1, 0.5)
-- Resizable handle (WindUI style)
if opts.Resizable ~= false then
local ResizeHandle = Instance.new("TextButton")
ResizeHandle.Name = "ResizeHandle"
ResizeHandle.Text = "⋯"
ResizeHandle.Font = Enum.Font.GothamBold
ResizeHandle.TextSize = 10
ResizeHandle.TextColor3 = Theme.Muted
ResizeHandle.BackgroundTransparency = 1
ResizeHandle.Size = UDim2.new(0, 20, 0, 20)
ResizeHandle.Position = UDim2.new(1, -20, 1, -20)
ResizeHandle.AutoButtonColor = false
ResizeHandle.ZIndex = 10
ResizeHandle.Parent = Main
local resizing, startPos, startSize
ResizeHandle.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
resizing = true
startPos = input.Position
startSize = Main.Size
input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then resizing=false end end)
end
end)
UserInputService.InputChanged:Connect(function(input)
if resizing and (input.UserInputType==Enum.UserInputType.MouseMovement or input.UserInputType==Enum.UserInputType.Touch) then
local delta = input.Position - startPos
local minW, minH
if IsMobile then
minW, minH = 320, 280
else
minW, minH = 480, 320
end
local maxW, maxH = 720, 520
if opts.MinSize then minW, minH = opts.MinSize.X, opts.MinSize.Y end
if opts.MaxSize then maxW, maxH = opts.MaxSize.X, opts.MaxSize.Y end
local newW = math.clamp(startSize.X.Offset + delta.X, minW, maxW)
local newH = math.clamp(startSize.Y.Offset + delta.Y, minH, maxH)
Main.Size = UDim2.new(0, newW, 0, newH)
if Main.Size.Y.Offset > 60 then
fullSize = Main.Size
end
end
end)
end
local NotifRoot = Instance.new("Frame")
NotifRoot.Name = "Notifications"
NotifRoot.Size = UDim2.new(0, 260, 1, 0)
NotifRoot.Position = UDim2.new(1, -272, 0, 0)
NotifRoot.BackgroundTransparency = 1
NotifRoot.Parent = Gui
local NotifLayout = Instance.new("UIListLayout")
NotifLayout.SortOrder = Enum.SortOrder.LayoutOrder
NotifLayout.Padding = UDim.new(0, 8)
NotifLayout.VerticalAlignment = Enum.VerticalAlignment.Bottom
NotifLayout.Parent = NotifRoot
padding(NotifRoot, 0, 0, 12, 12)
local Window = {}
Window.Gui = Gui
Window.Main = Main
Window.Header = Header
Window.TabsBar = TabsBar
Window.ContentWrap = ContentWrap
Window.Tabs = {}
Window.CurrentTab = nil
Window.Minimized = false
Window._notifRoot = NotifRoot
Window.Flags = {}
Window.FlagHandles = {}
Window.ConfigFolder = DivineUI.ConfigFolder
Window.AutoSave = opts.AutoSave or false
Window.ConfigName = opts.ConfigName or "default"
Window._accentObjects = accentObjects
function Window:SetAccent(color)
local old = Theme.Accent
Theme.Accent = color
Theme.Accent2 = Color3.new(math.clamp(color.R*0.85,0,1), math.clamp(color.G*0.85,0,1), math.clamp(color.B*0.85,0,1))
-- update registered objects
for _, info in ipairs(accentObjects) do
if info.obj and info.obj.Parent then
pcall(function()
if info.prop == "Color" then
tween(info.obj, TweenInfo.new(0.25), {Color = color})
else
tween(info.obj, TweenInfo.new(0.25), {[info.prop] = color})
end
end)
end
end
-- brute force fallback for objects not tracked (toggles, sliders that were active)
for _, obj in ipairs(Gui:GetDescendants()) do
if obj:IsA("UIStroke") and obj.Color == old then
tween(obj, TweenInfo.new(0.25), {Color = color})
elseif (obj:IsA("Frame") or obj:IsA("TextButton")) and obj.BackgroundColor3 == old then
tween(obj, TweenInfo.new(0.25), {BackgroundColor3 = color})
elseif obj:IsA("ScrollingFrame") and obj.ScrollBarImageColor3 == old then
tween(obj, TweenInfo.new(0.25), {ScrollBarImageColor3 = color})
end
end
self:Notify({Title="Tema", Desc="Cor atualizada!"})
end
DivineUI._lastWindow = Window
-- Drag
do
local dragging, dragInput, dragStart, startPos
Header.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = Main.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then dragging = false end
end)
end
end)
Header.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
local delta = input.Position - dragStart
Main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
end)
end
MinBtn.MouseButton1Click:Connect(function()
Window.Minimized = not Window.Minimized
if Window.Minimized then
fullSize = Main.Size
TabsBar.Visible = false
ContentWrap.Visible = false
tween(Main, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = miniSize})
MinBtn.Text = "+"
else
TabsBar.Visible = true
ContentWrap.Visible = true
tween(Main, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = fullSize})
MinBtn.Text = "-"
end
end)
CloseBtn.MouseButton1Click:Connect(function()
tween(Main, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1})
task.wait(0.18)
Gui:Destroy()
end)
for _, btn in ipairs({CloseBtn, MinBtn}) do
btn.MouseEnter:Connect(function() tween(btn, TweenInfo.new(0.15), {BackgroundTransparency = 0.05}) end)
btn.MouseLeave:Connect(function() tween(btn, TweenInfo.new(0.15), {BackgroundTransparency = 0.25}) end)
end
function Window:Notify(opts2)
opts2 = opts2 or {}
local t = opts2.Title or "DivineUI"
local d = opts2.Desc or opts2.Description or ""
local dur = opts2.Duration or 3
local card = Instance.new("Frame")
card.Size = UDim2.new(1, 0, 0, 62)
card.BackgroundColor3 = Theme.Bg
card.BackgroundTransparency = 0.08
card.BorderSizePixel = 0
card.Parent = NotifRoot
corner(card, UDim.new(0, 12))
stroke(card, Theme.Accent, 1, 0.4)
card.BackgroundTransparency = 1
local tl = Instance.new("TextLabel")
tl.Text = t
tl.Font = Enum.Font.GothamBold
tl.TextSize = 12
tl.TextColor3 = Theme.Text
tl.BackgroundTransparency = 1
tl.Position = UDim2.new(0, 12, 0, 10)
tl.Size = UDim2.new(1, -24, 0, 14)
tl.TextXAlignment = Enum.TextXAlignment.Left
tl.Parent = card
local dl = Instance.new("TextLabel")
dl.Text = d
dl.Font = Enum.Font.Gotham
dl.TextSize = 11
dl.TextColor3 = Theme.SubText
dl.BackgroundTransparency = 1
dl.Position = UDim2.new(0, 12, 0, 28)
dl.Size = UDim2.new(1, -24, 0, 24)
dl.TextXAlignment = Enum.TextXAlignment.Left
dl.TextYAlignment = Enum.TextYAlignment.Top
dl.TextWrapped = true
dl.Parent = card
tween(card, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0.08})
task.delay(dur, function()
tween(card, TweenInfo.new(0.25), {BackgroundTransparency = 1})
task.wait(0.26)
if card.Parent then card:Destroy() end
end)
end
function Window:SetTitle(newTitle, newSub)
TitleLbl.Text = newTitle or TitleLbl.Text
if newSub then SubLbl.Text = string.upper(newSub) end
end
function Window:Destroy() Gui:Destroy() end
function Window:Toggle(state) Gui.Enabled = state end
-- Config helpers
local function serializeValue(v)
if typeof(v) == "Color3" then return {__type="Color3", hex=toHex(v)}
elseif typeof(v) == "EnumItem" then return {__type="EnumItem", name=v.Name, enum=tostring(v.EnumType):gsub("Enum%.","")}
else return v end
end
local function deserializeValue(v)
if type(v) == "table" and v.__type == "Color3" then return fromHex(v.hex) or Color3.fromRGB(255,255,255)
elseif type(v) == "table" and v.__type == "EnumItem" then
local enumName = v.enum:gsub("Enum%.", "")
local ok, enumType = pcall(function() return Enum[enumName] end)
if ok and enumType then
local ok2, item = pcall(function() return enumType[v.name] end)
if ok2 and item then return item end
end
return Enum.KeyCode.Q
else return v end
end
function Window:_registerFlag(flag, handle, defaultValue, serializer)
if not flag then return end
Window.Flags[flag] = defaultValue
Window.FlagHandles[flag] = {handle=handle, serializer=serializer}
-- try autoload if file exists
if Window.AutoSave then
local ok, data = pcall(function()
if not isfile then return nil end
local path = Window.ConfigFolder.."/"..Window.ConfigName..".json"
if not isfile(path) then return nil end
return HttpService:JSONDecode(readfile(path))
end)
if ok and data and data[flag] ~= nil then
local v = deserializeValue(data[flag])
if handle and handle.Set then pcall(function() handle:Set(v) end) end
Window.Flags[flag] = v
end
end
end
function Window:SaveConfig(name)
name = name or Window.ConfigName
local out = {}
for flag, val in pairs(Window.Flags) do
out[flag] = serializeValue(val)
end
-- also collect from handles live values
for flag, info in pairs(Window.FlagHandles) do
if info.handle and info.handle.Get then
local ok, v = pcall(function() return info.handle:Get() end)
if ok then out[flag] = serializeValue(v) end
end
end
local json = HttpService:JSONEncode(out)
if writefile then
ensureFolder(Window.ConfigFolder)
local path = Window.ConfigFolder.."/"..name..".json"
pcall(writefile, path, json)
self:Notify({Title="Config", Desc="Salvo: "..name..".json"})
return true
else
warn("[DivineUI] writefile não disponível")
return false, json
end
end
function Window:LoadConfig(name)
name = name or Window.ConfigName
if not readfile or not isfile then warn("[DivineUI] readfile não disponível"); return false end
local path = Window.ConfigFolder.."/"..name..".json"
if not isfile(path) then self:Notify({Title="Config", Desc="Não encontrado: "..name}) return false end
local ok, data = pcall(function() return HttpService:JSONDecode(readfile(path)) end)
if not ok or type(data) ~= "table" then self:Notify({Title="Config", Desc="Erro ao ler "..name}) return false end
for flag, raw in pairs(data) do
local v = deserializeValue(raw)
Window.Flags[flag] = v
local info = Window.FlagHandles[flag]
if info and info.handle and info.handle.Set then
pcall(function() info.handle:Set(v) end)
end
end
self:Notify({Title="Config", Desc="Carregado: "..name})
return true
end
function Window:GetFlag(flag) return Window.Flags[flag] end
-- TAB CREATION
function Window:Tab(opts2)
opts2 = opts2 or {}
local name = opts2.Title or opts2.Name or ("Tab"..(#self.Tabs+1))
local icon = opts2.Icon or ""
local tabBtn = Instance.new("TextButton")
tabBtn.Name = name
tabBtn.Font = Enum.Font.GothamMedium
tabBtn.TextSize = 11
tabBtn.TextColor3 = Theme.SubText
tabBtn.BackgroundColor3 = Color3.fromRGB(58, 52, 70)
tabBtn.BackgroundTransparency = 1
tabBtn.AutoButtonColor = false
tabBtn.Parent = TabsBar
corner(tabBtn, UDim.new(0, 8))
if isSideBar then
tabBtn.Size = UDim2.new(1, -8, 0, 32)
if icon ~= "" then
if IsMobile and sideBarWidth <= 110 then
-- Mobile pequeno: sem ícone para não sobrepor texto
tabBtn.Text = name
tabBtn.TextXAlignment = Enum.TextXAlignment.Center
padding(tabBtn, 8, 0, 8, 0)
else
tabBtn.Text = " " .. name
tabBtn.TextXAlignment = Enum.TextXAlignment.Left
padding(tabBtn, 28, 0, 12, 0)
local iconImg = Instance.new("ImageLabel")
iconImg.Name = "Icon"
iconImg.Size = UDim2.new(0,16,0,16)
iconImg.Position = UDim2.new(0,8,0.5,-8)
iconImg.BackgroundTransparency = 1
iconImg.Image = ICONS[icon] or "rbxassetid://6031075938"
iconImg.ImageColor3 = Theme.SubText
iconImg.Parent = tabBtn
end
else
tabBtn.Text = name
tabBtn.TextXAlignment = Enum.TextXAlignment.Center
padding(tabBtn, 8, 0, 8, 0)
end
else
if icon ~= "" then
tabBtn.Text = " " .. name
tabBtn.TextXAlignment = Enum.TextXAlignment.Left
tabBtn.Size = UDim2.new(0, 0, 1, 0)
tabBtn.AutomaticSize = Enum.AutomaticSize.X
padding(tabBtn, 28, 0, 12, 0)
local iconImg = Instance.new("ImageLabel")
iconImg.Name = "Icon"
iconImg.Size = UDim2.new(0,16,0,16)
iconImg.Position = UDim2.new(0,8,0.5,-8)
iconImg.BackgroundTransparency = 1
iconImg.Image = ICONS[icon] or "rbxassetid://6031075938"
iconImg.ImageColor3 = Theme.SubText
iconImg.Parent = tabBtn
else
tabBtn.Text = name
tabBtn.Size = UDim2.new(0, 0, 1, 0)
tabBtn.AutomaticSize = Enum.AutomaticSize.X
padding(tabBtn, 12, 0, 12, 0)
end
end
local tabContent = Instance.new("ScrollingFrame")
tabContent.Name = name.."_Content"
tabContent.Size = UDim2.new(1, 0, 1, 0)
tabContent.BackgroundTransparency = 1
tabContent.BorderSizePixel = 0
tabContent.CanvasSize = UDim2.new(0, 0, 0, 0)
tabContent.AutomaticCanvasSize = Enum.AutomaticSize.None
tabContent.ScrollingDirection = Enum.ScrollingDirection.Y
tabContent.ScrollBarThickness = 4
tabContent.ScrollBarImageColor3 = Theme.Accent
tabContent.ScrollBarImageTransparency = 0.3
tabContent.VerticalScrollBarInset = Enum.ScrollBarInset.ScrollBar
tabContent.ScrollingEnabled = true
tabContent.Active = true
tabContent.ClipsDescendants = true
tabContent.Visible = false
tabContent.Parent = ContentWrap
padding(tabContent, 8, 8, 8, 8)
table.insert(accentObjects, {obj=tabContent, prop="ScrollBarImageColor3"})
local list = Instance.new("UIListLayout")
list.SortOrder = Enum.SortOrder.LayoutOrder
list.Padding = UDim.new(0, 0)
list.Parent = tabContent
list:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
tabContent.CanvasSize = UDim2.new(0, 0, 0, list.AbsoluteContentSize.Y + 16)
end)
local Tab = {}
Tab.Name = name
Tab.TabButton = tabBtn
Tab.Content = tabContent
Tab.Layout = list
Tab.Elements = {}
local function select()
for _, t in ipairs(Window.Tabs) do
t.Content.Visible = false
tween(t.TabButton, TweenInfo.new(0.2), {BackgroundTransparency = 1, BackgroundColor3 = Color3.fromRGB(58,52,70)})
t.TabButton.TextColor3 = Theme.SubText
local ic = t.TabButton:FindFirstChild("Icon")
if ic then tween(ic, TweenInfo.new(0.2), {ImageColor3 = Theme.SubText}) end
end
tabContent.Visible = true
tween(tabBtn, TweenInfo.new(0.2), {BackgroundTransparency = 0.08, BackgroundColor3 = Theme.Accent})
tabBtn.TextColor3 = Theme.Text
local selIcon = tabBtn:FindFirstChild("Icon")
if selIcon then tween(selIcon, TweenInfo.new(0.2), {ImageColor3 = Theme.Text}) end
Window.CurrentTab = Tab
end
tabBtn.MouseButton1Click:Connect(select)
tabBtn.MouseEnter:Connect(function()
if Window.CurrentTab ~= Tab then tween(tabBtn, TweenInfo.new(0.15), {BackgroundTransparency = 0.5}) end
end)
tabBtn.MouseLeave:Connect(function()
if Window.CurrentTab ~= Tab then tween(tabBtn, TweenInfo.new(0.15), {BackgroundTransparency = 1}) end
end)
function Tab:Divider()
local sep = Instance.new("Frame")
sep.Size = UDim2.new(1, -16, 0, 1)
sep.BackgroundColor3 = Theme.Separator
sep.BackgroundTransparency = 0.45
sep.BorderSizePixel = 0
sep.Parent = tabContent
return sep
end
function Tab:Section(opts3)
opts3 = opts3 or {}
local title = opts3.Title or opts3.Text or "Section"
local lbl = Instance.new("TextLabel")
lbl.Text = string.upper(title)
lbl.Font = Enum.Font.GothamBold
lbl.TextSize = 10
lbl.TextColor3 = Theme.AccentLight
lbl.BackgroundTransparency = 1
lbl.Size = UDim2.new(1, -16, 0, 18)
lbl.TextXAlignment = Enum.TextXAlignment.Left
lbl.Parent = tabContent
padding(lbl, 8, 0, 0, 0)
return lbl
end
function Tab:Label(opts3)
opts3 = opts3 or {}
local text = opts3.Text or opts3.Title or ""
local desc = opts3.Desc or ""
local f = Instance.new("Frame")
f.Size = UDim2.new(1, 0, 0, desc ~= "" and 44 or 28)
f.BackgroundTransparency = 1
f.Parent = tabContent
local a = Instance.new("TextLabel")
a.Text = text
a.Font = Enum.Font.GothamMedium
a.TextSize = 12
a.TextColor3 = Theme.Text
a.BackgroundTransparency = 1
a.Position = UDim2.new(0, 8, 0, 4)
a.Size = UDim2.new(1, -16, 0, 16)
a.TextXAlignment = Enum.TextXAlignment.Left
a.Parent = f
if desc ~= "" then
local b = Instance.new("TextLabel")
b.Text = desc
b.Font = Enum.Font.Gotham
b.TextSize = 10
b.TextColor3 = Theme.SubText
b.BackgroundTransparency = 1
b.Position = UDim2.new(0, 8, 0, 20)
b.Size = UDim2.new(1, -16, 0, 18)
b.TextXAlignment = Enum.TextXAlignment.Left
b.TextWrapped = true
b.Parent = f
end
return f
end
function Tab:Paragraph(opts3) return self:Label(opts3) end
function Tab:Button(opts3)
opts3 = opts3 or {}
local title = opts3.Title or opts3.Text or "Button"
local cb = opts3.Callback or function() end
local row = Instance.new("Frame")
row.Size = UDim2.new(1, 0, 0, 44)
row.BackgroundTransparency = 1
row.Parent = tabContent
local btn = Instance.new("TextButton")
btn.Text = ""
btn.AutoButtonColor = false
btn.Size = UDim2.new(1, -16, 0, 32)
btn.Position = UDim2.new(0, 8, 0, 6)
btn.BackgroundColor3 = Theme.Accent
btn.BorderSizePixel = 0
btn.Parent = row
corner(btn, UDim.new(0, 10))
table.insert(accentObjects, {obj=btn, prop="BackgroundColor3"})
local lbl = Instance.new("TextLabel")
lbl.Text = title
lbl.Font = Enum.Font.GothamBold
lbl.TextSize = 12
lbl.TextColor3 = Theme.Text
lbl.BackgroundTransparency = 1
lbl.Size = UDim2.new(1, -20, 1, 0)
lbl.Parent = btn
btn.MouseButton1Click:Connect(function()
tween(btn, TweenInfo.new(0.08), {BackgroundColor3 = Theme.Accent2})
task.wait(0.08)
tween(btn, TweenInfo.new(0.12), {BackgroundColor3 = Theme.Accent})
local ok, err = pcall(cb)
if not ok then warn("[DivineUI] Button error:", err) end
end)
btn.MouseEnter:Connect(function() tween(btn, TweenInfo.new(0.15), {BackgroundColor3 = Theme.Accent2}) end)
btn.MouseLeave:Connect(function() tween(btn, TweenInfo.new(0.15), {BackgroundColor3 = Theme.Accent}) end)
local handle = {}
function handle:SetText(t) lbl.Text = t end
function handle:Set(v) lbl.Text = tostring(v) end
function handle:Get() return lbl.Text end
function handle:Destroy() row:Destroy() end
return handle
end
function Tab:Toggle(opts3)
opts3 = opts3 or {}
local title = opts3.Title or opts3.Text or "Toggle"
local desc = opts3.Desc or opts3.Description or ""
local def = opts3.Default or opts3.Value or false
local cb = opts3.Callback or function() end
local flag = opts3.Flag
local row = Instance.new("Frame")
row.Size = UDim2.new(1, 0, 0, desc ~= "" and 58 or 48)
row.BackgroundTransparency = 1
row.Parent = tabContent
-- Título
local tLbl = Instance.new("TextLabel")
tLbl.Text = title
tLbl.Font = Enum.Font.GothamBold
tLbl.TextSize = 12
tLbl.TextColor3 = Theme.Text
tLbl.BackgroundTransparency = 1
tLbl.Position = UDim2.new(0, 10, 0, 10)
-- Responsivo:
-- reserva espaço para o switch à direita
tLbl.Size = UDim2.new(1, -82, 0, 16)
tLbl.TextXAlignment = Enum.TextXAlignment.Left
tLbl.TextTruncate = Enum.TextTruncate.AtEnd
tLbl.Parent = row
-- Descrição
if desc ~= "" then
local dLbl = Instance.new("TextLabel")
dLbl.Text = desc
dLbl.Font = Enum.Font.Gotham
dLbl.TextSize = 10
dLbl.TextColor3 = Theme.SubText
dLbl.BackgroundTransparency = 1
dLbl.Position = UDim2.new(0, 10, 0, 28)
-- Responsivo também
dLbl.Size = UDim2.new(1, -82, 0, 14)
dLbl.TextXAlignment = Enum.TextXAlignment.Left
dLbl.TextTruncate = Enum.TextTruncate.AtEnd
dLbl.Parent = row
end
-- Fundo do switch
local bg = Instance.new("TextButton")
bg.Text = ""
bg.AutoButtonColor = false
bg.Size = UDim2.new(0, 48, 0, 26)
bg.Position = UDim2.new(1, -58, 0.5, -13)
bg.BackgroundColor3 = def and Theme.Accent or Theme.SwitchOff
bg.BorderSizePixel = 0
bg.Parent = row
corner(bg, UDim.new(1, 0))
-- Bolinha do switch
local knob = Instance.new("Frame")
knob.Size = UDim2.new(0, 22, 0, 22)
knob.Position = def
and UDim2.new(1, -24, 0.5, -11)
or UDim2.new(0, 2, 0.5, -11)
knob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
knob.BorderSizePixel = 0
knob.Parent = bg
corner(knob, UDim.new(1, 0))
local state = def
local function set(v, noCB)
state = v
if flag then
Window.Flags[flag] = v
end
local pos = v
and UDim2.new(1, -24, 0.5, -11)
or UDim2.new(0, 2, 0.5, -11)
local col = v
and Theme.Accent
or Theme.SwitchOff
tween(
knob,
TweenInfo.new(
0.2,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
),
{
Position = pos
}
)
tween(
bg,
TweenInfo.new(
0.2,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
),
{
BackgroundColor3 = col
}
)
if not noCB then
pcall(cb, v)
end
end
bg.MouseButton1Click:Connect(function()
set(not state)
end)
local handle = {}
function handle:Set(v)
set(v)
end
function handle:Get()
return state
end
function handle:OnChanged(fn)
cb = fn
end
function handle:Destroy()
row:Destroy()
end
Window:_registerFlag(
flag,
handle,
def
)
table.insert(
Tab.Elements,
handle
)
return handle
end
function Tab:Slider(opts3)
opts3 = opts3 or {}
local title = opts3.Title or opts3.Text or "Slider"
local min = opts3.Min or opts3.Minimum or 0
local max = opts3.Max or opts3.Maximum or 100
local def = opts3.Default or opts3.Value or min
local step = opts3.Step or 1
local suffix = opts3.Suffix or ""
local cb = opts3.Callback or function() end
local flag = opts3.Flag
local row = Instance.new("Frame")
row.Size = UDim2.new(1, 0, 0, 68)
row.BackgroundTransparency = 1
row.Parent = tabContent
local tLbl = Instance.new("TextLabel")
tLbl.Text = title
tLbl.Font = Enum.Font.GothamBold
tLbl.TextSize = 12
tLbl.TextColor3 = Theme.Text
tLbl.BackgroundTransparency = 1