Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Created by EpicMetatableMoment 😎
- ]]--
- -- [[ Window API ]] --
- local window = {}
- do
- --// Window Methods
- local windowMethods = {}
- local windowMeta = {
- __index = windowMethods
- }
- local windowOffset = 0
- function window.new(uiContainer, windowName)
- local newWindow = {
- name = windowName,
- newWindowFrame = Instance.new("Frame")
- }
- do
- --// Construct UI
- local newWindowFrame = newWindow.newWindowFrame
- local newWindowTitle = Instance.new("TextLabel")
- local newWindowElementContainer = Instance.new("Frame")
- local elementContainerSorter = Instance.new("UIListLayout")
- do
- --// New Window Frame
- newWindowFrame.Name = windowName
- newWindowFrame.Draggable = true
- newWindowFrame.Active = true
- newWindowFrame.BorderSizePixel = 0
- newWindowFrame.AnchorPoint = Vector2.new(.5, .5)
- newWindowFrame.Size = UDim2.new(.14, 0, 0.14, 0)
- newWindowFrame.Position = UDim2.new(.125 + windowOffset, 0, .25, 0)
- newWindowFrame.BackgroundColor3 = Color3.fromRGB(232, 232, 232)
- newWindowFrame.SizeConstraint = Enum.SizeConstraint.RelativeXX
- newWindowFrame.Parent = uiContainer
- end
- do
- --// New Window Title
- newWindowTitle.Name = "Title"
- newWindowTitle.Text = newWindow.name
- newWindowTitle.BorderSizePixel = 0
- newWindowTitle.TextSize = 18
- newWindowTitle.Font = Enum.Font.Code
- newWindowTitle.Size = UDim2.new(1, 0, .12, 0)
- newWindowTitle.BackgroundColor3 = Color3.fromRGB(208, 208, 208)
- newWindowTitle.Parent = newWindowFrame
- end
- do
- --// New Window Button Container
- newWindowElementContainer.Name = "Container"
- newWindowElementContainer.BorderSizePixel = 0
- newWindowElementContainer.BackgroundTransparency = 1
- newWindowElementContainer.AnchorPoint = Vector2.new(0, 1)
- newWindowElementContainer.Size = UDim2.new(1, 0, .85, 0)
- newWindowElementContainer.Position = UDim2.new(0, 0, 1, 0)
- newWindowElementContainer.Parent = newWindowFrame
- end
- do
- --// Element Container Sorter
- elementContainerSorter.Padding = UDim.new(.025, 0)
- elementContainerSorter.SortOrder = Enum.SortOrder.LayoutOrder
- elementContainerSorter.FillDirection = Enum.FillDirection.Vertical
- elementContainerSorter.HorizontalAlignment = Enum.HorizontalAlignment.Center
- elementContainerSorter.Parent = newWindowElementContainer
- end
- end
- setmetatable(newWindow, windowMeta)
- windowOffset = windowOffset + 0.15
- return newWindow
- end
- function windowMethods:addLabel(labelText)
- local windowFrame = self.newWindowFrame
- local elementContainer = windowFrame.Container
- do
- --// Construct New Label
- local newLabel = Instance.new("TextLabel")
- do
- --// New Label
- newLabel.Text = labelText
- newLabel.BorderSizePixel = 0
- newLabel.TextSize = 14
- newLabel.Font = Enum.Font.Code
- newLabel.BackgroundColor3 = Color3.fromRGB(248, 248, 248)
- newLabel.Size = UDim2.new(.9, 0, .125, 0)
- newLabel.Parent = elementContainer
- end
- end
- end
- function windowMethods:addButton(buttonName, func)
- local windowFrame = self.newWindowFrame
- local elementContainer = windowFrame.Container
- do
- --// Construct New Button
- local newButton = Instance.new("TextButton")
- local newButtonDetail = Instance.new("Frame")
- do
- --// New Button
- newButton.Text = buttonName
- newButton.BorderSizePixel = 0
- newButton.TextSize = 14
- newButton.Font = Enum.Font.Code
- newButton.BackgroundColor3 = Color3.fromRGB(248, 248, 248)
- newButton.Size = UDim2.new(.9, 0, .125, 0)
- newButton.Parent = elementContainer
- newButton.MouseButton1Click:Connect(func)
- end
- do
- --// Button Detail
- newButtonDetail.BorderSizePixel = 0
- newButtonDetail.AnchorPoint = Vector2.new(0, 1)
- newButtonDetail.BackgroundColor3 = Color3.fromRGB(225, 225, 225)
- newButtonDetail.Position = UDim2.new(0, 0, 1, 0)
- newButtonDetail.Size = UDim2.new(1, 0, 0.15, 0)
- newButtonDetail.Parent = newButton
- end
- end
- end
- function windowMethods:addTextBox(textBoxName, func)
- local windowFrame = self.newWindowFrame
- local elementContainer = windowFrame.Container
- do
- --// Construct TextBox
- local newTextBoxLabel = Instance.new("TextLabel")
- local newTextBox = Instance.new("TextBox")
- local newTextBoxDetail = Instance.new("Frame")
- do
- --// Text Box Label
- newTextBoxLabel.Text = (" %s:"):format(textBoxName)
- newTextBoxLabel.BorderSizePixel = 0
- newTextBoxLabel.TextSize = 14
- newTextBoxLabel.Font = Enum.Font.Code
- newTextBoxLabel.TextXAlignment = Enum.TextXAlignment.Left
- newTextBoxLabel.BackgroundColor3 = Color3.fromRGB(248, 248, 248)
- newTextBoxLabel.Size = UDim2.new(.9, 0, .125, 0)
- newTextBoxLabel.Parent = elementContainer
- end
- do
- --// Text Box
- newTextBox.Text = ""
- newTextBox.PlaceholderText = "Enter Value"
- newTextBox.BorderSizePixel = 0
- newTextBox.TextSize = 14
- newTextBox.Font = Enum.Font.Code
- newTextBox.BackgroundColor3 = Color3.fromRGB(248, 248, 248)
- newTextBox.Position = UDim2.new(.5, 0, 0, 0)
- newTextBox.Size = UDim2.new(.5, 0, 1, 0)
- newTextBox.Parent = newTextBoxLabel
- newTextBox.FocusLost:Connect(function()
- func(newTextBox.Text)
- end)
- end
- do
- --// Button Detail
- newTextBoxDetail.BorderSizePixel = 0
- newTextBoxDetail.AnchorPoint = Vector2.new(0, 1)
- newTextBoxDetail.BackgroundColor3 = Color3.fromRGB(225, 225, 225)
- newTextBoxDetail.Position = UDim2.new(0, 0, 1, 0)
- newTextBoxDetail.Size = UDim2.new(1, 0, 0.15, 0)
- newTextBoxDetail.Parent = newTextBox
- end
- end
- end
- function windowMethods:addToggle(toggleName, func)
- local windowFrame = self.newWindowFrame
- local elementContainer = windowFrame.Container
- do
- --// Construct Toggle
- local toggleText = Instance.new("TextLabel")
- local toggleButton = Instance.new("ImageButton")
- local toggleTextDetail = Instance.new("Frame")
- do
- --// Toggle Text
- toggleText.Text = (" %s"):format(toggleName)
- toggleText.BorderSizePixel = 0
- toggleText.TextSize = 14
- toggleText.Size = UDim2.new(.9, 0, .125, 0)
- toggleText.Font = Enum.Font.Code
- toggleText.TextXAlignment = Enum.TextXAlignment.Left
- toggleText.BackgroundColor3 = Color3.fromRGB(248, 248, 248)
- toggleText.Parent = elementContainer
- end
- do
- --// Toggle Button
- toggleButton.BorderSizePixel = 0
- toggleButton.Image = ""
- toggleButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
- toggleButton.AnchorPoint = Vector2.new(1, 0.5)
- toggleButton.Size = UDim2.new(.9, 0, .0, 0)
- toggleButton.Position = UDim2.new(1, 0, .435, 0)
- toggleButton.BackgroundColor3 = Color3.fromRGB(232, 232, 232)
- toggleButton.Parent = toggleText
- local currentState = false
- toggleButton.MouseButton1Click:Connect(function()
- currentState = not currentState
- func(currentState)
- toggleButton.Image = (currentState and "http://www.roblox.com/asset/?id=247421287") or ""
- end)
- end
- do
- --// Toggle Detail
- toggleTextDetail.BorderSizePixel = 0
- toggleTextDetail.AnchorPoint = Vector2.new(0, 1)
- toggleTextDetail.BackgroundColor3 = Color3.fromRGB(225, 225, 225)
- toggleTextDetail.Position = UDim2.new(0, 0, 1, 0)
- toggleTextDetail.Size = UDim2.new(1, 0, 0.175, 0)
- toggleTextDetail.Parent = toggleText
- end
- end
- end
- end
- -- [[ Init ]] --
- return window
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement