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:
EJClaw
2026-10-12 17:24:16 +09:00
parent 998b2467d6
commit 05848d19d6
14 changed files with 2604 additions and 449 deletions

View File

@@ -9,10 +9,10 @@
## 해 볼 것 (15~20분) ## 해 볼 것 (15~20분)
1. 튜토리얼: 노란 줄과 ⬇️ 화살표를 따라 조리대로 가서 버튼을 꾹 누르고(PC는 E 키), 접시를 손님 자리로 가져갑니다. 손님 근처에 가면 접시가 자동으로 놓입니다. 1. 튜토리얼: 노란 줄과 ⬇️ 화살표를 따라 조리대로 가서 버튼을 꾹 누르고(PC는 E 키), 접시를 손님 자리로 가져갑니다. 손님 근처에 가면 접시가 자동으로 놓입니다.
2. 돈이 생기면 아래 가운데 카드의 [사기] 버튼으로 다음 업그레이드를 삽니다. 오른쪽 [📋 업그레이드]에서 전체 목록을 봅니다. 2. 돈이 생기면 아래 가운데 "다음 업그레이드" 카드의 초록 [사기] 버튼으로 삽니다. 살 수 있을 때는 버튼이 반짝이고, 오른쪽 주황 [업그레이드] 버튼에 빨간 `!` 배지가 붙습니다. [업그레이드] 버튼을 누르면 전체 목록이 열리고, 다음에 살 줄로 자동으로 내려갑니다(그 줄에서도 바로 살 수 있음).
3. 8번째 구매(알바생)부터는 알바생이 카운터(조리대 오른쪽)에 접시를 만들어 둡니다. 카운터 근처에 가면 접시를 자동으로 집습니다. 3. 8번째 구매(알바생)부터는 알바생이 카운터(조리대 오른쪽)에 접시를 만들어 둡니다. 카운터 근처에 가면 접시를 자동으로 집습니다.
4. 10번째 구매(실내 분식집 확장)를 하면 건물이 생기고 2단계 업그레이드 10개가 열립니다. 4. 10번째 구매(실내 분식집 확장)를 하면 건물이 생기고 2단계 업그레이드 10개가 열립니다.
5. 오른쪽 위 `⚙️ 설정` 버튼을 눌러 봅니다. 5. 오른쪽 위 파란 톱니바퀴 [설정] 버튼을 눌러 봅니다.
- 언어: 자동(계정 언어)·한국어·English·日本語·中文 중에서 고릅니다. 이름판·메뉴판·버튼 글자가 모두 바뀝니다. - 언어: 자동(계정 언어)·한국어·English·日本語·中文 중에서 고릅니다. 이름판·메뉴판·버튼 글자가 모두 바뀝니다.
- 마우스로 화면 돌리기(PC, 기본 켜짐): 우클릭 없이 마우스만 움직여도 화면이 돕니다. 버튼을 누를 땐 Ctrl을 누르고 있거나, 업그레이드·설정 창을 열면 커서가 나옵니다. - 마우스로 화면 돌리기(PC, 기본 켜짐): 우클릭 없이 마우스만 움직여도 화면이 돕니다. 버튼을 누를 땐 Ctrl을 누르고 있거나, 업그레이드·설정 창을 열면 커서가 나옵니다.
- 효과음 켜기/끄기. - 효과음 켜기/끄기.
@@ -25,20 +25,28 @@
## 휴대폰에서 해 볼 것 ## 휴대폰에서 해 볼 것
휴대폰·태블릿은 화면을 가로로 두고 합니다. 화면을 터치하면 휴대폰 배치로 바뀝니다. 휴대폰·태블릿은 화면을 가로로 두고 합니다. 화면을 터치하면 휴대폰 배치로 바뀝니다.
- 왼쪽 위: `💰x2 2배 수익`, `⚡ 돈 부스트`. 왼쪽 아래 조이스틱 자리와 겹치지 않게 위로 올렸습니다. - 왼쪽 위: 보라 [2배 수익], 노랑 [돈 부스트]. 왼쪽 아래 조이스틱 자리와 겹치지 않게 위로 올렸습니다.
- 오른쪽 위: `⚙️ 설정`, `📋 업그레이드`. 오른쪽 아래 점프 버튼 자리는 비워 두었습니다. - 오른쪽 위: 파랑 [설정], 주황 [업그레이드]. 오른쪽 아래 점프 버튼 자리는 비워 두었습니다.
- 아래: 다음 업그레이드 카드. [사기] 버튼은 조이스틱과 점프 버튼 사이에 옵니다. - 아래: 다음 업그레이드 카드. [사기] 버튼은 조이스틱과 점프 버튼 사이에 옵니다.
- 설정 창에는 마우스 회전 줄이 없습니다(휴대폰에는 필요 없음). - 설정 창에는 마우스 회전 줄이 없습니다(휴대폰에는 필요 없음).
- 조이스틱으로 걸을 때 버튼이 눌리지 않는지, 글자가 너무 작지 않은지 봐 주세요. - 조이스틱으로 걸을 때 버튼이 눌리지 않는지, 글자가 너무 작지 않은지 봐 주세요.
## 새 화면 UI에서 봐 줄 것
- 버튼을 누르면 쏙 들어갔다 나오는지, PC에서 마우스를 올리면 살짝 커지는지
- 돈을 벌면 돈 표시가 통 튀고 아래에 초록 `+돈` 글자가 떠오르는지
- 업그레이드·설정 창이 튀어나오듯 열리고 뒤 화면이 어두워지는지
- 아이콘(동전, 메뉴 음식, 테이블 등)이 깨지거나 빈 네모로 나오지 않는지
- 글자가 버튼 밖으로 넘치거나 너무 작은 곳이 없는지(영어·일본어·중국어도)
## 개발자 테스트 버튼(주인 계정에만 보임) ## 개발자 테스트 버튼(주인 계정에만 보임)
`⚙️ 설정` 창 맨 아래의 `🛠 개발자 테스트` 줄: [설정] 창 맨 아래의 렌치 아이콘 `개발자 테스트` 줄:
- `+1,000원`: 돈을 바로 넣습니다. 뒤쪽 업그레이드를 빨리 확인할 때 씁니다. - `+1,000원`: 돈을 바로 넣습니다. 뒤쪽 업그레이드를 빨리 확인할 때 씁니다.
- `2배 켜기/끄기`: 2배 수익 게임패스를 산 것처럼 켭니다(이번 접속에만 적용). - `2배 켜기/끄기`: 2배 수익 게임패스를 산 것처럼 켭니다(이번 접속에만 적용).
- `처음부터`: 돈·업그레이드·튜토리얼을 처음으로 되돌립니다. - `처음부터`: 돈·업그레이드·튜토리얼을 처음으로 되돌립니다.
`💰x2 2배 수익`, `⚡ 돈 부스트` 버튼은 진짜 결제 창이 뜹니다. 누르면 실제 로벅스가 나가니, 결제 테스트가 필요할 때만 쓰세요. [2배 수익], [돈 부스트] 버튼은 진짜 결제 창이 뜹니다. 누르면 실제 로벅스가 나가니, 결제 테스트가 필요할 때만 쓰세요.
## 알려 주시면 좋은 것 ## 알려 주시면 좋은 것

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -38,9 +38,10 @@ export type Result = {
}, },
} }
local CARD_W, CARD_H = 500, 96 local CARD_W, CARD_H = 500, 112
local BUY_W, BUY_H = 140, 72 local CARD_TAB = 16 -- 카드 위로 튀어나온 "다음 업그레이드" 이름표 높이(카드 사각형 안)
local PANEL_W = 520 local BUY_W, BUY_H = 140, 70
local PANEL_W = 540
local function rect(x: number, y: number, w: number, h: number): Rect local function rect(x: number, y: number, w: number, h: number): Rect
return { x = x, y = y, w = w, h = h } return { x = x, y = y, w = w, h = h }
@@ -70,26 +71,28 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
local W, H = w / s, h / s local W, H = w / s, h / s
local cx = W / 2 local cx = W / 2
local money = rect(cx - 150, 6, 300, 62) -- 돈: 왼쪽에 동전 아이콘이 튀어나온 알약 모양
local carry = rect(cx - 80, 72, 160, 28) local money = rect(cx - 160, 6, 320, 64)
local carry = rect(cx - 60, 74, 120, 30)
-- 네모 아이콘 버튼(아이콘 위, 이름 아래)
local settings, list, double, boost local settings, list, double, boost
local hintW local hintW
if touch then if touch then
-- 오른쪽 위: 설정, 업그레이드 목록. 왼쪽 위: 2배 수익, 돈 부스트(조이스틱 자리 H/3 위쪽). -- 왼쪽 위: 2배 수익, 돈 부스트(조이스틱 자리 H/3 위쪽). 오른쪽 위: 설정, 업그레이드 목록.
settings = rect(W - 160, 6, 150, 52) double = rect(8, 6, 84, 84)
list = rect(W - 160, 66, 150, 56) boost = rect(100, 6, 84, 84)
double = rect(10, 6, 170, 58) list = rect(W - 92, 6, 84, 84)
boost = rect(10, 70, 170, 58) settings = rect(W - 92 - 76, 6, 68, 68)
hintW = math.min(640, W - 2 * 190) hintW = math.min(640, W - 2 * 196)
else else
settings = rect(W - 140, 6, 130, 44) settings = rect(W - 78, 6, 68, 68)
list = rect(W - 160, H / 2 - 68, 150, 56) list = rect(W - 110, H / 2 - 50, 100, 100)
double = rect(10, H / 2 - 72, 170, 64) double = rect(10, H / 2 - 112, 100, 100)
boost = rect(10, H / 2 + 2, 170, 64) boost = rect(10, H / 2 + 12, 100, 100)
hintW = 640 hintW = 640
end end
local hint = rect(cx - hintW / 2, 104, hintW, 54) local hint = rect(cx - hintW / 2, 110, hintW, 58)
-- 아래 카드: 터치 화면에서는 점프 버튼 왼쪽까지 밀어 둡니다. -- 아래 카드: 터치 화면에서는 점프 버튼 왼쪽까지 밀어 둡니다.
local cardX = cx - CARD_W / 2 local cardX = cx - CARD_W / 2
@@ -99,31 +102,32 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
end end
cardX = math.max(cardX, 10) cardX = math.max(cardX, 10)
local card = rect(cardX, H - 8 - CARD_H, CARD_W, CARD_H) local card = rect(cardX, H - 8 - CARD_H, CARD_W, CARD_H)
local buy = rect(card.x + CARD_W - 12 - BUY_W, card.y + (CARD_H - BUY_H) / 2, BUY_W, BUY_H) local bodyH = CARD_H - CARD_TAB
local buy = rect(card.x + CARD_W - 12 - BUY_W, card.y + CARD_TAB + (bodyH - BUY_H) / 2, BUY_W, BUY_H)
local toastsW = math.min(560, hintW) local toastsW = math.min(560, hintW)
local toasts = rect(cx - toastsW / 2, 166, toastsW, math.max(0, card.y - 6 - 166)) local toasts = rect(cx - toastsW / 2, 176, toastsW, math.max(0, card.y - 6 - 176))
local panelH = math.min(430, H - 20) local panelH = math.min(450, H - 12)
local panel = rect(cx - PANEL_W / 2, math.max(6, H * 0.48 - panelH / 2), PANEL_W, panelH) local panel = rect(cx - PANEL_W / 2, math.max(6, H * 0.48 - panelH / 2), PANEL_W, panelH)
-- 설정 창 줄: 제목(10~54), 언어 이름(64), 언어 버튼(100~), 마우스(PC만), 효과음, 개발자(주인만) -- 설정 창 줄: 제목(10~54), 언어 이름(64), 언어 버튼(100~), 마우스(PC만), 효과음, 개발자(주인만)
local langButtonH = if touch then 52 else 44 local langButtonH = if touch then 52 else 44
local toggleH = if touch then 48 else 40 local toggleH = if touch then 48 else 40
local y = 100 + langButtonH + 12 local y = 104 + langButtonH + 16
local mouseY: number? = nil local mouseY: number? = nil
if not touch then if not touch then
mouseY = y mouseY = y
y += 90 y += 92
end end
local sfxY = y local sfxY = y
y += toggleH + 12 y += toggleH + 14
local devY: number? = nil local devY: number? = nil
if dev then if dev then
devY = y devY = y
y += 30 + toggleH + 12 y += 34 + toggleH + 14
end end
local setH = y + 4 local setH = y + 8
local settingsPanel = rect(cx - PANEL_W / 2, math.max(6, H * 0.48 - setH / 2), PANEL_W, setH) local settingsPanel = rect(cx - PANEL_W / 2, math.max(6, H * 0.48 - setH / 2), PANEL_W, setH)
return { return {
@@ -150,7 +154,7 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
toggleH = toggleH, toggleH = toggleH,
devY = devY, devY = devY,
devButtonH = toggleH, devButtonH = toggleH,
closeH = if touch then 48 else 42, closeH = if touch then 52 else 46,
}, },
} }
end end

View File

@@ -0,0 +1,230 @@
--!strict
-- 화면 UI 꾸미기 도구: 색, 굵은 테두리, 위아래 그러데이션, 입체 버튼(아래 그림자 판), 반짝 지나가는 빛,
-- 누르면 쏙 들어가는 애니메이션, 아이콘. 인기 시뮬레이터·타이쿤 게임의 "굵은 테두리 + 흰 글자" 스타일을 따릅니다.
-- 트윈만 쓰고 RenderStepped는 쓰지 않아서 서버(원격 테스트)에서도 만들 수 있습니다.
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Icons = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Icons"))
local Theme = {}
Theme.INK = Color3.fromRGB(59, 30, 18) -- 테두리·글자 외곽선(진한 갈색)
Theme.CREAM = Color3.fromRGB(255, 246, 228)
Theme.WHITE = Color3.new(1, 1, 1)
Theme.BROWN = Color3.fromRGB(120, 72, 40)
-- 버튼 색(위쪽 밝은 색). 아래쪽·그림자 판은 자동으로 어둡게 만듭니다.
Theme.RED = Color3.fromRGB(255, 84, 64)
Theme.ORANGE = Color3.fromRGB(255, 150, 40)
Theme.YELLOW = Color3.fromRGB(255, 205, 50)
Theme.GREEN = Color3.fromRGB(110, 225, 60)
Theme.BLUE = Color3.fromRGB(70, 175, 255)
Theme.PURPLE = Color3.fromRGB(180, 100, 255)
Theme.GRAY = Color3.fromRGB(175, 175, 180)
Theme.NAVY = Color3.fromRGB(40, 48, 80)
Theme.FONT = Font.new("rbxasset://fonts/families/FredokaOne.json", Enum.FontWeight.Bold)
function Theme.darken(c: Color3, k: number): Color3
return c:Lerp(Color3.new(0, 0, 0), k)
end
function Theme.lighten(c: Color3, k: number): Color3
return c:Lerp(Color3.new(1, 1, 1), k)
end
function Theme.corner(parent: Instance, r: number, scale: number?): UICorner
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(scale or 0, r)
c.Parent = parent
return c
end
function Theme.stroke(parent: Instance, color: Color3, thickness: number, contextual: boolean?): UIStroke
local s = Instance.new("UIStroke")
s.Color = color
s.Thickness = thickness
s.LineJoinMode = Enum.LineJoinMode.Round
s.ApplyStrokeMode = if contextual then Enum.ApplyStrokeMode.Contextual else Enum.ApplyStrokeMode.Border
s.Parent = parent
return s
end
-- 위(밝음) → 아래(어두움) 그러데이션. 배경색은 흰색으로 두고 색은 그러데이션이 냅니다.
function Theme.gradient(parent: GuiObject, top: Color3, bottom: Color3): UIGradient
local g = parent:FindFirstChildOfClass("UIGradient") or Instance.new("UIGradient")
g.Color = ColorSequence.new(top, bottom)
g.Rotation = 90
g.Parent = parent
parent.BackgroundColor3 = Theme.WHITE
return g
end
function Theme.frame(parent: Instance, name: string, color: Color3?): Frame
local f = Instance.new("Frame")
f.Name = name
f.BorderSizePixel = 0
f.BackgroundColor3 = color or Theme.WHITE
f.BackgroundTransparency = if color then 0 else 1
f.Parent = parent
return f
end
-- 흰 글자 + 진한 테두리(기본). dark=true면 진한 갈색 글자(밝은 바탕용).
function Theme.text(parent: Instance, name: string, dark: boolean?, strokeK: number?): TextLabel
local t = Instance.new("TextLabel")
t.Name = name
t.BackgroundTransparency = 1
t.FontFace = Theme.FONT
t.TextScaled = true
t.TextWrapped = true
t.AutoLocalize = false
t.Text = ""
t.TextColor3 = if dark then Theme.INK else Theme.WHITE
if not dark then
Theme.stroke(t, Theme.INK, strokeK or 2.5, true)
end
t.Parent = parent
return t
end
function Theme.icon(parent: Instance, name: string, icon: string): ImageLabel
local i = Instance.new("ImageLabel")
i.Name = name
i.BackgroundTransparency = 1
i.ScaleType = Enum.ScaleType.Fit
Icons.apply(i, icon)
i.Parent = parent
return i
end
Theme.setIcon = Icons.apply
-- 반짝 지나가는 빛: 같은 모양(둥근 모서리)의 흰 판 위에서 투명도 그러데이션이 왼쪽→오른쪽으로 지나갑니다.
function Theme.shine(face: GuiObject, radius: number, period: number): Tween
local s = Theme.frame(face, "Shine", Theme.WHITE)
s.Size = UDim2.fromScale(1, 1)
s.ZIndex = 6
Theme.corner(s, radius)
local g = Instance.new("UIGradient")
g.Rotation = 20
g.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 1),
NumberSequenceKeypoint.new(0.42, 1),
NumberSequenceKeypoint.new(0.5, 0.45),
NumberSequenceKeypoint.new(0.58, 1),
NumberSequenceKeypoint.new(1, 1),
})
g.Offset = Vector2.new(-1, 0)
g.Parent = s
local tw = TweenService:Create(
g,
TweenInfo.new(0.7, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, -1, false, period),
{ Offset = Vector2.new(1, 0) }
)
tw:Play()
return tw
end
export type Button = {
button: TextButton, -- 누르는 영역(투명). Layout 사각형이 여기에 들어갑니다.
face: Frame, -- 색 있는 윗면
base: Frame, -- 아래 그림자 판(입체감)
scale: UIScale,
setColor: (Color3) -> (),
}
-- 입체 버튼: 아래로 DEPTH만큼 어두운 판이 보이고, 누르면 윗면이 내려가며 살짝 작아집니다.
local DEPTH = 5
function Theme.button(parent: Instance, name: string, color: Color3, radius: number, strokeK: number?): Button
local b = Instance.new("TextButton")
b.Name = name
b.BackgroundTransparency = 1
b.AutoButtonColor = false
b.Text = ""
b.AutoLocalize = false
b.Parent = parent
local scale = Instance.new("UIScale")
scale.Parent = b
local base = Theme.frame(b, "Base", Theme.darken(color, 0.45))
base.Size = UDim2.new(1, 0, 1, -DEPTH)
base.Position = UDim2.fromOffset(0, DEPTH)
Theme.corner(base, radius)
Theme.stroke(base, Theme.INK, strokeK or 3)
local face = Theme.frame(b, "Face", Theme.WHITE)
face.Size = UDim2.new(1, 0, 1, -DEPTH)
face.ZIndex = 2
Theme.corner(face, radius)
Theme.stroke(face, Theme.INK, strokeK or 3)
-- 윗부분 반사광(흰 반투명 띠)
local gloss = Theme.frame(face, "Gloss", Theme.WHITE)
gloss.BackgroundTransparency = 0.72
gloss.Size = UDim2.new(1, -10, 0.36, 0)
gloss.Position = UDim2.fromOffset(5, 4)
gloss.ZIndex = 3
Theme.corner(gloss, math.max(4, radius - 4))
local function setColor(c: Color3)
Theme.gradient(face, Theme.lighten(c, 0.12), Theme.darken(c, 0.12))
base.BackgroundColor3 = Theme.darken(c, 0.45)
end
setColor(color)
local down = false
local hover = false
local function animate()
local target = if down then 0.92 elseif hover then 1.06 else 1
TweenService:Create(
scale,
TweenInfo.new(if down then 0.06 else 0.18, if down then Enum.EasingStyle.Quad else Enum.EasingStyle.Back),
{ Scale = target }
):Play()
face.Position = UDim2.fromOffset(0, if down then DEPTH - 1 else 0)
end
b.MouseButton1Down:Connect(function()
down = true
animate()
end)
b.MouseButton1Up:Connect(function()
down = false
animate()
end)
b.InputBegan:Connect(function(input: InputObject)
-- 터치에서는 MouseEnter가 같이 와서, 마우스일 때만 커집니다.
if input.UserInputType == Enum.UserInputType.MouseMovement then
hover = true
animate()
end
end)
b.MouseLeave:Connect(function()
down = false
hover = false
animate()
end)
return { button = b, face = face, base = base, scale = scale, setColor = setColor }
end
-- 빨간 동그라미 알림 배지(예: 살 수 있는 업그레이드가 있으면 "!")
function Theme.badge(parent: Instance, name: string): (Frame, TextLabel)
local f = Theme.frame(parent, name, Theme.RED)
f.Size = UDim2.fromOffset(30, 30)
f.AnchorPoint = Vector2.new(0.5, 0.5)
f.Position = UDim2.new(1, -12, 0, 12)
f.ZIndex = 8
Theme.corner(f, 1, 1)
Theme.stroke(f, Theme.INK, 2.5)
Theme.gradient(f, Color3.fromRGB(255, 110, 90), Color3.fromRGB(220, 40, 30))
local t = Theme.text(f, "Text", false, 2)
t.Size = UDim2.new(1, -6, 1, -6)
t.Position = UDim2.fromOffset(3, 3)
t.ZIndex = 9
return f, t
end
return Theme

View File

@@ -123,12 +123,14 @@ function Build.billboard(adornee: Instance, text: string, size: UDim2, offset: V
label.Text = text label.Text = text
label.Parent = gui label.Parent = gui
if not color then if not color then
-- 주문 말풍선: 흰 바탕 둘레에 화면 UI와 같은 진한 갈색 테두리(Theme.INK)
local corner = Instance.new("UICorner") local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0.3, 0) corner.CornerRadius = UDim.new(0.3, 0)
corner.Parent = label corner.Parent = label
local stroke = Instance.new("UIStroke") local stroke = Instance.new("UIStroke")
stroke.Thickness = 3 stroke.Thickness = 3
stroke.Color = Color3.fromRGB(255, 140, 60) stroke.Color = Color3.fromRGB(59, 30, 18)
stroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
stroke.Parent = label stroke.Parent = label
end end
return gui return gui

View File

@@ -346,12 +346,13 @@ local function floatText(parent: BasePart, text: string)
local label = gui:FindFirstChild("Text") :: TextLabel local label = gui:FindFirstChild("Text") :: TextLabel
local stroke = Instance.new("UIStroke") local stroke = Instance.new("UIStroke")
stroke.Thickness = 3 stroke.Thickness = 3
stroke.Color = Color3.fromRGB(120, 60, 0) stroke.Color = Color3.fromRGB(59, 30, 18) -- 화면 UI와 같은 진한 갈색(Theme.INK)
stroke.LineJoinMode = Enum.LineJoinMode.Round
stroke.Parent = label stroke.Parent = label
TweenService:Create(gui, TweenInfo.new(1.2, Enum.EasingStyle.Quad), { StudsOffset = Vector3.new(0, 6, 0) }):Play() TweenService:Create(gui, TweenInfo.new(1.2, Enum.EasingStyle.Quad), { StudsOffset = Vector3.new(0, 6, 0) }):Play()
TweenService:Create(label, TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { local fade = TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
TextTransparency = 1, TweenService:Create(label, fade, { TextTransparency = 1 }):Play()
}):Play() TweenService:Create(stroke, fade, { Transparency = 1 }):Play()
task.delay(1.3, function() task.delay(1.3, function()
gui:Destroy() gui:Destroy()
end) end)

View File

@@ -0,0 +1,52 @@
--!strict
-- 화면 UI 아이콘. 그림 한 장(art/ui_icons.png, tools/icons.py로 직접 그림)을 128px 칸으로 잘라 씁니다.
-- 칸 순서를 바꾸면 tools/icons.py --luau 출력으로 아래 표를 다시 맞추고, 그림을 새로 올려 ASSET을 바꿉니다.
local Icons = {}
Icons.ASSET = "rbxassetid://89649261251254"
Icons.CELL = Vector2.new(128, 128)
Icons.OFFSET = {
coin = Vector2.new(0, 0),
moneyBag = Vector2.new(128, 0),
bolt = Vector2.new(256, 0),
gear = Vector2.new(384, 0),
upgrade = Vector2.new(512, 0),
plate = Vector2.new(640, 0),
lock = Vector2.new(768, 0),
check = Vector2.new(896, 0),
close = Vector2.new(0, 128),
table = Vector2.new(128, 128),
sign = Vector2.new(256, 128),
flame = Vector2.new(384, 128),
sauce = Vector2.new(512, 128),
chef = Vector2.new(640, 128),
store = Vector2.new(768, 128),
tray = Vector2.new(896, 128),
Tteokbokki = Vector2.new(0, 256),
Gimbap = Vector2.new(128, 256),
Sundae = Vector2.new(256, 256),
Eomuk = Vector2.new(384, 256),
Twigim = Vector2.new(512, 256),
globe = Vector2.new(640, 256),
speaker = Vector2.new(768, 256),
mouse = Vector2.new(896, 256),
wrench = Vector2.new(0, 384),
star = Vector2.new(128, 384),
sparkle = Vector2.new(256, 384),
rays = Vector2.new(384, 384),
glow = Vector2.new(512, 384),
arrowDown = Vector2.new(640, 384),
scroll = Vector2.new(768, 384),
hand = Vector2.new(896, 384),
} :: { [string]: Vector2 }
-- ImageLabel/ImageButton에 아이콘을 씌웁니다.
function Icons.apply(image: ImageLabel, name: string)
image.Image = Icons.ASSET
image.ImageRectOffset = Icons.OFFSET[name] or Vector2.zero
image.ImageRectSize = Icons.CELL
end
return Icons

View File

@@ -17,6 +17,8 @@ local STRINGS: { [string]: { [string]: string } } = {
stage1 = "1단계 · 포장마차", stage1 = "1단계 · 포장마차",
stage2 = "2단계 · 실내 분식집", stage2 = "2단계 · 실내 분식집",
next = "다음", next = "다음",
nextUp = "다음 업그레이드",
doubleOn = "적용 중",
close = "닫기", close = "닫기",
cookAction = "{menu} 만들기", cookAction = "{menu} 만들기",
cookWait = "손님 기다리는 중", cookWait = "손님 기다리는 중",
@@ -106,6 +108,8 @@ local STRINGS: { [string]: { [string]: string } } = {
stage1 = "Stage 1 · Street Stall", stage1 = "Stage 1 · Street Stall",
stage2 = "Stage 2 · Indoor Shop", stage2 = "Stage 2 · Indoor Shop",
next = "Next", next = "Next",
nextUp = "Next Upgrade",
doubleOn = "Active",
close = "Close", close = "Close",
cookAction = "Cook {menu}", cookAction = "Cook {menu}",
cookWait = "Waiting for customers", cookWait = "Waiting for customers",
@@ -195,6 +199,8 @@ local STRINGS: { [string]: { [string]: string } } = {
stage1 = "ステージ1 · 屋台", stage1 = "ステージ1 · 屋台",
stage2 = "ステージ2 · 室内のお店", stage2 = "ステージ2 · 室内のお店",
next = "次", next = "次",
nextUp = "次のアップグレード",
doubleOn = "適用中",
close = "閉じる", close = "閉じる",
cookAction = "{menu}を作る", cookAction = "{menu}を作る",
cookWait = "お客さんを待っています", cookWait = "お客さんを待っています",
@@ -284,6 +290,8 @@ local STRINGS: { [string]: { [string]: string } } = {
stage1 = "第1阶段 · 路边摊", stage1 = "第1阶段 · 路边摊",
stage2 = "第2阶段 · 室内小吃店", stage2 = "第2阶段 · 室内小吃店",
next = "下一个", next = "下一个",
nextUp = "下一个升级",
doubleOn = "已生效",
close = "关闭", close = "关闭",
cookAction = "制作{menu}", cookAction = "制作{menu}",
cookWait = "等待客人中", cookWait = "等待客人中",

View 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 })

View File

@@ -398,6 +398,7 @@ eq(
section("화면 UI(서버에서 생성)") section("화면 UI(서버에서 생성)")
local Hud = require(StarterPlayer.StarterPlayerScripts.Client.Hud) local Hud = require(StarterPlayer.StarterPlayerScripts.Client.Hud)
local Icons = require(ReplicatedStorage.Shared.Icons)
local state = Instance.new("Folder") local state = Instance.new("Folder")
state:SetAttribute("Lang", "ko") state:SetAttribute("Lang", "ko")
state:SetAttribute("Money", 25) state:SetAttribute("Money", 25)
@@ -409,33 +410,77 @@ local hud = Hud.build(holder, state, function(kind, arg)
table.insert(sent, { kind, arg }) table.insert(sent, { kind, arg })
end) end)
local root = hud.gui:FindFirstChild("Root") :: Frame local root = hud.gui:FindFirstChild("Root") :: Frame
local moneyText = root:FindFirstChild("Money"):FindFirstChild("Text") :: TextLabel local function label(o: Instance?): string?
eq(moneyText.Text, "💰 25원", "돈 표시") local t = o and o:FindFirstChild("Label", true) :: TextLabel?
local nextTitle = root:FindFirstChild("Next"):FindFirstChild("Title") :: TextLabel return t and t.Text
eq(nextTitle.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((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") state:SetAttribute("Lang", "en")
eq(moneyText.Text, "💰 ₩25", "영어 돈 표시") eq(moneyText.Text, "₩60", "영어 돈 표시")
eq(nextTitle.Text, "Next: Unlock Gimbap", "영어 다음 업그레이드") eq(nextTitle.Text, "Unlock Gimbap", "영어 다음 업그레이드")
state:SetAttribute("Lang", "zh") state:SetAttribute("Lang", "zh")
eq(nextTitle.Text, "下一个: 解锁紫菜包饭", "중국어 다음 업그레이드") eq(nextTitle.Text, "解锁紫菜包饭", "중국어 다음 업그레이드")
state:SetAttribute("Lang", "en") state:SetAttribute("Lang", "en")
check(root:FindFirstChild("Lang") == nil, "언어 버튼 대신")
local settingsBtn = root:FindFirstChild("Settings") :: TextButton local settingsBtn = root:FindFirstChild("Settings") :: TextButton
check(settingsBtn ~= nil, "오른쪽 위 설정 버튼") check(settingsBtn ~= nil, "오른쪽 위 설정 버튼")
eq(settingsBtn and settingsBtn.Text, "⚙️ Settings", "설정 버튼 글자") eq(label(settingsBtn), "Settings", "설정 버튼 글자")
local settingsPanel = root:FindFirstChild("SettingsPanel") :: Frame local settingsPanel = root:FindFirstChild("SettingsPanel") :: Frame
check(settingsPanel ~= nil and not settingsPanel.Visible, "설정 창은 처음엔 닫힘") check(settingsPanel ~= nil and not settingsPanel.Visible, "설정 창은 처음엔 닫힘")
for _, l in { "auto", "ko", "en", "ja", "zh" } do for _, l in { "auto", "ko", "en", "ja", "zh" } do
check(settingsPanel:FindFirstChild("Lang_" .. l) ~= nil, `설정 창 언어 버튼 {l}`) check(settingsPanel:FindFirstChild("Lang_" .. l) ~= nil, `설정 창 언어 버튼 {l}`)
end end
eq((settingsPanel:FindFirstChild("Lang_ja") :: TextButton).Text, "日本語", "언어 이름은 그 나라 말") eq(label(settingsPanel:FindFirstChild("Lang_ja")), "日本語", "언어 이름은 그 나라 말")
eq((settingsPanel:FindFirstChild("MouseLook") :: TextButton).Text, "On", "마우스 회전 기본 켜짐") eq(label(settingsPanel:FindFirstChild("MouseLook")), "On", "마우스 회전 기본 켜짐")
state:SetAttribute("Sfx", false) state:SetAttribute("Sfx", false)
eq((settingsPanel:FindFirstChild("Sfx") :: TextButton).Text, "Off", "효과음 끔 표시") eq(label(settingsPanel:FindFirstChild("Sfx")), "Off", "효과음 끔 표시")
check(not hud.menuOpen(), "창 닫힘") 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) 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, "개발자 버튼은 설정 창 안으로") check(root:FindFirstChild("Dev") == nil, "개발자 버튼은 설정 창 안으로")
local devMoneyBtn = settingsPanel:FindFirstChild("devMoney") :: TextButton local devMoneyBtn = settingsPanel:FindFirstChild("devMoney") :: TextButton
check(not devMoneyBtn.Visible, "개발자 버튼은 기본으로 숨김") check(not devMoneyBtn.Visible, "개발자 버튼은 기본으로 숨김")
@@ -443,10 +488,20 @@ local setH = settingsPanel.Size.Y.Offset
state:SetAttribute("Dev", true) state:SetAttribute("Dev", true)
check(devMoneyBtn.Visible, "게임 주인에게 개발자 버튼(설정 창)") check(devMoneyBtn.Visible, "게임 주인에게 개발자 버튼(설정 창)")
check(settingsPanel.Size.Y.Offset > setH, "개발자 줄만큼 설정 창이 길어짐") 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" }) hud.notify("purchased", { item = "Table2" })
local toastText = root.Toasts:FindFirstChild("Toast"):FindFirstChild("Text") :: TextLabel local toastText = root.Toasts:FindFirstChild("Toast"):FindFirstChild("Text") :: TextLabel
eq(toastText.Text, "Table 2 bought!", "구매 알림에 업그레이드 이름(내 언어)") eq(toastText.Text, "Table 2 bought!", "구매 알림에 업그레이드 이름(내 언어)")
eq(
(root.Toasts:FindFirstChild("Toast"):FindFirstChild("Icon") :: ImageLabel).ImageRectOffset,
Icons.OFFSET.check,
"구매 알림 아이콘"
)
-- 휴대폰 배치(아이폰 15 가로, 상단 바·노치 뺀 영역): 루트가 화면을 채우고, 결제 버튼은 왼쪽 위, 마우스 줄 숨김 -- 휴대폰 배치(아이폰 15 가로, 상단 바·노치 뺀 영역): 루트가 화면을 채우고, 결제 버튼은 왼쪽 위, 마우스 줄 숨김
hud.setLayout(Vector2.new(750, 332), true) hud.setLayout(Vector2.new(750, 332), true)
local lay = hud.layout() local lay = hud.layout()
@@ -460,10 +515,11 @@ check(
"휴대폰: 루트 높이 = 화면" "휴대폰: 루트 높이 = 화면"
) )
eq( eq(
(root:FindFirstChild("Double") :: TextButton).Position.Y.Offset, doubleBtn.Position.Y.Offset,
lay.double.y, lay.double.y + lay.double.h / 2,
"휴대폰: 2배 수익 버튼 위치" "휴대폰: 2배 수익 버튼 위치(가운데 기준)"
) )
eq(doubleBtn.Size.Y.Offset, lay.double.h, "휴대폰: 2배 수익 버튼 크기")
check(lay.double.y + lay.double.h < lay.height / 3, "휴대폰: 결제 버튼은 조이스틱 자리 위") check(lay.double.y + lay.double.h < lay.height / 3, "휴대폰: 결제 버튼은 조이스틱 자리 위")
check(not (settingsPanel:FindFirstChild("MouseLook") :: TextButton).Visible, "휴대폰: 마우스 회전 줄 숨김") check(not (settingsPanel:FindFirstChild("MouseLook") :: TextButton).Visible, "휴대폰: 마우스 회전 줄 숨김")
check(scaleObj.Scale > 0.8, `휴대폰: 글자 배율 {scaleObj.Scale}`) check(scaleObj.Scale > 0.8, `휴대폰: 글자 배율 {scaleObj.Scale}`)
@@ -500,6 +556,20 @@ for name, id in Sounds do
end end
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") section("Products")
local Products = require(ReplicatedStorage.Shared.Products) local Products = require(ReplicatedStorage.Shared.Products)
local MarketplaceService = game:GetService("MarketplaceService") local MarketplaceService = game:GetService("MarketplaceService")

View File

@@ -0,0 +1,488 @@
#!/usr/bin/env python3
"""화면 UI 미리보기 그리기: 로블록스 서버에서 만든 ScreenGui를 JSON으로 덤프한 것(tests/cloud/dump_gui.luau)을
cairo로 그립니다. 서버에서는 실제 화면을 볼 수 없어서 배치·색·글자 크기를 눈으로 확인하는 용도입니다.
로블록스 렌더러와 똑같지는 않습니다(글꼴 대체, 글자 크기 맞춤, 3D 배경 없음).
지원: Frame/TextLabel/TextButton/ImageLabel/ImageButton/ScrollingFrame, UDim2·AnchorPoint·Rotation·ZIndex,
UICorner, UIStroke(테두리·글자), UIGradient(색·투명도·회전·오프셋), UIPadding, UIListLayout, UIScale,
UITextSizeConstraint, TextScaled/TextWrapped/정렬, ImageRectOffset/Size, ClipsDescendants.
python3 tools/gui_render.py dump.json out_dir [--bg scene.png]
"""
import json
import math
import os
import sys
import ctypes
import cairo
ROOT_UNUSED = None
class _Rect(ctypes.Structure):
_fields_ = [("x", ctypes.c_int), ("y", ctypes.c_int), ("width", ctypes.c_int), ("height", ctypes.c_int)]
class PangoLib:
"""python3-gi-cairo가 없어서 libpangocairo를 ctypes로 직접 부릅니다(쓰는 함수만)."""
SCALE = 1024
def __init__(self):
self.pc = ctypes.CDLL("libpangocairo-1.0.so.0")
self.p = ctypes.CDLL("libpango-1.0.so.0")
self.g = ctypes.CDLL("libgobject-2.0.so.0")
vp, ci, cs = ctypes.c_void_p, ctypes.c_int, ctypes.c_char_p
for lib, name, res, args in (
(self.pc, "pango_cairo_create_layout", vp, [vp]),
(self.pc, "pango_cairo_show_layout", None, [vp, vp]),
(self.pc, "pango_cairo_layout_path", None, [vp, vp]),
(self.p, "pango_layout_set_text", None, [vp, cs, ci]),
(self.p, "pango_layout_set_width", None, [vp, ci]),
(self.p, "pango_layout_set_wrap", None, [vp, ci]),
(self.p, "pango_layout_set_alignment", None, [vp, ci]),
(self.p, "pango_layout_set_font_description", None, [vp, vp]),
(self.p, "pango_layout_get_pixel_extents", None, [vp, ctypes.POINTER(_Rect), ctypes.POINTER(_Rect)]),
(self.p, "pango_layout_get_line_count", ci, [vp]),
(self.p, "pango_font_description_from_string", vp, [cs]),
(self.p, "pango_font_description_set_weight", None, [vp, ci]),
(self.p, "pango_font_description_set_absolute_size", None, [vp, ctypes.c_double]),
(self.p, "pango_font_description_free", None, [vp]),
(self.g, "g_object_unref", None, [vp]),
):
f = getattr(lib, name)
f.restype = res
f.argtypes = args
@staticmethod
def cr(ctx):
# pycairo Context 객체 안의 cairo_t 포인터(PyObject 머리 16바이트 다음)
return ctypes.c_void_p.from_address(id(ctx) + 16).value
PANGO = PangoLib()
ALIGN = {"Left": 0, "Center": 1, "Right": 2}
WEIGHT = {"SemiBold": 600, "Bold": 700, "Heavy": 900, "Black": 900}
class Layout:
def __init__(self, ctx, family, weight, size, text, width, wrap, align):
P = PANGO
self.ctx = ctx
self.ptr = P.pc.pango_cairo_create_layout(P.cr(ctx))
desc = P.p.pango_font_description_from_string(f"{family}, {FALLBACK}".encode())
P.p.pango_font_description_set_weight(desc, weight)
P.p.pango_font_description_set_absolute_size(desc, max(1.0, size) * P.SCALE)
P.p.pango_layout_set_font_description(self.ptr, desc)
P.p.pango_font_description_free(desc)
P.p.pango_layout_set_text(self.ptr, text.encode(), -1)
if wrap:
P.p.pango_layout_set_width(self.ptr, int(max(1, width) * P.SCALE))
P.p.pango_layout_set_wrap(self.ptr, 2) # WORD_CHAR
P.p.pango_layout_set_alignment(self.ptr, ALIGN.get(align, 1))
def extents(self):
ink, logical = _Rect(), _Rect()
PANGO.p.pango_layout_get_pixel_extents(self.ptr, ctypes.byref(ink), ctypes.byref(logical))
return ink, logical
def lines(self):
return PANGO.p.pango_layout_get_line_count(self.ptr)
def path(self, ctx):
PANGO.pc.pango_cairo_layout_path(PANGO.cr(ctx), self.ptr)
def show(self, ctx):
PANGO.pc.pango_cairo_show_layout(PANGO.cr(ctx), self.ptr)
def __del__(self):
PANGO.g.g_object_unref(self.ptr)
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
IMAGES = {} # rbxassetid 숫자 -> 로컬 png 경로 (Icons.luau의 ID와 art/ui_icons.png)
FONT_FAMILY = {
"FredokaOne": "Fredoka SemiBold",
"LuckiestGuy": "Luckiest Guy",
"Bangers": "Luckiest Guy",
"GothamBlack": "Noto Sans Black",
"BuilderSans": "Noto Sans",
"Montserrat": "Noto Sans",
}
# 한글·한자·이모지는 로블록스도 대체 글꼴로 그립니다.
FALLBACK = "Noto Sans CJK KR, Noto Color Emoji"
def surface_png(path):
return cairo.ImageSurface.create_from_png(path)
_img_cache = {}
def image_surface(asset):
num = "".join(ch for ch in str(asset) if ch.isdigit())
path = IMAGES.get(num)
if not path:
return None
if path not in _img_cache:
_img_cache[path] = surface_png(path)
return _img_cache[path]
def udim(u, size, k):
return u[0] * size + u[1] * k
def round_rect(c, x, y, w, h, r):
r = max(0, min(r, w / 2, h / 2))
if r <= 0.01:
c.rectangle(x, y, w, h)
return
c.new_sub_path()
c.arc(x + w - r, y + r, r, -math.pi / 2, 0)
c.arc(x + w - r, y + h - r, r, 0, math.pi / 2)
c.arc(x + r, y + h - r, r, math.pi / 2, math.pi)
c.arc(x + r, y + r, r, math.pi, 3 * math.pi / 2)
c.close_path()
def gradient_pattern(g, x, y, w, h, base, alpha):
"""UIGradient를 cairo 패턴으로. base(색)·alpha(불투명도)에 곱합니다."""
rot = math.radians(g.get("Rotation", 0))
ox, oy = g.get("Offset", [0, 0])
cx, cy = x + w / 2 + ox * w, y + h / 2 + oy * h
dx, dy = math.cos(rot), math.sin(rot)
# 회전된 방향으로 상자를 덮는 길이
half = (abs(dx) * w + abs(dy) * h) / 2
pat = cairo.LinearGradient(cx - dx * half, cy - dy * half, cx + dx * half, cy + dy * half)
colors = g.get("Color") or [[0, [1, 1, 1]], [1, [1, 1, 1]]]
trans = g.get("Transparency") or [[0, 0], [1, 0]]
times = sorted(set([t for t, _ in colors] + [t for t, _ in trans]))
def at(seq, t):
for i in range(len(seq) - 1):
t0, v0 = seq[i]
t1, v1 = seq[i + 1]
if t0 <= t <= t1:
f = 0 if t1 == t0 else (t - t0) / (t1 - t0)
if isinstance(v0, list):
return [v0[j] + (v1[j] - v0[j]) * f for j in range(3)]
return v0 + (v1 - v0) * f
return seq[-1][1] if t >= seq[-1][0] else seq[0][1]
for t in times:
col = at(colors, t)
tr = at(trans, t)
pat.add_color_stop_rgba(t, base[0] * col[0], base[1] * col[1], base[2] * col[2], alpha * (1 - tr))
return pat
class Renderer:
def __init__(self, c):
self.c = c
# ---------------------------------------------------------------- 배치
def children_rects(self, node, rect, k):
"""자식 GuiObject의 (자식, x, y, w, h, k) 목록. UIListLayout·UIPadding·UIScale 반영."""
x, y, w, h = rect
pad = node.get("UIPadding")
if pad:
pl = udim(pad["Left"], w, k)
pr = udim(pad["Right"], w, k)
pt = udim(pad["Top"], h, k)
pb = udim(pad["Bottom"], h, k)
x, y, w, h = x + pl, y + pt, w - pl - pr, h - pt - pb
out = []
kids = [ch for ch in node.get("children", []) if ch.get("Visible", True)]
for ch in kids:
s = ch.get("UIScale", 1)
cw = udim(ch["Size"][0], w, k) * s
chh = udim(ch["Size"][1], h, k) * s
ar = ch.get("UIAspectRatio")
if ar:
if cw / max(chh, 1e-6) > ar:
cw = chh * ar
else:
chh = cw / ar
out.append([ch, cw, chh, k * s])
lay = node.get("UIListLayout")
if lay:
horiz = lay.get("FillDirection") == "Horizontal"
gap = udim(lay.get("Padding", [0, 0]), w if horiz else h, k)
items = sorted(out, key=lambda o: (o[0].get("LayoutOrder", 0), o[0].get("_i", 0))) \
if lay.get("SortOrder") == "LayoutOrder" else sorted(out, key=lambda o: o[0].get("Name", ""))
total = sum((o[1] if horiz else o[2]) for o in items) + gap * max(0, len(items) - 1)
ha = lay.get("HorizontalAlignment", "Left")
va = lay.get("VerticalAlignment", "Top")
if horiz:
cur = x + {"Left": 0, "Center": (w - total) / 2, "Right": w - total}[ha]
else:
cur = y + {"Top": 0, "Center": (h - total) / 2, "Bottom": h - total}[va]
res = []
for ch, cw, chh, kk in items:
if horiz:
cy = y + {"Top": 0, "Center": (h - chh) / 2, "Bottom": h - chh}[va]
res.append((ch, cur, cy, cw, chh, kk))
cur += cw + gap
else:
cx = x + {"Left": 0, "Center": (w - cw) / 2, "Right": w - cw}[ha]
res.append((ch, cx, cur, cw, chh, kk))
cur += chh + gap
return res
res = []
for ch, cw, chh, kk in out:
s = ch.get("UIScale", 1)
# UIScale은 AnchorPoint를 기준으로 크기를 바꿉니다.
bw, bh = cw / s, chh / s
ax, ay = ch.get("AnchorPoint", [0, 0])
px = x + udim(ch["Position"][0], w, k) - ax * bw
py = y + udim(ch["Position"][1], h, k) - ay * bh
px -= (cw - bw) * ax
py -= (chh - bh) * ay
res.append((ch, px, py, cw, chh, kk))
return res
# ---------------------------------------------------------------- 그리기
def draw_node(self, node, x, y, w, h, k):
c = self.c
c.save()
rot = node.get("Rotation", 0)
if rot:
c.translate(x + w / 2, y + h / 2)
c.rotate(math.radians(rot))
c.translate(-(x + w / 2), -(y + h / 2))
corner = node.get("UICorner")
r = udim(corner, min(w, h), k) if corner else 0
grad = node.get("UIGradient")
bt = node.get("BackgroundTransparency", 1)
if bt < 1 and node["ClassName"] not in ("ScreenGui",):
base = node.get("BackgroundColor3", [1, 1, 1])
round_rect(c, x, y, w, h, r)
if grad:
c.set_source(gradient_pattern(grad, x, y, w, h, base, 1 - bt))
else:
c.set_source_rgba(*base, 1 - bt)
c.fill()
img = node.get("Image")
if img:
self.draw_image(node, x, y, w, h, r, grad)
if "Text" in node and node.get("Text"):
self.draw_text(node, x, y, w, h, k, grad)
for st in node.get("UIStrokes", []):
if st.get("ApplyStrokeMode") == "Border" and st.get("Enabled", True):
t = st["Thickness"] * k
round_rect(c, x - t / 2, y - t / 2, w + t, h + t, r + t / 2 if r > 0 else 0)
c.set_line_width(t)
c.set_line_join(cairo.LINE_JOIN_ROUND)
sg = st.get("UIGradient")
if sg:
c.set_source(gradient_pattern(sg, x, y, w, h, st["Color"], 1 - st.get("Transparency", 0)))
else:
c.set_source_rgba(*st["Color"], 1 - st.get("Transparency", 0))
c.stroke()
if node.get("ClipsDescendants") or node["ClassName"] == "ScrollingFrame":
round_rect(c, x, y, w, h, r)
c.clip()
cpx, cpy = node.get("CanvasPosition", [0, 0])
kids = self.children_rects(node, (x - cpx * k, y - cpy * k, w, h), k)
kids.sort(key=lambda t: (t[0].get("ZIndex", 1), t[0].get("_i", 0)))
for ch, cx, cy, cw, chh, kk in kids:
self.draw_node(ch, cx, cy, cw, chh, kk)
c.restore()
def draw_image(self, node, x, y, w, h, r, grad):
surf = image_surface(node["Image"])
c = self.c
if surf is None:
c.rectangle(x, y, w, h)
c.set_source_rgba(1, 0, 1, 0.5)
c.fill()
return
ox, oy = node.get("ImageRectOffset", [0, 0])
sw, sh = node.get("ImageRectSize", [0, 0])
if sw == 0 or sh == 0:
sw, sh = surf.get_width(), surf.get_height()
dw, dh = w, h
if node.get("ScaleType") == "Fit":
s = min(w / sw, h / sh)
dw, dh = sw * s, sh * s
dx, dy = x + (w - dw) / 2, y + (h - dh) / 2
c.save()
round_rect(c, x, y, w, h, r)
c.clip()
c.translate(dx, dy)
c.scale(dw / sw, dh / sh)
c.translate(-ox, -oy)
alpha = 1 - node.get("ImageTransparency", 0)
col = node.get("ImageColor3", [1, 1, 1])
c.rectangle(ox, oy, sw, sh)
c.clip()
if col != [1, 1, 1] or grad:
# 색 곱하기: 그림을 마스크로 쓰고 색을 곱한 그림을 그립니다.
tmp = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(sw), int(sh))
tc = cairo.Context(tmp)
tc.set_source_surface(surf, -ox, -oy)
tc.paint()
tc.set_operator(cairo.OPERATOR_MULTIPLY)
if grad:
tc.set_source(gradient_pattern(grad, 0, 0, sw, sh, col, 1))
else:
tc.set_source_rgb(*col)
tc.paint()
tc.set_operator(cairo.OPERATOR_DEST_IN)
tc.set_source_surface(surf, -ox, -oy)
tc.paint()
c.set_source_surface(tmp, ox, oy)
else:
c.set_source_surface(surf, 0, 0)
c.get_source().set_filter(cairo.FILTER_GOOD)
c.paint_with_alpha(alpha)
c.restore()
def layout_text(self, node, size, width, wrap):
fam = FONT_FAMILY.get(node.get("Font", "FredokaOne"), "Noto Sans")
weight = WEIGHT.get(node.get("Weight", ""), 400)
if fam.startswith("Fredoka"):
weight = 600
elif "Black" in fam:
weight = 900
align = node.get("TextXAlignment", "Center")
return Layout(self.c, fam.replace(" SemiBold", "").replace(" Black", ""), weight, size, node["Text"], width,
wrap, align)
def draw_text(self, node, x, y, w, h, k, grad):
c = self.c
pad = node.get("UIPadding")
if pad:
pl, pr = udim(pad["Left"], w, k), udim(pad["Right"], w, k)
pt, pb = udim(pad["Top"], h, k), udim(pad["Bottom"], h, k)
x, y, w, h = x + pl, y + pt, w - pl - pr, h - pt - pb
wrap = node.get("TextWrapped", False) or node.get("TextScaled", False)
maxsize = node.get("MaxTextSize", 100)
if node.get("TextScaled"):
lo, hi = 1, min(maxsize, 100) * k
best = lo
while hi - lo > 0.5:
mid = (lo + hi) / 2
lay = self.layout_text(node, mid, w, wrap)
ink, logical = lay.extents()
# 단어 중간에서 줄이 끊기면 안 맞는 것으로 봅니다(로블록스 TextScaled와 비슷하게).
words_ok = lay.lines() <= max(1, len(node["Text"].split())) + node["Text"].count("\n")
if logical.width <= w + 0.5 and logical.height <= h + 0.5 and words_ok:
best = mid
lo = mid
else:
hi = mid
size = best
else:
size = node.get("TextSize", 14) * k
lay = self.layout_text(node, size, w, wrap)
ink, logical = lay.extents()
ya = node.get("TextYAlignment", "Center")
ty = y + {"Top": 0, "Center": (h - logical.height) / 2, "Bottom": h - logical.height}[ya]
tx = x
if not wrap:
xa = node.get("TextXAlignment", "Center")
tx = x + {"Left": 0, "Center": (w - logical.width) / 2, "Right": w - logical.width}[xa]
c.save()
c.move_to(tx, ty)
lay.path(c)
alpha = 1 - node.get("TextTransparency", 0)
for st in node.get("UIStrokes", []):
if st.get("ApplyStrokeMode", "Contextual") == "Contextual" and st.get("Enabled", True):
c.set_line_width(st["Thickness"] * k * 2)
c.set_line_join(cairo.LINE_JOIN_ROUND)
c.set_source_rgba(*st["Color"], alpha * (1 - st.get("Transparency", 0)))
c.stroke_preserve()
if node.get("TextStrokeTransparency", 1) < 1:
c.set_line_width(2 * k)
c.set_source_rgba(*node.get("TextStrokeColor3", [0, 0, 0]), alpha * (1 - node["TextStrokeTransparency"]))
c.stroke_preserve()
c.new_path()
c.restore()
# 글자 채우기(이모지 색을 살리려고 path 대신 show_layout)
c.save()
col = node.get("TextColor3", [0, 0, 0])
if grad and node.get("TextGradient", True):
c.push_group()
c.move_to(tx, ty)
c.set_source_rgba(1, 1, 1, alpha)
lay.show(c)
mask = c.pop_group()
c.set_source(gradient_pattern(grad, x, y, w, h, col, 1))
c.mask(mask)
else:
c.move_to(tx, ty)
c.set_source_rgba(*col, alpha)
lay.show(c)
c.restore()
def render(dump, out, bg=None):
W, H, inset = dump["width"], dump["height"], dump.get("inset", 0)
surf = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(W), int(H + inset))
c = cairo.Context(surf)
if bg and os.path.exists(bg):
b = surface_png(bg)
c.save()
c.scale(W / b.get_width(), (H + inset) / b.get_height())
c.set_source_surface(b, 0, 0)
c.paint()
c.restore()
else:
g = cairo.LinearGradient(0, 0, 0, H + inset)
g.add_color_stop_rgb(0, 0.55, 0.78, 0.95)
g.add_color_stop_rgb(0.55, 0.75, 0.88, 0.98)
g.add_color_stop_rgb(0.56, 0.42, 0.66, 0.36)
g.add_color_stop_rgb(1, 0.33, 0.55, 0.28)
c.set_source(g)
c.paint()
# 로블록스 상단 바(대략)
if inset:
c.set_source_rgba(0, 0, 0, 0.25)
for i, x in enumerate((12, 60)):
round_rect(c, x, 10, 40, 40, 10)
c.fill()
touch = dump.get("touch")
if touch and dump.get("zones"):
for z in dump["zones"].values():
c.set_source_rgba(1, 1, 1, 0.12)
c.rectangle(z["x"], z["y"] + inset, z["w"], z["h"])
c.fill()
# 조이스틱·점프 버튼 모양(대략)
st = dump["zones"]["stick"]
c.arc(st["x"] + 110, inset + H - 110, 60, 0, 2 * math.pi)
c.set_source_rgba(0, 0, 0, 0.3)
c.fill()
jp = dump["zones"]["jump"]
jr = min(jp["w"], jp["h"]) * 0.3
c.arc(jp["x"] + jp["w"] * 0.55, inset + jp["y"] + jp["h"] * 0.55, jr, 0, 2 * math.pi)
c.fill()
r = Renderer(c)
gui = dump["gui"]
c.translate(0, inset)
for ch, x, y, w, h, k in r.children_rects(gui, (0, 0, W, H), 1):
r.draw_node(ch, x, y, w, h, k)
surf.write_to_png(out)
def main(argv):
src, outdir = argv[0], argv[1]
bg = argv[argv.index("--bg") + 1] if "--bg" in argv else None
with open(src) as f:
data = json.load(f)
for num, path in data.get("images", {}).items():
IMAGES[str(num)] = os.path.join(ROOT, path)
os.makedirs(outdir, exist_ok=True)
for shot in data["shots"]:
out = os.path.join(outdir, shot["name"] + ".png")
render(shot, out, bg)
print(out)
if __name__ == "__main__":
main(sys.argv[1:])

View File

@@ -0,0 +1,719 @@
#!/usr/bin/env python3
"""화면 UI 아이콘 모음(1024x1024, 128px 칸 8x8)을 직접 그립니다. 외부 그림을 쓰지 않습니다.
로블록스에는 이 한 장만 올리고, 각 아이콘은 ImageRectOffset/ImageRectSize로 잘라 씁니다.
칸 이름과 위치는 src/shared/Icons.luau 와 같아야 합니다(tools/icons.py --luau 로 확인).
python3 tools/icons.py # art/ui_icons.png
python3 tools/icons.py --sheet x.png # 이름표가 붙은 확인용 그림
"""
import math
import os
import sys
import cairo
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "art", "ui_icons.png")
CELL = 128
GRID = 8
INK = (0.23, 0.12, 0.07) # 테두리(진한 갈색)
LW = 7 # 테두리 굵기
def rgb(h):
h = h.lstrip("#")
return tuple(int(h[i:i + 2], 16) / 255 for i in (0, 2, 4))
def lin(x0, y0, x1, y1, *stops):
g = cairo.LinearGradient(x0, y0, x1, y1)
for i, c in enumerate(stops):
g.add_color_stop_rgb(i / max(1, len(stops) - 1), *rgb(c))
return g
def rad(cx, cy, r, *stops):
g = cairo.RadialGradient(cx - r * 0.3, cy - r * 0.35, r * 0.1, cx, cy, r)
for i, c in enumerate(stops):
g.add_color_stop_rgb(i / max(1, len(stops) - 1), *rgb(c))
return g
def fill_stroke(c, paint, lw=LW):
c.set_source(paint) if isinstance(paint, cairo.Pattern) else c.set_source_rgb(*paint)
c.fill_preserve()
c.set_source_rgb(*INK)
c.set_line_width(lw)
c.set_line_join(cairo.LINE_JOIN_ROUND)
c.set_line_cap(cairo.LINE_CAP_ROUND)
c.stroke()
def rrect(c, x, y, w, h, r):
c.new_sub_path()
c.arc(x + w - r, y + r, r, -math.pi / 2, 0)
c.arc(x + w - r, y + h - r, r, 0, math.pi / 2)
c.arc(x + r, y + h - r, r, math.pi / 2, math.pi)
c.arc(x + r, y + r, r, math.pi, 3 * math.pi / 2)
c.close_path()
def shine(c, x, y, w, h, alpha=0.55):
"""왼쪽 위 흰 반사광(타원 조각)."""
c.save()
c.translate(x, y)
c.scale(w, h)
c.arc(0, 0, 1, 0, 2 * math.pi)
c.restore()
c.set_source_rgba(1, 1, 1, alpha)
c.fill()
def polygon(c, pts):
c.move_to(*pts[0])
for p in pts[1:]:
c.line_to(*p)
c.close_path()
def star_pts(cx, cy, r1, r2, n=5, rot=-math.pi / 2):
pts = []
for i in range(n * 2):
r = r1 if i % 2 == 0 else r2
a = rot + i * math.pi / n
pts.append((cx + r * math.cos(a), cy + r * math.sin(a)))
return pts
# ---------------------------------------------------------------- 아이콘들 (64x64 중심, 128 칸)
def coin(c):
c.arc(64, 66, 50, 0, 2 * math.pi)
fill_stroke(c, rad(64, 66, 56, "#fff3a0", "#ffd23a", "#f59e0b"))
c.arc(64, 66, 36, 0, 2 * math.pi)
c.set_source(lin(0, 30, 0, 100, "#f5a70b", "#ffd84a"))
c.fill_preserve()
c.set_source_rgba(*INK, 0.35)
c.set_line_width(3)
c.stroke()
# ₩
c.set_source_rgb(*rgb("#b45309"))
c.set_line_width(8)
c.set_line_cap(cairo.LINE_CAP_ROUND)
c.set_line_join(cairo.LINE_JOIN_ROUND)
c.move_to(44, 47)
c.line_to(53, 87)
c.line_to(64, 57)
c.line_to(75, 87)
c.line_to(84, 47)
c.stroke()
c.set_line_width(5)
for y in (64, 74):
c.move_to(41, y)
c.line_to(87, y)
c.stroke()
shine(c, 44, 40, 14, 8, 0.7)
def money_bag(c):
c.move_to(46, 30)
c.curve_to(30, 50, 14, 74, 22, 96)
c.curve_to(28, 116, 100, 116, 106, 96)
c.curve_to(114, 74, 98, 50, 82, 30)
c.close_path()
fill_stroke(c, rad(64, 76, 56, "#c7f59a", "#6cc63c", "#3f8f25"))
rrect(c, 42, 16, 44, 18, 8)
fill_stroke(c, lin(0, 16, 0, 34, "#a5e57a", "#4f9f2c"))
c.set_source_rgb(*rgb("#ffd23a"))
c.set_line_width(7)
c.move_to(44, 36)
c.line_to(84, 36)
c.stroke()
# ₩ 표시
c.set_source_rgb(*rgb("#2f6f17"))
c.set_line_width(7)
c.set_line_cap(cairo.LINE_CAP_ROUND)
c.move_to(46, 62)
c.line_to(54, 94)
c.line_to(64, 70)
c.line_to(74, 94)
c.line_to(82, 62)
c.stroke()
c.set_line_width(4)
c.move_to(43, 76)
c.line_to(85, 76)
c.stroke()
shine(c, 40, 62, 8, 14, 0.5)
def bolt(c):
polygon(c, [(74, 8), (26, 72), (58, 72), (48, 120), (102, 50), (68, 50), (82, 8)])
fill_stroke(c, lin(30, 10, 90, 120, "#fff6a8", "#ffd21f", "#ff9f0a"))
polygon(c, [(72, 18), (40, 64), (52, 64)])
c.set_source_rgba(1, 1, 1, 0.6)
c.fill()
def gear(c):
teeth = 8
pts = []
for i in range(teeth * 4):
a = i * 2 * math.pi / (teeth * 4) - math.pi / 2
r = 54 if (i % 4) in (0, 1) else 40
pts.append((64 + r * math.cos(a + math.pi / (teeth * 4)), 64 + r * math.sin(a + math.pi / (teeth * 4))))
polygon(c, pts)
c.new_sub_path()
c.arc_negative(64, 64, 17, 0, -2 * math.pi)
c.set_fill_rule(cairo.FILL_RULE_EVEN_ODD)
fill_stroke(c, rad(64, 64, 58, "#f1f5f9", "#a8b4c4", "#64748b"))
c.set_fill_rule(cairo.FILL_RULE_WINDING)
shine(c, 46, 42, 10, 6, 0.6)
def upgrade(c):
# 초록 위쪽 화살표
polygon(c, [(64, 8), (114, 60), (84, 60), (84, 116), (44, 116), (44, 60), (14, 60)])
fill_stroke(c, lin(0, 8, 0, 116, "#b6f774", "#46c937", "#178a2c"))
polygon(c, [(64, 22), (34, 54), (50, 54)])
c.set_source_rgba(1, 1, 1, 0.55)
c.fill()
def plate(c):
c.save()
c.translate(64, 76)
c.scale(1, 0.5)
c.arc(0, 0, 56, 0, 2 * math.pi)
c.restore()
fill_stroke(c, lin(0, 50, 0, 104, "#ffffff", "#d7dde6"))
c.save()
c.translate(64, 74)
c.scale(1, 0.5)
c.arc(0, 0, 36, 0, 2 * math.pi)
c.restore()
c.set_source_rgba(*INK, 0.25)
c.set_line_width(3)
c.stroke()
# 김 나는 음식
c.move_to(36, 72)
c.curve_to(36, 36, 92, 36, 92, 72)
c.close_path()
fill_stroke(c, lin(0, 40, 0, 72, "#ff7a59", "#e63b1f"))
for x in (52, 64, 76):
c.move_to(x, 30)
c.curve_to(x - 6, 22, x + 6, 16, x, 8)
c.set_source_rgba(1, 1, 1, 0.9)
c.set_line_width(4)
c.stroke()
def lock(c):
c.arc(64, 50, 26, math.pi, 2 * math.pi)
c.set_line_width(14 + LW)
c.set_source_rgb(*INK)
c.stroke()
c.arc(64, 50, 26, math.pi, 2 * math.pi)
c.set_line_width(13)
c.set_source_rgb(*rgb("#cbd5e1"))
c.stroke()
rrect(c, 26, 50, 76, 64, 14)
fill_stroke(c, lin(0, 50, 0, 114, "#ffe066", "#f59e0b"))
c.arc(64, 76, 9, 0, 2 * math.pi)
c.set_source_rgb(*INK)
c.fill()
rrect(c, 60, 78, 8, 20, 4)
c.fill()
def check(c):
c.set_line_cap(cairo.LINE_CAP_ROUND)
c.set_line_join(cairo.LINE_JOIN_ROUND)
for w, col in ((30, INK), (18, rgb("#4ade80"))):
c.move_to(22, 66)
c.line_to(52, 96)
c.line_to(106, 34)
c.set_line_width(w)
c.set_source_rgb(*col)
c.stroke()
def close_x(c):
c.set_line_cap(cairo.LINE_CAP_ROUND)
for w, col in ((32, INK), (19, (1, 1, 1))):
c.set_line_width(w)
c.set_source_rgb(*col)
c.move_to(30, 30)
c.line_to(98, 98)
c.move_to(98, 30)
c.line_to(30, 98)
c.stroke()
def table(c):
# 다리
for x in (30, 92):
rrect(c, x, 58, 12, 56, 4)
fill_stroke(c, lin(0, 58, 0, 114, "#b9763c", "#7a4a22"), 5)
c.save()
c.translate(64, 52)
c.scale(1, 0.42)
c.arc(0, 0, 58, 0, 2 * math.pi)
c.restore()
fill_stroke(c, lin(0, 28, 0, 76, "#f2b46b", "#c97b36"))
c.save()
c.translate(64, 50)
c.scale(1, 0.42)
c.arc(0, 0, 42, 0, 2 * math.pi)
c.restore()
c.set_source_rgba(1, 1, 1, 0.3)
c.fill()
def sign(c):
for x in (34, 90):
rrect(c, x, 70, 8, 50, 3)
fill_stroke(c, rgb("#7a4a22"), 5)
rrect(c, 10, 16, 108, 64, 14)
fill_stroke(c, lin(0, 16, 0, 80, "#ff6b4a", "#d92f1c"))
rrect(c, 20, 26, 88, 44, 8)
c.set_source_rgb(*rgb("#fff3d6"))
c.fill()
for i, x in enumerate((40, 64, 88)):
polygon(c, star_pts(x, 48, 13, 6))
fill_stroke(c, rgb("#ffc61a"), 3)
def flame(c):
c.move_to(64, 6)
c.curve_to(96, 40, 112, 62, 108, 86)
c.curve_to(104, 112, 84, 122, 64, 122)
c.curve_to(40, 122, 20, 108, 20, 84)
c.curve_to(20, 64, 34, 52, 40, 34)
c.curve_to(48, 50, 52, 54, 56, 56)
c.curve_to(56, 36, 58, 22, 64, 6)
c.close_path()
fill_stroke(c, lin(0, 6, 0, 122, "#ffd23a", "#ff7a1a", "#e8341c"))
c.move_to(64, 58)
c.curve_to(82, 76, 88, 88, 84, 100)
c.curve_to(80, 114, 48, 114, 44, 100)
c.curve_to(42, 88, 54, 78, 64, 58)
c.close_path()
c.set_source(lin(0, 58, 0, 114, "#fff8c2", "#ffd23a"))
c.fill()
def sauce(c):
rrect(c, 52, 6, 24, 20, 6)
fill_stroke(c, rgb("#ffffff"), 5)
c.move_to(48, 26)
c.line_to(80, 26)
c.curve_to(80, 40, 100, 44, 100, 64)
c.line_to(100, 108)
c.curve_to(100, 118, 94, 122, 86, 122)
c.line_to(42, 122)
c.curve_to(34, 122, 28, 118, 28, 108)
c.line_to(28, 64)
c.curve_to(28, 44, 48, 40, 48, 26)
c.close_path()
fill_stroke(c, lin(28, 0, 100, 0, "#ff5a3c", "#d61f12", "#a8150b"))
rrect(c, 38, 66, 52, 36, 8)
c.set_source_rgb(*rgb("#fff3d6"))
c.fill()
polygon(c, [(64, 72), (72, 84), (64, 96), (56, 84)])
c.set_source_rgb(*rgb("#e8341c"))
c.fill()
c.rectangle(36, 46, 8, 52)
c.set_source_rgba(1, 1, 1, 0.45)
c.fill()
def chef(c):
# 요리사 모자
for x, y, r in ((40, 46, 24), (64, 34, 28), (88, 46, 24)):
c.arc(x, y, r, 0, 2 * math.pi)
c.set_source_rgb(*INK)
c.fill()
rrect(c, 34, 56, 60, 52, 8)
fill_stroke(c, lin(0, 56, 0, 108, "#ffffff", "#dfe5ee"))
for x, y, r in ((40, 46, 24 - LW / 2), (64, 34, 28 - LW / 2), (88, 46, 24 - LW / 2)):
c.arc(x, y, r, 0, 2 * math.pi)
c.set_source(rad(x, y, r + 4, "#ffffff", "#e6ebf2"))
c.fill()
rrect(c, 34 + LW / 2, 60, 60 - LW, 20, 4)
c.set_source_rgb(1, 1, 1)
c.fill()
for x in (52, 64, 76):
c.move_to(x, 86)
c.line_to(x, 104)
c.set_source_rgba(*INK, 0.3)
c.set_line_width(3)
c.stroke()
def store(c):
rrect(c, 18, 54, 92, 64, 6)
fill_stroke(c, lin(0, 54, 0, 118, "#fff3d6", "#f2d7a8"))
# 줄무늬 차양
polygon(c, [(10, 56), (22, 18), (106, 18), (118, 56)])
c.set_source_rgb(*INK)
c.set_line_width(LW)
c.stroke_preserve()
c.save()
c.clip()
for i in range(7):
polygon(c, [(10 + i * 18, 56), (22 + i * 12, 18), (34 + i * 12, 18), (28 + i * 18, 56)])
c.set_source_rgb(*(rgb("#e8341c") if i % 2 == 0 else (1, 1, 1)))
c.fill()
c.restore()
polygon(c, [(10, 56), (22, 18), (106, 18), (118, 56)])
c.set_source_rgb(*INK)
c.set_line_width(LW)
c.stroke()
rrect(c, 52, 76, 24, 42, 4)
fill_stroke(c, rgb("#b9763c"), 5)
rrect(c, 26, 70, 18, 18, 3)
fill_stroke(c, rgb("#8fd3ff"), 4)
rrect(c, 84, 70, 18, 18, 3)
fill_stroke(c, rgb("#8fd3ff"), 4)
def tray(c):
polygon(c, [(8, 70), (120, 70), (108, 98), (20, 98)])
fill_stroke(c, lin(0, 70, 0, 98, "#e2e8f0", "#94a3b8"))
for x, col in ((40, "#ff6b4a"), (64, "#ffd23a"), (88, "#7dd36b")):
c.move_to(x - 16, 68)
c.curve_to(x - 16, 44, x + 16, 44, x + 16, 68)
c.close_path()
fill_stroke(c, rgb(col), 5)
shine(c, 30, 80, 14, 4, 0.6)
def tteokbokki(c):
# 그릇
c.move_to(10, 58)
c.line_to(118, 58)
c.curve_to(116, 96, 92, 118, 64, 118)
c.curve_to(36, 118, 12, 96, 10, 58)
c.close_path()
fill_stroke(c, lin(0, 58, 0, 118, "#ffffff", "#cfd8e3"))
# 소스
c.save()
c.translate(64, 58)
c.scale(1, 0.32)
c.arc(0, 0, 52, 0, 2 * math.pi)
c.restore()
c.set_source_rgb(*rgb("#e8341c"))
c.fill()
# 떡
for x, y, a in ((40, 46, -0.5), (64, 40, 0.3), (86, 48, -0.2), (54, 56, 0.1), (78, 58, -0.4)):
c.save()
c.translate(x, y)
c.rotate(a)
rrect(c, -16, -8, 32, 16, 8)
c.restore()
fill_stroke(c, lin(0, y - 8, 0, y + 8, "#ff8a6a", "#d92f1c"), 4)
c.save()
c.translate(x, y)
c.rotate(a)
rrect(c, -10, -5, 14, 4, 2)
c.restore()
c.set_source_rgba(1, 1, 1, 0.6)
c.fill()
shine(c, 26, 80, 6, 12, 0.5)
def gimbap(c):
for x, y in ((40, 74), (88, 74), (64, 50)):
c.arc(x, y, 26, 0, 2 * math.pi)
fill_stroke(c, rgb("#1f2a1f"), 5)
c.arc(x, y, 19, 0, 2 * math.pi)
c.set_source_rgb(1, 1, 1)
c.fill()
for dx, dy, col in ((-6, -5, "#ff8c1a"), (6, -4, "#ffd23a"), (0, 6, "#4caf50"), (-7, 6, "#e8341c")):
c.arc(x + dx, y + dy, 5, 0, 2 * math.pi)
c.set_source_rgb(*rgb(col))
c.fill()
def sundae(c):
for x, y in ((38, 80), (64, 60), (90, 80)):
c.arc(x, y, 26, 0, 2 * math.pi)
fill_stroke(c, rad(x, y, 30, "#8a5a6a", "#5a2e3c", "#3a1a24"), 5)
for dx, dy in ((-8, -6), (6, -8), (8, 6), (-6, 8), (0, 0)):
c.arc(x + dx, y + dy, 3, 0, 2 * math.pi)
c.set_source_rgba(1, 0.85, 0.8, 0.7)
c.fill()
def eomuk(c):
c.set_line_cap(cairo.LINE_CAP_ROUND)
for w, col in ((10 + LW, INK), (8, rgb("#e8c58f"))):
c.move_to(64, 6)
c.line_to(64, 124)
c.set_line_width(w)
c.set_source_rgb(*col)
c.stroke()
# 꼬치에 접어 꽂은 어묵(지그재그 세 겹)
for i, (dx, a) in enumerate(((-8, -0.12), (8, 0.12), (-8, -0.12))):
y = 30 + i * 28
c.save()
c.translate(64 + dx, y)
c.rotate(a)
rrect(c, -40, -14, 80, 28, 12)
c.restore()
fill_stroke(c, lin(0, y - 14, 0, y + 14, "#ffe2a8", "#f2b46b", "#d98a3a"), 6)
c.save()
c.translate(64 + dx, y)
c.rotate(a)
rrect(c, -32, -9, 40, 5, 2.5)
c.restore()
c.set_source_rgba(1, 1, 1, 0.55)
c.fill()
def twigim(c):
# 새우튀김
c.save()
c.translate(64, 64)
c.rotate(-0.7)
c.move_to(-52, 0)
c.curve_to(-52, -26, 30, -26, 40, -6)
c.line_to(40, 6)
c.curve_to(30, 26, -52, 26, -52, 0)
c.close_path()
c.restore()
fill_stroke(c, lin(20, 20, 110, 110, "#ffe28a", "#f5a524", "#c9761a"))
c.save()
c.translate(64, 64)
c.rotate(-0.7)
polygon(c, [(38, -2), (60, -18), (54, 0), (60, 18), (38, 2)])
c.restore()
fill_stroke(c, rgb("#ff6b4a"), 5)
for x, y in ((40, 74), (54, 62), (68, 50), (48, 86), (62, 74), (76, 62), (34, 62)):
c.arc(x, y, 3.5, 0, 2 * math.pi)
c.set_source_rgba(1, 1, 1, 0.55)
c.fill()
def globe(c):
c.arc(64, 64, 52, 0, 2 * math.pi)
fill_stroke(c, rad(64, 64, 58, "#a8e6ff", "#38a8f5", "#1769c4"))
c.save()
c.arc(64, 64, 52 - LW / 2, 0, 2 * math.pi)
c.clip()
c.set_source(lin(0, 0, 0, 128, "#86e06a", "#3fa33a"))
c.move_to(30, 30)
c.curve_to(50, 20, 60, 40, 52, 56)
c.curve_to(44, 70, 22, 64, 18, 52)
c.close_path()
c.fill()
c.move_to(70, 60)
c.curve_to(94, 50, 112, 70, 100, 92)
c.curve_to(90, 108, 70, 100, 72, 84)
c.close_path()
c.fill()
c.restore()
c.set_source_rgba(*INK, 0.35)
c.set_line_width(3)
c.save()
c.translate(64, 64)
c.scale(0.45, 1)
c.arc(0, 0, 52, 0, 2 * math.pi)
c.restore()
c.stroke()
c.move_to(12, 64)
c.line_to(116, 64)
c.stroke()
shine(c, 44, 40, 12, 8, 0.6)
def speaker(c):
polygon(c, [(14, 48), (38, 48), (68, 20), (68, 108), (38, 80), (14, 80)])
fill_stroke(c, lin(0, 20, 0, 108, "#ffe066", "#f59e0b"))
c.set_line_cap(cairo.LINE_CAP_ROUND)
for r in (22, 40):
for w, col in ((9 + LW, INK), (9, (1, 1, 1))):
c.arc(70, 64, r, -0.8, 0.8)
c.set_line_width(w)
c.set_source_rgb(*col)
c.stroke()
def mouse(c):
rrect(c, 32, 14, 64, 100, 32)
fill_stroke(c, lin(32, 0, 96, 0, "#ffffff", "#cbd5e1"))
c.move_to(64, 16)
c.line_to(64, 52)
c.move_to(34, 52)
c.line_to(94, 52)
c.set_source_rgb(*INK)
c.set_line_width(5)
c.stroke()
rrect(c, 59, 28, 10, 18, 5)
c.set_source_rgb(*rgb("#38a8f5"))
c.fill()
def wrench(c):
c.save()
c.translate(64, 64)
c.rotate(-math.pi / 4)
rrect(c, -11, -6, 22, 66, 11)
c.restore()
fill_stroke(c, lin(0, 0, 128, 128, "#e2e8f0", "#7b8796"))
cx, cy, r, d = 46, 46, 30, -3 * math.pi / 4
def u(a, k):
return cx + k * math.cos(a), cy + k * math.sin(a)
c.new_sub_path()
c.arc(cx, cy, r, d + 0.5, d - 0.5 + 2 * math.pi)
c.line_to(*u(d - 0.75, 12))
c.line_to(*u(d + 0.75, 12))
c.close_path()
fill_stroke(c, rad(cx, cy, r + 2, "#f1f5f9", "#94a3b8"))
def star(c):
polygon(c, star_pts(64, 68, 58, 26))
fill_stroke(c, lin(0, 10, 0, 120, "#fff6a8", "#ffd21f", "#ff9f0a"))
polygon(c, star_pts(56, 56, 16, 7))
c.set_source_rgba(1, 1, 1, 0.55)
c.fill()
def sparkle(c):
# 테두리 없는 반짝이(흰색, 버튼·카드 위 장식)
pts = star_pts(64, 64, 60, 12, n=4)
polygon(c, pts)
g = cairo.RadialGradient(64, 64, 4, 64, 64, 60)
g.add_color_stop_rgba(0, 1, 1, 1, 1)
g.add_color_stop_rgba(1, 1, 1, 0.85, 0.9)
c.set_source(g)
c.fill()
def rays(c):
# 햇살(흰색, 테두리 없음). 2배·부스트 버튼 뒤에서 천천히 돕니다.
g = cairo.RadialGradient(64, 64, 6, 64, 64, 64)
g.add_color_stop_rgba(0, 1, 1, 1, 1)
g.add_color_stop_rgba(0.6, 1, 1, 1, 0.55)
g.add_color_stop_rgba(1, 1, 1, 1, 0)
for i in range(12):
a0 = i * math.pi / 6
a1 = a0 + math.pi / 12
c.move_to(64, 64)
c.line_to(64 + 90 * math.cos(a0), 64 + 90 * math.sin(a0))
c.line_to(64 + 90 * math.cos(a1), 64 + 90 * math.sin(a1))
c.close_path()
c.set_source(g)
c.fill()
def glow(c):
# 둥근 빛(흰색). 버튼 뒤 후광·알림 빛
g = cairo.RadialGradient(64, 64, 0, 64, 64, 64)
g.add_color_stop_rgba(0, 1, 1, 1, 1)
g.add_color_stop_rgba(0.45, 1, 1, 1, 0.6)
g.add_color_stop_rgba(1, 1, 1, 1, 0)
c.rectangle(0, 0, 128, 128)
c.set_source(g)
c.fill()
def arrow_down(c):
polygon(c, [(40, 8), (88, 8), (88, 64), (114, 64), (64, 120), (14, 64), (40, 64)])
fill_stroke(c, lin(0, 8, 0, 120, "#fff6a8", "#ffd21f", "#ff8a0a"))
c.rectangle(48, 16, 10, 44)
c.set_source_rgba(1, 1, 1, 0.55)
c.fill()
def scroll(c):
# 업그레이드 목록(두루마리 메뉴판)
rrect(c, 24, 14, 80, 100, 10)
fill_stroke(c, lin(0, 14, 0, 114, "#fff8e6", "#f2d7a8"))
for y in (38, 58, 78):
c.arc(40, y, 6, 0, 2 * math.pi)
c.set_source_rgb(*rgb("#e8341c"))
c.fill()
rrect(c, 52, y - 4, 38, 8, 4)
c.set_source_rgba(*INK, 0.55)
c.fill()
rrect(c, 16, 98, 96, 22, 11)
fill_stroke(c, lin(0, 98, 0, 120, "#ff8a5a", "#d92f1c"), 6)
def hand(c):
# 누르는 손가락(튜토리얼)
c.move_to(50, 18)
c.curve_to(50, 6, 70, 6, 70, 18)
c.line_to(70, 56)
c.curve_to(92, 52, 110, 58, 110, 76)
c.line_to(108, 98)
c.curve_to(106, 116, 90, 122, 72, 122)
c.curve_to(54, 122, 42, 114, 34, 100)
c.line_to(20, 76)
c.curve_to(14, 64, 30, 58, 38, 68)
c.line_to(50, 80)
c.close_path()
fill_stroke(c, lin(0, 6, 0, 122, "#ffe9d0", "#f5c89a"))
ICONS = [
("coin", coin), ("moneyBag", money_bag), ("bolt", bolt), ("gear", gear),
("upgrade", upgrade), ("plate", plate), ("lock", lock), ("check", check),
("close", close_x), ("table", table), ("sign", sign), ("flame", flame),
("sauce", sauce), ("chef", chef), ("store", store), ("tray", tray),
("Tteokbokki", tteokbokki), ("Gimbap", gimbap), ("Sundae", sundae), ("Eomuk", eomuk),
("Twigim", twigim), ("globe", globe), ("speaker", speaker), ("mouse", mouse),
("wrench", wrench), ("star", star), ("sparkle", sparkle), ("rays", rays),
("glow", glow), ("arrowDown", arrow_down), ("scroll", scroll), ("hand", hand),
]
def draw():
surf = cairo.ImageSurface(cairo.FORMAT_ARGB32, CELL * GRID, CELL * GRID)
for i, (name, fn) in enumerate(ICONS):
c = cairo.Context(surf)
c.translate((i % GRID) * CELL, (i // GRID) * CELL)
c.rectangle(0, 0, CELL, CELL)
c.clip()
# 테두리가 칸 밖으로 안 나가게 살짝 줄입니다.
c.translate(64, 64)
c.scale(0.9, 0.9)
c.translate(-64, -64)
fn(c)
return surf
def main(argv):
surf = draw()
if "--luau" in argv:
for i, (name, _) in enumerate(ICONS):
print(f"\t{name} = Vector2.new({(i % GRID) * CELL}, {(i // GRID) * CELL}),")
return
if "--sheet" in argv:
out = argv[argv.index("--sheet") + 1]
rows = (len(ICONS) + GRID - 1) // GRID
sheet = cairo.ImageSurface(cairo.FORMAT_ARGB32, CELL * GRID, (CELL + 20) * rows)
c = cairo.Context(sheet)
c.set_source_rgb(0.55, 0.75, 0.6)
c.paint()
for i, (name, _) in enumerate(ICONS):
x, y = (i % GRID) * CELL, (i // GRID) * (CELL + 20)
c.set_source_surface(surf, x - (i % GRID) * CELL + 0, y - (i // GRID) * CELL)
c.rectangle(x, y, CELL, CELL)
c.fill()
c.set_source_rgb(0, 0, 0)
c.move_to(x + 4, y + CELL + 15)
c.set_font_size(13)
c.show_text(name)
sheet.write_to_png(out)
print(out)
return
surf.write_to_png(OUT)
print(os.path.normpath(OUT))
if __name__ == "__main__":
main(sys.argv[1:])

20
bunsik-tycoon/tools/preview.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# 화면 UI 미리보기: 빌드 → 저장 버전 업로드 → 로블록스 서버에서 UI 덤프 → 그림(PNG)으로.
# tools/preview.sh 출력폴더
set -euo pipefail
cd "$(dirname "$0")/.."
export PATH="$HOME/.rokit/bin:$PATH"
out=${1:-.cache/preview}
mkdir -p .cache "$out"
rojo build default.project.json -o build/BunsikTycoon.rbxl >/dev/null
ver=$(python3 tools/cloud.py publish build/BunsikTycoon.rbxl | awk '{print $2}')
python3 tools/cloud.py run tests/cloud/dump_gui.luau --version "$ver" >.cache/dump_raw.txt || { tail -20 .cache/dump_raw.txt; exit 1; }
python3 - <<'PY'
import json
raw = open(".cache/dump_raw.txt").read()
line = [l for l in raw.splitlines() if l.startswith("output: ")][-1]
out = json.loads(line[len("output: "):])
data = out["results"][0]
open(".cache/gui_dump.json", "w").write(data)
PY
python3 tools/gui_render.py .cache/gui_dump.json "$out"