feat(bunsik): 화면 UI 전면 개편 — 시뮬레이터 스타일(굵은 테두리·그러데이션·입체 버튼·직접 그린 아이콘·애니메이션)
- Theme 모듈: 색, 테두리, 입체 버튼(누르면 들어감, PC 마우스 올리면 커짐), 반짝임, 배지 - 아이콘 32개를 직접 그린 한 장(art/ui_icons.png, tools/icons.py)으로 올리고 Icons 모듈로 잘라 씀 - 돈 알약+동전, +돈 떠오름, 네모 아이콘 버튼, 다음 업그레이드 카드(이름표·아이콘·진행 막대), 업그레이드/설정 창(리본 제목·빨간 X·뒤 어둡게·튀어나오며 열림·다음 줄로 자동 스크롤) - 손님 말풍선·+돈 글자 테두리 색 통일 - 미리보기 도구: tests/cloud/dump_gui.luau + tools/gui_render.py + tools/preview.sh - 통합 테스트 668/668, Layout 1522 검사 통과 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
236
bunsik-tycoon/tests/cloud/dump_gui.luau
Normal file
236
bunsik-tycoon/tests/cloud/dump_gui.luau
Normal file
@@ -0,0 +1,236 @@
|
||||
-- 화면 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 })
|
||||
@@ -398,6 +398,7 @@ eq(
|
||||
|
||||
section("화면 UI(서버에서 생성)")
|
||||
local Hud = require(StarterPlayer.StarterPlayerScripts.Client.Hud)
|
||||
local Icons = require(ReplicatedStorage.Shared.Icons)
|
||||
local state = Instance.new("Folder")
|
||||
state:SetAttribute("Lang", "ko")
|
||||
state:SetAttribute("Money", 25)
|
||||
@@ -409,33 +410,77 @@ local hud = Hud.build(holder, state, function(kind, arg)
|
||||
table.insert(sent, { kind, arg })
|
||||
end)
|
||||
local root = hud.gui:FindFirstChild("Root") :: Frame
|
||||
local moneyText = root:FindFirstChild("Money"):FindFirstChild("Text") :: TextLabel
|
||||
eq(moneyText.Text, "💰 25원", "돈 표시")
|
||||
local nextTitle = root:FindFirstChild("Next"):FindFirstChild("Title") :: TextLabel
|
||||
eq(nextTitle.Text, "다음: 김밥 해금", "다음 업그레이드")
|
||||
local function label(o: Instance?): string?
|
||||
local t = o and o:FindFirstChild("Label", true) :: TextLabel?
|
||||
return t and t.Text
|
||||
end
|
||||
local moneyText = root:FindFirstChild("Money"):FindFirstChild("Text", true) :: TextLabel
|
||||
eq(moneyText.Text, "25원", "돈 표시")
|
||||
local nextCard = root:FindFirstChild("Next") :: Frame
|
||||
local nextTitle = nextCard:FindFirstChild("Title", true) :: TextLabel
|
||||
eq(nextTitle.Text, "김밥 해금", "다음 업그레이드")
|
||||
eq(
|
||||
(nextCard:FindFirstChild("Tab", true):FindFirstChild("Text") :: TextLabel).Text,
|
||||
"다음 업그레이드",
|
||||
"카드 이름표"
|
||||
)
|
||||
local nextIcon = nextCard:FindFirstChild("IconBox", true):FindFirstChild("Icon") :: ImageLabel
|
||||
eq(nextIcon.Image, Icons.ASSET, "다음 업그레이드 아이콘 그림")
|
||||
eq(nextIcon.ImageRectOffset, Icons.OFFSET.Gimbap, "김밥 해금 아이콘")
|
||||
check((root:FindFirstChild("Hint") :: Frame).Visible, "튜토리얼 안내 보임")
|
||||
check((nextCard:FindFirstChild("Pointer") :: ImageLabel).Visible, "튜토리얼 3: [사기] 가리키는 손")
|
||||
local buyBtn = nextCard:FindFirstChild("Buy") :: TextButton
|
||||
eq(label(buyBtn), "사기", "사기 버튼 글자")
|
||||
check(not (buyBtn:FindFirstChild("Shine", true) :: Frame).Visible, "돈이 모자라면 반짝임 없음")
|
||||
local listButton = root:FindFirstChild("ListButton") :: TextButton
|
||||
check(not (listButton:FindFirstChild("Badge") :: Frame).Visible, "돈이 모자라면 업그레이드 배지 없음")
|
||||
state:SetAttribute("Money", 60)
|
||||
check((buyBtn:FindFirstChild("Shine", true) :: Frame).Visible, "살 수 있으면 [사기] 반짝임")
|
||||
check((listButton:FindFirstChild("Badge") :: Frame).Visible, "살 수 있으면 업그레이드 버튼에 ! 배지")
|
||||
check(root:FindFirstChild("Gain") ~= nil, "돈이 늘면 +돈 글자가 떠오름")
|
||||
eq((root:FindFirstChild("Gain") :: TextLabel).Text, "+35원", "늘어난 돈")
|
||||
for _, d in Icons.OFFSET do
|
||||
check(d.X % 128 == 0 and d.Y % 128 == 0 and d.X < 1024 and d.Y < 1024, "아이콘 칸 위치")
|
||||
end
|
||||
state:SetAttribute("Lang", "en")
|
||||
eq(moneyText.Text, "💰 ₩25", "영어 돈 표시")
|
||||
eq(nextTitle.Text, "Next: Unlock Gimbap", "영어 다음 업그레이드")
|
||||
eq(moneyText.Text, "₩60", "영어 돈 표시")
|
||||
eq(nextTitle.Text, "Unlock Gimbap", "영어 다음 업그레이드")
|
||||
state:SetAttribute("Lang", "zh")
|
||||
eq(nextTitle.Text, "下一个: 解锁紫菜包饭", "중국어 다음 업그레이드")
|
||||
eq(nextTitle.Text, "解锁紫菜包饭", "중국어 다음 업그레이드")
|
||||
state:SetAttribute("Lang", "en")
|
||||
check(root:FindFirstChild("Lang") == nil, "언어 버튼 대신")
|
||||
local settingsBtn = root:FindFirstChild("Settings") :: TextButton
|
||||
check(settingsBtn ~= nil, "오른쪽 위 설정 버튼")
|
||||
eq(settingsBtn and settingsBtn.Text, "⚙️ Settings", "설정 버튼 글자")
|
||||
eq(label(settingsBtn), "Settings", "설정 버튼 글자")
|
||||
local settingsPanel = root:FindFirstChild("SettingsPanel") :: Frame
|
||||
check(settingsPanel ~= nil and not settingsPanel.Visible, "설정 창은 처음엔 닫힘")
|
||||
for _, l in { "auto", "ko", "en", "ja", "zh" } do
|
||||
check(settingsPanel:FindFirstChild("Lang_" .. l) ~= nil, `설정 창 언어 버튼 {l}`)
|
||||
end
|
||||
eq((settingsPanel:FindFirstChild("Lang_ja") :: TextButton).Text, "日本語", "언어 이름은 그 나라 말")
|
||||
eq((settingsPanel:FindFirstChild("MouseLook") :: TextButton).Text, "On", "마우스 회전 기본 켜짐")
|
||||
eq(label(settingsPanel:FindFirstChild("Lang_ja")), "日本語", "언어 이름은 그 나라 말")
|
||||
eq(label(settingsPanel:FindFirstChild("MouseLook")), "On", "마우스 회전 기본 켜짐")
|
||||
state:SetAttribute("Sfx", false)
|
||||
eq((settingsPanel:FindFirstChild("Sfx") :: TextButton).Text, "Off", "효과음 끔 표시")
|
||||
eq(label(settingsPanel:FindFirstChild("Sfx")), "Off", "효과음 끔 표시")
|
||||
check(not hud.menuOpen(), "창 닫힘")
|
||||
hud.open("shop")
|
||||
check(hud.menuOpen() and (root:FindFirstChild("Panel") :: Frame).Visible, "업그레이드 창 열기")
|
||||
check((root:FindFirstChild("Dim") :: Frame).Visible, "창 뒤 어둡게")
|
||||
local rowsFrame = root:FindFirstChild("Panel"):FindFirstChild("List", true) :: ScrollingFrame
|
||||
check(
|
||||
rowsFrame:FindFirstChild("Row2"):FindFirstChild("BuyRow") ~= nil,
|
||||
"목록의 다음 업그레이드에 사기 버튼"
|
||||
)
|
||||
check(rowsFrame:FindFirstChild("Row1"):FindFirstChild("Done") ~= nil, "산 업그레이드는 체크 표시")
|
||||
check(
|
||||
rowsFrame:FindFirstChild("Row5"):FindFirstChild("IconBox"):FindFirstChild("Lock") ~= nil,
|
||||
"잠긴 업그레이드 자물쇠"
|
||||
)
|
||||
hud.open("settings")
|
||||
check(settingsPanel.Visible and not (root:FindFirstChild("Panel") :: Frame).Visible, "창은 하나만 열림")
|
||||
hud.open(nil)
|
||||
check(not hud.menuOpen() and not (root:FindFirstChild("Dim") :: Frame).Visible, "창 닫기")
|
||||
state:SetAttribute("Bought", #Economy.PURCHASES)
|
||||
check(not (root:FindFirstChild("Next"):FindFirstChild("Buy") :: TextButton).Visible, "다 사면 사기 버튼 숨김")
|
||||
check(not buyBtn.Visible, "다 사면 사기 버튼 숨김")
|
||||
check(not (root:FindFirstChild("Boost") :: TextButton).Visible, "다 사면 돈 부스트 숨김")
|
||||
check(root:FindFirstChild("Dev") == nil, "개발자 버튼은 설정 창 안으로")
|
||||
local devMoneyBtn = settingsPanel:FindFirstChild("devMoney") :: TextButton
|
||||
check(not devMoneyBtn.Visible, "개발자 버튼은 기본으로 숨김")
|
||||
@@ -443,10 +488,20 @@ local setH = settingsPanel.Size.Y.Offset
|
||||
state:SetAttribute("Dev", true)
|
||||
check(devMoneyBtn.Visible, "게임 주인에게 개발자 버튼(설정 창)")
|
||||
check(settingsPanel.Size.Y.Offset > setH, "개발자 줄만큼 설정 창이 길어짐")
|
||||
check((root:FindFirstChild("Double") :: TextButton).Visible, "2배 수익 버튼(상품 ID 설정됨)")
|
||||
local doubleBtn = root:FindFirstChild("Double") :: TextButton
|
||||
check(doubleBtn.Visible, "2배 수익 버튼(상품 ID 설정됨)")
|
||||
eq(label(doubleBtn), "Double Money", "2배 수익 버튼 글자")
|
||||
state:SetAttribute("Double", true)
|
||||
eq(label(doubleBtn), "Active", "2배 수익 산 뒤")
|
||||
check((doubleBtn:FindFirstChild("Owned") :: ImageLabel).Visible, "2배 수익 산 뒤 체크")
|
||||
hud.notify("purchased", { item = "Table2" })
|
||||
local toastText = root.Toasts:FindFirstChild("Toast"):FindFirstChild("Text") :: TextLabel
|
||||
eq(toastText.Text, "Table 2 bought!", "구매 알림에 업그레이드 이름(내 언어)")
|
||||
eq(
|
||||
(root.Toasts:FindFirstChild("Toast"):FindFirstChild("Icon") :: ImageLabel).ImageRectOffset,
|
||||
Icons.OFFSET.check,
|
||||
"구매 알림 아이콘"
|
||||
)
|
||||
-- 휴대폰 배치(아이폰 15 가로, 상단 바·노치 뺀 영역): 루트가 화면을 채우고, 결제 버튼은 왼쪽 위, 마우스 줄 숨김
|
||||
hud.setLayout(Vector2.new(750, 332), true)
|
||||
local lay = hud.layout()
|
||||
@@ -460,10 +515,11 @@ check(
|
||||
"휴대폰: 루트 높이 = 화면"
|
||||
)
|
||||
eq(
|
||||
(root:FindFirstChild("Double") :: TextButton).Position.Y.Offset,
|
||||
lay.double.y,
|
||||
"휴대폰: 2배 수익 버튼 위치"
|
||||
doubleBtn.Position.Y.Offset,
|
||||
lay.double.y + lay.double.h / 2,
|
||||
"휴대폰: 2배 수익 버튼 위치(가운데 기준)"
|
||||
)
|
||||
eq(doubleBtn.Size.Y.Offset, lay.double.h, "휴대폰: 2배 수익 버튼 크기")
|
||||
check(lay.double.y + lay.double.h < lay.height / 3, "휴대폰: 결제 버튼은 조이스틱 자리 위")
|
||||
check(not (settingsPanel:FindFirstChild("MouseLook") :: TextButton).Visible, "휴대폰: 마우스 회전 줄 숨김")
|
||||
check(scaleObj.Scale > 0.8, `휴대폰: 글자 배율 {scaleObj.Scale}`)
|
||||
@@ -500,6 +556,20 @@ for name, id in Sounds do
|
||||
end
|
||||
end
|
||||
|
||||
section("UI 아이콘 그림(직접 그린 이미지 에셋)")
|
||||
do
|
||||
local Icons = require(ReplicatedStorage.Shared.Icons)
|
||||
local num = tonumber(string.match(Icons.ASSET, "%d+"))
|
||||
local okInfo, info = pcall(function()
|
||||
return game:GetService("MarketplaceService"):GetProductInfoAsync(num :: number, Enum.InfoType.Asset)
|
||||
end)
|
||||
check(okInfo, "아이콘 그림 정보 조회")
|
||||
if okInfo then
|
||||
eq(info.AssetTypeId, 1, "아이콘 그림은 이미지")
|
||||
eq(info.Creator.CreatorTargetId, game.CreatorId, "아이콘 그림은 게임 주인 소유")
|
||||
end
|
||||
end
|
||||
|
||||
section("Products")
|
||||
local Products = require(ReplicatedStorage.Shared.Products)
|
||||
local MarketplaceService = game:GetService("MarketplaceService")
|
||||
|
||||
Reference in New Issue
Block a user