feat(bunsik): 메뉴별 요리 창(메뉴 고르기→2~3단계 조리→완성) + 어린이용 화면 UI 새 디자인
- 요리: 조리대 버튼 → 요리 창. 주문 있는 메뉴만 고름(서버도 검사), 메뉴마다 다른 단계 (톡톡/꾹/문지르기, 실패 없음), 화구 업그레이드로 누르는 양 감소. Recipes(순수 로직)+Kitchen(화면) - 서버: cook에 메뉴 인자, 조리대 거리 검사, Orders/Hand 속성, 주문 말풍선을 그림으로(받으면 하트) - 경제: 한 접시에 손이 더 가므로 떡볶이·김밥·순대 15·25·40원, 시뮬레이터가 요리 창 시간 반영(확장 9:47) - UI: 사탕색 테마(흰 바탕·같은 계열 테두리·숫자는 Fredoka), 버튼 묶음 정리, 상점 5x2 카드, 마스코트 떡이 튜토리얼 말풍선, 손에 든 음식 표시, 알림 3개 제한, 움직임은 살 수 있는 것에만 - 그림: 요리 재료·도구 33칸 추가(ui_icons v2), 조리 도구·마스코트 큰 그림(kitchen.png), 톡톡 효과음 - 검사: 단위 테스트(Recipes 71, Layout 1642 등) + 로블록스 서버 통합 테스트 801/801 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -60,9 +60,9 @@ Economy.START = {
|
||||
}
|
||||
|
||||
Economy.MENUS = {
|
||||
Tteokbokki = { price = 10, icon = "🌶️" },
|
||||
Gimbap = { price = 20, icon = "🍙" },
|
||||
Sundae = { price = 35, icon = "🌭" },
|
||||
Tteokbokki = { price = 15, icon = "🌶️" },
|
||||
Gimbap = { price = 25, icon = "🍙" },
|
||||
Sundae = { price = 40, icon = "🌭" },
|
||||
Eomuk = { price = 50, icon = "🍢" },
|
||||
Twigim = { price = 70, icon = "🍤" },
|
||||
} :: { [string]: Menu }
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
--!strict
|
||||
-- 화면 UI 아이콘. 그림 한 장(art/ui_icons.png, tools/icons.py로 직접 그림)을 128px 칸으로 잘라 씁니다.
|
||||
-- 칸 순서를 바꾸면 tools/icons.py --luau 출력으로 아래 표를 다시 맞추고, 그림을 새로 올려 ASSET을 바꿉니다.
|
||||
-- 화면 UI 그림. 직접 그린 그림 두 장을 칸으로 잘라 씁니다.
|
||||
-- ASSET(art/ui_icons.png, tools/icons.py): 128px 칸 8x8. 버튼 아이콘, 메뉴, 요리 재료·도구
|
||||
-- KITCHEN_ASSET(art/kitchen.png, tools/kitchen_art.py): 256px 칸 4x4. 조리 도구(팬·도마·찜기·냄비·튀김기), 마스코트 떡이
|
||||
-- 칸 순서를 바꾸면 각 도구의 --luau 출력으로 아래 표를 다시 맞추고, 그림을 새로 올려(tools/cloud.py image) ID를 바꿉니다.
|
||||
|
||||
local Icons = {}
|
||||
|
||||
Icons.ASSET = "rbxassetid://89649261251254"
|
||||
Icons.ASSET = "rbxassetid://111384470366371"
|
||||
Icons.CELL = Vector2.new(128, 128)
|
||||
Icons.KITCHEN_ASSET = "rbxassetid://118704012792360"
|
||||
Icons.KITCHEN_CELL = Vector2.new(256, 256)
|
||||
|
||||
Icons.OFFSET = {
|
||||
coin = Vector2.new(0, 0),
|
||||
@@ -40,6 +44,44 @@ Icons.OFFSET = {
|
||||
arrowDown = Vector2.new(640, 384),
|
||||
scroll = Vector2.new(768, 384),
|
||||
hand = Vector2.new(896, 384),
|
||||
riceCake = Vector2.new(0, 512),
|
||||
riceCakeRed = Vector2.new(128, 512),
|
||||
riceCakes = Vector2.new(256, 512),
|
||||
sauceBowl = Vector2.new(384, 512),
|
||||
sauceBlob = Vector2.new(512, 512),
|
||||
spatula = Vector2.new(640, 512),
|
||||
bubble = Vector2.new(768, 512),
|
||||
steam = Vector2.new(896, 512),
|
||||
fillings = Vector2.new(0, 640),
|
||||
mat = Vector2.new(128, 640),
|
||||
knife = Vector2.new(256, 640),
|
||||
gimbapSlice = Vector2.new(384, 640),
|
||||
sundaeRaw = Vector2.new(512, 640),
|
||||
sundaePiece = Vector2.new(640, 640),
|
||||
sundaeSlice = Vector2.new(768, 640),
|
||||
fishCake = Vector2.new(896, 640),
|
||||
batter = Vector2.new(0, 768),
|
||||
shrimpRaw = Vector2.new(128, 768),
|
||||
shrimpBatter = Vector2.new(256, 768),
|
||||
tongs = Vector2.new(384, 768),
|
||||
customer = Vector2.new(512, 768),
|
||||
mascot = Vector2.new(640, 768),
|
||||
heart = Vector2.new(768, 768),
|
||||
cart = Vector2.new(896, 768),
|
||||
pot = Vector2.new(0, 896),
|
||||
} :: { [string]: Vector2 }
|
||||
|
||||
Icons.KITCHEN = {
|
||||
pan = Vector2.new(0, 0),
|
||||
board = Vector2.new(256, 0),
|
||||
steamer = Vector2.new(512, 0),
|
||||
pot = Vector2.new(768, 0),
|
||||
fryer = Vector2.new(0, 256),
|
||||
mascot = Vector2.new(256, 256),
|
||||
mascotCheer = Vector2.new(512, 256),
|
||||
gimbapRoll = Vector2.new(768, 256),
|
||||
plateBig = Vector2.new(0, 512),
|
||||
burst = Vector2.new(256, 512),
|
||||
} :: { [string]: Vector2 }
|
||||
|
||||
-- ImageLabel/ImageButton에 아이콘을 씌웁니다.
|
||||
@@ -49,4 +91,11 @@ function Icons.apply(image: ImageLabel, name: string)
|
||||
image.ImageRectSize = Icons.CELL
|
||||
end
|
||||
|
||||
-- 큰 요리 그림(조리 도구, 마스코트)
|
||||
function Icons.applyKitchen(image: ImageLabel, name: string)
|
||||
image.Image = Icons.KITCHEN_ASSET
|
||||
image.ImageRectOffset = Icons.KITCHEN[name] or Vector2.zero
|
||||
image.ImageRectSize = Icons.KITCHEN_CELL
|
||||
end
|
||||
|
||||
return Icons
|
||||
|
||||
@@ -20,11 +20,34 @@ local STRINGS: { [string]: { [string]: string } } = {
|
||||
nextUp = "다음 업그레이드",
|
||||
doubleOn = "적용 중",
|
||||
close = "닫기",
|
||||
cookAction = "{menu} 만들기",
|
||||
cookAction = "요리하기",
|
||||
cook_Twigim_3 = "집게로 건져요",
|
||||
cook_Twigim_2 = "기름에 바삭하게 튀겨요",
|
||||
cook_Twigim_1 = "새우에 튀김옷을 입혀요",
|
||||
cook_Eomuk_2 = "국물에 퐁당 담가요",
|
||||
cook_Eomuk_1 = "어묵을 꼬치에 끼워요",
|
||||
cook_Sundae_3 = "먹기 좋게 썰어요",
|
||||
cook_Sundae_2 = "김이 나게 푹 쪄요",
|
||||
cook_Sundae_1 = "순대를 찜기에 넣어요",
|
||||
cook_Gimbap_3 = "송송 썰어요",
|
||||
cook_Gimbap_2 = "돌돌 말아요",
|
||||
cook_Gimbap_1 = "김 위에 재료를 올려요",
|
||||
cook_Tteokbokki_3 = "주걱으로 휘휘 저어요",
|
||||
cook_Tteokbokki_2 = "빨간 양념을 부어요",
|
||||
cook_Tteokbokki_1 = "떡을 팬에 넣어요",
|
||||
gestureRub = "문질문질!",
|
||||
gestureHold = "꾹 누르고 있기",
|
||||
gestureTap = "톡톡! {n}번",
|
||||
cookDone = "완성!",
|
||||
chooseMenu = "무엇을 만들까요? 손님이 주문한 걸 골라요!",
|
||||
cookTitle = "요리하기",
|
||||
btnBoost = "부스트",
|
||||
btnDouble = "2배 돈",
|
||||
btnShop = "상점",
|
||||
cookWait = "손님 기다리는 중",
|
||||
cookHandFull = "손이 꽉 찼어요",
|
||||
cookHandFull = "손이 꽉 찼어요! 먼저 손님에게 가져다줘요",
|
||||
stoveObject = "조리대",
|
||||
tut1 = "손님이 왔어요! 빛나는 조리대로 가서 버튼을 꾹 누르세요",
|
||||
tut1 = "손님이 왔어요! 빛나는 조리대로 가서 요리를 시작해요",
|
||||
tut2 = "다 만들었어요! 접시를 손님 자리로 가져가세요",
|
||||
tut3 = "돈을 벌었어요! 아래 [사기] 버튼으로 테이블을 사세요",
|
||||
tutDone = "잘했어요! 계속 손님을 받고 가게를 키워 보세요",
|
||||
@@ -111,11 +134,34 @@ local STRINGS: { [string]: { [string]: string } } = {
|
||||
nextUp = "Next Upgrade",
|
||||
doubleOn = "Active",
|
||||
close = "Close",
|
||||
cookAction = "Cook {menu}",
|
||||
cookAction = "Cook",
|
||||
cook_Twigim_3 = "Pick it up with the tongs",
|
||||
cook_Twigim_2 = "Fry it until crispy",
|
||||
cook_Twigim_1 = "Coat the shrimp in batter",
|
||||
cook_Eomuk_2 = "Dip it in the hot soup",
|
||||
cook_Eomuk_1 = "Put the fish cake on the skewer",
|
||||
cook_Sundae_3 = "Slice it up",
|
||||
cook_Sundae_2 = "Steam it nice and hot",
|
||||
cook_Sundae_1 = "Put the sundae in the steamer",
|
||||
cook_Gimbap_3 = "Slice it",
|
||||
cook_Gimbap_2 = "Roll it up",
|
||||
cook_Gimbap_1 = "Put fillings on the seaweed",
|
||||
cook_Tteokbokki_3 = "Stir it with the spatula",
|
||||
cook_Tteokbokki_2 = "Pour in the red sauce",
|
||||
cook_Tteokbokki_1 = "Put the rice cakes in the pan",
|
||||
gestureRub = "Rub rub!",
|
||||
gestureHold = "Press and hold",
|
||||
gestureTap = "Tap! x{n}",
|
||||
cookDone = "Done!",
|
||||
chooseMenu = "What shall we cook? Pick what a customer ordered!",
|
||||
cookTitle = "Cooking",
|
||||
btnBoost = "Boost",
|
||||
btnDouble = "2x Cash",
|
||||
btnShop = "Shop",
|
||||
cookWait = "Waiting for customers",
|
||||
cookHandFull = "Hands are full",
|
||||
cookHandFull = "Hands are full! Serve the customer first",
|
||||
stoveObject = "Stove",
|
||||
tut1 = "A customer is here! Go to the glowing stove and hold the button",
|
||||
tut1 = "A customer is here! Go to the glowing stove and start cooking",
|
||||
tut2 = "Done! Bring the dish to the customer's seat",
|
||||
tut3 = "You earned money! Tap [Buy] at the bottom to get a table",
|
||||
tutDone = "Great job! Keep serving and grow your shop",
|
||||
@@ -202,11 +248,34 @@ local STRINGS: { [string]: { [string]: string } } = {
|
||||
nextUp = "次のアップグレード",
|
||||
doubleOn = "適用中",
|
||||
close = "閉じる",
|
||||
cookAction = "{menu}を作る",
|
||||
cookAction = "料理する",
|
||||
cook_Twigim_3 = "トングで取り出そう",
|
||||
cook_Twigim_2 = "カリッと揚げよう",
|
||||
cook_Twigim_1 = "エビに衣をつけよう",
|
||||
cook_Eomuk_2 = "スープにつけよう",
|
||||
cook_Eomuk_1 = "おでんを串にさそう",
|
||||
cook_Sundae_3 = "食べやすく切ろう",
|
||||
cook_Sundae_2 = "ほかほかに蒸そう",
|
||||
cook_Sundae_1 = "スンデを蒸し器に入れよう",
|
||||
cook_Gimbap_3 = "トントン切ろう",
|
||||
cook_Gimbap_2 = "くるくる巻こう",
|
||||
cook_Gimbap_1 = "のりの上に具をのせよう",
|
||||
cook_Tteokbokki_3 = "ヘラでぐるぐる混ぜよう",
|
||||
cook_Tteokbokki_2 = "赤いタレをかけよう",
|
||||
cook_Tteokbokki_1 = "おもちをフライパンに入れよう",
|
||||
gestureRub = "こすこす!",
|
||||
gestureHold = "長押し",
|
||||
gestureTap = "タップ!{n}回",
|
||||
cookDone = "できた!",
|
||||
chooseMenu = "何を作る?お客さんの注文を選んでね!",
|
||||
cookTitle = "料理する",
|
||||
btnBoost = "ブースト",
|
||||
btnDouble = "2倍",
|
||||
btnShop = "ショップ",
|
||||
cookWait = "お客さんを待っています",
|
||||
cookHandFull = "手がいっぱいです",
|
||||
cookHandFull = "手がいっぱい!先にお客さんに運んでね",
|
||||
stoveObject = "コンロ",
|
||||
tut1 = "お客さんが来たよ!光っているコンロに行って、ボタンを長押ししてね",
|
||||
tut1 = "お客さんが来たよ!光っているコンロに行って料理を始めよう",
|
||||
tut2 = "できた!お皿をお客さんの席まで運んでね",
|
||||
tut3 = "お金をかせいだよ!下の[買う]ボタンでテーブルを買ってね",
|
||||
tutDone = "よくできました!お客さんを迎えて、お店を大きくしよう",
|
||||
@@ -293,11 +362,34 @@ local STRINGS: { [string]: { [string]: string } } = {
|
||||
nextUp = "下一个升级",
|
||||
doubleOn = "已生效",
|
||||
close = "关闭",
|
||||
cookAction = "制作{menu}",
|
||||
cookAction = "做菜",
|
||||
cook_Twigim_3 = "用夹子夹出来",
|
||||
cook_Twigim_2 = "炸得脆脆的",
|
||||
cook_Twigim_1 = "给虾裹上面糊",
|
||||
cook_Eomuk_2 = "放进汤里泡一泡",
|
||||
cook_Eomuk_1 = "把鱼饼串到签子上",
|
||||
cook_Sundae_3 = "切成小块",
|
||||
cook_Sundae_2 = "热乎乎地蒸",
|
||||
cook_Sundae_1 = "把米肠放进蒸锅",
|
||||
cook_Gimbap_3 = "切成片",
|
||||
cook_Gimbap_2 = "卷起来",
|
||||
cook_Gimbap_1 = "在紫菜上放馅料",
|
||||
cook_Tteokbokki_3 = "用铲子搅一搅",
|
||||
cook_Tteokbokki_2 = "倒入红色酱料",
|
||||
cook_Tteokbokki_1 = "把年糕放进锅里",
|
||||
gestureRub = "来回搓!",
|
||||
gestureHold = "按住不放",
|
||||
gestureTap = "点一点!{n}次",
|
||||
cookDone = "完成!",
|
||||
chooseMenu = "做什么呢?选客人点的菜吧!",
|
||||
cookTitle = "做菜",
|
||||
btnBoost = "加速",
|
||||
btnDouble = "双倍",
|
||||
btnShop = "商店",
|
||||
cookWait = "等待客人中",
|
||||
cookHandFull = "手里拿满了",
|
||||
cookHandFull = "手里拿满了!先端给客人吧",
|
||||
stoveObject = "灶台",
|
||||
tut1 = "客人来了!走到发光的灶台,按住按钮",
|
||||
tut1 = "客人来了!走到发光的灶台开始做菜吧",
|
||||
tut2 = "做好了!把盘子端到客人的座位上",
|
||||
tut3 = "赚到钱了!点下面的[购买]按钮买一张桌子",
|
||||
tutDone = "做得好!继续招待客人,把店做大吧",
|
||||
|
||||
188
bunsik-tycoon/src/shared/Recipes.luau
Normal file
188
bunsik-tycoon/src/shared/Recipes.luau
Normal file
@@ -0,0 +1,188 @@
|
||||
--!strict
|
||||
-- 메뉴별 조리 과정(요리 화면의 단계)과 진행 상태 기계. 로블록스 API를 쓰지 않아서 lune 테스트와 시뮬레이터에서 그대로 씁니다.
|
||||
-- 단계 종류(모두 실패 없음, 어린아이도 끝까지 할 수 있게):
|
||||
-- tap = 재료를 톡톡 누르기(need번)
|
||||
-- hold = 꾹 누르고 있기(need초)
|
||||
-- rub = 손가락·마우스로 문지르기(이동 거리 need × RUB_UNIT 기준 단위)
|
||||
-- "화구" 업그레이드(stats.cook 2.5 → 1.5 → 1)를 사면 누르는 횟수·시간이 같은 비율로 줄어듭니다.
|
||||
|
||||
local Recipes = {}
|
||||
|
||||
export type StepKind = "tap" | "hold" | "rub"
|
||||
|
||||
export type Step = {
|
||||
kind: StepKind,
|
||||
key: string, -- 안내 글 Locale 키(cook_<메뉴>_<번호>)
|
||||
base: number, -- 화구 Lv0 기준 횟수·초·문지르기 양
|
||||
tool: string, -- 누르는 물건 그림(Kitchen 그림 이름)
|
||||
}
|
||||
|
||||
export type Recipe = {
|
||||
stage: string, -- 조리 도구 그림(팬, 도마, 찜기, 냄비, 튀김기)
|
||||
steps: { Step },
|
||||
}
|
||||
|
||||
Recipes.BASE_COOK = 2.5 -- Economy.START.cook과 같음
|
||||
Recipes.RUB_UNIT = 260 -- 문지르기 1번 = 기준 단위 260만큼 움직이기
|
||||
|
||||
Recipes.LIST = {
|
||||
Tteokbokki = {
|
||||
stage = "pan",
|
||||
steps = {
|
||||
{ kind = "tap", key = "cook_Tteokbokki_1", base = 4, tool = "riceCakes" },
|
||||
{ kind = "hold", key = "cook_Tteokbokki_2", base = 1.0, tool = "sauceBowl" },
|
||||
{ kind = "rub", key = "cook_Tteokbokki_3", base = 3, tool = "spatula" },
|
||||
},
|
||||
},
|
||||
Gimbap = {
|
||||
stage = "board",
|
||||
steps = {
|
||||
{ kind = "tap", key = "cook_Gimbap_1", base = 4, tool = "fillings" },
|
||||
{ kind = "rub", key = "cook_Gimbap_2", base = 3, tool = "roll" },
|
||||
{ kind = "tap", key = "cook_Gimbap_3", base = 4, tool = "knife" },
|
||||
},
|
||||
},
|
||||
Sundae = {
|
||||
stage = "steamer",
|
||||
steps = {
|
||||
{ kind = "tap", key = "cook_Sundae_1", base = 3, tool = "sundaeRaw" },
|
||||
{ kind = "hold", key = "cook_Sundae_2", base = 1.2, tool = "fire" },
|
||||
{ kind = "tap", key = "cook_Sundae_3", base = 4, tool = "knife" },
|
||||
},
|
||||
},
|
||||
Eomuk = {
|
||||
stage = "pot",
|
||||
steps = {
|
||||
{ kind = "tap", key = "cook_Eomuk_1", base = 4, tool = "fishCake" },
|
||||
{ kind = "hold", key = "cook_Eomuk_2", base = 1.4, tool = "skewer" },
|
||||
},
|
||||
},
|
||||
Twigim = {
|
||||
stage = "fryer",
|
||||
steps = {
|
||||
{ kind = "rub", key = "cook_Twigim_1", base = 3, tool = "batter" },
|
||||
{ kind = "hold", key = "cook_Twigim_2", base = 1.2, tool = "fire" },
|
||||
{ kind = "tap", key = "cook_Twigim_3", base = 3, tool = "tongs" },
|
||||
},
|
||||
},
|
||||
} :: { [string]: Recipe }
|
||||
|
||||
-- 화구 수준에 맞춘 단계 목표(횟수는 정수, 최소 2번)
|
||||
function Recipes.need(step: Step, cook: number): number
|
||||
local k = cook / Recipes.BASE_COOK
|
||||
if step.kind == "tap" then
|
||||
return math.max(2, math.floor(step.base * k + 0.5))
|
||||
end
|
||||
return step.base * k
|
||||
end
|
||||
|
||||
-- 시뮬레이터용: 아이가 쉬지 않고 했을 때 걸리는 시간(초). 메뉴 고르기·완성 연출 포함.
|
||||
Recipes.TIME_TAP = 0.3 -- 한 번 누르는 데
|
||||
Recipes.TIME_RUB = 0.35 -- 문지르기 1번에
|
||||
Recipes.TIME_STEP = 0.4 -- 단계가 바뀔 때 안내를 보는 시간
|
||||
Recipes.TIME_CHOOSE = 1.0 -- 조리대 버튼 + 메뉴 고르기
|
||||
Recipes.TIME_DONE = 0.6 -- "완성!" 연출
|
||||
|
||||
function Recipes.expectedTime(menu: string, cook: number): number
|
||||
local r = Recipes.LIST[menu]
|
||||
local t = Recipes.TIME_CHOOSE + Recipes.TIME_DONE
|
||||
for _, s in r.steps do
|
||||
local n = Recipes.need(s, cook)
|
||||
t += Recipes.TIME_STEP
|
||||
if s.kind == "tap" then
|
||||
t += n * Recipes.TIME_TAP
|
||||
elseif s.kind == "rub" then
|
||||
t += n * Recipes.TIME_RUB
|
||||
else
|
||||
t += n
|
||||
end
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
-- 요리 화면 한 번의 진행 상태
|
||||
export type Phase = "menu" | "cook" | "done"
|
||||
export type Flow = {
|
||||
phase: Phase,
|
||||
cook: number, -- 화구 수준(stats.cook)
|
||||
menu: string?,
|
||||
step: number, -- 지금 단계(1부터)
|
||||
progress: number, -- 지금 단계 진행량(0 ~ need)
|
||||
need: number,
|
||||
}
|
||||
|
||||
function Recipes.newFlow(cook: number): Flow
|
||||
return { phase = "menu", cook = cook, menu = nil, step = 0, progress = 0, need = 0 }
|
||||
end
|
||||
|
||||
function Recipes.current(flow: Flow): Step?
|
||||
local r = flow.menu and Recipes.LIST[flow.menu]
|
||||
return r and r.steps[flow.step]
|
||||
end
|
||||
|
||||
local function startStep(flow: Flow, i: number)
|
||||
local r = Recipes.LIST[flow.menu :: string]
|
||||
flow.step = i
|
||||
flow.progress = 0
|
||||
local s = r.steps[i]
|
||||
flow.need = if s then Recipes.need(s, flow.cook) else 0
|
||||
end
|
||||
|
||||
-- 메뉴를 고르면 첫 단계부터 시작합니다.
|
||||
function Recipes.choose(flow: Flow, menu: string): boolean
|
||||
if flow.phase ~= "menu" or not Recipes.LIST[menu] then
|
||||
return false
|
||||
end
|
||||
flow.menu = menu
|
||||
flow.phase = "cook"
|
||||
startStep(flow, 1)
|
||||
return true
|
||||
end
|
||||
|
||||
-- 입력을 넣습니다. kind가 지금 단계와 다르면 무시합니다.
|
||||
-- 돌려주는 값: nil(무시), "progress", "step"(다음 단계로), "done"(완성)
|
||||
function Recipes.input(flow: Flow, kind: StepKind, amount: number): string?
|
||||
if flow.phase ~= "cook" then
|
||||
return nil
|
||||
end
|
||||
local s = Recipes.current(flow)
|
||||
if not s or s.kind ~= kind or amount <= 0 then
|
||||
return nil
|
||||
end
|
||||
flow.progress = math.min(flow.need, flow.progress + amount)
|
||||
if flow.progress < flow.need - 1e-9 then
|
||||
return "progress"
|
||||
end
|
||||
local r = Recipes.LIST[flow.menu :: string]
|
||||
if flow.step >= #r.steps then
|
||||
flow.phase = "done"
|
||||
return "done"
|
||||
end
|
||||
startStep(flow, flow.step + 1)
|
||||
return "step"
|
||||
end
|
||||
|
||||
-- 완성 뒤 다음 접시를 만들 때(메뉴 고르기로 돌아감)
|
||||
function Recipes.reset(flow: Flow, cook: number)
|
||||
flow.phase = "menu"
|
||||
flow.cook = cook
|
||||
flow.menu = nil
|
||||
flow.step = 0
|
||||
flow.progress = 0
|
||||
flow.need = 0
|
||||
end
|
||||
|
||||
-- 지금 단계까지 포함한 전체 진행률(0~1). 위쪽 단계 표시에 씁니다.
|
||||
function Recipes.fraction(flow: Flow): number
|
||||
local r = flow.menu and Recipes.LIST[flow.menu]
|
||||
if not r then
|
||||
return 0
|
||||
end
|
||||
if flow.phase == "done" then
|
||||
return 1
|
||||
end
|
||||
local part = if flow.need > 0 then flow.progress / flow.need else 0
|
||||
return ((flow.step - 1) + part) / #r.steps
|
||||
end
|
||||
|
||||
return Recipes
|
||||
@@ -121,6 +121,15 @@ function Shop.nextCookMenu(self: Shop): string?
|
||||
return if open[1] then open[1].menu else nil
|
||||
end
|
||||
|
||||
-- 메뉴별로 아직 접시가 정해지지 않은 주문 수(요리 화면의 "주문" 표시)
|
||||
function Shop.openCounts(self: Shop): { [string]: number }
|
||||
local counts = {}
|
||||
for _, c in Shop.openOrders(self) do
|
||||
counts[c.menu] = (counts[c.menu] or 0) + 1
|
||||
end
|
||||
return counts
|
||||
end
|
||||
|
||||
function Shop.handFull(self: Shop): boolean
|
||||
return #self.hand >= self.stats.carry
|
||||
end
|
||||
@@ -176,12 +185,19 @@ function Shop.tick(self: Shop, now: number): { Event }
|
||||
return events
|
||||
end
|
||||
|
||||
-- 플레이어가 조리대에서 다 만들었을 때. 만든 메뉴를 돌려줍니다.
|
||||
function Shop.cook(self: Shop): string?
|
||||
-- 플레이어가 요리 화면에서 다 만들었을 때. 만든 메뉴를 돌려줍니다.
|
||||
-- menu를 주면 그 메뉴를 기다리는 주문이 있을 때만 만들고, 없으면 먼저 온 손님 메뉴를 만듭니다.
|
||||
function Shop.cook(self: Shop, menu: string?): string?
|
||||
if Shop.handFull(self) then
|
||||
return nil
|
||||
end
|
||||
local menu = Shop.nextCookMenu(self)
|
||||
if menu then
|
||||
if not Shop.openCounts(self)[menu] then
|
||||
return nil
|
||||
end
|
||||
else
|
||||
menu = Shop.nextCookMenu(self)
|
||||
end
|
||||
if menu then
|
||||
table.insert(self.hand, menu)
|
||||
end
|
||||
|
||||
@@ -6,4 +6,5 @@ return {
|
||||
COIN = "rbxassetid://96594483709547", -- 서빙하고 돈 받을 때
|
||||
BUY = "rbxassetid://90178922626515", -- 업그레이드 구매, 돈 부스트
|
||||
LEVELUP = "rbxassetid://134931950463198", -- 실내 분식집 확장
|
||||
POP = "rbxassetid://114946217416724", -- 요리 화면에서 톡톡 누를 때
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user