Files
roblox-project/bunsik-tycoon/tests/cloud/dump_gui.luau
EJClaw 25df3d4846 feat(bunsik): 꾸미기 모드(아래 물건 줄·이동·삭제), 가게 이름 색 10가지, 개발자 결제 테스트 모드
- [가게 꾸미기]를 누르면 창 없이 바로 꾸미기 모드: 아래 물건 줄(테이블·의자·소품 6가지, 값·개수)에서 고르면
  투명 미리보기를 들고 걸어가 [배치]. [이동]은 고른 가구를 들고 옮기기, [삭제]는 고른 가구를 빨갛게 표시한 뒤
  한 번 더 눌러 지우고 산 값 돌려받기(조리대·마지막 테이블/의자·의자가 보는 테이블·손님 앉은 의자는 막음)
- 새 요청 remove, Floor.remove, Shop.removeSeat(뒤 자리 손님·걷는 시간 번호 당김)
- 내 가게 탭: 이름 색 무료 10색 + 무지개(게임패스) 칸. 부지 속성 NameColor로 모두에게 보임
- 개발자 테스트 [결제 테스트 켜기/끄기]: 켜면 2배·부스트·러시·쫓아내기·광고 홍보·무지개·유료 디자인이
  결제 창 없이 바로 지급(이번 접속만), 게임패스는 안 가진 상태로 바꿔 사는 흐름을 볼 수 있고 끄면 실제 보유로 복구

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 05:32:32 +09:00

352 lines
11 KiB
Lua

-- 화면 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 Decorate = require(Client.Decorate)
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
-- 상태 묶음(NETWORK.md 플레이어 속성). 갈래 레벨은 Levels 글자로
local function shopState(levels: string, seats: number, tables: number, extra: { [string]: any }): { [string]: any }
local t: { [string]: any } = { Levels = levels, Seats = seats, Tables = tables }
local stage = 1 + (tonumber(string.match(levels, "Stage=(%d)")) or 0)
t.Stage = stage
for k, v in extra do
t[k] = v
end
return t
end
local EARLY = "Stage=0,Menu=1,Price=0,Speed=1,Stove=0,Tray=0,Staff=0"
local MID = "Stage=1,Menu=2,Price=2,Speed=3,Stove=1,Tray=1,Staff=1"
local LATE = "Stage=2,Menu=4,Price=4,Speed=5,Stove=3,Tray=2,Staff=1"
local LAYOUT = '{"stove":{"x":0,"z":-26,"r":0},"tables":[{"x":-9,"z":-10,"f":1},{"x":9,"z":-10,"f":1}],'
.. '"chairs":[{"t":1,"s":1},{"t":1,"s":3},{"t":2,"s":1}],"decor":[{"k":"Plant","x":-31,"z":-35,"f":1,"r":0}]}'
local SHOTS = {
shot(
"phone_main",
PHONE,
shopState(EARLY, 2, 1, { Money = 85, Carry = 1, Hand = "Gimbap", Tut = 0 }),
{ toast = true }
),
shot("phone_tut", PHONE, shopState("", 1, 1, { Money = 15, Tut = 3 })),
shot("phone_shop", PHONE, shopState(EARLY, 2, 1, { Money = 150 }), { open = "shop" }),
shot("phone_deco", PHONE, shopState(MID, 3, 2, { Money = 120, Layout = LAYOUT }), { deco = true }),
shot("pc_deco", PC, shopState(MID, 3, 2, { Money = 120, Layout = LAYOUT }), { deco = true }),
shot("pc_tut", PC, shopState("", 1, 1, { Money = 15, Tut = 3 })),
shot(
"phone_shop_staff",
PHONE,
shopState(MID, 3, 2, { Money = 600, Staff = "Cook=1,Server=0,Promoter=0", Wage = 18 }),
{ open = "shop", tab = "staff" }
),
shot(
"phone_shop_mine",
PHONE,
shopState(MID, 3, 2, { Money = 600, ShopName = "떡볶이 천국", Design = "Mint", RainbowOwned = false }),
{ open = "shop", tab = "mine" }
),
shot("phone_promote", PHONE, shopState(EARLY, 2, 1, { Money = 150 }), { open = "promote" }),
shot("phone_settings", PHONE, shopState(EARLY, 2, 1, { Money = 150 }), { open = "settings" }),
shot(
"phone_kitchen_menu",
PHONE,
shopState(EARLY, 2, 1, { Money = 300, Orders = "Tteokbokki=1,Gimbap=2", Tut = 1 }),
{ kitchen = { menu = nil } }
),
shot(
"phone_kitchen_tteok",
PHONE,
shopState(EARLY, 2, 1, { Money = 300, Orders = "Tteokbokki=1" }),
{ kitchen = { menu = "Tteokbokki", step = 3, frac = 0.5 } }
),
shot("pc_main", PC, shopState(EARLY, 2, 1, { Money = 1234, Carry = 1, Hand = "Tteokbokki" }), { toast = true }),
shot("pc_buyable", PC, shopState(EARLY, 2, 1, { Money = 160, Carry = 0, Tut = 0 })),
shot("pc_shop", PC, shopState(MID, 4, 2, { Money = 760, Double = true }), { open = "shop" }),
shot("pc_shop_staff_locked", PC, shopState(EARLY, 2, 1, { Money = 760 }), { open = "shop", tab = "staff" }),
shot(
"pc_shop_staff_strike",
PC,
shopState(LATE, 10, 4, { Money = 0, Staff = "Cook=2,Server=1,Promoter=1", Strike = true, Wage = 120 }),
{ open = "shop", tab = "staff" }
),
shot(
"pc_shop_mine",
PC,
shopState(
LATE,
10,
4,
{ Money = 760, Design = "Candy", DesignsOwned = "Candy", RainbowOwned = true, Rainbow = true }
),
{ open = "shop", tab = "mine" }
),
shot("pc_settings", PC, shopState(MID, 4, 2, { Money = 760, Dev = true }), { open = "settings" }),
shot(
"pc_kitchen_menu",
PC,
shopState(MID, 4, 2, { Money = 300, Orders = "Gimbap=1,Sundae=2,Eomuk=1" }),
{ kitchen = { menu = nil } }
),
shot(
"pc_kitchen_gimbap",
PC,
shopState(MID, 4, 2, { Money = 300, Orders = "Gimbap=1" }),
{ kitchen = { menu = "Gimbap", step = 2, frac = 0.6 } }
),
shot(
"pc_kitchen_sundae",
PC,
shopState(MID, 4, 2, { Money = 300, Orders = "Sundae=1" }),
{ kitchen = { menu = "Sundae", step = 2, frac = 0.7 } }
),
shot(
"pc_kitchen_eomuk",
PC,
shopState(LATE, 4, 2, { Money = 300, Orders = "Eomuk=1" }),
{ kitchen = { menu = "Eomuk", step = 2, frac = 0.4 } }
),
shot(
"pc_kitchen_twigim",
PC,
shopState(LATE, 4, 2, { Money = 300, Orders = "Twigim=1" }),
{ kitchen = { menu = "Twigim", step = 3, frac = 0.5 } }
),
shot(
"pc_kitchen_done",
PC,
shopState(EARLY, 2, 1, { Money = 300, Orders = "Tteokbokki=1" }),
{ kitchen = { menu = "Tteokbokki", step = "done" } }
),
shot(
"tablet_ipad",
{ w = 1024, h = 710, inset = 58, touch = true },
shopState(LATE, 10, 4, { Money = 98765, Carry = 2, Hand = "Eomuk,Sundae" })
),
}
local shots = {}
-- 한 번에 다 그리면 5분 제한을 넘을 수 있어서, ONLY에 이름을 넣으면 그 장면만 그립니다(tools/preview.sh가 나눠서 부름).
local ONLY: { string }? = nil
for _, s in SHOTS do
if ONLY and not table.find(ONLY, s.name) then
continue
end
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("upgraded", { track = "Speed", level = 2 })
end
if s.open then
hud.open(s.open, s.tab)
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()
local gui = hud.gui
local deco = nil
if s.deco then
-- 꾸미기 모드: 화면 UI는 숨기고 꾸미기 화면만
local plotStub = Instance.new("Model")
plotStub:SetAttribute("Origin", CFrame.new())
deco = Decorate.build(holder, state, plotStub, function() end)
deco.setLayout(hud.layout())
deco.open()
gui = deco.gui
end
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(gui, 1),
})
if deco then
deco.destroy()
end
hud.destroy()
end
local images = {}
images[Icons.ASSET:match("%d+")] = "art/ui_icons.png"
images[Icons.KITCHEN_ASSET:match("%d+")] = "art/kitchen.png"
-- 결과가 커서(4MB 넘음) 바이너리 출력으로 돌려줍니다(tools/preview.sh가 --out 파일로 받음).
local json = HttpService:JSONEncode({ shots = shots, images = images })
return { BinaryOutput = buffer.fromstring(json), ReturnValues = { #shots } }