-- 화면 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 d.SizeConstraint = o.SizeConstraint.Name 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 Recipes = require(game:GetService("ReplicatedStorage").Shared.Recipes) -- kitchen = { menu, step, frac } 이면 요리 창을 열어 그 단계까지 진행합니다(step = "done"이면 완성 화면). local PHONE = { w = 750, h = 332, inset = 58, touch = true } local PC = { w = 1366, h = 710, inset = 58, touch = false } local function shot(name: string, dev: { [string]: any }, attrs: { [string]: any }, extra: { [string]: any }?) local t = { name = name, w = dev.w, h = dev.h, inset = dev.inset, touch = dev.touch, attrs = attrs } for k, v in extra or {} do t[k] = v end return t end local SHOTS = { shot("phone_main", PHONE, { Money = 85, Bought = 4, Carry = 1, Hand = "Gimbap", Tut = 0 }, { toast = true }), shot("phone_tut", PHONE, { Money = 15, Bought = 0, Tut = 3 }), shot("phone_shop", PHONE, { Money = 150, Bought = 5 }, { open = "shop" }), shot("phone_settings", PHONE, { Money = 150, Bought = 5 }, { open = "settings" }), shot( "phone_kitchen_menu", PHONE, { Money = 300, Bought = 6, Orders = "Tteokbokki=1,Gimbap=2", Tut = 1 }, { kitchen = { menu = nil } } ), shot( "phone_kitchen_tteok", PHONE, { Money = 300, Bought = 6, Orders = "Tteokbokki=1" }, { kitchen = { menu = "Tteokbokki", step = 3, frac = 0.5 } } ), shot("pc_main", PC, { Money = 1234, Bought = 4, Carry = 1, Hand = "Tteokbokki" }, { toast = true }), shot("pc_buyable", PC, { Money = 160, Bought = 5, Carry = 0, Tut = 0 }), shot("pc_shop", PC, { Money = 760, Bought = 12, Double = true }, { open = "shop" }), shot("pc_settings", PC, { Money = 760, Bought = 12, Dev = true }, { open = "settings" }), shot( "pc_kitchen_menu", PC, { Money = 300, Bought = 13, Orders = "Gimbap=1,Sundae=2,Eomuk=1" }, { kitchen = { menu = nil } } ), shot( "pc_kitchen_gimbap", PC, { Money = 300, Bought = 13, Orders = "Gimbap=1" }, { kitchen = { menu = "Gimbap", step = 2, frac = 0.6 } } ), shot( "pc_kitchen_sundae", PC, { Money = 300, Bought = 13, Orders = "Sundae=1" }, { kitchen = { menu = "Sundae", step = 2, frac = 0.7 } } ), shot( "pc_kitchen_eomuk", PC, { Money = 300, Bought = 13, Orders = "Eomuk=1" }, { kitchen = { menu = "Eomuk", step = 2, frac = 0.4 } } ), shot( "pc_kitchen_twigim", PC, { Money = 300, Bought = 17, Orders = "Twigim=1" }, { kitchen = { menu = "Twigim", step = 3, frac = 0.5 } } ), shot( "pc_kitchen_done", PC, { Money = 300, Bought = 6, Orders = "Tteokbokki=1" }, { kitchen = { menu = "Tteokbokki", step = "done" } } ), shot( "tablet_ipad", { w = 1024, h = 710, inset = 58, touch = true }, { Money = 98765, Bought = 15, Carry = 2, Hand = "Eomuk,Sundae" } ), } 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.toast then hud.notify("purchased", { item = "Stove1" }) end if s.open then hud.open(s.open) end local k = s.kitchen if k then hud.open("kitchen") if k.menu then hud.kitchen.choose(k.menu) local r = Recipes.LIST[k.menu] local cook = hud.kitchen.flow().cook for i, st in r.steps do local need = Recipes.need(st, cook) if k.step == "done" or i < k.step then hud.kitchen.input(st.kind, need) elseif i == k.step then hud.kitchen.input(st.kind, need * k.frac) break end end end end hud.refresh() task.wait(0.3) 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" images[Icons.KITCHEN_ASSET:match("%d+")] = "art/kitchen.png" return HttpService:JSONEncode({ shots = shots, images = images })