-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneralUI.lua
More file actions
376 lines (324 loc) · 12.9 KB
/
GeneralUI.lua
File metadata and controls
376 lines (324 loc) · 12.9 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
local GeneralUI = {}
local ThemeManager = require(script.Parent:WaitForChild("ThemeManager"))
function GeneralUI:CreateMain(customToggleKey, themeName)
local UserInputService = game:GetService("UserInputService")
local ScreenGui = Instance.new("ScreenGui")
local MainFrame = Instance.new("Frame")
local UICorner = Instance.new("UICorner")
local ResizeButton = Instance.new("ImageButton")
local DragHandle = Instance.new("Frame")
local ControlButtons = Instance.new("Frame")
local CloseButton = Instance.new("TextButton")
local MaximizeButton = Instance.new("TextButton")
local MinimizeButton = Instance.new("TextButton")
local Divider = Instance.new("Frame")
-- Glassmorphism için Blur Background
local BlurBackground = Instance.new("Frame")
local BlurCorner = Instance.new("UICorner")
-- Gradient Background
local GradientBackground = Instance.new("Frame")
local GradientCorner = Instance.new("UICorner")
local UIGradient = Instance.new("UIGradient")
local ExitMenu = Instance.new("Frame")
local ExitMenuCorner = Instance.new("UICorner")
local ExitMenuContent = Instance.new("Frame")
local ExitHeader = Instance.new("Frame")
local ExitHeaderCorner = Instance.new("UICorner")
local ExitCorner = Instance.new("UICorner")
local ExitTitle = Instance.new("TextLabel")
local ExitLine = Instance.new("Frame")
local ExitYes = Instance.new("TextButton")
local ExitYesCorner = Instance.new("UICorner")
local ExitYesStroke = Instance.new("UIStroke")
local ExitNo = Instance.new("TextButton")
local ExitNoCorner = Instance.new("UICorner")
local ExitNoStroke = Instance.new("UIStroke")
local ToggleKey = customToggleKey
local isHidden = false
local MinSize = Vector2.new(500, 400)
local DefaultSize = UDim2.new(0, 500, 0, 400)
local selectedTheme = ThemeManager:GetTheme(themeName)
local function getDarkerColor(color)
local h, s, v = color:ToHSV()
return Color3.fromHSV(h, s, math.clamp(v * 0.7, 0, 1))
end
ScreenGui.Name = "GeneralUI_Base"
ScreenGui.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.ResetOnSpawn = false
MainFrame.Name = "MainFrame"
MainFrame.Parent = ScreenGui
MainFrame.BackgroundColor3 = selectedTheme.MainColor
MainFrame.BackgroundTransparency = 0.3
MainFrame.Position = UDim2.new(0.5, -225, 0.5, -150)
MainFrame.Size = DefaultSize
MainFrame.BorderSizePixel = 0
MainFrame.ClipsDescendants = false
-- Gradient Background (en altta)
GradientBackground.Name = "GradientBackground"
GradientBackground.Parent = MainFrame
GradientBackground.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
GradientBackground.BackgroundTransparency = 0
GradientBackground.Size = UDim2.new(1, 0, 1, 0)
GradientBackground.Position = UDim2.new(0, 0, 0, 0)
GradientBackground.ZIndex = -2
GradientCorner.CornerRadius = UDim.new(0, 12)
GradientCorner.Parent = GradientBackground
UIGradient.Parent = GradientBackground
UIGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, selectedTheme.GradientStart or Color3.fromRGB(45, 85, 100)),
ColorSequenceKeypoint.new(1, selectedTheme.GradientEnd or Color3.fromRGB(25, 55, 70))
}
UIGradient.Rotation = 135
-- Blur Background (glassmorphism katmanı)
BlurBackground.Name = "BlurBackground"
BlurBackground.Parent = MainFrame
BlurBackground.BackgroundColor3 = selectedTheme.MainColor
BlurBackground.BackgroundTransparency = 0.25
BlurBackground.Size = UDim2.new(1, 0, 1, 0)
BlurBackground.Position = UDim2.new(0, 0, 0, 0)
BlurBackground.ZIndex = -1
BlurCorner.CornerRadius = UDim.new(0, 12)
BlurCorner.Parent = BlurBackground
if ThemeManager.Decorations then
for name, data in pairs(ThemeManager.Decorations) do
local Deco = Instance.new("ImageLabel")
Deco.Name = name
Deco.Parent = MainFrame
Deco.BackgroundTransparency = 1
Deco.Image = data.AssetId
Deco.ImageColor3 = data.Color or Color3.fromRGB(255, 255, 255)
Deco.ImageTransparency = data.Transparency or 0.5
Deco.Size = data.Size or UDim2.new(0, 100, 0, 100)
Deco.Position = data.Position or UDim2.new(0, 0, 0, 0)
Deco.ZIndex = data.ZIndex or -1
if data.Rotation then Deco.Rotation = data.Rotation end
end
end
UICorner.CornerRadius = UDim.new(0, 12)
UICorner.Parent = MainFrame
DragHandle.Name = "DragHandle"
DragHandle.Parent = MainFrame
DragHandle.Size = UDim2.new(1, 0, 0, 30)
DragHandle.BackgroundTransparency = 1
DragHandle.BorderSizePixel = 0
ControlButtons.Name = "ControlButtons"
ControlButtons.Parent = MainFrame
ControlButtons.AnchorPoint = Vector2.new(1, 0)
ControlButtons.Position = UDim2.new(1, -10, 0, 5)
ControlButtons.Size = UDim2.new(0, 75, 0, 20)
ControlButtons.BackgroundTransparency = 1
CloseButton.Name = "CloseButton"
CloseButton.Parent = ControlButtons
CloseButton.Size = UDim2.new(0, 20, 0, 20)
CloseButton.Position = UDim2.new(1, -20, 0, 0)
CloseButton.BackgroundTransparency = 1
CloseButton.Text = "X"
CloseButton.TextColor3 = selectedTheme.TextColor
CloseButton.TextSize = 12
CloseButton.Font = Enum.Font.GothamBold
MaximizeButton.Name = "MaximizeButton"
MaximizeButton.Parent = ControlButtons
MaximizeButton.Size = UDim2.new(0, 20, 0, 20)
MaximizeButton.Position = UDim2.new(1, -45, 0, 0)
MaximizeButton.BackgroundTransparency = 1
MaximizeButton.Text = "▢"
MaximizeButton.TextColor3 = selectedTheme.TextColor
MaximizeButton.TextSize = 14
MaximizeButton.Font = Enum.Font.Gotham
MinimizeButton.Name = "MinimizeButton"
MinimizeButton.Parent = ControlButtons
MinimizeButton.Size = UDim2.new(0, 20, 0, 20)
MinimizeButton.Position = UDim2.new(1, -70, 0, 0)
MinimizeButton.BackgroundTransparency = 1
MinimizeButton.Text = "—"
MinimizeButton.TextColor3 = selectedTheme.TextColor
MinimizeButton.TextSize = 10
MinimizeButton.Font = Enum.Font.GothamBold
Divider.Name = "Divider"
Divider.Parent = MainFrame
Divider.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Divider.BackgroundTransparency = 0.8
Divider.BorderSizePixel = 0
Divider.Position = UDim2.new(0, 10, 0, 30)
Divider.Size = UDim2.new(1, -20, 0, 1)
ExitMenu.Name = "ExitMenu"
ExitMenu.Parent = MainFrame
ExitMenu.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
ExitMenu.BackgroundTransparency = 0.5
ExitMenu.Size = UDim2.new(1, 0, 1, 0)
ExitMenu.Position = UDim2.new(0, 0, 0, 0)
ExitMenu.Visible = false
ExitMenu.ZIndex = 10
ExitMenuCorner.CornerRadius = UDim.new(0, 12)
ExitMenuCorner.Parent = ExitMenu
ExitMenuContent.Name = "ExitMenuContent"
ExitMenuContent.Parent = ExitMenu
ExitMenuContent.BackgroundColor3 = getDarkerColor(selectedTheme.MainColor)
ExitMenuContent.BackgroundTransparency = 0.05
ExitMenuContent.AnchorPoint = Vector2.new(0.5, 0.5)
ExitMenuContent.Position = UDim2.new(0.55, 0, 0.5, 0)
ExitMenuContent.Size = UDim2.new(0, 200, 0, 100)
ExitMenuContent.ClipsDescendants = true
ExitCorner.CornerRadius = UDim.new(0, 12)
ExitCorner.Parent = ExitMenuContent
ExitHeader.Name = "ExitHeader"
ExitHeader.Parent = ExitMenuContent
ExitHeader.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
ExitHeader.BackgroundTransparency = 0.6
ExitHeader.BorderSizePixel = 0
ExitHeader.Size = UDim2.new(1, 0, 0, 45)
ExitHeaderCorner.CornerRadius = UDim.new(0, 12)
ExitHeaderCorner.Parent = ExitHeader
ExitTitle.Name = "ExitTitle"
ExitTitle.Parent = ExitMenuContent
ExitTitle.Size = UDim2.new(1, 0, 0, 45)
ExitTitle.BackgroundTransparency = 1
ExitTitle.Text = "Exit?"
ExitTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
ExitTitle.TextSize = 18
ExitTitle.Font = Enum.Font.GothamBold
ExitTitle.ZIndex = 2
ExitLine.Name = "ExitLine"
ExitLine.Parent = ExitMenuContent
ExitLine.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
ExitLine.BackgroundTransparency = 0.8
ExitLine.BorderSizePixel = 0
ExitLine.Position = UDim2.new(0, 0, 0, 45)
ExitLine.Size = UDim2.new(1, 0, 0, 1)
ExitLine.ZIndex = 3
ExitYes.Name = "ExitYes"
ExitYes.Parent = ExitMenuContent
ExitYes.Position = UDim2.new(0, 20, 0, 60)
ExitYes.Size = UDim2.new(0, 75, 0, 30)
ExitYes.BackgroundTransparency = 1
ExitYes.BorderSizePixel = 0
ExitYes.Text = "yes"
ExitYes.TextColor3 = Color3.fromRGB(255, 255, 255)
ExitYes.TextSize = 18
ExitYes.Font = Enum.Font.GothamBold
ExitYesCorner.CornerRadius = UDim.new(0, 8)
ExitYesCorner.Parent = ExitYes
ExitYesStroke.Parent = ExitYes
ExitYesStroke.Thickness = 1
ExitYesStroke.Color = Color3.fromRGB(255, 255, 255)
ExitYesStroke.Transparency = 0.8
ExitYesStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
ExitNo.Name = "ExitNo"
ExitNo.Parent = ExitMenuContent
ExitNo.Position = UDim2.new(1, -95, 0, 60)
ExitNo.Size = UDim2.new(0, 75, 0, 30)
ExitNo.BackgroundTransparency = 1
ExitNo.BorderSizePixel = 0
ExitNo.Text = "no"
ExitNo.TextColor3 = Color3.fromRGB(255, 255, 255)
ExitNo.TextSize = 18
ExitNo.Font = Enum.Font.GothamBold
ExitNoCorner.CornerRadius = UDim.new(0, 8)
ExitNoCorner.Parent = ExitNo
ExitNoStroke.Parent = ExitNo
ExitNoStroke.Thickness = 1
ExitNoStroke.Color = Color3.fromRGB(255, 255, 255)
ExitNoStroke.Transparency = 0.8
ExitNoStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
MainFrame:GetPropertyChangedSignal("BackgroundColor3"):Connect(function()
local darker = getDarkerColor(MainFrame.BackgroundColor3)
ExitMenuContent.BackgroundColor3 = darker
BlurBackground.BackgroundColor3 = MainFrame.BackgroundColor3
UIGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, MainFrame.BackgroundColor3),
ColorSequenceKeypoint.new(1, getDarkerColor(MainFrame.BackgroundColor3))
}
end)
ResizeButton.Name = "ResizeButton"
ResizeButton.Parent = MainFrame
ResizeButton.Position = UDim2.new(1, -15, 1, -15)
ResizeButton.Size = UDim2.new(0, 15, 0, 15)
ResizeButton.BackgroundTransparency = 1
ResizeButton.Image = "rbxassetid://10133132833"
ResizeButton.ImageColor3 = Color3.fromRGB(255, 255, 255)
local dragging, dragInput, dragStart, startPos
local resizing, resizeStart, startSize
local isMaximized = false
local oldPos
CloseButton.MouseButton1Click:Connect(function()
ExitMenu.Visible = true
end)
ExitYes.MouseButton1Click:Connect(function()
ScreenGui:Destroy()
end)
ExitNo.MouseButton1Click:Connect(function()
ExitMenu.Visible = false
end)
MaximizeButton.MouseButton1Click:Connect(function()
if not isMaximized then
oldPos = MainFrame.Position
MainFrame:TweenSizeAndPosition(UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 0, 0), "Out", "Quart", 0.3, true)
isMaximized = true
else
MainFrame:TweenSizeAndPosition(DefaultSize, oldPos or UDim2.new(0.5, -225, 0.5, -150), "Out", "Quart", 0.3, true)
isMaximized = false
end
end)
MinimizeButton.MouseButton1Click:Connect(function()
if isMaximized then
MainFrame:TweenSizeAndPosition(DefaultSize, oldPos or UDim2.new(0.5, -225, 0.5, -150), "Out", "Quart", 0.3, true)
isMaximized = false
else
isHidden = true
MainFrame.Visible = false
MainFrame.Size = DefaultSize
end
end)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if ToggleKey and not gameProcessed and input.KeyCode == ToggleKey then
isHidden = not isHidden
MainFrame.Visible = not isHidden
if not isHidden then
MainFrame.Size = DefaultSize
end
end
end)
DragHandle.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 and not isMaximized and not ExitMenu.Visible then
dragging = true
dragStart = input.Position
startPos = MainFrame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
DragHandle.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
dragInput = input
end
end)
ResizeButton.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 and not isMaximized and not ExitMenu.Visible then
resizing = true
resizeStart = input.Position
startSize = MainFrame.Size
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
resizing = false
end
end)
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging and not isMaximized then
local delta = input.Position - dragStart
MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
elseif resizing and input.UserInputType == Enum.UserInputType.MouseMovement and not isMaximized then
local delta = input.Position - resizeStart
local newWidth = math.max(MinSize.X, startSize.X.Offset + delta.X)
local newHeight = math.max(MinSize.Y, startSize.Y.Offset + delta.Y)
MainFrame.Size = UDim2.new(0, newWidth, 0, newHeight)
end
end)
return ScreenGui
end
return GeneralUI