- Layout 모듈: 안전 영역(상단 바·노치 제외) 크기와 터치 여부로 배율·위치 계산 - 휴대폰: 기준 화면 900x400으로 글자·버튼 크게, 결제 버튼은 왼쪽 위, 사기 버튼은 조이스틱(왼쪽 40%×아래 2/3)과 점프 버튼 자리 사이, 마우스 회전 줄 숨김 - 루트가 화면을 꽉 채우고, 배율을 상단 바 뺀 영역 기준으로 계산(아래 카드 잘림 수정) - 개발자 테스트 버튼을 설정 창 안으로 이동 - 기기 12종 배치 단위 테스트, 배치 미리보기 도구(tools/hud_preview.py) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
542 lines
22 KiB
Lua
542 lines
22 KiB
Lua
-- 로블록스 서버(Open Cloud Luau Execution)에서 돌리는 통합 테스트.
|
||
-- python3 tools/cloud.py run tests/cloud/integration.luau --version <저장 버전>
|
||
-- 이 환경에서는 플레이어가 없고 물리가 돌지 않으며 Script가 자동 실행되지 않으므로,
|
||
-- 모듈을 직접 불러 가짜 플레이어(Folder)와 가상 시계로 가게를 돌립니다.
|
||
|
||
local Players = game:GetService("Players")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local ServerScriptService = game:GetService("ServerScriptService")
|
||
local StarterPlayer = game:GetService("StarterPlayer")
|
||
|
||
local Server = ServerScriptService.Server
|
||
local failures = {}
|
||
local count = 0
|
||
local function check(cond: any, msg: string)
|
||
count += 1
|
||
if not cond then
|
||
table.insert(failures, msg)
|
||
print("FAIL " .. msg)
|
||
end
|
||
end
|
||
local function eq(a: any, b: any, msg: string)
|
||
check(a == b, `{msg} (기대 {tostring(b)}, 실제 {tostring(a)})`)
|
||
end
|
||
local function section(name: string)
|
||
print("== " .. name)
|
||
end
|
||
|
||
local Economy = require(ReplicatedStorage.Shared.Economy)
|
||
local Locale = require(ReplicatedStorage.Shared.Locale)
|
||
|
||
section("맵")
|
||
local World = require(Server.World)
|
||
local slots = World.build()
|
||
eq(#slots, 6, "부지 6칸")
|
||
for i, s in slots do
|
||
check(s.refs.stove and s.refs.stove:IsDescendantOf(workspace), `부지 {i} 조리대`)
|
||
for j, o in slots do
|
||
if i < j then
|
||
local d = (s.cf.Position - o.cf.Position).Magnitude
|
||
check(d >= 76, `부지 {i},{j} 겹치지 않음 (거리 {d})`)
|
||
end
|
||
end
|
||
-- 입구(+Z)가 길(z=0) 쪽을 봐야 함
|
||
local front = s.cf:PointToWorldSpace(Vector3.new(0, 0, 40))
|
||
check(math.abs(front.Z) < math.abs(s.cf.Position.Z), `부지 {i} 입구가 길 쪽`)
|
||
end
|
||
check(workspace.BunsikWorld:FindFirstChild("Spawn") ~= nil, "스폰 지점")
|
||
local partCount = 0
|
||
for _, d in workspace.BunsikWorld:GetDescendants() do
|
||
if d:IsA("BasePart") then
|
||
partCount += 1
|
||
check(not d:IsA("PartOperation"), "Union 없음(업로드 제한)")
|
||
end
|
||
end
|
||
print("맵 파트 수", partCount)
|
||
check(partCount < 6000, "맵 파트 6000개 미만")
|
||
|
||
section("NPC")
|
||
local Npc = require(Server.Npc)
|
||
Npc.preload()
|
||
local npc = Npc.spawn(workspace, CFrame.new(0, 5, 0), Random.new(1))
|
||
check(npc.model:FindFirstChild("HumanoidRootPart") ~= nil, "NPC 몸")
|
||
check(npc.tracks.walk ~= nil and npc.tracks.sit ~= nil and npc.tracks.idle ~= nil, "NPC 애니메이션 3종 로드")
|
||
npc.model:Destroy()
|
||
|
||
section("가게 1: 튜토리얼 흐름")
|
||
local PlotController = require(Server.PlotController)
|
||
local Data = require(Server.Data)
|
||
local function newData()
|
||
local d = table.clone(Data.TEMPLATE)
|
||
d.PurchaseIdCache = {}
|
||
return d
|
||
end
|
||
local owner = Instance.new("Folder")
|
||
owner.Name = "FakePlayer"
|
||
owner.Parent = ServerScriptService
|
||
local notes = {}
|
||
local data = newData()
|
||
local c = PlotController.new(slots[1], owner, {
|
||
userId = 111,
|
||
displayName = "Tester",
|
||
data = data,
|
||
now = 0,
|
||
notify = function(k)
|
||
table.insert(notes, k)
|
||
end,
|
||
})
|
||
local Plots = require(StarterPlayer.StarterPlayerScripts.Client.Plots)
|
||
eq(owner:GetAttribute("Tut"), 1, "튜토리얼 1단계")
|
||
eq(owner:GetAttribute("Money"), 0, "돈 0")
|
||
eq(slots[1].model:GetAttribute("OwnerId"), 111, "부지 주인 속성")
|
||
eq(Plots.nameText(slots[1].model, "ko"), "Tester의 분식집", "이름판(한국어)")
|
||
eq(Plots.nameText(slots[1].model, "ja"), "Testerのブンシク店", "이름판(일본어)")
|
||
eq(Plots.nameText(slots[4].model, "en"), "Empty lot", "빈 자리 이름판")
|
||
c:update(0)
|
||
local dyn = slots[1].refs.dynamic
|
||
local customers = 0
|
||
for _, ch in dyn:GetChildren() do
|
||
if ch.Name == "Customer" then
|
||
customers += 1
|
||
check(ch:FindFirstChild("Order", true) ~= nil, "손님 주문 말풍선")
|
||
end
|
||
end
|
||
eq(customers, 1, "첫 손님 NPC 1명")
|
||
eq(slots[1].refs.stove:GetAttribute("CookMenu"), "Tteokbokki", "조리대에 떡볶이 주문 표시")
|
||
eq(slots[1].refs.stove:GetAttribute("OwnerId"), 111, "조리대 주인")
|
||
check((owner:FindFirstChild("Guide") :: ObjectValue).Value ~= nil, "튜토리얼 화살표 목표(조리대)")
|
||
c:update(3)
|
||
eq(c.shop.customers[1].state, "waiting", "손님이 앉음")
|
||
eq(c:cook(), "Tteokbokki", "조리")
|
||
eq(owner:GetAttribute("Tut"), 2, "튜토리얼 2단계")
|
||
eq(owner:GetAttribute("Carry"), 1, "접시 1개 듦")
|
||
eq(slots[1].refs.stove:GetAttribute("CookMenu"), "", "더 만들 것 없음")
|
||
eq(c:serve(1), 10, "서빙 10원")
|
||
eq(owner:GetAttribute("Money"), 10, "돈 10")
|
||
eq(data.Money, 10, "세이브 데이터 돈 10")
|
||
eq(owner:GetAttribute("Tut"), 3, "튜토리얼 3단계")
|
||
check(dyn:FindFirstChild("Dish_Tteokbokki") ~= nil, "테이블에 접시")
|
||
local ok = c:buy()
|
||
check(ok, "테이블 2 구매")
|
||
check(slots[1].refs.upgrades:FindFirstChild("Table2") ~= nil, "테이블 2 모형")
|
||
eq(owner:GetAttribute("Tut"), 0, "튜토리얼 끝")
|
||
eq(data.TutorialDone, true, "튜토리얼 저장")
|
||
eq(data.Bought, 1, "세이브 데이터 구매 1")
|
||
check(table.find(notes, "tutDone") and table.find(notes, "purchased"), "알림")
|
||
|
||
section("가게 1: 김밥 해금이 바로 보임")
|
||
c:addMoney(40)
|
||
check(c:buy(), "김밥 해금 구매")
|
||
check(slots[1].refs.upgrades:FindFirstChild("UnlockGimbap") ~= nil, "김밥 진열대 모형")
|
||
check(
|
||
slots[1].refs.upgrades:FindFirstChild("UnlockGimbap"):FindFirstChild("Display") ~= nil,
|
||
"진열대에 김밥 접시"
|
||
)
|
||
check(table.find(notes, "newMenu") ~= nil, "새 메뉴 알림")
|
||
check(string.find(Plots.menuText(slots[1].model, "ko"), "김밥") ~= nil, "메뉴판에 김밥")
|
||
local gimbapOrder = false
|
||
for k = 1, 30 do
|
||
c:update(3 + Economy.EAT + 0.5 + k * 0.1)
|
||
for _, cust in c.shop.customers do
|
||
if cust.menu == "Gimbap" then
|
||
gimbapOrder = true
|
||
end
|
||
end
|
||
if gimbapOrder then
|
||
break
|
||
end
|
||
end
|
||
check(gimbapOrder, "산 직후 3초 안에 김밥 주문 손님")
|
||
c:update(3 + Economy.EAT + 0.5)
|
||
eq(dyn:FindFirstChild("Dish_Tteokbokki"), nil, "다 먹은 접시 치움")
|
||
|
||
section("가게 1: 전부 구매")
|
||
c:addMoney(10_000_000)
|
||
for i = 3, #Economy.PURCHASES do
|
||
local okBuy, err = c:buy()
|
||
check(okBuy, `#{i} 구매 ({err})`)
|
||
end
|
||
eq(owner:GetAttribute("Bought"), #Economy.PURCHASES, "20개 구매")
|
||
eq(owner:GetAttribute("Stage"), 2, "2단계")
|
||
for _, id in { "Expand", "Sign1", "Sign2", "Stove1", "Stove2", "Sauce1", "Sauce2", "Tray1", "Tray2", "Table8" } do
|
||
check(slots[1].refs.upgrades:FindFirstChild(id) ~= nil, `업그레이드 모형 {id}`)
|
||
end
|
||
check(dyn:FindFirstChild("Helper") ~= nil, "알바생 NPC")
|
||
check(table.find(notes, "expanded") ~= nil, "확장 알림")
|
||
local okMax, errMax = c:buy()
|
||
check(not okMax and errMax == "max", "더 살 것 없음")
|
||
check(string.find(Plots.menuText(slots[1].model, "ko"), "튀김") ~= nil, "메뉴판에 튀김")
|
||
check(string.find(Plots.menuText(slots[1].model, "zh"), "炸物") ~= nil, "중국어 메뉴판")
|
||
check(slots[1].refs.upgrades:FindFirstChild("UnlockTwigim") ~= nil, "튀김 진열대 모형")
|
||
|
||
section("가게 1: 가상 5분 영업(봇)")
|
||
local t = 20
|
||
local servedBefore = c.shop.served
|
||
local t0 = os.clock()
|
||
while t < 320 do
|
||
t += 0.1
|
||
c:update(t)
|
||
c:pickup()
|
||
if not c.shop.stats.helper then
|
||
c:cook()
|
||
end
|
||
for id, cust in c.shop.customers do
|
||
if cust.state == "waiting" then
|
||
c:serve(id)
|
||
end
|
||
end
|
||
end
|
||
local elapsed = os.clock() - t0
|
||
local served = c.shop.served - servedBefore
|
||
print(`5분 영업: 서빙 {served}회, 계산 시간 {math.floor(elapsed * 1000)}ms`)
|
||
check(served > 60, "5분 동안 60회 넘게 서빙")
|
||
-- 나가는 손님은 실제 시간으로 몇 초 뒤 지워지므로 잠깐 기다립니다.
|
||
task.wait(Economy.WALK_IN + 1.5)
|
||
local alive = 0
|
||
for _, ch in dyn:GetChildren() do
|
||
if ch.Name == "Customer" then
|
||
alive += 1
|
||
end
|
||
end
|
||
check(alive <= Economy.MAX_SEATS + 6, `손님 NPC가 쌓이지 않음 ({alive})`)
|
||
|
||
section("가게 2: 캐릭터 가까이 가면 자동 서빙·집기")
|
||
local charModel =
|
||
Players:CreateHumanoidModelFromDescription(Instance.new("HumanoidDescription"), Enum.HumanoidRigType.R15)
|
||
charModel.Name = "FakeCharacter"
|
||
charModel.Parent = workspace
|
||
local hrp = charModel:FindFirstChild("HumanoidRootPart") :: BasePart
|
||
hrp.Anchored = true
|
||
local owner2 = Instance.new("Folder")
|
||
owner2.Parent = ServerScriptService
|
||
local data2 = newData()
|
||
data2.Bought = 8 -- 알바생까지 산 상태
|
||
data2.Money = 5
|
||
local c2 = PlotController.new(slots[2], owner2, {
|
||
userId = 222,
|
||
displayName = "Tester2",
|
||
data = data2,
|
||
now = 0,
|
||
getCharacter = function()
|
||
return charModel
|
||
end,
|
||
})
|
||
eq(owner2:GetAttribute("Money"), 5, "저장된 돈 불러옴")
|
||
eq(owner2:GetAttribute("Tut"), 1, "튜토리얼 안 끝났으면 1")
|
||
c2:update(0)
|
||
eq(#c2.shop.counter, 1, "알바생이 카운터에 접시")
|
||
hrp.CFrame = slots[2].refs.counter.CFrame + Vector3.new(0, 3, 4)
|
||
c2:update(0.2)
|
||
eq(#c2.shop.hand, 1, "카운터 근처에서 자동으로 집음")
|
||
local held = 0
|
||
for _, ch in charModel:GetChildren() do
|
||
if string.sub(ch.Name, 1, 5) == "Dish_" then
|
||
held += 1
|
||
end
|
||
end
|
||
eq(held, 1, "손에 접시 모형")
|
||
c2:update(3)
|
||
local seat = c2.shop.customers[1].seat
|
||
local PlotBuilder = require(Server.PlotBuilder)
|
||
hrp.CFrame = PlotBuilder.seatCFrame(slots[2].cf, seat) + Vector3.new(0, 2, 2)
|
||
local before = c2.shop.money
|
||
c2:update(3.2)
|
||
check(c2.shop.money > before, "손님 근처에서 자동 서빙")
|
||
-- 리스폰: 손에 든 접시 모형 다시 만들기
|
||
c2:update(4)
|
||
c2:update(4.1)
|
||
c2:rebuildHand()
|
||
c2:destroy()
|
||
eq(#slots[2].refs.dynamic:GetChildren(), 0, "나가면 가게 비움")
|
||
eq(slots[2].refs.stove:GetAttribute("OwnerId"), nil, "조리대 주인 해제")
|
||
charModel:Destroy()
|
||
|
||
section("다른 플레이어가 손님으로 방문")
|
||
local guestChar =
|
||
Players:CreateHumanoidModelFromDescription(Instance.new("HumanoidDescription"), Enum.HumanoidRigType.R15)
|
||
guestChar.Name = "GuestCharacter"
|
||
guestChar.Parent = workspace
|
||
local hostOwner = Instance.new("Folder")
|
||
hostOwner.Parent = ServerScriptService
|
||
local hostData = newData()
|
||
hostData.Bought = 5 -- 자리 3개
|
||
hostData.TutorialDone = true
|
||
local guestEvents = {}
|
||
local host = PlotController.new(slots[2], hostOwner, {
|
||
userId = 333,
|
||
displayName = "Host",
|
||
data = hostData,
|
||
now = 0,
|
||
guestEvent = function(kind, userId, info)
|
||
table.insert(guestEvents, { kind, userId, info })
|
||
end,
|
||
})
|
||
local gc = host:addGuest(444, guestChar)
|
||
check(gc ~= nil, "빈자리에 손님으로 앉음")
|
||
eq(host:addGuest(444, guestChar), nil, "같은 손님은 한 번만")
|
||
local guestSeat = slots[2].refs.dynamic:FindFirstChild("GuestSeat") :: Seat?
|
||
check(guestSeat ~= nil, "손님 의자")
|
||
print("손님 의자 Occupant", guestSeat and guestSeat.Occupant)
|
||
eq(slots[2].refs.stove:GetAttribute("CookMenu"), gc and gc.menu, "손님 주문이 조리대에 뜸")
|
||
host.shop.now = 0.5
|
||
eq(host:cook(), gc and gc.menu, "손님 메뉴 조리")
|
||
local hostBefore = host.shop.money
|
||
local guestEarn = host:serve(gc.id)
|
||
eq(guestEarn, Economy.dishPrice(gc.menu, host.shop.stats, 1) * Economy.GUEST_MULT, "손님 접시는 2배 값")
|
||
eq(host.shop.money - hostBefore, guestEarn, "주인 돈 증가")
|
||
eq(guestEvents[1] and guestEvents[1][1], "served", "손님에게 서빙 소식")
|
||
eq(guestEvents[1] and guestEvents[1][3].price, Economy.dishPrice(gc.menu, host.shop.stats, 1), "시식 보너스 값")
|
||
host:update(0.6 + Economy.EAT + 0.5)
|
||
eq(guestEvents[2] and guestEvents[2][1], "left", "다 먹고 일어남")
|
||
eq(guestEvents[2] and guestEvents[2][3].reason, "ate", "일어난 이유: 다 먹음")
|
||
eq(slots[2].refs.dynamic:FindFirstChild("GuestSeat"), nil, "손님 의자 치움")
|
||
-- 오래 기다리면 일어남
|
||
local gc2 = host:addGuest(444, guestChar)
|
||
check(gc2 ~= nil, "다시 손님으로 앉음")
|
||
host:update(0.6 + Economy.EAT + 1 + Economy.GUEST_WAIT + 0.5)
|
||
eq(guestEvents[#guestEvents][3].reason, "hungry", "너무 기다리면 일어남")
|
||
-- 주인이 나가면 손님도 일어남
|
||
check(host:addGuest(444, guestChar) ~= nil, "세 번째 앉음")
|
||
host:destroy()
|
||
eq(guestEvents[#guestEvents][3].reason, "closed", "가게가 닫히면 일어남")
|
||
guestChar:Destroy()
|
||
|
||
section("이웃 가게(NPC 가게)")
|
||
local Neighbor = require(Server.Neighbor)
|
||
local nb = Neighbor.open(slots[5], 0)
|
||
eq(slots[5].model:GetAttribute("Npc"), 5, "이웃 가게 속성")
|
||
eq(slots[5].model:GetAttribute("OwnerId"), nil, "이웃 가게엔 주인 없음")
|
||
eq(slots[5].model:GetAttribute("Level"), Neighbor.LEVELS[5], "이웃 가게 크기")
|
||
eq(slots[5].refs.stove:GetAttribute("OwnerId"), nil, "이웃 가게 조리대엔 버튼 없음")
|
||
check(slots[5].refs.dynamic:FindFirstChild("Keeper") ~= nil, "사장님 NPC")
|
||
eq(
|
||
Plots.nameText(slots[5].model, "ko"),
|
||
Locale.t("ko", "npcShop5") .. ` ⭐Lv.{Neighbor.LEVELS[5]}`,
|
||
"이웃 가게 이름판"
|
||
)
|
||
local nt = 0
|
||
while nt < 90 do
|
||
nt += 0.1
|
||
Neighbor.update(nb, nt)
|
||
end
|
||
print(`이웃 가게 90초: 서빙 {nb.controller.shop.served}회`)
|
||
check(nb.controller.shop.served >= 5, "이웃 가게가 스스로 서빙")
|
||
Neighbor.close(nb)
|
||
eq(slots[5].model:GetAttribute("Npc"), nil, "닫으면 속성 해제")
|
||
eq(#slots[5].refs.dynamic:GetChildren(), 0, "닫으면 가게 비움")
|
||
|
||
section("부지 글자·손님 버튼(클라이언트 모듈)")
|
||
local viewer = Instance.new("Folder")
|
||
viewer:SetAttribute("Lang", "en")
|
||
local nb2 = Neighbor.open(slots[6], 0)
|
||
local detach = Plots.attach(slots[6].model, viewer, 999, function() end)
|
||
local visitPrompt = slots[6].model.Base.VisitPoint:FindFirstChild("VisitPrompt") :: ProximityPrompt
|
||
check(visitPrompt ~= nil and visitPrompt.Enabled, "이웃 가게 입구에 손님 버튼")
|
||
eq(visitPrompt.ActionText, "Eat here as a customer", "손님 버튼 글자(영어)")
|
||
local boardLabel = slots[6].model.Base.NameBoard:FindFirstChildOfClass("SurfaceGui"):FindFirstChildOfClass("TextLabel")
|
||
check(string.find(boardLabel.Text, "Twigim King") ~= nil, `이름판 영어 ({boardLabel.Text})`)
|
||
viewer:SetAttribute("Lang", "ja")
|
||
check(string.find(boardLabel.Text, "天ぷら") ~= nil, `언어 바꾸면 이름판도 바뀜 ({boardLabel.Text})`)
|
||
Neighbor.close(nb2)
|
||
check(not visitPrompt.Enabled, "닫힌 가게엔 손님 버튼 없음")
|
||
slots[6].model:SetAttribute("OwnerId", 999)
|
||
check(not visitPrompt.Enabled, "내 가게엔 손님 버튼 없음")
|
||
slots[6].model:SetAttribute("OwnerId", nil)
|
||
detach()
|
||
|
||
section("마우스 회전 판단")
|
||
local MouseLook = require(StarterPlayer.StarterPlayerScripts.Client.MouseLook)
|
||
check(MouseLook.shouldLock(true, true, false, false), "켜짐 + 마우스 = 고정")
|
||
check(not MouseLook.shouldLock(false, true, false, false), "설정 끄면 안 고정")
|
||
check(not MouseLook.shouldLock(true, false, false, false), "마우스 없으면(모바일) 안 고정")
|
||
check(not MouseLook.shouldLock(true, true, true, false), "Ctrl 누르면 커서 풀림")
|
||
check(not MouseLook.shouldLock(true, true, false, true), "창 열리면 커서 풀림")
|
||
|
||
section("결제(ProfileStore Mock + Receipts)")
|
||
local ProfileStore = require(ServerScriptService.Vendor.ProfileStore)
|
||
local Receipts = require(Server.Receipts)
|
||
local store = ProfileStore.New("CloudTest", Data.TEMPLATE)
|
||
local prof = store.Mock:StartSessionAsync("Player_1")
|
||
check(prof ~= nil, "Mock 세션")
|
||
local grants = 0
|
||
local decision = Receipts.process(prof, "purchase-1", function()
|
||
grants += 1
|
||
prof.Data.Money += 100
|
||
return true
|
||
end)
|
||
eq(decision, "Granted", "첫 결제 지급")
|
||
local decision2 = Receipts.process(prof, "purchase-1", function()
|
||
grants += 1
|
||
return true
|
||
end)
|
||
eq(decision2, "Granted", "재시도 완료 응답")
|
||
eq(grants, 1, "한 번만 지급")
|
||
eq(prof.Data.Money, 100, "Mock 돈")
|
||
prof:EndSession()
|
||
|
||
section("실제 DataStore 세션")
|
||
local live = ProfileStore.New("CloudTest_v1", Data.TEMPLATE)
|
||
local lp = live:StartSessionAsync("Player_test", {
|
||
Cancel = function()
|
||
return false
|
||
end,
|
||
})
|
||
check(lp ~= nil, "실제 저장소 세션 시작")
|
||
if lp then
|
||
lp.Data.Money += 1
|
||
lp:Save()
|
||
lp:EndSession()
|
||
end
|
||
|
||
section("Game.processReceipt(플레이어 없음)")
|
||
local Game = require(Server.Game)
|
||
eq(
|
||
Game.processReceipt({ PlayerId = 1, PurchaseId = "x", ProductId = 1 }),
|
||
Enum.ProductPurchaseDecision.NotProcessedYet,
|
||
"플레이어가 없으면 나중에"
|
||
)
|
||
|
||
section("화면 UI(서버에서 생성)")
|
||
local Hud = require(StarterPlayer.StarterPlayerScripts.Client.Hud)
|
||
local state = Instance.new("Folder")
|
||
state:SetAttribute("Lang", "ko")
|
||
state:SetAttribute("Money", 25)
|
||
state:SetAttribute("Bought", 1)
|
||
state:SetAttribute("Tut", 3)
|
||
local sent = {}
|
||
local holder = Instance.new("Folder")
|
||
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, "다음: 김밥 해금", "다음 업그레이드")
|
||
check((root:FindFirstChild("Hint") :: Frame).Visible, "튜토리얼 안내 보임")
|
||
state:SetAttribute("Lang", "en")
|
||
eq(moneyText.Text, "💰 ₩25", "영어 돈 표시")
|
||
eq(nextTitle.Text, "Next: Unlock Gimbap", "영어 다음 업그레이드")
|
||
state:SetAttribute("Lang", "zh")
|
||
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", "설정 버튼 글자")
|
||
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", "마우스 회전 기본 켜짐")
|
||
state:SetAttribute("Sfx", false)
|
||
eq((settingsPanel:FindFirstChild("Sfx") :: TextButton).Text, "Off", "효과음 끔 표시")
|
||
check(not hud.menuOpen(), "창 닫힘")
|
||
state:SetAttribute("Bought", #Economy.PURCHASES)
|
||
check(not (root:FindFirstChild("Next"):FindFirstChild("Buy") :: TextButton).Visible, "다 사면 사기 버튼 숨김")
|
||
check(root:FindFirstChild("Dev") == nil, "개발자 버튼은 설정 창 안으로")
|
||
local devMoneyBtn = settingsPanel:FindFirstChild("devMoney") :: TextButton
|
||
check(not devMoneyBtn.Visible, "개발자 버튼은 기본으로 숨김")
|
||
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 설정됨)")
|
||
hud.notify("purchased", { item = "Table2" })
|
||
local toastText = root.Toasts:FindFirstChild("Toast"):FindFirstChild("Text") :: TextLabel
|
||
eq(toastText.Text, "Table 2 bought!", "구매 알림에 업그레이드 이름(내 언어)")
|
||
-- 휴대폰 배치(아이폰 15 가로, 상단 바·노치 뺀 영역): 루트가 화면을 채우고, 결제 버튼은 왼쪽 위, 마우스 줄 숨김
|
||
hud.setLayout(Vector2.new(750, 332), true)
|
||
local lay = hud.layout()
|
||
local scaleObj = root:FindFirstChildOfClass("UIScale") :: UIScale
|
||
check(
|
||
root.Size.X.Offset * scaleObj.Scale - 750 >= -1e-3 and root.Size.X.Offset * scaleObj.Scale - 750 < scaleObj.Scale,
|
||
"휴대폰: 루트 너비 = 화면"
|
||
)
|
||
check(
|
||
root.Size.Y.Offset * scaleObj.Scale - 332 >= -1e-3 and root.Size.Y.Offset * scaleObj.Scale - 332 < scaleObj.Scale,
|
||
"휴대폰: 루트 높이 = 화면"
|
||
)
|
||
eq(
|
||
(root:FindFirstChild("Double") :: TextButton).Position.Y.Offset,
|
||
lay.double.y,
|
||
"휴대폰: 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}`)
|
||
hud.setLayout(Vector2.new(1366, 710), false)
|
||
check((settingsPanel:FindFirstChild("MouseLook") :: TextButton).Visible, "PC: 마우스 회전 줄 보임")
|
||
check(math.abs(scaleObj.Scale - math.min(1366 / 1100, 710 / 620)) < 1e-6, "PC: 배율(상단 바 뺀 높이 기준)")
|
||
hud.destroy()
|
||
|
||
section("조리 버튼(클라이언트 모듈)")
|
||
local Stove = require(StarterPlayer.StarterPlayerScripts.Client.Stove)
|
||
local stove = slots[3].refs.stove
|
||
local pstate = Instance.new("Folder")
|
||
pstate:SetAttribute("Lang", "ko")
|
||
local prompt = Stove.attach(stove, pstate, function() end)
|
||
check(not prompt.Enabled, "주문 없으면 버튼 꺼짐")
|
||
stove:SetAttribute("CookMenu", "Gimbap")
|
||
stove:SetAttribute("CookTime", 1.5)
|
||
check(prompt.Enabled, "주문 있으면 버튼 켜짐")
|
||
eq(prompt.ActionText, "🍙 김밥 만들기", "버튼 글자")
|
||
eq(prompt.HoldDuration, 1.5, "누르는 시간")
|
||
prompt:Destroy()
|
||
|
||
section("효과음(직접 만든 오디오 에셋)")
|
||
local Sounds = require(ReplicatedStorage.Shared.Sounds)
|
||
for name, id in Sounds do
|
||
local num = tonumber(string.match(id, "%d+"))
|
||
local okInfo, info = pcall(function()
|
||
return game:GetService("MarketplaceService"):GetProductInfoAsync(num :: number, Enum.InfoType.Asset)
|
||
end)
|
||
check(okInfo, `효과음 {name} 정보 조회`)
|
||
if okInfo then
|
||
eq(info.AssetTypeId, 3, `효과음 {name}은 오디오`)
|
||
eq(info.Creator.CreatorTargetId, game.CreatorId, `효과음 {name}은 게임 주인 소유`)
|
||
end
|
||
end
|
||
|
||
section("Products")
|
||
local Products = require(ReplicatedStorage.Shared.Products)
|
||
local MarketplaceService = game:GetService("MarketplaceService")
|
||
if Products.DOUBLE_MONEY_PASS ~= 0 then
|
||
local info = MarketplaceService:GetProductInfoAsync(Products.DOUBLE_MONEY_PASS, Enum.InfoType.GamePass)
|
||
print("게임패스", info.Name, info.PriceInRobux, info.IsForSale)
|
||
check(info.IsForSale, "2배 수익 판매 중")
|
||
end
|
||
if Products.MONEY_BOOST_PRODUCT ~= 0 then
|
||
local info = MarketplaceService:GetProductInfoAsync(Products.MONEY_BOOST_PRODUCT, Enum.InfoType.Product)
|
||
print("개발자 상품", info.Name, info.PriceInRobux)
|
||
check(info.PriceInRobux ~= nil, "돈 부스트 가격")
|
||
end
|
||
|
||
c:destroy()
|
||
|
||
section("Game.start(실제 서버 시작 순서)")
|
||
local okStart, errStart = pcall(Game.start)
|
||
check(okStart, `Game.start 오류 없음 ({errStart})`)
|
||
task.wait(1)
|
||
eq(#workspace.BunsikWorld.Plots:GetChildren(), 6, "시작 후 부지 6칸")
|
||
for _, plot in workspace.BunsikWorld.Plots:GetChildren() do
|
||
check(plot:GetAttribute("Npc") ~= nil, `{plot.Name}: 빈 부지에 이웃 가게`)
|
||
end
|
||
task.wait(3)
|
||
local npcCustomers = 0
|
||
for _, d in workspace.BunsikWorld.Plots:GetDescendants() do
|
||
if d.Name == "Customer" then
|
||
npcCustomers += 1
|
||
end
|
||
end
|
||
print("이웃 가게 손님 수", npcCustomers)
|
||
check(npcCustomers > 0, "이웃 가게에 손님이 옴(실제 Heartbeat)")
|
||
|
||
print(`통합 테스트: {count - #failures}/{count} 통과`)
|
||
if #failures > 0 then
|
||
error(`{#failures} failed: ` .. table.concat(failures, " | "))
|
||
end
|
||
return { passed = count }
|