- PlotController.startCook/finishCook: 고른 메뉴 일치, 주문·손 자리, 조리대 거리, Recipes.minTime 확인 - 원격 이벤트만 보내 조리 과정을 건너뛰면 거절(통합 테스트 추가), 쓰지 않게 된 lastCook 제거 - 통합 테스트 822/822, Recipes.spec 101 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
791 lines
35 KiB
Lua
791 lines
35 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 Icons = require(ReplicatedStorage.Shared.Icons)
|
|
local Locale = require(ReplicatedStorage.Shared.Locale)
|
|
local Recipes = require(ReplicatedStorage.Shared.Recipes)
|
|
|
|
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
|
|
local bubble = ch:FindFirstChild("Order", true)
|
|
check(bubble ~= nil, "손님 주문 말풍선")
|
|
local icon = bubble and bubble:FindFirstChild("Icon", true) :: ImageLabel?
|
|
eq(icon and icon.ImageRectOffset, Icons.OFFSET.Tteokbokki, "말풍선에 떡볶이 그림")
|
|
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(owner:GetAttribute("Orders"), "Tteokbokki=1", "요리 창에 보여 줄 주문 수")
|
|
eq(c:cook("Gimbap"), nil, "주문 없는 메뉴(김밥)는 못 만듦")
|
|
-- 요리 창 세션: 원격 이벤트만 보내 조리 과정을 건너뛰지 못함
|
|
eq(c:finishCook("Tteokbokki", 10), nil, "메뉴를 고르지 않고 완성만 보내면 거절")
|
|
eq(c:startCook("Gimbap", 10), false, "주문 없는 메뉴로는 시작 못 함")
|
|
check(c:startCook("Tteokbokki", 10), "주문 있는 메뉴로 시작")
|
|
eq(c:finishCook("Gimbap", 20), nil, "고른 메뉴와 다른 메뉴로 완성하면 거절")
|
|
check(c:startCook("Tteokbokki", 10), "다시 시작")
|
|
local minT = Recipes.minTime("Tteokbokki", c.shop.stats.cook)
|
|
eq(c:finishCook("Tteokbokki", 10 + minT * 0.5), nil, `조리 과정 최소 시간({minT}초)보다 빠르면 거절`)
|
|
eq(c:finishCook("Tteokbokki", 10 + minT), nil, "거절된 세션은 다시 못 씀")
|
|
eq(owner:GetAttribute("Carry"), 0, "거절되면 접시 없음")
|
|
-- (가상 시계를 3초에 맞춰 끝냅니다. 뒤의 식사 시간 검사가 3초 기준)
|
|
check(c:startCook("Tteokbokki", 3 - Recipes.expectedTime("Tteokbokki", c.shop.stats.cook)), "다시 시작")
|
|
eq(c:finishCook("Tteokbokki", 3), "Tteokbokki", "정상 시간이면 조리")
|
|
eq(owner:GetAttribute("Hand"), "Tteokbokki", "손에 든 접시 종류")
|
|
eq(owner:GetAttribute("Orders"), "", "주문이 다 채워짐")
|
|
eq(owner:GetAttribute("Tut"), 2, "튜토리얼 2단계")
|
|
eq(owner:GetAttribute("Carry"), 1, "접시 1개 듦")
|
|
eq(slots[1].refs.stove:GetAttribute("CookMenu"), "", "더 만들 것 없음")
|
|
eq(c:serve(1), 15, "서빙 15원")
|
|
eq(owner:GetAttribute("Money"), 15, "돈 15")
|
|
eq(data.Money, 15, "세이브 데이터 돈 15")
|
|
local served1 = dyn:FindFirstChild("Customer"):FindFirstChild("Order", true)
|
|
eq(
|
|
served1 and (served1:FindFirstChild("Icon", true) :: ImageLabel).ImageRectOffset,
|
|
Icons.OFFSET.heart,
|
|
"받은 손님 말풍선은 하트"
|
|
)
|
|
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 function label(o: Instance?): string?
|
|
local t = o and o:FindFirstChild("Label", true) :: TextLabel?
|
|
return t and t.Text
|
|
end
|
|
local moneyText = root:FindFirstChild("Money"):FindFirstChild("Text", true) :: TextLabel
|
|
eq(moneyText.Text, "25", "돈 표시(숫자만, 동전 그림 옆)")
|
|
local nextCard = root:FindFirstChild("Next") :: Frame
|
|
local nextTitle = nextCard:FindFirstChild("Title", true) :: TextLabel
|
|
eq(nextTitle.Text, "김밥 해금", "다음 업그레이드")
|
|
local nextIcon = nextCard:FindFirstChild("IconBox", true):FindFirstChild("Icon") :: ImageLabel
|
|
eq(nextIcon.Image, Icons.ASSET, "다음 업그레이드 아이콘 그림")
|
|
eq(nextIcon.ImageRectOffset, Icons.OFFSET.Gimbap, "김밥 해금 아이콘")
|
|
eq((nextCard:FindFirstChild("Cost", true) :: TextLabel).Text, "25 / 40", "진행 막대 글자")
|
|
local hintFrame = root:FindFirstChild("Hint") :: Frame
|
|
check(hintFrame.Visible, "튜토리얼 말풍선 보임")
|
|
check(hintFrame:FindFirstChild("Mascot") ~= nil, "말풍선에 마스코트")
|
|
check((nextCard:FindFirstChild("Pointer") :: ImageLabel).Visible, "튜토리얼 3: [사기] 가리키는 손")
|
|
local buyBtn = nextCard:FindFirstChild("Buy") :: TextButton
|
|
eq(label(buyBtn), "사기", "사기 버튼 글자")
|
|
local Theme = require(StarterPlayer.StarterPlayerScripts.Client.Theme)
|
|
eq(
|
|
(buyBtn:FindFirstChild("Base") :: Frame).BackgroundColor3,
|
|
Theme.darken(Theme.GRAY, 0.3),
|
|
"돈이 모자라면 회색"
|
|
)
|
|
local listButton = root:FindFirstChild("ListButton") :: TextButton
|
|
eq(label(listButton), "상점", "상점 버튼 글자(짧게)")
|
|
check(not (listButton:FindFirstChild("Badge") :: Frame).Visible, "돈이 모자라면 상점 배지 없음")
|
|
state:SetAttribute("Money", 60)
|
|
eq((buyBtn:FindFirstChild("Base") :: Frame).BackgroundColor3, Theme.darken(Theme.MINT, 0.3), "살 수 있으면 초록")
|
|
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
|
|
for _, d in Icons.KITCHEN do
|
|
check(d.X % 256 == 0 and d.Y % 256 == 0 and d.X < 1024 and d.Y < 1024, "요리 그림 칸 위치")
|
|
end
|
|
-- 손에 든 접시
|
|
local carryFrame = root:FindFirstChild("Carry") :: Frame
|
|
check(not carryFrame.Visible, "빈손이면 접시 표시 숨김")
|
|
state:SetAttribute("Carry", 1)
|
|
state:SetAttribute("Hand", "Tteokbokki")
|
|
check(carryFrame.Visible, "접시를 들면 표시")
|
|
eq((carryFrame:FindFirstChild("Slot1") :: ImageLabel).ImageRectOffset, Icons.OFFSET.Tteokbokki, "든 음식 그림")
|
|
state:SetAttribute("Carry", 0)
|
|
state:SetAttribute("Hand", "")
|
|
state:SetAttribute("Lang", "en")
|
|
eq(moneyText.Text, "60", "영어 돈 표시")
|
|
eq(nextTitle.Text, "Unlock Gimbap", "영어 다음 업그레이드")
|
|
state:SetAttribute("Lang", "zh")
|
|
eq(nextTitle.Text, "解锁紫菜包饭", "중국어 다음 업그레이드")
|
|
state:SetAttribute("Lang", "en")
|
|
local settingsBtn = root:FindFirstChild("Settings") :: TextButton
|
|
check(settingsBtn ~= nil, "오른쪽 위 설정 버튼")
|
|
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(label(settingsPanel:FindFirstChild("Lang_ja")), "日本語", "언어 이름은 그 나라 말")
|
|
eq(label(settingsPanel:FindFirstChild("MouseLook")), "On", "마우스 회전 기본 켜짐")
|
|
state:SetAttribute("Sfx", false)
|
|
eq(label(settingsPanel:FindFirstChild("Sfx")), "Off", "효과음 끔 표시")
|
|
check(not hud.menuOpen(), "창 닫힘")
|
|
hud.open("shop")
|
|
check(hud.menuOpen() and (root:FindFirstChild("Panel") :: Frame).Visible, "상점 창 열기")
|
|
check((root:FindFirstChild("Dim") :: TextButton).Visible, "창 뒤 어둡게")
|
|
local cardsFrame = root:FindFirstChild("Panel"):FindFirstChild("Cards", true) :: Frame
|
|
local n1 = 0
|
|
for _, ch in cardsFrame:GetChildren() do
|
|
if ch.Name:sub(1, 3) == "Row" then
|
|
n1 += 1
|
|
end
|
|
end
|
|
eq(n1, 10, "상점: 지금 단계 10개가 한 화면에(넘기지 않음)")
|
|
check(
|
|
cardsFrame:FindFirstChild("Row2"):FindFirstChild("BuyRow") ~= nil,
|
|
"상점의 다음 업그레이드에 사기 버튼"
|
|
)
|
|
check(cardsFrame:FindFirstChild("Row1"):FindFirstChild("Done", true) ~= nil, "산 업그레이드는 체크 표시")
|
|
check(cardsFrame:FindFirstChild("Row5"):FindFirstChild("Lock", true) ~= 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") :: TextButton).Visible, "창 닫기")
|
|
state:SetAttribute("Bought", #Economy.PURCHASES)
|
|
check(not buyBtn.Visible, "다 사면 사기 버튼 숨김")
|
|
check(not (root:FindFirstChild("Boost") :: TextButton).Visible, "다 사면 돈 부스트 숨김")
|
|
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, "개발자 줄만큼 설정 창이 길어짐")
|
|
local doubleBtn = root:FindFirstChild("Double") :: TextButton
|
|
check(doubleBtn.Visible, "2배 수익 버튼(상품 ID 설정됨)")
|
|
eq(label(doubleBtn), "2x Cash", "2배 수익 버튼 글자")
|
|
state:SetAttribute("Double", true)
|
|
eq(label(doubleBtn), "Active", "2배 수익 산 뒤")
|
|
check((doubleBtn:FindFirstChild("Owned") :: ImageLabel).Visible, "2배 수익 산 뒤 체크")
|
|
hud.notify("purchased", { item = "Table2" })
|
|
local toastText = root.Toasts:FindFirstChild("Toast"):FindFirstChild("Text") :: TextLabel
|
|
eq(toastText.Text, "Table 2 bought!", "구매 알림에 업그레이드 이름(내 언어)")
|
|
eq(
|
|
(root.Toasts:FindFirstChild("Toast"):FindFirstChild("Icon") :: ImageLabel).ImageRectOffset,
|
|
Icons.OFFSET.check,
|
|
"구매 알림 아이콘"
|
|
)
|
|
for _ = 1, 5 do
|
|
hud.notify("purchased", { item = "Table2" })
|
|
end
|
|
local toastCount = 0
|
|
for _, ch in root.Toasts:GetChildren() do
|
|
if ch:IsA("Frame") then
|
|
toastCount += 1
|
|
end
|
|
end
|
|
check(toastCount <= 3, `알림은 3개까지만 쌓임 ({toastCount})`)
|
|
-- 휴대폰 배치(아이폰 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(
|
|
doubleBtn.Position.Y.Offset,
|
|
lay.double.y + lay.double.h / 2,
|
|
"휴대폰: 2배 수익 버튼 위치(가운데 기준)"
|
|
)
|
|
eq(doubleBtn.Size.Y.Offset, lay.double.h, "휴대폰: 2배 수익 버튼 크기")
|
|
check(lay.double.y + lay.double.h < lay.height / 3, "휴대폰: 결제 버튼은 조이스틱 자리 위")
|
|
check(not (settingsPanel:FindFirstChild("MouseLook") :: TextButton).Visible, "휴대폰: 마우스 회전 줄 숨김")
|
|
check(scaleObj.Scale > 0.8, `휴대폰: 글자 배율 {scaleObj.Scale}`)
|
|
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 kstate = Instance.new("Folder")
|
|
kstate:SetAttribute("Lang", "ko")
|
|
kstate:SetAttribute("Money", 0)
|
|
kstate:SetAttribute("Bought", 6) -- 떡볶이·김밥·순대 해금
|
|
kstate:SetAttribute("Tut", 1)
|
|
kstate:SetAttribute("Orders", "Gimbap=2")
|
|
local ksent = {}
|
|
local khud = Hud.build(Instance.new("Folder"), kstate, function(kind, arg)
|
|
table.insert(ksent, { kind, arg })
|
|
end)
|
|
local kroot = khud.gui:FindFirstChild("Root") :: Frame
|
|
local kitchen = khud.kitchen
|
|
local kframe = kroot:FindFirstChild("Kitchen") :: Frame
|
|
check(not kframe.Visible, "요리 창은 처음엔 닫힘")
|
|
khud.open("kitchen")
|
|
check(kframe.Visible and kitchen.isOpen() and khud.menuOpen(), "요리 창 열림(커서 풀림)")
|
|
check((kroot:FindFirstChild("Dim") :: TextButton).Visible, "요리 창 뒤 어둡게")
|
|
local menuPage = kframe:FindFirstChild("MenuPage", true) :: Frame
|
|
check(menuPage.Visible, "처음엔 메뉴 고르기")
|
|
local function menuCard(m: string): Frame
|
|
return menuPage:FindFirstChild("Menu_" .. m, true) :: Frame
|
|
end
|
|
for _, m in Economy.MENU_ORDER do
|
|
check(menuCard(m) ~= nil, `메뉴 카드 {m}`)
|
|
end
|
|
check((menuCard("Gimbap"):FindFirstChild("Orders", true) :: Frame).Visible, "주문 있는 김밥에 손님 표시")
|
|
eq((menuCard("Gimbap"):FindFirstChild("Orders", true):FindFirstChild("Text") :: TextLabel).Text, "x2", "주문 수 2")
|
|
check(
|
|
not (menuCard("Tteokbokki"):FindFirstChild("Orders", true) :: Frame).Visible,
|
|
"주문 없는 떡볶이는 표시 없음"
|
|
)
|
|
check((menuCard("Eomuk"):FindFirstChild("Lock", true) :: ImageLabel).Visible, "안 산 어묵은 자물쇠")
|
|
check(not (menuCard("Sundae"):FindFirstChild("Lock", true) :: ImageLabel).Visible, "산 순대는 자물쇠 없음")
|
|
check(
|
|
(menuPage:FindFirstChild("Pointer") or menuCard("Gimbap"):FindFirstChild("Pointer", true)) ~= nil,
|
|
"튜토리얼 손가락"
|
|
)
|
|
eq(kitchen.choose("Tteokbokki"), false, "주문 없는 메뉴는 못 고름")
|
|
eq(kitchen.choose("Eomuk"), false, "안 산 메뉴는 못 고름")
|
|
eq(kitchen.choose("Gimbap"), true, "김밥 고름")
|
|
local cookPage = kframe:FindFirstChild("CookPage", true) :: Frame
|
|
check(cookPage.Visible and not menuPage.Visible, "조리 화면으로")
|
|
eq((cookPage:FindFirstChild("Instruction") :: TextLabel).Text, "김 위에 재료를 올려요", "1단계 안내")
|
|
check(
|
|
(cookPage:FindFirstChild("Base", true) :: ImageLabel).Image == Icons.KITCHEN_ASSET,
|
|
"조리 도구 그림(도마)"
|
|
)
|
|
eq((cookPage:FindFirstChild("Base", true) :: ImageLabel).ImageRectOffset, Icons.KITCHEN.board, "김밥은 도마")
|
|
local flowK = kitchen.flow()
|
|
local need1 = flowK.need
|
|
eq((cookPage:FindFirstChild("Gesture") :: TextLabel).Text, `톡톡! {need1}번`, "톡톡 남은 횟수")
|
|
eq(kitchen.input("hold", 1), nil, "다른 동작은 무시")
|
|
eq(kitchen.input("tap", 1), "progress", "톡 1")
|
|
eq((cookPage:FindFirstChild("Gesture") :: TextLabel).Text, `톡톡! {need1 - 1}번`, "남은 횟수 줄어듦")
|
|
local strip1 = cookPage:FindFirstChild("Strip1", true) :: Frame
|
|
check(strip1 ~= nil and strip1.Visible, "누를 때마다 재료가 올라감")
|
|
for _ = 2, need1 do
|
|
kitchen.input("tap", 1)
|
|
end
|
|
eq(flowK.step, 2, "2단계(말기)")
|
|
eq((cookPage:FindFirstChild("Instruction") :: TextLabel).Text, "돌돌 말아요", "2단계 안내")
|
|
eq((cookPage:FindFirstChild("Gesture") :: TextLabel).Text, "문질문질!", "문지르기 안내")
|
|
eq(kitchen.input("rub", flowK.need), "step", "다 문지름 → 3단계")
|
|
check((cookPage:FindFirstChild("Roll", true) :: ImageLabel).Visible, "김밥이 말림")
|
|
eq(#ksent, 1, "완성 전에는 시작만 보냄")
|
|
eq(kitchen.input("tap", flowK.need), "done", "썰기 끝 → 완성")
|
|
eq(ksent[1] and ksent[1][1], "cookStart", "메뉴를 고르면 서버에 cookStart")
|
|
eq(ksent[1] and ksent[1][2], "Gimbap", "고른 메뉴로 시작")
|
|
eq(ksent[2] and ksent[2][1], "cook", "다 만들면 서버에 cook")
|
|
eq(ksent[2] and ksent[2][2], "Gimbap", "고른 메뉴를 보냄")
|
|
local donePage = kframe:FindFirstChild("DonePage", true) :: Frame
|
|
check(donePage.Visible, "완성 화면")
|
|
eq((donePage:FindFirstChild("Dish") :: ImageLabel).ImageRectOffset, Icons.OFFSET.Gimbap, "완성 접시 그림")
|
|
-- 주문이 남아 있고 손에 자리가 있으면 다시 메뉴 고르기, 아니면 닫힘
|
|
kstate:SetAttribute("Orders", "Gimbap=1")
|
|
kstate:SetAttribute("Carry", 0)
|
|
task.wait(1.5)
|
|
check(kitchen.isOpen() and menuPage.Visible, "주문이 남으면 다음 접시 고르기")
|
|
kitchen.choose("Gimbap")
|
|
for _ = 1, 20 do
|
|
local st = Recipes.current(kitchen.flow())
|
|
if not st then
|
|
break
|
|
end
|
|
kitchen.input(st.kind, kitchen.flow().need)
|
|
end
|
|
kstate:SetAttribute("Carry", 1) -- 손이 꽉 참(쟁반 없음)
|
|
kstate:SetAttribute("Orders", "")
|
|
task.wait(1.5)
|
|
check(not kitchen.isOpen() and not kframe.Visible, "더 만들 것이 없으면 창이 닫힘")
|
|
check(not (kroot:FindFirstChild("Dim") :: TextButton).Visible, "닫히면 어둡게도 꺼짐")
|
|
-- 메뉴마다 과정이 다르고 끝까지 갈 수 있음
|
|
for _, m in Economy.MENU_ORDER do
|
|
kstate:SetAttribute("Bought", 20)
|
|
kstate:SetAttribute("Carry", 0)
|
|
kstate:SetAttribute("Orders", `{m}=1`)
|
|
khud.open("kitchen")
|
|
check(kitchen.choose(m), `{m} 고름`)
|
|
eq(
|
|
(cookPage:FindFirstChild("Base", true) :: ImageLabel).ImageRectOffset,
|
|
Icons.KITCHEN[Recipes.LIST[m].stage],
|
|
`{m} 조리 도구 그림`
|
|
)
|
|
local guard = 0
|
|
while kitchen.flow().phase == "cook" and guard < 10 do
|
|
local st = Recipes.current(kitchen.flow()) :: Recipes.Step
|
|
check(
|
|
Icons.OFFSET[({ roll = "mat", fire = "flame", skewer = "Eomuk" } :: any)[st.tool] or st.tool] ~= nil,
|
|
`{m} 도구 그림 {st.tool}`
|
|
)
|
|
kitchen.input(st.kind, kitchen.flow().need)
|
|
guard += 1
|
|
end
|
|
eq(kitchen.flow().phase, "done", `{m} 완성`)
|
|
eq(ksent[#ksent][1], "cook", `{m} 완성 보냄`)
|
|
eq(ksent[#ksent][2], m, `{m} 서버에 보냄`)
|
|
eq(ksent[#ksent - 1][1], "cookStart", `{m} 시작 보냄`)
|
|
khud.open(nil)
|
|
check(not kitchen.isOpen(), `{m} 창 닫기`)
|
|
end
|
|
-- 요리 창은 화면 안에(휴대폰)
|
|
khud.setLayout(Vector2.new(667, 317), true)
|
|
local kl = khud.layout().kitchen
|
|
check(kl.x >= 0 and kl.y >= 0 and kl.x + kl.w <= khud.layout().width + 1e-6, "휴대폰: 요리 창 화면 안")
|
|
khud.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")
|
|
check(prompt.Enabled, "주문 있으면 버튼 켜짐")
|
|
eq(prompt.ActionText, "요리하기", "버튼 글자")
|
|
eq(prompt.HoldDuration, 0, "누르면 바로 요리 창(꾹 누르지 않음)")
|
|
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("UI 그림(직접 그린 이미지 에셋)")
|
|
for _, asset in { Icons.ASSET, Icons.KITCHEN_ASSET } do
|
|
local num = tonumber(string.match(asset, "%d+"))
|
|
local okInfo, info = pcall(function()
|
|
return game:GetService("MarketplaceService"):GetProductInfoAsync(num :: number, Enum.InfoType.Asset)
|
|
end)
|
|
check(okInfo, `그림 {num} 정보 조회`)
|
|
if okInfo then
|
|
eq(info.AssetTypeId, 1, `그림 {num}은 이미지`)
|
|
eq(info.Creator.CreatorTargetId, game.CreatorId, `그림 {num}은 게임 주인 소유`)
|
|
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 }
|