Files
2026-11-16 23:50:40 +03:00

105 lines
6.6 KiB
Luau
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
local TweenService = game:GetService("TweenService")
local UX = {}
local gold=Color3.fromRGB(255,211,116)
local function tween(o, duration, props)
local t=TweenService:Create(o,TweenInfo.new(duration,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),props);t:Play();return t
end
local function make(class,props,parent)
local o=Instance.new(class);for k,v in props do o[k]=v end;o.Parent=parent;return o
end
function UX.install(c)
local self={pendingUntil=0}
local panel=c.panel
-- Cover baked button art once; all live controls are rendered above this quiet footer.
local cover=make("Frame",{Name="CraftActionSurface",Position=UDim2.fromOffset(44,785),Size=UDim2.fromOffset(499,182),BackgroundColor3=Color3.fromRGB(5,55,36),BorderSizePixel=0,ZIndex=3},panel)
make("UICorner",{CornerRadius=UDim.new(0,18)},cover)
local function action(b,primary)
for _,n in b:GetChildren() do if n.Name=="Pill" then n.Visible=false end end
b.BackgroundTransparency=0;b.TextTransparency=1;b.AutoButtonColor=false;b.ZIndex=5
-- Existing skin listeners force transparency; a dedicated visual child avoids fighting them.
local face=make("Frame",{Name="LiveFace",Size=UDim2.fromScale(1,1),BackgroundColor3=Color3.new(1,1,1),BorderSizePixel=0,ZIndex=5},b)
make("UICorner",{CornerRadius=UDim.new(0,primary and 20 or 16)},face)
local stroke=make("UIStroke",{Color=gold,Thickness=2,Transparency=.12},face)
local grad=make("UIGradient",{Rotation=90},face)
local caption=b:FindFirstChild("Caption");if caption then caption.ZIndex=7 end
local p,z=b.Position,b.Size
b.AnchorPoint=Vector2.new(.5,.5);b.Position=UDim2.new(p.X.Scale+z.X.Scale/2,p.X.Offset+z.X.Offset/2,p.Y.Scale+z.Y.Scale/2,p.Y.Offset+z.Y.Offset/2)
local scale=make("UIScale",{Scale=1},b)
local hover=false
local function paint()
local enabled=b.Active
local top=not enabled and Color3.fromRGB(61,76,79) or primary and Color3.fromRGB(232,62,67) or Color3.fromRGB(31,151,100)
grad.Color=ColorSequence.new(top,top:Lerp(Color3.new(0,0,0),.42))
if caption then caption.TextColor3=enabled and Color3.fromRGB(255,247,222) or Color3.fromRGB(193,205,203) end
tween(stroke,.12,{Transparency=enabled and (hover and 0 or .12) or .6})
if not enabled then tween(scale,.12,{Scale=1}) end
end
b.MouseEnter:Connect(function() hover=true;if b.Active then tween(scale,.12,{Scale=1.025}) end;paint() end)
b.MouseLeave:Connect(function() hover=false;tween(scale,.12,{Scale=1});paint() end)
b.SelectionGained:Connect(function() hover=true;paint() end)
b.SelectionLost:Connect(function() hover=false;paint() end)
b.InputBegan:Connect(function(input) if b.Active and (input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch) then tween(scale,.07,{Scale=.965}) end end)
b.InputEnded:Connect(function(input) if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then tween(scale,.14,{Scale=hover and b.Active and 1.025 or 1}) end end)
b:GetPropertyChangedSignal("Active"):Connect(paint);paint()
end
action(c.fill,false);action(c.clear,false);action(c.generate,true)
for i,slot in c.slots do
slot.button.Name="ShardSlot"..i
local hint=make("TextLabel",{Name="AddHint",Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Text="+",TextColor3=Color3.fromRGB(166,236,230),TextTransparency=1,Font=Enum.Font.GothamBold,TextSize=35,ZIndex=5},slot.button)
local original=slot.icon.Size
slot.button.MouseEnter:Connect(function() if not slot.icon.Visible then tween(hint,.12,{TextTransparency=.2}) end end)
slot.button.MouseLeave:Connect(function() tween(hint,.12,{TextTransparency=1}) end)
slot.icon:GetPropertyChangedSignal("Visible"):Connect(function()
if slot.icon.Visible then
hint.TextTransparency=1;slot.icon.Size=UDim2.fromOffset(48,49);slot.icon.Rotation=-12
TweenService:Create(slot.icon,TweenInfo.new(.23,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Size=original,Rotation=0}):Play()
end
end)
end
for _,row in c.boosters do
local highlight=make("Frame",{Name="HoverTint",Size=UDim2.fromScale(1,1),BackgroundColor3=gold,BackgroundTransparency=1,BorderSizePixel=0,ZIndex=3},row.row)
make("UICorner",{CornerRadius=UDim.new(0,20)},highlight)
row.row.MouseEnter:Connect(function() tween(highlight,.12,{BackgroundTransparency=.9}) end)
row.row.MouseLeave:Connect(function() tween(highlight,.15,{BackgroundTransparency=1}) end)
end
c.boosterText.TextScaled=true
make("UITextSizeConstraint",{MinTextSize=20,MaxTextSize=44},c.boosterText)
local orb=make("Frame",{Name="BoosterGlow",AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromScale(.5,.5),Size=UDim2.fromScale(.68,.68),BackgroundColor3=Color3.fromRGB(39,178,106),BackgroundTransparency=.65,BorderSizePixel=0,ZIndex=3,Visible=false},c.boosterSlot)
make("UICorner",{CornerRadius=UDim.new(1,0)},orb)
function self.update()
local s=c.player:GetAttribute("CraftSlots") or string.rep("0",16)
local _,placed=s:gsub("1","")
local shards=c.player:GetAttribute("Shards") or 0
c.counter.Text=string.format("Shards in: %d / 16",placed)
c.counter.TextColor3=placed>=c.minimum and Color3.fromRGB(174,255,195) or Color3.fromRGB(220,235,228)
local busy=os.clock()<self.pendingUntil or (c.machine() and c.machine():GetAttribute("GeneratorBusy"))
local ready=placed>=c.minimum and placed<=shards and not busy
c.generate.Active=ready;c.generate.AutoButtonColor=false
if busy then c.generate.Text="Generator working…"
elseif placed>shards then c.generate.Text="Not enough shards"
elseif placed<c.minimum then c.generate.Text="Add "..(c.minimum-placed).." shards"
else c.generate.Text="Create · "..placed.." shards" end
c.clear.Active=placed>0 and not busy
c.fill.Active=shards>=c.minimum and not busy
local id=c.player:GetAttribute("CraftBooster")
local b=id and c.boosterConfig[id]
orb.Visible=b~=nil
if b then orb.BackgroundColor3=b.Color;c.boosterText.Text="×"..b.Luck;c.boosterInfo.Text=b.Name.." selected\nClick the slot to remove it."
else c.boosterText.Text="+";c.boosterInfo.Text="Pick a booster below.\nIt boosts one generation." end
end
c.generate.Activated:Connect(function()
if not c.generate.Active or not c.machine() then return end
self.pendingUntil=os.clock()+1.5;self.update();c.submit(c.machine())
end)
c.overlay:GetPropertyChangedSignal("Visible"):Connect(function()
if c.overlay.Visible then
local art=panel:FindFirstChild("Art");if art then art.ImageTransparency=.15;tween(art,.18,{ImageTransparency=0}) end
self.update()
end
end)
task.spawn(function() while panel.Parent do if c.overlay.Visible then self.update() end;task.wait(.15) end end)
self.update()
return self
end
return UX