Update
This commit is contained in:
commit
2d6a8a867d
1093 files changed
+2424571
No files matched your search
@@ -0,0 +1,494 @@
|
||||
-- ShopKit: shared pieces of the New Year shop-style windows (Мастерская, Рынок).
|
||||
-- Art from GUI/магазин: snowy green panel, red ribbon, pill buttons, ray cards, crystal, holly, gift.
|
||||
-- Design canvas 1400 x 1000 px; OrnamentCraftUI's openWindow() scales it to the screen.
|
||||
--
|
||||
-- K.pill : action button with states
|
||||
-- ready (gold) / alt (blue) / confirm, danger (red) — clickable
|
||||
-- done (green) / info (blue) — inert, off (grey, says what is missing) / busy (•••, waiting for the server)
|
||||
-- hover = grow + light ring, press = shrink + darken, a click on "off" wiggles it.
|
||||
-- K.chip : filter chip (green, gold when selected), same hover / press feel.
|
||||
-- K.chrome : the whole window frame — gradient body, stars, garlands, ribbon title, balance plate, close button,
|
||||
-- content panel, tip line and up to 4 tabs (normal / hover / pressed / selected + red badge).
|
||||
local TweenService = game:GetService("TweenService")
|
||||
|
||||
local K = {}
|
||||
|
||||
K.FONT = Font.new("rbxasset://fonts/families/FredokaOne.json", Enum.FontWeight.Bold)
|
||||
K.BODY = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Bold)
|
||||
K.INK = Color3.fromRGB(12, 8, 10)
|
||||
K.WHITE = Color3.new(1, 1, 1)
|
||||
K.GOLD = Color3.fromRGB(255, 211, 116)
|
||||
K.SOFT = Color3.fromRGB(222, 238, 230)
|
||||
K.OK = Color3.fromRGB(150, 255, 160)
|
||||
K.WARN = Color3.fromRGB(255, 196, 120)
|
||||
K.NAVY = Color3.fromRGB(14, 26, 58)
|
||||
local FONT, BODY, INK, WHITE, GOLD, SOFT, OK, NAVY = K.FONT, K.BODY, K.INK, K.WHITE, K.GOLD, K.SOFT, K.OK, K.NAVY
|
||||
|
||||
-- art (id, opaque rect in the source png)
|
||||
K.ART = {
|
||||
panel = { "rbxassetid://138527541920438", { 18, 42, 278, 234 } },
|
||||
ribbon = { "rbxassetid://103499479509351", { 10, 74, 294, 166 } },
|
||||
green = { "rbxassetid://93987797017793", { 16, 110, 280, 102 } },
|
||||
red = { "rbxassetid://138508596098174", { 18, 108, 280, 102 } },
|
||||
blue = { "rbxassetid://111888989174975", { 18, 114, 278, 94 } },
|
||||
gold = { "rbxassetid://131564766133063", { 16, 108, 280, 102 } },
|
||||
grey = { "rbxassetid://89653402754634", { 16, 108, 280, 102 } },
|
||||
crystal = { "rbxassetid://105804941618750", { 54, 56, 206, 210 } },
|
||||
cardGreen = { "rbxassetid://105142745227171", { 16, 22, 280, 272 } },
|
||||
cardCyan = { "rbxassetid://116968687145512", { 18, 22, 280, 272 } },
|
||||
cardViolet = { "rbxassetid://103872013133887", { 16, 22, 282, 272 } },
|
||||
cardOrange = { "rbxassetid://125846279529125", { 18, 22, 280, 272 } },
|
||||
gift = { "rbxassetid://85573436333424" },
|
||||
holly = { "rbxassetid://96646166091621" },
|
||||
garland = { "rbxassetid://133428323657868" },
|
||||
}
|
||||
K.CARD_SLICE = Rect.new(34, 60, 246, 206)
|
||||
local ART = K.ART
|
||||
|
||||
function K.tween(o, t, props, style, dir)
|
||||
local tw = TweenService:Create(o, TweenInfo.new(t, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
|
||||
tw:Play()
|
||||
return tw
|
||||
end
|
||||
local tween = K.tween
|
||||
function K.new(class, props, children)
|
||||
local o = Instance.new(class)
|
||||
for k, v in props do if k ~= "Parent" then o[k] = v end end
|
||||
for _, c in children or {} do c.Parent = o end
|
||||
if class == "TextButton" or class == "ImageButton" then o:SetAttribute("UXDone", true) end -- OrnamentUX: hands off
|
||||
if props.Parent then o.Parent = props.Parent end
|
||||
return o
|
||||
end
|
||||
local new = K.new
|
||||
function K.corner(r) return new("UICorner", { CornerRadius = r }) end
|
||||
local corner = K.corner
|
||||
function K.art(name, props, isButton)
|
||||
local d = ART[name]
|
||||
props.BackgroundTransparency = 1
|
||||
props.Image = d[1]
|
||||
if d[2] then
|
||||
props.ImageRectOffset = Vector2.new(d[2][1], d[2][2])
|
||||
props.ImageRectSize = Vector2.new(d[2][3], d[2][4])
|
||||
end
|
||||
return new(isButton and "ImageButton" or "ImageLabel", props)
|
||||
end
|
||||
local art = K.art
|
||||
function K.setArt(img, name)
|
||||
local d = ART[name]
|
||||
img.Image = d[1]
|
||||
img.ImageRectOffset = Vector2.new(d[2][1], d[2][2])
|
||||
img.ImageRectSize = Vector2.new(d[2][3], d[2][4])
|
||||
end
|
||||
local setArt = K.setArt
|
||||
-- rounded title text with a thin black outline
|
||||
function K.label(props, stroke)
|
||||
props.BackgroundTransparency = 1
|
||||
props.FontFace = props.FontFace or FONT
|
||||
props.TextColor3 = props.TextColor3 or WHITE
|
||||
if props.TextXAlignment == nil then props.TextXAlignment = Enum.TextXAlignment.Left end
|
||||
local t = new("TextLabel", props)
|
||||
new("UIStroke", { Color = INK, Thickness = stroke or 2, Parent = t })
|
||||
return t
|
||||
end
|
||||
local label = K.label
|
||||
function K.maxText(t, size) new("UITextSizeConstraint", { MaxTextSize = size, Parent = t }) return t end
|
||||
local maxText = K.maxText
|
||||
function K.isPress(input)
|
||||
return input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch
|
||||
end
|
||||
local isPress = K.isPress
|
||||
-- floating "+1" over a card
|
||||
function K.floatText(parent, text, color)
|
||||
local t = label({ AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.45), Size = UDim2.fromOffset(300, 60),
|
||||
Text = text, TextSize = 48, TextColor3 = color or OK, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 40, Parent = parent }, 3)
|
||||
local sc = new("UIScale", { Scale = 0.6, Parent = t })
|
||||
tween(sc, 0.25, { Scale = 1 }, Enum.EasingStyle.Back)
|
||||
tween(t, 1.1, { Position = UDim2.fromScale(0.5, 0.05), TextTransparency = 1 })
|
||||
tween(t.UIStroke, 1.1, { Transparency = 1 })
|
||||
task.delay(1.15, function() t:Destroy() end)
|
||||
end
|
||||
function K.flash(card, radius)
|
||||
local f = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, BackgroundTransparency = 0.45, ZIndex = 39, Parent = card }, { corner(UDim.new(0, radius or 30)) })
|
||||
tween(f, 0.5, { BackgroundTransparency = 1 })
|
||||
task.delay(0.55, function() f:Destroy() end)
|
||||
end
|
||||
-- vertical scrolling list / grid
|
||||
function K.scroll(parent, pos, size, layout)
|
||||
local s = new("ScrollingFrame", { Position = pos, Size = size, BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 10, ZIndex = 4,
|
||||
ScrollBarImageColor3 = GOLD, AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), ScrollingDirection = Enum.ScrollingDirection.Y, Parent = parent })
|
||||
if layout then layout.Parent = s end
|
||||
return s
|
||||
end
|
||||
-- gift + title + hint (+ optional button) for an empty list
|
||||
function K.emptyState(props, title, hint)
|
||||
local f = new("Frame", props)
|
||||
f.BackgroundTransparency = 1
|
||||
f.Parent = props.Parent
|
||||
art("gift", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Size = UDim2.fromOffset(170, 170), ScaleType = Enum.ScaleType.Fit, ZIndex = 5, Parent = f })
|
||||
maxText(label({ Position = UDim2.new(0, 40, 0, 190), Size = UDim2.new(1, -80, 0, 50), Text = title, TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 5, Parent = f }, 3), 42)
|
||||
maxText(label({ Position = UDim2.new(0, 40, 0, 246), Size = UDim2.new(1, -80, 0, 60), Text = hint, TextScaled = true, TextWrapped = true, FontFace = BODY,
|
||||
TextColor3 = SOFT, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 5, Parent = f }, 1.5), 26)
|
||||
return f
|
||||
end
|
||||
|
||||
-- links between windows: OrnamentCraftUI registers K.nav.<Window> = function(tabId) ... end
|
||||
K.nav = {}
|
||||
function K.go(window, tab)
|
||||
local f = K.nav[window]
|
||||
if f then f(tab) end
|
||||
end
|
||||
|
||||
-- toy tile (button): dark rounded square, the toy's pattern on a disc, name, rarity line, optional value line.
|
||||
-- o = { Config, miniPattern, parent, item, w, h, order, z, value } -> { button, stroke, scale, setSelected, lock }
|
||||
function K.toyTile(o)
|
||||
local Config = o.Config
|
||||
local it = o.item
|
||||
local r = Config.RarityById[it.Rarity]
|
||||
local v = it.Variant and Config.VariantById[it.Variant]
|
||||
local z = o.z or 5
|
||||
local edge = v and v.Color or r.Color
|
||||
local b = new("TextButton", { Text = "", AutoButtonColor = false, BackgroundColor3 = Color3.fromRGB(10, 26, 34), Size = UDim2.fromOffset(o.w, o.h),
|
||||
LayoutOrder = o.order or 0, ZIndex = z, Parent = o.parent }, { corner(UDim.new(0, 18)) })
|
||||
local st = new("UIStroke", { Color = edge, Thickness = 2.5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Parent = b })
|
||||
local sc = new("UIScale", { Parent = b })
|
||||
local d = math.floor(math.min(o.w * 0.66, o.h * 0.52))
|
||||
local disc = new("Frame", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 6), Size = UDim2.fromOffset(d, d), BackgroundColor3 = Color3.new(0, 0, 0),
|
||||
BackgroundTransparency = 0.4, ZIndex = z + 1, Parent = b }, { corner(UDim.new(0.5, 0)) })
|
||||
local mini = o.miniPattern(Config.ToyById[it.Toy].Mask, r.Color, math.floor(d * 0.72), disc)
|
||||
mini.AnchorPoint = Vector2.new(0.5, 0.5)
|
||||
mini.Position = UDim2.fromScale(0.5, 0.5)
|
||||
mini.ZIndex = z + 2
|
||||
for _, x in mini:GetDescendants() do if x:IsA("GuiObject") then x.ZIndex = z + 2 end end
|
||||
local y = d + 8
|
||||
local lineH = math.floor((o.h - y - 4) / (o.value and 3 or 2))
|
||||
maxText(label({ Position = UDim2.fromOffset(4, y), Size = UDim2.new(1, -8, 0, lineH), Text = Config.ToyById[it.Toy].Name, TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = b }, 1.5), 22)
|
||||
maxText(label({ Position = UDim2.fromOffset(4, y + lineH), Size = UDim2.new(1, -8, 0, lineH), Text = r.Name .. (v and (" · " .. v.Name) or ""), TextScaled = true,
|
||||
TextColor3 = edge, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = b }, 1.5), 18)
|
||||
if o.value then
|
||||
maxText(label({ Position = UDim2.fromOffset(4, y + lineH * 2), Size = UDim2.new(1, -8, 0, lineH), Text = o.valueText or (Config.Value(it) .. " shards"), TextScaled = true, FontFace = BODY,
|
||||
TextColor3 = Color3.fromRGB(190, 225, 255), TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = b }, 1.5), 16)
|
||||
end
|
||||
local t = { button = b, stroke = st, scale = sc, selected = false, locked = false, inert = o.inert }
|
||||
local function paint(hover, down)
|
||||
st.Color = t.selected and GOLD or edge
|
||||
st.Thickness = t.selected and 5 or 2.5
|
||||
local live = not t.locked and not t.inert
|
||||
tween(sc, 0.12, { Scale = (down and live) and 0.94 or (hover and live) and 1.06 or t.selected and 1.04 or 1 }, Enum.EasingStyle.Back)
|
||||
end
|
||||
function t.setSelected(v2) t.selected = v2; paint() end
|
||||
function t.lock(text)
|
||||
t.locked = true
|
||||
local f = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.12, ZIndex = z + 5, Parent = b }, { corner(UDim.new(0, 18)) })
|
||||
maxText(label({ Position = UDim2.fromScale(0.06, 0.2), Size = UDim2.fromScale(0.88, 0.6), Text = text, TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 6, Parent = f }, 2), 24)
|
||||
end
|
||||
function t.wiggle()
|
||||
tween(b, 0.05, { Rotation = -4 }).Completed:Wait()
|
||||
tween(b, 0.07, { Rotation = 4 }).Completed:Wait()
|
||||
tween(b, 0.06, { Rotation = 0 })
|
||||
end
|
||||
local hover = false
|
||||
b.MouseEnter:Connect(function() hover = true; paint(true) end)
|
||||
b.MouseLeave:Connect(function() hover = false; paint(false) end)
|
||||
b.InputBegan:Connect(function(i) if isPress(i) then paint(hover, true) end end)
|
||||
b.InputEnded:Connect(function(i) if isPress(i) then paint(hover) end end)
|
||||
return t
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- pill button with states
|
||||
local ART_FOR = { ready = "gold", alt = "blue", info = "blue", confirm = "red", danger = "red", done = "green", off = "grey", busy = "grey" }
|
||||
local LIVE = { ready = true, alt = true, confirm = true, danger = true }
|
||||
function K.pill(parent, props, onClick)
|
||||
local textMax = props.TextMax or 32
|
||||
props.TextMax = nil
|
||||
props.AutoButtonColor = false
|
||||
local b = art("gold", props, true)
|
||||
b.Parent = parent
|
||||
local p, z = b.Position, b.Size
|
||||
b.AnchorPoint = Vector2.new(0.5, 0.5)
|
||||
b.Position = p + UDim2.new(z.X.Scale / 2, z.X.Offset / 2, z.Y.Scale / 2, z.Y.Offset / 2)
|
||||
local sc = new("UIScale", { Parent = b })
|
||||
local ring = new("Frame", { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Size = UDim2.new(1, 4, 1, 4),
|
||||
BackgroundTransparency = 1, ZIndex = 1, Parent = b }, { corner(UDim.new(0.5, 0)) })
|
||||
local ringStroke = new("UIStroke", { Color = Color3.fromRGB(255, 240, 180), Thickness = 4, Transparency = 1, Parent = ring })
|
||||
local cap = maxText(label({ Position = UDim2.fromScale(0.08, 0.16), Size = UDim2.fromScale(0.84, 0.62), Text = "", TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = (props.ZIndex or 1) + 1, Parent = b }, 2.5), textMax)
|
||||
local o = { button = b, state = "ready", hover = false }
|
||||
local dots
|
||||
local function paint()
|
||||
local s = o.state
|
||||
setArt(b, ART_FOR[s] or "gold")
|
||||
local live = LIVE[s] == true
|
||||
b.ImageColor3 = (o.down and live) and Color3.fromRGB(205, 205, 205) or WHITE
|
||||
cap.TextColor3 = s == "off" and Color3.fromRGB(214, 220, 226) or WHITE
|
||||
cap.Position = UDim2.fromScale(0.08, (o.down and live) and 0.2 or 0.16)
|
||||
ringStroke.Transparency = (o.hover and live) and 0.15 or 1
|
||||
local target = not live and 1 or o.down and 0.94 or o.hover and 1.05 or 1
|
||||
tween(sc, o.down and 0.07 or 0.14, { Scale = target }, o.down and Enum.EasingStyle.Quad or Enum.EasingStyle.Back)
|
||||
end
|
||||
function o.set(state, caption)
|
||||
if caption then cap.Text = caption end
|
||||
if state == o.state and state ~= "busy" then paint() return end
|
||||
if state == "busy" and o.state == "busy" then return end
|
||||
o.state = state
|
||||
b.Active = LIVE[state] == true
|
||||
b.Selectable = b.Active
|
||||
if state == "busy" then
|
||||
local my = {}
|
||||
dots = my
|
||||
task.spawn(function()
|
||||
local n = 0
|
||||
while dots == my and o.state == "busy" do
|
||||
n = n % 3 + 1
|
||||
cap.Text = string.rep("•", n)
|
||||
task.wait(0.25)
|
||||
end
|
||||
end)
|
||||
else
|
||||
dots = nil
|
||||
end
|
||||
paint()
|
||||
end
|
||||
function o.wiggle()
|
||||
tween(b, 0.05, { Rotation = -3 }).Completed:Wait()
|
||||
tween(b, 0.07, { Rotation = 3 }).Completed:Wait()
|
||||
tween(b, 0.06, { Rotation = 0 })
|
||||
end
|
||||
b.MouseEnter:Connect(function() o.hover = true; paint() end)
|
||||
b.MouseLeave:Connect(function() o.hover, o.down = false, false; paint() end)
|
||||
b.SelectionGained:Connect(function() o.hover = true; paint() end)
|
||||
b.SelectionLost:Connect(function() o.hover = false; paint() end)
|
||||
b.InputBegan:Connect(function(input) if isPress(input) then o.down = true; paint() end end)
|
||||
b.InputEnded:Connect(function(input) if isPress(input) then o.down = false; paint() end end)
|
||||
b.Activated:Connect(function()
|
||||
if LIVE[o.state] then
|
||||
onClick(o.state)
|
||||
elseif o.state == "off" then
|
||||
o.wiggle() -- "can't"
|
||||
end
|
||||
end)
|
||||
paint()
|
||||
return o
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- filter chip (green; gold when selected)
|
||||
function K.chip(parent, props, text, onClick, dot)
|
||||
props.AutoButtonColor = false
|
||||
local b = art("green", props, true)
|
||||
b.Parent = parent
|
||||
local sc = new("UIScale", { Parent = b })
|
||||
local z = (props.ZIndex or 4) + 1
|
||||
local x0 = 0.1
|
||||
if dot then
|
||||
new("Frame", { AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.08, 0, 0.47, 0), Size = UDim2.fromOffset(18, 18), BackgroundColor3 = dot, ZIndex = z, Parent = b },
|
||||
{ corner(UDim.new(0.5, 0)), new("UIStroke", { Color = INK, Thickness = 2 }) })
|
||||
x0 = 0.2
|
||||
end
|
||||
local cap = maxText(label({ Position = UDim2.fromScale(x0, 0.18), Size = UDim2.fromScale(0.92 - x0, 0.58), Text = text, TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z, Parent = b }, 2), 24)
|
||||
local o = { button = b, selected = false, hover = false, down = false }
|
||||
local function paint()
|
||||
setArt(b, o.selected and "gold" or "green")
|
||||
b.ImageColor3 = o.down and Color3.fromRGB(205, 205, 205) or WHITE
|
||||
cap.TextColor3 = o.selected and WHITE or Color3.fromRGB(236, 248, 238)
|
||||
tween(sc, 0.12, { Scale = o.down and 0.95 or (o.hover or o.selected) and 1.04 or 1 }, Enum.EasingStyle.Back)
|
||||
end
|
||||
function o.setSelected(v) o.selected = v; paint() end
|
||||
b.MouseEnter:Connect(function() o.hover = true; paint() end)
|
||||
b.MouseLeave:Connect(function() o.hover, o.down = false, false; paint() end)
|
||||
b.InputBegan:Connect(function(input) if isPress(input) then o.down = true; paint() end end)
|
||||
b.InputEnded:Connect(function(input) if isPress(input) then o.down = false; paint() end end)
|
||||
b.Activated:Connect(function() onClick() end)
|
||||
paint()
|
||||
return o
|
||||
end
|
||||
|
||||
-- price plate: crystal + number (orange when you can not afford it)
|
||||
function K.pricePlate(parent, pos, size, z)
|
||||
z = z or 3
|
||||
local f = new("Frame", { Position = pos, Size = size, BackgroundColor3 = NAVY, BackgroundTransparency = 0.1, ZIndex = z, Parent = parent }, {
|
||||
corner(UDim.new(0.5, 0)), new("UIStroke", { Color = Color3.fromRGB(190, 225, 255), Thickness = 2 }),
|
||||
})
|
||||
art("crystal", { Position = UDim2.new(0, -10, 0.5, -30), Size = UDim2.fromOffset(60, 60), ZIndex = z + 1, Parent = f })
|
||||
local t = maxText(label({ Position = UDim2.new(0, 52, 0, 4), Size = UDim2.new(1, -62, 1, -8), Text = "", TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = f }, 2), 32)
|
||||
return f, t
|
||||
end
|
||||
|
||||
---------------------------------------------------------------- window frame + tabs
|
||||
-- opts: win, title, subtitle, tabs = { { id, text, icon, tip } }, closeWindow, fmtNum, onTab(id)
|
||||
K.AREA_POS, K.AREA_SIZE = UDim2.fromOffset(70, 346), UDim2.fromOffset(1260, 566)
|
||||
function K.chrome(opts)
|
||||
local win = opts.win
|
||||
local panel = win.panel
|
||||
local WIDTH, HEIGHT = 1400, 1000
|
||||
win.w, win.h = WIDTH, HEIGHT
|
||||
panel.Size = UDim2.fromOffset(WIDTH, HEIGHT)
|
||||
panel.BackgroundTransparency = 1
|
||||
for _, c in panel:GetChildren() do
|
||||
if c:IsA("UIStroke") then c.Enabled = false end
|
||||
if c:IsA("Frame") then c.Visible = false end -- makeWindow's title bar
|
||||
end
|
||||
local fmt = opts.fmtNum
|
||||
|
||||
local bg = new("Frame", { Name = "Bg", Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, ZIndex = 0, Parent = panel }, {
|
||||
corner(UDim.new(0, 44)),
|
||||
new("UIGradient", { Rotation = 90, Color = ColorSequence.new(Color3.fromRGB(22, 84, 70), Color3.fromRGB(8, 36, 44)) }),
|
||||
new("UIStroke", { Name = "GoldEdge", Color = Color3.fromRGB(242, 196, 82), Thickness = 5 }),
|
||||
})
|
||||
new("Frame", { Position = UDim2.fromOffset(12, 12), Size = UDim2.new(1, -24, 1, -24), BackgroundTransparency = 1, ZIndex = 0, Parent = bg }, {
|
||||
corner(UDim.new(0, 36)), new("UIStroke", { Color = GOLD, Thickness = 2, Transparency = 0.55 }),
|
||||
})
|
||||
-- twinkling stars in the header sky
|
||||
local rng = Random.new(7)
|
||||
for _ = 1, 26 do
|
||||
local s = rng:NextInteger(3, 7)
|
||||
local star = new("Frame", { Position = UDim2.fromOffset(rng:NextInteger(40, 1360), rng:NextInteger(24, 190)), Size = UDim2.fromOffset(s, s),
|
||||
BackgroundColor3 = WHITE, BackgroundTransparency = rng:NextNumber(0.2, 0.6), ZIndex = 1, Parent = panel }, { corner(UDim.new(0.5, 0)) })
|
||||
local delay0 = rng:NextNumber(0, 3)
|
||||
task.spawn(function()
|
||||
task.wait(delay0)
|
||||
while star.Parent do
|
||||
tween(star, 1.4, { BackgroundTransparency = 0.85 }, Enum.EasingStyle.Sine).Completed:Wait()
|
||||
tween(star, 1.4, { BackgroundTransparency = 0.2 }, Enum.EasingStyle.Sine).Completed:Wait()
|
||||
end
|
||||
end)
|
||||
end
|
||||
art("garland", { Position = UDim2.fromOffset(20, -70), Size = UDim2.fromOffset(330, 330), ScaleType = Enum.ScaleType.Fit, ZIndex = 2, Parent = panel })
|
||||
art("garland", { Position = UDim2.fromOffset(1050, -70), Size = UDim2.fromOffset(330, 330), ScaleType = Enum.ScaleType.Fit, ZIndex = 2, Parent = panel })
|
||||
|
||||
-- ribbon title + subtitle
|
||||
local ribbon = art("ribbon", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.fromOffset(WIDTH / 2, -22), Size = UDim2.fromOffset(480, 271), ZIndex = 3, Parent = panel })
|
||||
maxText(label({ Position = UDim2.fromScale(0.14, 0.5), Size = UDim2.fromScale(0.72, 0.25), Text = opts.title, TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = ribbon }, 3.5), 64)
|
||||
maxText(label({ Position = UDim2.fromOffset(60, 132), Size = UDim2.fromOffset(330, 56), Text = opts.subtitle or "", TextScaled = true,
|
||||
TextColor3 = SOFT, FontFace = BODY, ZIndex = 3, Parent = panel }, 1.5), 24)
|
||||
|
||||
-- balance plate (animated count)
|
||||
local balance = art("blue", { Position = UDim2.fromOffset(1000, 120), Size = UDim2.fromOffset(250, 84), ZIndex = 3, Parent = panel })
|
||||
art("crystal", { Position = UDim2.fromOffset(-26, -10), Size = UDim2.fromOffset(100, 100), ZIndex = 4, Parent = balance })
|
||||
local balanceText = maxText(label({ Position = UDim2.fromOffset(72, 12), Size = UDim2.new(1, -90, 1, -24), Text = "0", TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = balance }, 3), 40)
|
||||
local lastShown = 0
|
||||
local function setBalance(v, instant)
|
||||
local from = lastShown
|
||||
lastShown = v
|
||||
if instant or from == v or not win.overlay.Visible then balanceText.Text = fmt(v) return end
|
||||
local nv = Instance.new("NumberValue")
|
||||
nv.Value = from
|
||||
nv.Changed:Connect(function(x) balanceText.Text = fmt(x) end)
|
||||
tween(nv, 0.45, { Value = v }).Completed:Connect(function() balanceText.Text = fmt(v); nv:Destroy() end)
|
||||
end
|
||||
|
||||
-- close: drawn in code (red glossy square, gold rim, snow cap, "X"; Fredoka has no ✕ glyph)
|
||||
local close = new("TextButton", { Name = "Close", AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(1320, 92), Size = UDim2.fromOffset(96, 96), Text = "",
|
||||
BackgroundColor3 = Color3.fromRGB(214, 36, 46), AutoButtonColor = false, ZIndex = 5, Parent = panel }, {
|
||||
corner(UDim.new(0, 24)),
|
||||
new("UIStroke", { Color = GOLD, Thickness = 5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }),
|
||||
})
|
||||
new("Frame", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 6), Size = UDim2.new(1, -16, 0.4, 0), BackgroundColor3 = WHITE,
|
||||
BackgroundTransparency = 0.8, ZIndex = 6, Parent = close }, { corner(UDim.new(0, 18)), new("UIGradient", { Rotation = 90, Transparency = NumberSequence.new(0.1, 1) }) })
|
||||
new("Frame", { Position = UDim2.new(0, -6, 0, -12), Size = UDim2.new(1, 12, 0, 24), BackgroundColor3 = Color3.fromRGB(245, 250, 255), ZIndex = 8, Parent = close }, {
|
||||
corner(UDim.new(0.5, 0)), new("UIGradient", { Rotation = 90, Color = ColorSequence.new(WHITE, Color3.fromRGB(205, 222, 240)) }),
|
||||
})
|
||||
label({ Position = UDim2.fromScale(0.14, 0.16), Size = UDim2.fromScale(0.72, 0.72), Text = "X", TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 7, Parent = close }, 3)
|
||||
local closeScale = new("UIScale", { Parent = close })
|
||||
close.MouseEnter:Connect(function() tween(closeScale, 0.14, { Scale = 1.08 }, Enum.EasingStyle.Back); tween(close, 0.14, { Rotation = 6 }) end)
|
||||
close.MouseLeave:Connect(function() tween(closeScale, 0.14, { Scale = 1 }); tween(close, 0.14, { Rotation = 0 }) end)
|
||||
close.InputBegan:Connect(function(i) if isPress(i) then tween(closeScale, 0.06, { Scale = 0.92 }) end end)
|
||||
close.Activated:Connect(function() opts.closeWindow() end)
|
||||
|
||||
-- content panel + footer tip
|
||||
art("panel", { Position = UDim2.fromOffset(40, 300), Size = UDim2.fromOffset(1320, 632), ScaleType = Enum.ScaleType.Slice,
|
||||
SliceCenter = Rect.new(60, 70, 218, 180), ZIndex = 2, Parent = panel })
|
||||
art("holly", { Position = UDim2.fromOffset(1262, 262), Size = UDim2.fromOffset(130, 130), ScaleType = Enum.ScaleType.Fit, ZIndex = 6, Parent = panel })
|
||||
art("gift", { Position = UDim2.fromOffset(-34, 850), Size = UDim2.fromOffset(150, 150), ScaleType = Enum.ScaleType.Fit, ZIndex = 6, Parent = panel })
|
||||
local tip = maxText(label({ Position = UDim2.fromOffset(130, 940), Size = UDim2.fromOffset(1140, 44), Text = "", TextScaled = true, FontFace = BODY,
|
||||
TextColor3 = SOFT, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 3, Parent = panel }, 1.5), 26)
|
||||
|
||||
-- pages: a CanvasGroup each (fade + slide on switch)
|
||||
local AREA_POS, AREA_SIZE = K.AREA_POS, K.AREA_SIZE
|
||||
local pages = {}
|
||||
local function makePage(id, withScroll)
|
||||
local g = new("CanvasGroup", { Name = "Page" .. id, Position = AREA_POS, Size = AREA_SIZE, BackgroundTransparency = 1, Visible = false, ZIndex = 4, Parent = panel })
|
||||
pages[id] = { group = g }
|
||||
if withScroll then
|
||||
return g, K.scroll(g, UDim2.new(), UDim2.fromScale(1, 1))
|
||||
end
|
||||
return g
|
||||
end
|
||||
|
||||
-- tabs
|
||||
local tabs, current = {}, nil
|
||||
local self = { panel = panel, tabs = tabs, makePage = makePage, setBalance = setBalance, tip = tip }
|
||||
local startX = math.floor((WIDTH - (#opts.tabs * 300 + (#opts.tabs - 1) * 22)) / 2)
|
||||
for i, t in opts.tabs do
|
||||
local x = startX + (i - 1) * 322
|
||||
local b = art("green", { Name = "Tab" .. t.id, AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(x + 150, 258), Size = UDim2.fromOffset(300, 96),
|
||||
AutoButtonColor = false, ZIndex = 3, Parent = panel }, true)
|
||||
local sc = new("UIScale", { Parent = b })
|
||||
local ring = new("Frame", { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Size = UDim2.new(1, 4, 1, 4), BackgroundTransparency = 1, Parent = b }, { corner(UDim.new(0.5, 0)) })
|
||||
local ringStroke = new("UIStroke", { Color = Color3.fromRGB(255, 240, 180), Thickness = 4, Transparency = 1, Parent = ring })
|
||||
label({ Position = UDim2.fromScale(0.07, 0.17), Size = UDim2.fromScale(0.2, 0.62), Text = t.icon, TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = b }, 0)
|
||||
local cap = maxText(label({ Position = UDim2.fromScale(0.27, 0.17), Size = UDim2.fromScale(0.66, 0.6), Text = t.text, TextScaled = true,
|
||||
TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = b }, 2.5), 34)
|
||||
local badge = new("Frame", { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -18, 0, 10), Size = UDim2.fromOffset(46, 46),
|
||||
BackgroundColor3 = Color3.fromRGB(226, 40, 52), Visible = false, ZIndex = 6, Parent = b }, { corner(UDim.new(0.5, 0)), new("UIStroke", { Color = WHITE, Thickness = 3 }) })
|
||||
local badgeText = label({ Size = UDim2.fromScale(1, 1), Text = "", TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 7, Parent = badge }, 1.5)
|
||||
new("UIPadding", { PaddingTop = UDim.new(0.2, 0), PaddingBottom = UDim.new(0.2, 0), PaddingLeft = UDim.new(0.15, 0), PaddingRight = UDim.new(0.15, 0), Parent = badge })
|
||||
local badgeScale = new("UIScale", { Parent = badge })
|
||||
local o = { button = b, hover = false, down = false, count = 0 }
|
||||
function o.paint()
|
||||
local sel = current == t.id
|
||||
setArt(b, sel and "red" or "green")
|
||||
b.ImageColor3 = (o.down and not sel) and Color3.fromRGB(205, 205, 205) or WHITE
|
||||
cap.TextColor3 = sel and WHITE or Color3.fromRGB(236, 248, 238)
|
||||
ringStroke.Transparency = (o.hover and not sel) and 0.2 or 1
|
||||
b.Position = UDim2.fromOffset(x + 150, sel and 252 or 258)
|
||||
tween(sc, 0.14, { Scale = o.down and 0.95 or sel and 1.07 or o.hover and 1.04 or 1 }, Enum.EasingStyle.Back)
|
||||
end
|
||||
function o.setBadge(n)
|
||||
badge.Visible = n > 0
|
||||
badgeText.Text = n > 9 and "9+" or tostring(n)
|
||||
if n > o.count then
|
||||
badgeScale.Scale = 1.5
|
||||
tween(badgeScale, 0.3, { Scale = 1 }, Enum.EasingStyle.Back)
|
||||
end
|
||||
o.count = n
|
||||
end
|
||||
b.MouseEnter:Connect(function() o.hover = true; o.paint() end)
|
||||
b.MouseLeave:Connect(function() o.hover, o.down = false, false; o.paint() end)
|
||||
b.SelectionGained:Connect(function() o.hover = true; o.paint() end)
|
||||
b.SelectionLost:Connect(function() o.hover = false; o.paint() end)
|
||||
b.InputBegan:Connect(function(input) if isPress(input) then o.down = true; o.paint() end end)
|
||||
b.InputEnded:Connect(function(input) if isPress(input) then o.down = false; o.paint() end end)
|
||||
b.Activated:Connect(function() self.showTab(t.id) end)
|
||||
tabs[t.id] = o
|
||||
end
|
||||
|
||||
function self.current() return current end
|
||||
function self.showTab(id, force)
|
||||
if current == id and not force then return end
|
||||
local prev = current
|
||||
current = id
|
||||
for _, t in tabs do t.paint() end
|
||||
for pid, p in pages do
|
||||
if pid == id then
|
||||
p.group.Visible = true
|
||||
if prev ~= id then
|
||||
p.group.GroupTransparency = 1
|
||||
p.group.Position = AREA_POS + UDim2.fromOffset(0, 24)
|
||||
tween(p.group, 0.22, { GroupTransparency = 0, Position = AREA_POS })
|
||||
end
|
||||
elseif pid == prev then
|
||||
p.group.Visible = false
|
||||
end
|
||||
end
|
||||
for _, t in opts.tabs do if t.id == id then tip.Text = t.tip; tip.TextColor3 = SOFT end end
|
||||
if opts.onTab then opts.onTab(id) end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
return K
|
||||
Reference in new issue
Block a user