-- 화면 UI를 여러 상황(기기 크기, 창 열림)으로 서버에서 만들어 JSON으로 덤프합니다. -- python3 tools/cloud.py run tests/cloud/dump_gui.luau --version N → 출력의 JSON을 tools/gui_render.py로 그림 local HttpService = game:GetService("HttpService") local StarterPlayer = game:GetService("StarterPlayer") local Client = StarterPlayer.StarterPlayerScripts.Client local Hud = require(Client.Hud) local Layout = require(Client.Layout) local Icons = require(game:GetService("ReplicatedStorage").Shared.Icons) local function c3(c: Color3): { number } return { c.R, c.G, c.B } end local function ud(u: UDim): { number } return { u.Scale, u.Offset } end local function ud2(u: UDim2): { { number } } return { ud(u.X), ud(u.Y) } end local function gradient(g: UIGradient): { [string]: any } local colors = {} for _, kp in g.Color.Keypoints do table.insert(colors, { kp.Time, c3(kp.Value) }) end local trans = {} for _, kp in g.Transparency.Keypoints do table.insert(trans, { kp.Time, kp.Value }) end return { Color = colors, Transparency = trans, Rotation = g.Rotation, Offset = { g.Offset.X, g.Offset.Y }, Enabled = g.Enabled, } end local function fontName(f: Font): string return (f.Family:match("families/(.-)%.json") or "FredokaOne") end local function dump(o: Instance, i: number): { [string]: any }? if not o:IsA("GuiBase2d") then return nil end local d: { [string]: any } = { ClassName = o.ClassName, Name = o.Name, _i = i } if o:IsA("GuiObject") then d.Visible = o.Visible d.Size = ud2(o.Size) d.Position = ud2(o.Position) d.AnchorPoint = { o.AnchorPoint.X, o.AnchorPoint.Y } d.Rotation = o.Rotation d.ZIndex = o.ZIndex d.LayoutOrder = o.LayoutOrder d.BackgroundColor3 = c3(o.BackgroundColor3) d.BackgroundTransparency = o.BackgroundTransparency d.ClipsDescendants = o.ClipsDescendants end if o:IsA("ScrollingFrame") then d.CanvasPosition = { o.CanvasPosition.X, o.CanvasPosition.Y } end if o:IsA("TextLabel") or o:IsA("TextButton") or o:IsA("TextBox") then d.Text = o.Text d.TextColor3 = c3(o.TextColor3) d.TextTransparency = o.TextTransparency d.TextScaled = o.TextScaled d.TextWrapped = o.TextWrapped d.TextSize = o.TextSize d.TextXAlignment = o.TextXAlignment.Name d.TextYAlignment = o.TextYAlignment.Name d.TextStrokeTransparency = o.TextStrokeTransparency d.TextStrokeColor3 = c3(o.TextStrokeColor3) d.Font = fontName(o.FontFace) d.Weight = o.FontFace.Weight.Name end if o:IsA("ImageLabel") or o:IsA("ImageButton") then d.Image = o.Image d.ImageColor3 = c3(o.ImageColor3) d.ImageTransparency = o.ImageTransparency d.ImageRectOffset = { o.ImageRectOffset.X, o.ImageRectOffset.Y } d.ImageRectSize = { o.ImageRectSize.X, o.ImageRectSize.Y } d.ScaleType = o.ScaleType.Name end local strokes = {} local children = {} for j, ch in o:GetChildren() do if ch:IsA("UICorner") then d.UICorner = ud(ch.CornerRadius) elseif ch:IsA("UIStroke") then local s: { [string]: any } = { Color = c3(ch.Color), Thickness = ch.Thickness, Transparency = ch.Transparency, ApplyStrokeMode = ch.ApplyStrokeMode.Name, Enabled = ch.Enabled, } local g = ch:FindFirstChildOfClass("UIGradient") if g then s.UIGradient = gradient(g) end table.insert(strokes, s) elseif ch:IsA("UIGradient") then if ch.Enabled then d.UIGradient = gradient(ch) end elseif ch:IsA("UIPadding") then d.UIPadding = { Left = ud(ch.PaddingLeft), Right = ud(ch.PaddingRight), Top = ud(ch.PaddingTop), Bottom = ud(ch.PaddingBottom), } elseif ch:IsA("UIListLayout") then d.UIListLayout = { FillDirection = ch.FillDirection.Name, Padding = ud(ch.Padding), HorizontalAlignment = ch.HorizontalAlignment.Name, VerticalAlignment = ch.VerticalAlignment.Name, SortOrder = ch.SortOrder.Name, } elseif ch:IsA("UIScale") then d.UIScale = ch.Scale elseif ch:IsA("UIAspectRatioConstraint") then d.UIAspectRatio = ch.AspectRatio elseif ch:IsA("UITextSizeConstraint") then d.MaxTextSize = ch.MaxTextSize else local cd = dump(ch, j) if cd then table.insert(children, cd) end end end if #strokes > 0 then d.UIStrokes = strokes end d.children = children return d end local SHOTS = { { name = "phone_iphone15", w = 750, h = 332, inset = 58, touch = true, attrs = { Money = 1234, Bought = 4, Carry = 1, Tut = 0 }, }, { name = "phone_tut", w = 750, h = 332, inset = 58, touch = true, attrs = { Money = 12, Bought = 0, Tut = 3 } }, { name = "phone_shop", w = 750, h = 332, inset = 58, touch = true, attrs = { Money = 150, Bought = 5 }, open = "Panel", }, { name = "phone_settings", w = 750, h = 332, inset = 58, touch = true, attrs = { Money = 150, Bought = 5 }, open = "SettingsPanel", }, { name = "pc_1366", w = 1366, h = 710, inset = 58, touch = false, attrs = { Money = 1234, Bought = 4, Carry = 1 } }, { name = "pc_shop", w = 1366, h = 710, inset = 58, touch = false, attrs = { Money = 760, Bought = 12, Double = true }, open = "Panel", }, { name = "pc_settings", w = 1366, h = 710, inset = 58, touch = false, attrs = { Money = 760, Bought = 12, Dev = true }, open = "SettingsPanel", }, { name = "tablet_ipad", w = 1024, h = 710, inset = 58, touch = true, attrs = { Money = 98765, Bought = 15, Carry = 2 }, }, } local shots = {} for _, s in SHOTS do local state = Instance.new("Folder") state:SetAttribute("Lang", "ko") state:SetAttribute("Ready", true) for k, v in s.attrs do state:SetAttribute(k, v) end local holder = Instance.new("Folder") local hud = Hud.build(holder, state, function() end) hud.setLayout(Vector2.new(s.w, s.h), s.touch) if s.attrs.Tut == nil then state:SetAttribute("Tut", 0) end if s.name == "phone_iphone15" or s.name == "pc_1366" then hud.notify("purchased", { item = "Stove1" }) end if s.open then hud.open(if s.open == "Panel" then "shop" else "settings") end hud.refresh() task.wait(0.2) local zones = Layout.touchZones(s.w, s.h) table.insert(shots, { name = s.name, width = s.w, height = s.h, inset = s.inset, touch = s.touch, zones = zones, gui = dump(hud.gui, 1), }) hud.destroy() end local images = {} images[Icons.ASSET:match("%d+")] = "art/ui_icons.png" return HttpService:JSONEncode({ shots = shots, images = images })