- [가게 꾸미기]를 누르면 창 없이 바로 꾸미기 모드: 아래 물건 줄(테이블·의자·소품 6가지, 값·개수)에서 고르면 투명 미리보기를 들고 걸어가 [배치]. [이동]은 고른 가구를 들고 옮기기, [삭제]는 고른 가구를 빨갛게 표시한 뒤 한 번 더 눌러 지우고 산 값 돌려받기(조리대·마지막 테이블/의자·의자가 보는 테이블·손님 앉은 의자는 막음) - 새 요청 remove, Floor.remove, Shop.removeSeat(뒤 자리 손님·걷는 시간 번호 당김) - 내 가게 탭: 이름 색 무료 10색 + 무지개(게임패스) 칸. 부지 속성 NameColor로 모두에게 보임 - 개발자 테스트 [결제 테스트 켜기/끄기]: 켜면 2배·부스트·러시·쫓아내기·광고 홍보·무지개·유료 디자인이 결제 창 없이 바로 지급(이번 접속만), 게임패스는 안 가진 상태로 바꿔 사는 흐름을 볼 수 있고 끄면 실제 보유로 복구 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
199 lines
8.3 KiB
Lua
199 lines
8.3 KiB
Lua
-- 화면 UI 배치 검사: 기기별 화면에서 UI가 화면 안에 있고, 서로 겹치지 않고,
|
|
-- 휴대폰에서는 누르는 버튼이 조이스틱·점프 버튼 자리를 피하고 손가락으로 누를 만큼 큰지. lune run tests/Layout.spec.luau
|
|
local Layout = require("../src/client/Layout")
|
|
local T = require("./check")
|
|
|
|
type Rect = Layout.Rect
|
|
|
|
-- 가로 화면 크기(포인트)에서 로블록스 상단 바(58)와 노치(좌우)를 뺀 UI 영역
|
|
local DEVICES: { { name: string, w: number, h: number, touch: boolean } } = {
|
|
{ name = "iPhone SE", w = 667, h = 375 - 58, touch = true },
|
|
{ name = "iPhone 15", w = 844 - 94, h = 390 - 58, touch = true },
|
|
{ name = "iPhone 15 Pro Max", w = 932 - 118, h = 430 - 58, touch = true },
|
|
{ name = "Android 640x360", w = 640, h = 360 - 58, touch = true },
|
|
{ name = "Android 800x360", w = 800, h = 360 - 58, touch = true },
|
|
{ name = "Galaxy S 915x412", w = 915, h = 412 - 58, touch = true },
|
|
{ name = "iPad 1024x768", w = 1024, h = 768 - 58, touch = true },
|
|
{ name = "iPad Pro 11", w = 1194, h = 834 - 58, touch = true },
|
|
{ name = "PC 1280x720", w = 1280, h = 720 - 58, touch = false },
|
|
{ name = "PC 1366x768", w = 1366, h = 768 - 58, touch = false },
|
|
{ name = "PC 1920x1080", w = 1920, h = 1080 - 58, touch = false },
|
|
{ name = "PC 작은 창 800x600", w = 800, h = 600 - 58, touch = false },
|
|
}
|
|
|
|
local function inside(r: Rect, W: number, H: number): boolean
|
|
return r.x >= 0 and r.y >= 0 and r.x + r.w <= W + 1e-6 and r.y + r.h <= H + 1e-6
|
|
end
|
|
|
|
local function overlap(a: Rect, b: Rect): boolean
|
|
return a.x < b.x + b.w and b.x < a.x + a.w and a.y < b.y + b.h and b.y < a.y + a.h
|
|
end
|
|
|
|
local function px(r: Rect, s: number): Rect
|
|
return { x = r.x * s, y = r.y * s, w = r.w * s, h = r.h * s }
|
|
end
|
|
|
|
for _, d in DEVICES do
|
|
for _, dev in { false, true } do
|
|
local L = Layout.compute(d.w, d.h, d.touch, dev)
|
|
local tag = `{d.name}{if dev then "(개발자)" else ""}`
|
|
T.check(
|
|
math.abs(L.width * L.scale - d.w) < 1e-6 and math.abs(L.height * L.scale - d.h) < 1e-6,
|
|
`{tag}: 화면 꽉 채움`
|
|
)
|
|
|
|
-- 늘 보이는 요소: 화면 안, 서로 안 겹침
|
|
local hud: { [string]: Rect } = {
|
|
money = L.money,
|
|
carry = L.carry,
|
|
hint = L.hint,
|
|
toasts = L.toasts,
|
|
settings = L.settings,
|
|
list = L.list,
|
|
decorate = L.decorate,
|
|
double = L.double,
|
|
boost = L.boost,
|
|
promote = L.promote,
|
|
rush = L.rush,
|
|
}
|
|
for name, r in hud do
|
|
T.check(inside(r, L.width, L.height), `{tag}: {name} 화면 안`)
|
|
end
|
|
local names = {}
|
|
for name in hud do
|
|
table.insert(names, name)
|
|
end
|
|
table.sort(names)
|
|
for i, a in names do
|
|
for j = i + 1, #names do
|
|
local b = names[j]
|
|
T.check(not overlap(hud[a], hud[b]), `{tag}: {a}와 {b} 안 겹침`)
|
|
end
|
|
end
|
|
T.check(L.toasts.h >= 46, `{tag}: 알림 한 줄 이상 자리`)
|
|
|
|
-- 창(업그레이드 목록, 설정)은 화면 안에 다 들어감
|
|
T.check(inside(L.panel, L.width, L.height), `{tag}: 업그레이드 창 화면 안`)
|
|
T.check(inside(L.settingsPanel, L.width, L.height), `{tag}: 설정 창 화면 안`)
|
|
T.check(inside(L.kitchen, L.width, L.height), `{tag}: 요리 창 화면 안`)
|
|
T.check(inside(L.confirm, L.width, L.height), `{tag}: 홍보 확인 창 화면 안`)
|
|
|
|
-- 상점 창 안: 탭 3개와 내용 자리가 창 안에, 서로 안 겹침
|
|
local panelBox = { x = 0, y = 0, w = L.panel.w, h = L.panel.h }
|
|
T.eq(#L.tabs, 3, `{tag}: 탭 3개`)
|
|
for i, t in L.tabs do
|
|
T.check(inside(t, panelBox.w, panelBox.h), `{tag}: 탭 {i} 창 안`)
|
|
T.check(not overlap(t, L.content), `{tag}: 탭 {i}와 내용 안 겹침`)
|
|
T.check(t.y >= Layout.HEADER_H, `{tag}: 탭 {i}는 제목 띠 아래`)
|
|
T.check(t.h * L.scale >= 44 and t.w * L.scale >= 44, `{tag}: 탭 {i} 누르기 쉬움`)
|
|
if i > 1 then
|
|
T.check(not overlap(t, L.tabs[i - 1]), `{tag}: 탭 {i - 1}·{i} 안 겹침`)
|
|
end
|
|
end
|
|
T.check(inside(L.content, panelBox.w, panelBox.h), `{tag}: 탭 내용 창 안`)
|
|
T.check(inside(L.decorContent, panelBox.w, panelBox.h), `{tag}: 가게 꾸미기 내용 창 안`)
|
|
T.check(L.decorContent.y >= Layout.HEADER_H, `{tag}: 가게 꾸미기 내용은 제목 띠 아래`)
|
|
-- 카드 칸(업그레이드 4x2, 알바생 3x1, 가게 꾸미기 5x2): 손가락으로 누를 만큼 큼
|
|
for _, grid in { { 4, 2, L.content }, { 3, 1, L.content }, { 5, 2, L.decorContent } } do
|
|
-- ShopWindow의 칸: 내용 자리를 똑같이 나누고 칸마다 8씩 띄움
|
|
local box = grid[3] :: Rect
|
|
local cw = box.w / grid[1] - 8
|
|
local chh = box.h / grid[2] - 8
|
|
T.check(
|
|
cw * L.scale >= 90 and chh * L.scale >= 90,
|
|
`{tag}: {grid[1]}x{grid[2]} 카드가 손가락으로 누를 만큼 큼({math.floor(cw * L.scale)}x{math.floor(
|
|
chh * L.scale
|
|
)}px)`
|
|
)
|
|
end
|
|
|
|
-- 꾸미기 화면 버튼: 화면 안, 서로 안 겹침, 누르기 쉬움
|
|
T.eq(#L.deco.tools, 3, `{tag}: 꾸미기 버튼 3개`)
|
|
-- 물건 줄·이동·삭제(고를 때)와 들고 있을 때 버튼은 따로 보이므로 각각 검사합니다.
|
|
local pick: { [string]: Rect } =
|
|
{ exit = L.deco.exit, info = L.deco.info, strip = L.deco.strip, move = L.deco.move, delete = L.deco.delete }
|
|
local pnames = {}
|
|
for name, r in pick do
|
|
T.check(inside(r, L.width, L.height), `{tag}: 꾸미기 {name} 화면 안`)
|
|
table.insert(pnames, name)
|
|
end
|
|
table.sort(pnames)
|
|
for i, a in pnames do
|
|
for j = i + 1, #pnames do
|
|
T.check(not overlap(pick[a], pick[pnames[j]]), `{tag}: 꾸미기 {a}와 {pnames[j]} 안 겹침`)
|
|
end
|
|
end
|
|
T.check(L.deco.strip.w >= 3 * L.deco.move.w, `{tag}: 물건 줄에 3칸 넘게 보임`)
|
|
if d.touch then
|
|
local zones = Layout.touchZones(d.w, d.h)
|
|
for name, r in pick do
|
|
local p = px(r, L.scale)
|
|
T.check(not overlap(p, zones.jump), `{tag}: 꾸미기 {name}이 점프 버튼 자리 피함`)
|
|
if name ~= "info" then
|
|
T.check(p.h >= 44, `{tag}: 꾸미기 {name} 높이 {math.floor(p.h)}px ≥ 44`)
|
|
end
|
|
end
|
|
-- 물건 줄은 조이스틱 자리 맨 아래 띠만 씀(위쪽 2/3 넘게는 비어 있음)
|
|
local sp = px(L.deco.strip, L.scale)
|
|
T.check(sp.h <= zones.stick.h / 3, `{tag}: 물건 줄이 조이스틱 자리를 조금만 씀`)
|
|
end
|
|
local deco: { [string]: Rect } = { exit = L.deco.exit, info = L.deco.info }
|
|
for i, r in L.deco.tools do
|
|
deco["tool" .. i] = r
|
|
end
|
|
local dnames = {}
|
|
for name, r in deco do
|
|
T.check(inside(r, L.width, L.height), `{tag}: 꾸미기 {name} 화면 안`)
|
|
table.insert(dnames, name)
|
|
end
|
|
table.sort(dnames)
|
|
for i, a in dnames do
|
|
for j = i + 1, #dnames do
|
|
T.check(not overlap(deco[a], deco[dnames[j]]), `{tag}: 꾸미기 {a}와 {dnames[j]} 안 겹침`)
|
|
end
|
|
end
|
|
T.check(L.kitchen.w * L.scale >= 0.6 * d.w or L.kitchen.w >= 780, `{tag}: 요리 창이 충분히 큼`)
|
|
T.eq(L.rows.devY ~= nil, dev, `{tag}: 개발자 줄은 주인에게만`)
|
|
T.eq(L.rows.mouseY == nil, d.touch, `{tag}: 마우스 회전 줄은 PC만`)
|
|
|
|
if d.touch then
|
|
local zones = Layout.touchZones(d.w, d.h)
|
|
local buttons: { [string]: Rect } = {
|
|
settings = L.settings,
|
|
list = L.list,
|
|
decorate = L.decorate,
|
|
double = L.double,
|
|
boost = L.boost,
|
|
promote = L.promote,
|
|
rush = L.rush,
|
|
}
|
|
for name, r in buttons do
|
|
local p = px(r, L.scale)
|
|
T.check(not overlap(p, zones.stick), `{tag}: {name} 버튼이 조이스틱 자리 피함`)
|
|
T.check(not overlap(p, zones.jump), `{tag}: {name} 버튼이 점프 버튼 자리 피함`)
|
|
T.check(p.h >= 44, `{tag}: {name} 버튼 높이 {math.floor(p.h)}px ≥ 44(어린이 손가락)`)
|
|
end
|
|
-- 꾸미기 화면에서는 걸어 다니므로 조이스틱 자리도 피함
|
|
for name, r in deco do
|
|
local p = px(r, L.scale)
|
|
T.check(not overlap(p, zones.jump), `{tag}: 꾸미기 {name}이 점프 버튼 자리 피함`)
|
|
T.check(not overlap(p, zones.stick), `{tag}: 꾸미기 {name}이 조이스틱 자리 피함`)
|
|
if name ~= "info" then
|
|
T.check(p.h >= 44, `{tag}: 꾸미기 {name} 버튼 높이 {math.floor(p.h)}px ≥ 44`)
|
|
end
|
|
end
|
|
T.check(L.rows.langButtonH * L.scale >= 36, `{tag}: 언어 버튼 누르기 쉬움`)
|
|
T.check(L.rows.toggleH * L.scale >= 34, `{tag}: 켜기/끄기 버튼 누르기 쉬움`)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- PC는 예전과 같은 기준 화면(1100x620), 휴대폰은 더 크게
|
|
T.eq(Layout.scaleFor(1100, 620, false), 1, "PC 기준 배율")
|
|
T.check(
|
|
Layout.scaleFor(750, 332, true) > Layout.scaleFor(750, 332, false),
|
|
"휴대폰은 같은 화면에서 더 크게"
|
|
)
|
|
|
|
T.done("Layout")
|