feat(bunsik): 꾸미기 모드(아래 물건 줄·이동·삭제), 가게 이름 색 10가지, 개발자 결제 테스트 모드

- [가게 꾸미기]를 누르면 창 없이 바로 꾸미기 모드: 아래 물건 줄(테이블·의자·소품 6가지, 값·개수)에서 고르면
  투명 미리보기를 들고 걸어가 [배치]. [이동]은 고른 가구를 들고 옮기기, [삭제]는 고른 가구를 빨갛게 표시한 뒤
  한 번 더 눌러 지우고 산 값 돌려받기(조리대·마지막 테이블/의자·의자가 보는 테이블·손님 앉은 의자는 막음)
- 새 요청 remove, Floor.remove, Shop.removeSeat(뒤 자리 손님·걷는 시간 번호 당김)
- 내 가게 탭: 이름 색 무료 10색 + 무지개(게임패스) 칸. 부지 속성 NameColor로 모두에게 보임
- 개발자 테스트 [결제 테스트 켜기/끄기]: 켜면 2배·부스트·러시·쫓아내기·광고 홍보·무지개·유료 디자인이
  결제 창 없이 바로 지급(이번 접속만), 게임패스는 안 가진 상태로 바꿔 사는 흐름을 볼 수 있고 끄면 실제 보유로 복구

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 05:32:32 +09:00
parent fdc5c05c2c
commit 25df3d4846
22 changed files with 906 additions and 329 deletions

View File

@@ -24,6 +24,8 @@
| KickCredits | number | 남은 "손님 쫓아내기" 횟수(유료로 산 것) |
| ShopName | string | 내가 정한 가게 이름 원문("" = 기본 이름). 다른 사람에게 보이는 이름은 부지 속성 ShopName(필터 거친 글) |
| Rainbow | bool | 무지개 이름 켜기 설정 |
| NameColor | number | 가게 이름 글자색(Economy.NAME_COLORS 번호 1~10, 0 = 디자인 기본색) |
| DevFree | bool | 개발자 결제 테스트 모드(로벅스 버튼이 결제 없이 바로 지급, 이번 접속만) |
| RainbowOwned | bool | 무지개 이름 게임패스 보유 |
| Design | string | 건물 디자인 id(Economy.DESIGNS) |
| DesignsOwned | string | 유료 디자인 보유 목록 `"Candy,Hanok"` |
@@ -45,7 +47,8 @@
| Menus | 파는 메뉴 `"Tteokbokki,Gimbap"` (메뉴판) |
| PriceMult | 판매 금액 배율(메뉴판 값) |
| ShopName | 필터를 거친 가게 이름("" = 기본 이름 "{name}의 분식집") |
| Rainbow | 무지개 이름(게임패스 + 켜짐) |
| Rainbow | 무지개 이름(게임패스 + 켜짐). 켜져 있으면 NameColor보다 먼저 |
| NameColor | 가게 이름 글자색 번호(0 = 기본) |
| Design | 건물 디자인 |
| ShieldUntil | 손님 쫓아내기 보호가 끝나는 서버 시각 |
| Origin | 부지 기준 CFrame. 배치 좌표 (x, z, 층 f) → 월드: `Origin * CFrame.new(x, Floor.BASE_Y + (f == 2 and Floor.FLOOR2_Y or 0), z)` |
@@ -70,6 +73,8 @@
| `buyDecor` | 소품 id | 소품 1개(빈 곳 자동 배치) |
| `buyOffer` | `"Seat"`/`"Table"`/갈래 id | 추천 구매(화면 막대는 없어졌고 테스트용으로 남김) |
| `move` | `{kind="stove"/"table"/"chair"/"decor", i, x, z, f, r}` | 옮기기(Floor.move로 검사). 테이블의 r은 그 테이블을 보는 의자들을 테이블 둘레로 돌리는 횟수(의자도 같이 옮겨짐) |
| `remove` | `{kind="table"/"chair"/"decor", i}` | 꾸미기 [삭제]: 지우고 산 값 돌려받기(Floor.remove + Shop.removeSeat 검사, 실패면 `removeFail`) |
| `nameColor` | 0~10 | 가게 이름 색(고르면 무지개는 꺼짐) |
| `hire`, `fire` | 역할 id | 알바 고용·해고 |
| `rename` | 문자열(최대 20자) | 이름 바꾸기(TextService 필터) |
| `rainbow` | bool | 무지개 이름 켜기/끄기. 없으면 게임패스 결제 창 |
@@ -77,7 +82,7 @@
| `promote` | `{ad=bool}` | 홍보. ad=true면 보상형 광고(서버가 AdService로 띄움), 아니면 대기 시간 확인 후 바로 |
| `kick` | 부지 번호 | 손님 쫓아내기. 횟수가 있으면 바로 쓰고, 없으면 결제 창(결제되면 그 부지에 씀) |
| `rush` | nil | 손님 러시 결제 창 |
| `visit`, `lang`, `mouseLook`, `sfx`, `pass`, `boost`, `dev_*` | | 예전과 같음 |
| `visit`, `lang`, `mouseLook`, `sfx`, `pass`, `boost`, `dev_*` | | 예전과 같음. `dev_free`는 결제 테스트 모드 켜기/끄기(게임 주인만) |
## 알림 키 (Notify)
@@ -89,4 +94,5 @@
- `renamed`, `nameRejected`(필터 실패·빈 이름), `designSet {design}`, `designLocked`(실내 분식집부터)
- `promoted {n}`, `promoteNone`(데려올 손님 없음), `promoteFull`(빈자리 없음), `promoteWait {sec}`, `adUnavailable`
- `kicked {n, shop}`(내가 쫓아냄), `kickedBy {name}`(내 가게 손님이 쫓겨남), `shielded`(보호 중), `kickOwn`(내 가게는 안 됨)
- `removed {thing, money}`, `removeFail {why}`(why = stove | last | hasChairs | busy | 배치 검사 이유), `devFreeOn`, `devFreeOff`
- `rushOn {min}`, `notEnough {need}`, `doubleOwned`(2배 수익 게임패스를 이미 가지고 있어 결제 창 대신 바로 켬)

View File

@@ -13,13 +13,14 @@
3. 분홍 [상점] 버튼: 탭 3개
- 업그레이드: 건물(포장마차 → 실내 분식집 → 2층), 새 메뉴, 판매 금액, 손님 속도, 화구, 쟁반, 알바생 기능을 따로따로 삽니다. 실내 분식집이 필요한 것은 자물쇠와 "실내 분식집부터"가 붙습니다.
- 알바생: 알바생 기능을 사면 열립니다. 요리·서빙·홍보 알바를 고용하고 뺄 수 있고, 시급은 1분마다 나갑니다. 돈이 모자라면 알바생 머리 위에 💤가 뜨고 쉽니다.
- 내 가게: 가게 이름 쓰고 [저장], 무지개 이름(💎 게임패스), 건물 디자인 5개(실내 분식집부터, 사탕 궁전·한옥은 💎 게임패스).
4. 초록 [가게 꾸미기] 버튼(상점과 따로): 테이블, 의자, 소품 6가지(화분·카펫·풍선·전등·곰인형·냉장고) 카드와 큰 [옮기기] 버튼
- 카드를 누르면 창이 닫히고, 그 물건이 **투명하게 캐릭터 앞에 붙어 다닙니다**. 걸어 다니며 자리를 잡고 [돌리기]로 방향을 바꾼 뒤 [놓기]를 누르면 거기에 놓이고 그때 돈이 나갑니다. PC는 R 돌리기, F 놓기도 됩니다.
- 놓을 수 있으면 초록, 안 되면 빨강과 이유(문 앞, 겹침, 손님 길 막힘, 돈 부족 등)가 위에 나옵니다. [취소]나 [나가기]로 그만둡니다.
- 테이블과 의자는 따로 삽니다(테이블에 의자가 딸려 오지 않음). 의자는 등받이가 있어서 방향이 보이고, **의자가 테이블을 보게** 놓아야 합니다. 손님은 의자가 보는 쪽 테이블에서 먹습니다.
- [옮기기]를 누르고 이미 놓은 테이블·의자·소품·조리대를 누르면 그 물건을 들고 옮길 수 있습니다. 테이블을 들면 그 테이블을 보는 의자도 같이 따라오고, [돌리기]는 의자들을 테이블 둘레로 돌립니다.
- 2층 건물이면 계단으로 2층에 올라가서 놓으면 2층에 놓입니다.
- 내 가게: 가게 이름 쓰고 [저장]. **이름 색**은 무료 10색(빨강·주황·노랑·초록·하늘·파랑·보라·분홍·흰색·검정) 중에서 고르고(고른 색을 다시 누르면 디자인 기본색), 맨 오른쪽 무지개 칸은 💎 게임패스입니다. 건물 디자인 5개(실내 분식집부터, 사탕 궁전·한옥은 💎 게임패스).
4. 초록 [가게 꾸미기] 버튼(상점과 따로)을 누르면 바로 **꾸미기 모드**가 됩니다(다른 버튼은 숨고, 캐릭터는 그대로 걸어 다님).
- 아래 줄에 테이블·의자·소품 6가지(화분·카펫·풍선·전등·곰인형·냉장고)가 값·개수와 함께 나옵니다(휴대폰은 옆으로 밀면 더 보임). 하나를 누르면 그 물건이 **투명하게 캐릭터 앞에 붙어 다닙니다**. 걸어가서 자리를 잡고 [돌리기]로 방향을 바꾼 뒤 [배치]를 누르면 거기에 놓이고 그때 돈이 나갑니다. PC는 R 돌리기, F 배치도 됩니다.
- 놓을 수 있으면 초록, 안 되면 빨강과 이유(문 앞, 겹침, 손님 길 막힘, 의자 앞에 테이블 없음, 돈 부족)가 위에 나옵니다.
- [이동]: "이동할 가구를 고르세요"가 나오면 테이블·의자·소품·조리대를 누릅니다. 그 물건을 들고 같은 방법으로 옮기고 돌립니다. 테이블을 들면 그 테이블을 보는 의자도 같이 따라오고, [돌리기]는 의자들을 테이블 둘레로 돌립니다.
- [삭제]: "삭제할 가구를 고르세요"가 나오면 지울 물건을 누릅니다(빨갛게 표시). 아래 [삭제]를 한 번 더 누르면 지우고 산 값을 돌려받습니다. 조리대, 마지막 테이블·의자, 의자가 보고 있는 테이블, 손님이 앉아 있는 의자는 못 지웁니다(이유가 나옴).
- 테이블과 의자는 따로 삽니다. 의자는 등받이가 있어서 방향이 보이고, **의자가 테이블을 보게** 놓아야 합니다. 2층 건물이면 계단으로 2층에 올라가서 놓으면 2층에 놓입니다.
- 왼쪽 위 [나가기]로 꾸미기 모드를 끝냅니다.
5. 실내 분식집을 사면 천장·지붕이 있는 건물이 생기고, 2층을 사면 계단과 2층이 생깁니다. 2층에 놓은 자리에도 손님이 계단을 올라가 앉는지 봐 주세요.
6. 오른쪽 위(휴대폰)·오른쪽(PC) 손님 버튼
- 📣 홍보: 옆 가게에서 기다리던 손님이 최대 3명(빈자리만큼) 걸어서 우리 가게로 옵니다. 광고를 볼 수 있는 계정이면 [광고 보기]가 나오고, 아니면 바로 홍보됩니다(3분마다). 비공개 게임이라 지금은 광고가 나오지 않는 것이 정상입니다.
@@ -34,14 +35,15 @@
[설정] 창 맨 아래 `개발자 테스트` 줄:
- `+1,000원`: 돈을 바로 넣습니다. 뒤쪽 업그레이드를 빨리 확인할 때 씁니다(여러 번 누르면 2층까지 빨리 갈 수 있음).
- `2배 켜기/끄기`: 2배 수익을 켜고 끕니다(이번 접속에만 적용). 게임 주인 계정은 게임패스를 자동으로 가지고 있어서, 꺼 둔 뒤 [2배 돈]을 누르면 결제 창 없이 다시 켜집니다.
- `결제 테스트 켜기/끄기`: 켜면 **로벅스 버튼이 결제 창 없이 바로 됩니다**(이번 접속만). 2배 돈, 부스트, 손님 러시, 쫓아내기(옆 가게 입구 F), 홍보 광고 보상(광고 없이 바로), 무지개 이름, 유료 디자인(사탕 궁전·한옥)을 진짜 로벅스 없이 시험할 수 있습니다. 켜는 순간 게임패스는 "안 가진 상태"로 바뀌어서 사는 과정을 볼 수 있고, 끄면 실제로 가진 게임패스로 돌아갑니다(게임 주인 계정은 게임패스를 모두 자동으로 가지고 있음).
- `2배 켜기/끄기`: 2배 수익을 켜고 끕니다(이번 접속에만 적용).
- `처음부터`: 돈·업그레이드·배치·알바생·튜토리얼을 처음으로 되돌립니다. 이름과 산 게임패스(2배 수익 포함)는 남습니다.
[2배 돈], [부스트], 손님 러시, 쫓아내기, 무지개 이름, 유료 디자인은 진짜 결제 창이 뜹니다. 누르면 실제 로벅스가 나가니, 결제 테스트가 필요할 때만 쓰세요.
`결제 테스트`를 끈 상태에서는 [2배 돈], [부스트], 손님 러시, 쫓아내기, 무지개 이름, 유료 디자인이 진짜 결제 창을 띄웁니다. 결제 테스트가 필요하면 꼭 먼저 `결제 테스트 켜기`를 누르세요.
## 알려 주시면 좋은 것
- 가게 꾸미기: 투명 미리보기가 캐릭터 앞에서 잘 따라오는지, 거리가 적당한지, 돌리기·놓기가 쉬운지, 휴대폰에서 버튼이 조이스틱·점프에 안 가리는지
- 가게 꾸미기: 투명 미리보기가 캐릭터 앞에서 잘 따라오는지, 거리가 적당한지, 돌리기·배치·이동·삭제가 쉬운지, 휴대폰에서 아래 물건 줄과 버튼이 조이스틱·점프에 안 가리는지
- 손님·알바생이 걷고 앉는 모습, 동물 손님 모습이 어색하지 않은지
- 서빙 알바가 접시를 들고 손님에게 가는 모습
- 너무 빠르거나 느리다고 느낀 구간(어떤 업그레이드 근처인지). 손님이 너무 느리게 오는지

View File

@@ -1,13 +1,14 @@
--!strict
-- 꾸미기(놓기) 화면: 화면의 [가게 꾸미기] 창에서 물건을 고르거나 [옮기기]를 누르면 시작합니다.
-- - 들기: 고른 물건의 투명한 미리보기가 내 캐릭터 바로 앞에 붙어 다닙니다. 걸어 다니며 자리를 잡고
-- [돌리기](PC: R)로 방향을 바꾼 뒤 [놓기](PC: F)를 누르면 그 자리에 놓습니다.
-- 놓을 수 있으면 초록, 안 되면 빨강과 이유(문 앞, 겹침, 길이 막힘, 의자 앞에 테이블 없음, 돈 부족 등)가 나옵니다.
-- 검사는 서버와 같은 Floor.add / Floor.move이고, 서버가 다시 검사합니다. 새 물건 값은 놓을 때 나갑니다.
-- - 옮기기: 내 가게의 테이블·의자·소품·조리대를 누르면 그 물건을 듭니다(원래 물건은 내 화면에서만 숨김).
-- 테이블을 들면 그 테이블을 보는 의자도 같이 들리고, [돌리기]는 의자들을 테이블 둘레로 돌립니다.
-- 꾸미기 모드: 화면의 [가게 꾸미기] 버튼으로 들어갑니다. 다른 화면 UI는 숨기고 캐릭터는 그대로 걸어 다닙니다.
-- - 아래 물건 줄(테이블·의자·소품 6가지, 값과 개수)에서 하나를 고르면 그 물건의 투명한 미리보기가 캐릭터 바로 앞에
-- 붙어 다닙니다. 걸어가서 자리를 잡고 [돌리기](PC: R)로 방향을 바꾼 뒤 [배치](PC: F)를 누르면 그 자리에 놓이고
-- 그때 돈이 나갑니다. 놓을 수 있으면 초록, 안 되면 빨강과 이유(문 앞, 겹침, 길 막힘, 의자 앞에 테이블 없음, 돈 부족)가 나옵니다.
-- - [이동]: "이동할 가구를 고르세요" → 내 가게의 테이블·의자·소품·조리대를 누르면 그 물건을 들고(원래 물건은 내 화면에서만 숨김)
-- 같은 방법으로 옮기고 돌립니다. 테이블을 들면 그 테이블을 보는 의자도 같이 들리고, [돌리기]는 의자들을 테이블 둘레로 돌립니다.
-- - [삭제]: "삭제할 가구를 고르세요" → 누르면 빨갛게 표시되고, [삭제]를 한 번 더 누르면 지우고 산 값을 돌려받습니다.
-- - 층은 캐릭터가 서 있는 층(2층 건물이면 계단으로 올라가서 놓음)입니다.
-- 캐릭터는 그대로 움직이고, 다른 화면 UI와 조리대 버튼은 Main이 onOpen/onClose로 숨깁니다.
-- 검사는 서버와 같은 Floor.add / Floor.move / Floor.remove이고, 서버가 다시 검사합니다.
-- 다른 화면 UI와 조리대 버튼은 Main이 onOpen/onClose로 숨깁니다.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
@@ -25,14 +26,12 @@ local Decorate = {}
export type Handle = {
gui: ScreenGui,
-- kind = "table" | "chair" | "decor"(k = 소품 종류)이면 새 물건 들기, "move"면 옮길 물건 고르기
start: (kind: string, k: string?) -> (),
open: () -> (), -- 꾸미기 모드 들어가기(아래 물건 줄)
close: () -> (),
isOpen: () -> boolean,
holding: () -> boolean, -- 물건을 들고 있으면 true(PC 마우스 회전은 그대로)
onOpen: (fn: () -> ()) -> (),
-- 끝날 때. placed = 새 물건을 놓으려고 보냈으면 "new", 옮기기를 보냈으면 "move", 그냥 나가면 nil
onClose: (fn: (placed: string?) -> ()) -> (),
onClose: (fn: () -> ()) -> (),
setLayout: (lay: Layout.Result) -> (),
notify: (key: string, args: { [string]: any }?) -> (),
destroy: () -> (),
@@ -46,6 +45,13 @@ type Hold = {
r: number, -- 회전(테이블은 지금 자리 기준 돌린 횟수)
}
-- 아래 물건 줄 순서: 테이블, 의자, 소품(Economy.DECOR 순서)
local ITEMS: { { kind: string, k: string? } } = { { kind = "table" }, { kind = "chair" } }
for _, d in Economy.DECOR do
table.insert(ITEMS, { kind = "decor", k = d.id })
end
Decorate.ITEMS = ITEMS
type Piece = { kind: string, index: number, clone: Model, from: CFrame?, pivot: CFrame }
local GOOD = Color3.fromRGB(70, 220, 120)
@@ -164,6 +170,52 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
local rotateBtn, rotateLabel = Theme.textButton(root, "Rotate", Theme.LAVENDER, 22)
local cancelBtn, cancelLabel = Theme.textButton(root, "Cancel", Theme.GRAY, 22)
local okBtn, okLabel = Theme.textButton(root, "Place", Theme.MINT, 22)
local moveBtn, moveLabel = Theme.iconButton(root, "Move", Theme.SKY, "hand")
local deleteBtn, deleteLabel = Theme.iconButton(root, "Delete", Theme.RED, "close")
-- 아래 물건 줄(넘치면 옆으로 밀어 봄)
local strip = Instance.new("ScrollingFrame")
strip.Name = "Items"
strip.BackgroundTransparency = 1
strip.BorderSizePixel = 0
strip.ScrollingDirection = Enum.ScrollingDirection.X
strip.AutomaticCanvasSize = Enum.AutomaticSize.X
strip.CanvasSize = UDim2.new()
strip.ScrollBarThickness = 4
strip.ElasticBehavior = Enum.ElasticBehavior.Never
strip.Parent = root
local stripList = Instance.new("UIListLayout")
stripList.FillDirection = Enum.FillDirection.Horizontal
stripList.Padding = UDim.new(0, 10)
stripList.SortOrder = Enum.SortOrder.LayoutOrder
stripList.VerticalAlignment = Enum.VerticalAlignment.Top
stripList.Parent = strip
type ItemButton = { b: Theme.Button, glyph: Info.Glyph, price: TextLabel, tag: TextLabel }
local itemButtons: { ItemButton } = {}
for n, it in ITEMS do
local b = Theme.button(strip, "Item_" .. (it.k or it.kind), Theme.WHITE, 18)
b.button.LayoutOrder = n
local icon = if it.kind == "table"
then "table"
elseif it.kind == "chair" then Info.SEAT_ICON
else Info.DECOR_ICON[it.k or ""] or "sparkle"
local g = Info.glyph(b.face, "Icon", icon)
g.frame.AnchorPoint = Vector2.new(0.5, 0.5)
g.frame.Position = UDim2.fromScale(0.5, 0.4)
g.frame.Size = UDim2.fromScale(0.62, 0.62)
g.zindex(4)
local price = Theme.text(b.button, "Price", Theme.edge(Theme.MINT), true)
price.AnchorPoint = Vector2.new(0.5, 1)
price.Position = UDim2.fromScale(0.5, 1)
price.Size = UDim2.fromScale(1, 0.3)
price.ZIndex = 5
local tag = Theme.text(b.button, "Count", Theme.edge(Theme.LAVENDER), true)
tag.AnchorPoint = Vector2.new(1, 0)
tag.Position = UDim2.new(1, 2, 0, -4)
tag.Size = UDim2.fromScale(0.7, 0.26)
tag.ZIndex = 6
itemButtons[n] = { b = b, glyph = g, price = price, tag = tag }
end
-- 미리보기 모형(내 화면에만)
local ghost = Instance.new("Model")
@@ -176,6 +228,13 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
local plates: { BasePart } = {}
local isOpen = false
local mode = "menu" -- "menu"(물건 줄) | "hold"(들고 있음) | "pickMove"(이동할 것 고르기) | "pickDelete"(지울 것 고르기)
local delSel: { kind: string, i: number }? = nil
local selHighlight = Instance.new("Highlight")
selHighlight.FillColor = BAD
selHighlight.FillTransparency = 0.4
selHighlight.OutlineColor = Theme.WHITE
selHighlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
local hold: Hold? = nil
local pieces: { Piece } = {}
local hiddenParts: { [BasePart]: boolean } = {} -- 옮기는 원래 물건(내 화면에서만 숨김) -> 원래 CanCollide
@@ -185,7 +244,7 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
local message: string? = nil
local messageToken = 0
local openFns: { () -> () } = {}
local closeFns: { (string?) -> () } = {}
local closeFns: { () -> () } = {}
local conns: { RBXScriptConnection } = {}
-- 배치는 속성이 바뀔 때만 다시 읽습니다(매 프레임 JSON을 풀지 않게).
@@ -241,6 +300,34 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
return d and d.cost
end
-- 새로 살 때 값과 살 수 있는지(최대 수)
local function buyInfo(kind: string, k: string?): (number?, boolean)
local st = stage()
local seats = Info.attr(state, "Seats", 1)
local tables = Info.attr(state, "Tables", 1)
if kind == "chair" then
return Economy.seatCost(seats + 1), seats < Economy.seatCap(st)
elseif kind == "table" then
return Economy.tableCost(tables), tables < Economy.tableCap(st)
end
local d = k and Economy.decor(k)
return d and d.cost, #curLayout().decor < Economy.DECOR_MAX
end
-- 지우면 돌려받는 값(서버 PlotController.removeItem과 같음)
local function refundOf(kind: string, i: number): number
local layout = curLayout()
if kind == "chair" then
return Economy.seatCost(#layout.chairs)
elseif kind == "table" then
return Economy.tableCost(#layout.tables - 1)
elseif kind == "decor" and layout.decor[i] then
local d = Economy.decor(layout.decor[i].k)
return if d then d.cost else 0
end
return 0
end
local function itemName(h: Hold, layout: Floor.Layout): (string, string)
if h.kind == "stove" then
return L("stoveObject"), "flame"
@@ -373,33 +460,93 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
end
end
-- 안내 글과 버튼
-- 물건 줄 값·개수
local function refreshStrip()
local money = Info.attr(state, "Money", 0)
local st = stage()
local layout = curLayout()
local counts: { [string]: number } = {}
for _, d in layout.decor do
counts[d.k] = (counts[d.k] or 0) + 1
end
for n, it in ITEMS do
local ib = itemButtons[n]
local c, canBuy = buyInfo(it.kind, it.k)
local can = canBuy and c ~= nil and money >= c
ib.b.setColor(if can then Theme.MINT else Theme.GRAY)
ib.glyph.fade(if canBuy then 0 else 0.5)
ib.price.Text = if canBuy then Locale.number(c or 0) else L("full")
if it.kind == "table" then
ib.tag.Text = `{#layout.tables}/{Economy.tableCap(st)}`
elseif it.kind == "chair" then
ib.tag.Text = `{#layout.chairs}/{Economy.seatCap(st)}`
else
local cnt = counts[it.k or ""] or 0
ib.tag.Text = if cnt > 0 then `x{cnt}` else ""
end
end
end
-- 안내 글과 버튼(모드마다)
local function redraw()
exitLabel.Text = L("exit")
rotateLabel.Text = L("rotate")
cancelLabel.Text = L("cancel")
okLabel.Text = L("placeIt")
moveLabel.Text = L("btnMove")
deleteLabel.Text = L("btnDelete")
local h = hold
local layout = curLayout()
local menu = mode == "menu"
strip.Visible = menu
moveBtn.button.Visible = menu
deleteBtn.button.Visible = menu
rotateBtn.button.Visible = h ~= nil and not (h.new and h.kind == "table")
cancelBtn.button.Visible = h ~= nil
okBtn.button.Visible = h ~= nil
okBtn.setColor(if h and valid then Theme.MINT else Theme.GRAY)
cancelBtn.button.Visible = not menu
local sel = delSel
if mode == "pickDelete" then
okBtn.button.Visible = sel ~= nil
okLabel.Text = L("btnDelete")
okBtn.setColor(Theme.RED)
else
okBtn.button.Visible = h ~= nil
okLabel.Text = L("placeIt")
okBtn.setColor(if h and valid then Theme.MINT else Theme.GRAY)
end
selHighlight.Adornee = nil
selHighlight.Parent = nil
local text: string
local color = Theme.MINT
if message then
text = message
color = Theme.ORANGE
elseif not h then
text = L("decoPick")
infoIcon.set("hand")
elseif not valid then
elseif menu then
text = L("decoChoose")
infoIcon.set("table")
elseif mode == "pickMove" then
text = L("decoPickMove")
infoIcon.set("hand")
elseif mode == "pickDelete" then
color = Theme.RED
infoIcon.set("close")
text = L("decoPickDelete")
if sel then
local name, icon = itemName({ new = false, kind = sel.kind, i = sel.i, r = 0 }, layout)
infoIcon.set(icon)
text = `{name} · {L("decoDeleteAsk", { money = Locale.number(refundOf(sel.kind, sel.i)) })}`
local m = itemModel(sel.kind, sel.i)
if m then
selHighlight.Adornee = m
selHighlight.Parent = m
end
end
elseif h and not valid then
text = L("why_" .. (why or "none"))
color = Theme.RED
else
text = L("decoOk")
end
if h then
if h and mode == "hold" then
local name, icon = itemName(h, layout)
infoIcon.set(icon)
local c = cost(h)
@@ -416,12 +563,18 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
infoStroke.Color = Theme.edge(color)
highlight.FillColor = if valid then GOOD else BAD
highlight.OutlineColor = if valid then Theme.WHITE else BAD
if menu then
refreshStrip()
end
end
-- 캐릭터 앞 자리 계산 → 바뀌면 다시 검사
local lastKey = ""
local function update(force: boolean?)
local h = hold
if not h then
return
end
local o = origin()
local char = player.Character
local rootPart = char and char:FindFirstChild("HumanoidRootPart") :: BasePart?
@@ -487,7 +640,7 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
local renderConn: RBXScriptConnection? = nil
local function close(placed: string?)
local function close()
if not isOpen then
return
end
@@ -495,18 +648,34 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
gui.Enabled = false
hold = nil
target = nil
delSel = nil
mode = "menu"
clearGhost()
selHighlight.Adornee = nil
selHighlight.Parent = nil
if renderConn then
renderConn:Disconnect()
renderConn = nil
end
for _, fn in closeFns do
fn(placed)
fn()
end
end
local function setMode(m: string)
mode = m
hold = nil
target = nil
delSel = nil
message = nil
clearGhost()
redraw()
end
local function beginHold(h: Hold)
mode = "hold"
hold = h
delSel = nil
valid = false
why = nil
message = nil
@@ -516,47 +685,50 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
end
local function open()
if isOpen then
if isOpen or not origin() then
return
end
isOpen = true
gui.Enabled = true
renderConn = RunService.RenderStepped:Connect(function()
-- 화면이 그려질 때마다 미리보기를 캐릭터 앞으로(서버 테스트에서는 Heartbeat)
local step = if RunService:IsClient() then RunService.RenderStepped else RunService.Heartbeat
renderConn = step:Connect(function()
update()
end)
for _, fn in openFns do
fn()
end
setMode("menu")
end
local function start(kind: string, k: string?)
if not origin() then
-- 물건 줄에서 새 물건 고르기
local function startNew(kind: string, k: string?)
local c, canBuy = buyInfo(kind, k)
if not canBuy then
showMessage(L("full"))
return
end
open()
if kind == "move" then
hold = nil
clearGhost()
redraw()
else
-- 새 의자는 캐릭터가 보는 쪽(앞의 테이블 쪽)을 보게 들고 시작합니다.
local r = 0
local o = origin()
local char = player.Character
local rootPart = char and char:FindFirstChild("HumanoidRootPart") :: BasePart?
if kind == "chair" and o and rootPart then
local look = o:VectorToObjectSpace(rootPart.CFrame.LookVector)
local best = -math.huge
for cr = 0, 3 do
local fx, fz = Floor.facing(cr)
local d = fx * look.X + fz * look.Z
if d > best then
best, r = d, cr
end
if c and Info.attr(state, "Money", 0) < c then
showMessage(L("why_money"))
return
end
-- 새 의자는 캐릭터가 보는 쪽(앞의 테이블 쪽)을 보게 들고 시작합니다.
local r = 0
local o = origin()
local char = player.Character
local rootPart = char and char:FindFirstChild("HumanoidRootPart") :: BasePart?
if kind == "chair" and o and rootPart then
local look = o:VectorToObjectSpace(rootPart.CFrame.LookVector)
local best = -math.huge
for cr = 0, 3 do
local fx, fz = Floor.facing(cr)
local d = fx * look.X + fz * look.Z
if d > best then
best, r = d, cr
end
end
beginHold({ new = true, kind = kind, k = k, i = 0, r = r })
end
beginHold({ new = true, kind = kind, k = k, i = 0, r = r })
end
-- 옮길 물건 고르기(누른 곳의 내 가게 물건)
@@ -601,14 +773,22 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
end
local function tryPick(sx: number, sy: number, screen: boolean)
if not isOpen or hold then
if not isOpen or (mode ~= "pickMove" and mode ~= "pickDelete") then
return
end
local kind, i = pickItem(sx, sy, screen)
if kind and i then
local layout = curLayout()
local _, _, _, r = spot(layout, kind, i)
if not kind or not i then
return
end
if mode == "pickMove" then
local _, _, _, r = spot(curLayout(), kind, i)
beginHold({ new = false, kind = kind, i = i, r = if kind == "table" then 0 else r or 0 })
elseif kind == "stove" then
showMessage(L("why_stove"))
else
delSel = { kind = kind, i = i }
message = nil
redraw()
end
end
@@ -621,6 +801,15 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
end
local function placeNow()
local sel = delSel
if mode == "pickDelete" then
if sel then
send("remove", { kind = sel.kind, i = sel.i })
delSel = nil
redraw()
end
return
end
local h = hold
local t = target
if not h or not t then
@@ -633,25 +822,22 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
end
if h.new then
send("buyAt", { kind = h.kind, k = h.k, x = t.x, z = t.z, f = t.f, r = h.r })
close("new")
else
send("move", { kind = h.kind, i = h.i, x = t.x, z = t.z, f = t.f, r = h.r })
-- 옮기기는 계속 다른 물건을 고를 수 있게 고르기로 돌아갑니다.
hold = nil
target = nil
clearGhost()
redraw()
end
-- 놓은 뒤에는 물건 줄로 돌아갑니다(더 사거나 이동·삭제).
setMode("menu")
end
local function cancel()
if hold and not hold.new then
hold = nil
target = nil
clearGhost()
local h = hold
if h and not h.new then
setMode("pickMove")
elseif mode == "pickDelete" and delSel then
delSel = nil
redraw()
else
close(nil)
setMode("menu")
end
end
@@ -680,12 +866,29 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
end
end)
)
table.insert(conns, exitBtn.button.Activated:Connect(close))
table.insert(
conns,
exitBtn.button.Activated:Connect(function()
close(nil)
moveBtn.button.Activated:Connect(function()
setMode("pickMove")
end)
)
table.insert(
conns,
deleteBtn.button.Activated:Connect(function()
setMode("pickDelete")
end)
)
for n, it in ITEMS do
table.insert(
conns,
itemButtons[n].b.button.Activated:Connect(function()
if mode == "menu" then
startNew(it.kind, it.k)
end
end)
)
end
table.insert(conns, rotateBtn.button.Activated:Connect(rotate))
table.insert(conns, cancelBtn.button.Activated:Connect(cancel))
table.insert(conns, okBtn.button.Activated:Connect(placeNow))
@@ -700,10 +903,14 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
layoutNow = Info.layout(state)
end
local h = hold
-- 지우려고 고른 물건 번호는 배치가 바뀌면 달라질 수 있으니 풉니다.
if key == "Layout" then
delSel = nil
end
-- 옮기던 물건이 없어졌으면 내려놓기
if h and not h.new and not spot(curLayout(), h.kind, h.i) then
hold = nil
clearGhost()
setMode("menu")
return
elseif h and not h.new and key == "Layout" then
-- 서버가 가구를 다시 지었으면 새 모형을 다시 숨기고 미리보기를 새로 만듭니다.
buildGhost(h)
@@ -718,10 +925,8 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
return {
gui = gui,
start = start,
close = function()
close(nil)
end,
open = open,
close = close,
isOpen = function()
return isOpen
end,
@@ -748,6 +953,12 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
place(rotateBtn.button, d.tools[1])
place(cancelBtn.button, d.tools[2])
place(okBtn.button, d.tools[3])
place(strip, d.strip)
place(moveBtn.button, d.move)
place(deleteBtn.button, d.delete)
for _, ib in itemButtons do
ib.b.button.Size = UDim2.fromOffset(d.move.w, d.move.h)
end
end,
notify = function(key: string, args: { [string]: any }?)
if isOpen then
@@ -755,7 +966,7 @@ function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (s
end
end,
destroy = function()
close(nil)
close()
for _, c in conns do
c:Disconnect()
end

View File

@@ -1,6 +1,7 @@
--!strict
-- 화면 UI: 돈, 손에 든 접시, 상점·가게 꾸미기·2배 수익·돈 부스트 버튼, 홍보·손님 러시 버튼, 설정,
-- 튜토리얼 말풍선(아래 가운데), 알림, 그리고 창(상점 탭 3개, 가게 꾸미기, 설정, 요리, 홍보 확인).
-- 튜토리얼 말풍선(아래 가운데), 알림, 그리고 창(상점 탭 3개, 설정, 요리, 홍보 확인).
-- [가게 꾸미기]는 창 없이 꾸미기 모드(Decorate)를 엽니다.
-- 모양은 Theme("사탕" 스타일), 배치는 Layout, 상점 창은 ShopWindow, 요리 창은 Kitchen 모듈.
-- 상태는 `state` 인스턴스(실제 게임에서는 Player)의 속성에서 읽습니다. 서버에서도 만들 수 있어서 원격 테스트로 검사합니다.
@@ -27,11 +28,10 @@ export type HudHandle = {
-- UI가 쓸 수 있는 화면 크기(픽셀, 상단 바 제외)와 터치 화면 여부로 배치를 다시 잡습니다.
setLayout: (size: Vector2, touch: boolean) -> (),
layout: () -> Layout.Result,
-- "shop"(tab: "upgrade"/"staff"/"mine"), "decor"(가게 꾸미기 창), "settings", "kitchen", "promote", nil(닫기)
-- "shop"(tab: "upgrade"/"staff"/"mine"), "settings", "kitchen", "promote", nil(닫기)
open: (which: string?, tab: string?) -> (),
menuOpen: () -> boolean, -- 창이 열려 있으면 true(마우스 커서를 풀어 줌)
-- 가게 꾸미기 창에서 물건(kind = "table"/"chair"/"decor", k = 소품 종류)이나 [옮기기](kind = "move")를 골랐을 때
onDecorate: (fn: (kind: string, k: string?) -> ()) -> (),
onDecorate: (fn: () -> ()) -> (), -- [가게 꾸미기] 버튼을 눌렀을 때
kitchen: Kitchen.KitchenHandle,
shop: ShopWindow.Handle,
destroy: () -> (),
@@ -75,6 +75,10 @@ local TOAST_STYLE: { [string]: { icon: string, color: Color3 } } = {
rushOn = { icon = "bolt", color = Theme.YELLOW },
boostGot = { icon = "bolt", color = Theme.YELLOW },
doubleOwned = { icon = "moneyBag", color = Theme.LAVENDER },
removed = { icon = "check", color = Theme.MINT },
removeFail = { icon = "close", color = Theme.RED },
devFreeOn = { icon = "wrench", color = Theme.YELLOW },
devFreeOff = { icon = "wrench", color = Theme.GRAY },
guestBonus = { icon = "coin", color = Theme.MINT },
guestArrived = { icon = "customer", color = Theme.SKY },
guestSeated = { icon = "customer", color = Theme.SKY },
@@ -297,15 +301,10 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
dim.ZIndex = 10
dim.Parent = root
-- 상점 창(탭 3개)과 가게 꾸미기 창
local decorateFns: { (string, string?) -> () } = {}
local shop = ShopWindow.build(root, state, send, function(kind: string, k: string?)
for _, fn in decorateFns do
fn(kind, k)
end
end)
-- 상점 창(탭 3개)
local decorateFns: { () -> () } = {}
local shop = ShopWindow.build(root, state, send)
local panel = shop.frame
local decorPanel = shop.decorFrame
-- 홍보 확인 창: 광고를 보면 무엇을 받는지 먼저 알려 주고, 고르게 합니다(광고는 늘 선택).
local promotePanel = Theme.panel(root, "PromotePanel", Theme.SKY)
@@ -363,7 +362,7 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
local devRow, devTitle = settingRow(settings, "DevLabel", "wrench")
local devButtons: { [string]: Theme.Button } = {}
local devLabels: { [string]: TextLabel } = {}
for _, key in { "devMoney", "devDouble", "devReset" } do
for _, key in { "devMoney", "devFree", "devDouble", "devReset" } do
local b, t = Theme.textButton(settings, key, Color3.fromRGB(130, 120, 160), 16)
b.button.ZIndex = 3
devButtons[key] = b
@@ -444,11 +443,11 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
at(devRow, 22, devY, 360, 36)
end
local j = 0
for _, key in { "devMoney", "devDouble", "devReset" } do
for _, key in { "devMoney", "devFree", "devDouble", "devReset" } do
local db = devButtons[key].button
db.Visible = devY ~= nil
if devY then
at(db, 22 + j * 174, devY + 40, 164, r.devButtonH)
at(db, 22 + j * 130, devY + 40, 122, r.devButtonH)
end
j += 1
end
@@ -556,6 +555,9 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
for key, t in devLabels do
t.Text = L(key)
end
local free = attr(state, "DevFree", false) == true
devLabels.devFree.Text = L(if free then "devFreeBtnOff" else "devFreeBtnOn")
devButtons.devFree.setColor(if free then Theme.MINT else Color3.fromRGB(130, 120, 160))
listLabel.Text = L("btnShop")
decoLabel.Text = L("btnDecorate")
@@ -653,11 +655,6 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
else
shop.close()
end
if which == "decor" then
shop.openDecor()
else
shop.closeDecor()
end
settings.Visible = which == "settings"
promoteWin.Visible = which == "promote"
if which == "kitchen" then
@@ -673,7 +670,7 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
end
end
kitchen.onClose(function()
if not panel.Visible and not decorPanel.Visible and not settings.Visible and not promoteWin.Visible then
if not panel.Visible and not settings.Visible and not promoteWin.Visible then
dim.Visible = false
end
end)
@@ -712,7 +709,10 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
show(if panel.Visible then nil else "shop")
end)
on(decoBtn.button.Activated, function()
show(if decorPanel.Visible then nil else "decor")
show(nil)
for _, fn in decorateFns do
fn()
end
end)
on(dim.Activated, function()
-- 요리 중에는 바깥을 눌러도 닫지 않습니다(실수로 닫히지 않게).
@@ -728,11 +728,9 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
show(nil)
end)
end
for _, b in { shop.closeButton, shop.decorCloseButton } do
on(b.Activated, function()
show(nil)
end)
end
on(shop.closeButton.Activated, function()
show(nil)
end)
for l, b in langButtons do
on(b.button.Activated, function()
send("lang", l)
@@ -766,7 +764,8 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
send("promote", { ad = false })
end
end)
local devKinds: { [string]: string } = { devMoney = "dev_money", devDouble = "dev_double", devReset = "dev_reset" }
local devKinds: { [string]: string } =
{ devMoney = "dev_money", devFree = "dev_free", devDouble = "dev_double", devReset = "dev_reset" }
for key, kind in devKinds do
on(devButtons[key].button.Activated, function()
send(kind)
@@ -801,9 +800,9 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
end,
open = show,
menuOpen = function(): boolean
return panel.Visible or decorPanel.Visible or settings.Visible or promoteWin.Visible or kitchen.isOpen()
return panel.Visible or settings.Visible or promoteWin.Visible or kitchen.isOpen()
end,
onDecorate = function(fn: (string, string?) -> ())
onDecorate = function(fn: () -> ())
table.insert(decorateFns, fn)
end,
destroy = function()

View File

@@ -202,6 +202,13 @@ function Info.toast(lang: string, key: string, args: { [string]: any }?): string
if typeof(t.design) == "string" then
t.name = Locale.t(lang, "design_" .. t.design)
end
if typeof(t.thing) == "string" then
local thingKey = if t.thing == "table"
then "thing_Table"
elseif t.thing == "chair" then "thing_Seat"
else "thing_Decor"
t.name = Locale.t(lang, thingKey)
end
if typeof(t.why) == "string" then
t.reason = Locale.t(lang, "why_" .. t.why)
end

View File

@@ -37,11 +37,14 @@ export type Result = {
settingsPanel: Rect,
kitchen: Rect, -- 요리 창
confirm: Rect, -- 홍보 확인 창(광고 보기 / 그냥 홍보)
-- 꾸미기(놓기) 화면. 다른 UI는 숨기고, 캐릭터는 걸어 다니며 투명 미리보기를 옮깁니다(조이스틱·점프 그대로).
-- 꾸미기 모드. 다른 UI는 숨기고, 캐릭터는 걸어 다니며 투명 미리보기를 옮깁니다(조이스틱·점프 그대로).
deco: {
exit: Rect,
info: Rect, -- 든 물건 이름·값과 안내 글
tools: { Rect }, -- 아래 버튼 3개(돌리기·취소·놓기). 휴대폰은 조이스틱과 점프 버튼 사이
tools: { Rect }, -- 들고 있을 때 아래 버튼 3개(돌리기·취소·배치). 휴대폰은 조이스틱과 점프 버튼 사이
strip: Rect, -- 고를 때 아래 물건 줄(넘치면 옆으로 밀어 봄). 휴대폰은 조이스틱 자리 맨 아래 띠를 씀
move: Rect, -- 물건 줄 오른쪽 [이동]
delete: Rect, -- 물건 줄 오른쪽 [삭제]
},
-- 설정 창 안쪽 줄(설정 창 기준 y)
rows: {
@@ -197,6 +200,18 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
for i = 1, 3 do
tools[i] = rect(toolX + (i - 1) * (bs + toolGap), H - 8 - bs, bs, bs)
end
-- 물건 줄 + [이동] [삭제]: 휴대폰은 점프 버튼 왼쪽까지, PC는 가운데
local itemsW = 8 * bs + 7 * toolGap
local right = W - 8
if touch then
right = Layout.touchZones(w, h).jump.x / s - 8
end
local sideW = 2 * bs + toolGap
local stripW = math.min(itemsW, right - 8 - sideW - toolGap)
local stripX = if touch then 8 else math.max(8, cx - (stripW + toolGap + sideW) / 2)
local strip = rect(stripX, H - 8 - bs, stripW, bs)
local moveBtn = rect(stripX + stripW + toolGap, H - 8 - bs, bs, bs)
local deleteBtn = rect(moveBtn.x + bs + toolGap, H - 8 - bs, bs, bs)
return {
scale = s,
@@ -221,7 +236,7 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res
settingsPanel = settingsPanel,
kitchen = kitchen,
confirm = confirm,
deco = { exit = exit, info = info, tools = tools },
deco = { exit = exit, info = info, tools = tools, strip = strip, move = moveBtn, delete = deleteBtn },
rows = {
langButtonH = langButtonH,
mouseY = mouseY,

View File

@@ -138,26 +138,21 @@ hud.kitchen.onClose(function()
end)
Plots.start(world:WaitForChild("Plots"), player, player.UserId, send)
-- 꾸미기(놓기) 화면: [가게 꾸미기] 창에서 물건이나 [옮기기]를 고르면 엽니다.
-- 꾸미기 모드: 화면의 [가게 꾸미기] 버튼으로 들어갑니다.
-- 캐릭터는 걸어 다니며 투명 미리보기를 옮기고, 그동안 다른 화면 UI와 조리대 버튼(E)은 숨깁니다.
local deco = Decorate.build(player:WaitForChild("PlayerGui"), player, plot, send)
decorate = deco
deco.setLayout(hud.layout())
hud.onDecorate(function(kind: string, k: string?)
hud.open(nil)
deco.start(kind, k)
hud.onDecorate(function()
deco.open()
end)
deco.onOpen(function()
hud.gui.Enabled = false
ProximityPromptService.Enabled = false
end)
deco.onClose(function(placed: string?)
deco.onClose(function()
hud.gui.Enabled = true
ProximityPromptService.Enabled = true
-- 새 물건을 놓았으면 더 살 수 있게 가게 꾸미기 창을 다시 엽니다.
if placed == "new" then
hud.open("decor")
end
end)
Guide.start(player)

View File

@@ -85,14 +85,14 @@ local RAINBOW = ColorSequence.new({
ColorSequenceKeypoint.new(1, Color3.fromRGB(190, 80, 255)),
})
-- 무지개 켜기/끄기. 글자색은 흰색으로 바꿔야 그러데이션 색이 그대로 보이고, 끄면 원래 색으로 돌립니다.
-- 가게 이름 글자 꾸미기: 무지개(게임패스)가 켜져 있으면 무지개, 아니면 고른 색(NameColor, 0이면 디자인 기본색).
-- 무지개는 글자색을 흰색으로 바꿔야 그러데이션 색이 그대로 보입니다.
local original: { [TextLabel]: Color3 } = setmetatable({}, { __mode = "k" }) :: any
local spinning: { [UIGradient]: Tween } = setmetatable({}, { __mode = "k" }) :: any
local function setRainbow(t: TextLabel, on: boolean)
local g = t:FindFirstChild("RainbowGradient") :: UIGradient?
if on then
if not g then
original[t] = t.TextColor3
local ng = Instance.new("UIGradient")
ng.Name = "RainbowGradient"
ng.Color = RAINBOW
@@ -112,8 +112,17 @@ local function setRainbow(t: TextLabel, on: boolean)
tw:Cancel()
end
g:Destroy()
t.TextColor3 = original[t] or t.TextColor3
original[t] = nil
end
end
local function styleName(t: TextLabel, rainbow: boolean, colorIndex: any)
if not original[t] then
original[t] = t.TextColor3
end
setRainbow(t, rainbow)
if not rainbow then
local c = if typeof(colorIndex) == "number" then Economy.NAME_COLORS[colorIndex] else nil
t.TextColor3 = if c then Color3.fromRGB(c[1], c[2], c[3]) else original[t]
end
end
@@ -156,16 +165,17 @@ function Plots.attach(plot: Model, state: Instance, myId: number, send: (string,
function refresh()
local lang = (state:GetAttribute("Lang") :: string?) or "ko"
local rainbow = plot:GetAttribute("Rainbow") == true
local nameColor = plot:GetAttribute("NameColor")
local nameText = Plots.nameText(plot, lang)
for _, t in labels(nameBoard) do
t.Text = nameText
setRainbow(t, rainbow)
styleName(t, rainbow, nameColor)
end
local shopName = Plots.shopName(plot, lang)
for _, t in shopLabels do
if t.Parent then
t.Text = shopName
setRainbow(t, rainbow)
styleName(t, rainbow, nameColor)
end
end
local menuText = Plots.menuText(plot, lang)

View File

@@ -2,9 +2,8 @@
-- 상점 창: 왼쪽 큰 탭 버튼 3개와 탭 내용.
-- 업그레이드: 갈래(건물·메뉴·판매 금액·손님 속도·화구·쟁반·알바생 기능)마다 카드 한 장. 다음 단계 효과와 값, [사기]
-- 알바생: 역할(요리·서빙·홍보)별 고용·빼기, 시급
-- 내 가게: 가게 이름, 무지개 이름, 건물 디자인
-- 가게 꾸미기 창(상점과 따로, 화면의 [가게 꾸미기] 버튼): 테이블·의자·소품 카드와 큰 [옮기기] 버튼.
-- 카드를 누르면 창이 닫히고 그 물건을 투명하게 들고 걸어가서 놓습니다(Decorate). 돈은 놓을 때 나갑니다.
-- 내 가게: 가게 이름, 이름 색(무료 10색 + 무지개 게임패스), 건물 디자인
-- 가게 꾸미기는 상점과 따로(화면의 [가게 꾸미기] 버튼 → Decorate 꾸미기 모드).
-- 카드는 처음에 다 만들어 두고 속성이 바뀌면 글자·색만 바꿉니다. 칸 위치는 탭 내용 자리 비율이라 배치가 바뀌어도 그대로입니다.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
@@ -21,11 +20,6 @@ local ShopWindow = {}
export type Handle = {
frame: Frame,
closeButton: TextButton,
decorFrame: Frame, -- 가게 꾸미기 창
decorCloseButton: TextButton,
openDecor: () -> (),
closeDecor: () -> (),
decorOpen: () -> boolean,
open: (tab: string?) -> (),
close: () -> (),
isOpen: () -> boolean,
@@ -181,13 +175,7 @@ local function setCard(c: Card, mode: string, cost: number?, can: boolean?, stat
end
end
-- onDecorate(kind, k): 가게 꾸미기 창에서 고른 것. kind = "table" | "chair" | "decor"(k = 소품 종류) | "move"(옮기기)
function ShopWindow.build(
root: Frame,
state: Instance,
send: (string, any?) -> (),
onDecorate: (kind: string, k: string?) -> ()
): Handle
function ShopWindow.build(root: Frame, state: Instance, send: (string, any?) -> ()): Handle
local function lang(): string
return Info.attr(state, "Lang", "ko")
end
@@ -272,52 +260,7 @@ function ShopWindow.build(
end)
end
-- 2) 가게 꾸미기 창: 왼쪽 큰 [옮기기], 오른쪽 4x2 카드(테이블, 의자, 소품 6개)
local decorPanel = Theme.panel(root, "DecorPanel", Theme.MINT)
local decorFrame = decorPanel.frame
local decorPage = Theme.frame(decorPanel.body, "Page_decor")
decorPage.ZIndex = 3
local placeBtn = Theme.button(decorPage, "Place", Theme.MINT, 22)
cell(placeBtn.button, 1, 1, 5, 2, 1, 2)
placeBtn.button.ZIndex = 4
local placeIcon = Theme.icon(placeBtn.face, "Icon", "hand")
Theme.place(placeIcon, 0.5, 0.32, 0.8, 0.36)
placeIcon.ZIndex = 4
local placeLabel = Theme.text(placeBtn.face, "Label", Theme.edge(Theme.MINT))
Theme.place(placeLabel, 0.5, 0.62, 0.86, 0.14)
placeLabel.ZIndex = 4
local placeCount = Theme.text(placeBtn.face, "Count", Theme.edge(Theme.MINT))
Theme.place(placeCount, 0.5, 0.8, 0.86, 0.1)
placeCount.ZIndex = 4
on(placeBtn.button.Activated, function()
onDecorate("move", nil)
end)
local decorIds = { "Table", "Seat" }
for _, d in Economy.DECOR do
table.insert(decorIds, d.id)
end
local decorCards: { [string]: Card } = {}
for i, id in decorIds do
local c = makeCard(decorPage, "Decor_" .. id)
cell(c.holder, 2 + (i - 1) % 4, 1 + (i - 1) // 4, 5, 2)
c.note.Visible = false
c.title.Position = UDim2.fromScale(0.5, 0.56)
c.glyph.frame.Position = UDim2.fromScale(0.5, 0.28)
c.glyph.frame.Size = UDim2.fromScale(0.64, 0.4)
c.glyph.set(if id == "Table" then "table" elseif id == "Seat" then Info.SEAT_ICON else Info.DECOR_ICON[id])
decorCards[id] = c
on(c.buy.button.Activated, function()
if id == "Table" then
onDecorate("table", nil)
elseif id == "Seat" then
onDecorate("chair", nil)
else
onDecorate("decor", id)
end
end)
end
-- 3) 알바생: 위 띠(시급 합계 또는 파업 안내), 역할 카드 3장 / 아직 안 열렸으면 자물쇠 카드
-- 2) 알바생: 위 띠(시급 합계 또는 파업 안내), 역할 카드 3장 / 아직 안 열렸으면 자물쇠 카드
local staffOpen = Theme.frame(pages.staff, "Open")
staffOpen.Size = UDim2.fromScale(1, 1)
staffOpen.ZIndex = 3
@@ -397,7 +340,7 @@ function ShopWindow.build(
refresh()
end)
-- 4) 내 가게: 이름, 무지개, 디자인
-- 3) 내 가게: 이름, 이름 색(10색 + 무지개), 디자인
local mine = pages.mine
local function row(name: string, y: number, h: number): Frame
local f = Theme.frame(mine, name)
@@ -456,12 +399,49 @@ function ShopWindow.build(
end
end)
local rainbowRow = row("RainbowRow", 0.23, 0.17)
local rainbowTitle = Theme.text(rainbowRow, "Title", Theme.edge(Theme.LAVENDER))
rainbowTitle.TextXAlignment = Enum.TextXAlignment.Left
rainbowTitle.Position = UDim2.fromScale(0, 0.2)
rainbowTitle.Size = UDim2.fromScale(0.45, 0.6)
rainbowTitle.ZIndex = 4
-- 이름 색: 무료 10색 + 무지개(게임패스). 고른 색을 다시 누르면 디자인 기본색으로
local colorRow = row("ColorRow", 0.23, 0.17)
local colorTitle = Theme.text(colorRow, "Title")
colorTitle.TextXAlignment = Enum.TextXAlignment.Left
colorTitle.Position = UDim2.fromScale(0, 0.2)
colorTitle.Size = UDim2.fromScale(0.13, 0.6)
colorTitle.ZIndex = 4
type Swatch = { button: TextButton, stroke: UIStroke, check: ImageLabel }
local swatches: { Swatch } = {}
local SW = 0.87 / 11
local function makeSwatch(name: string, n: number, color: Color3): Swatch
local b = Instance.new("TextButton")
b.Name = name
b.Text = ""
b.AutoButtonColor = true
b.BorderSizePixel = 0
b.BackgroundColor3 = color
b.AnchorPoint = Vector2.new(0.5, 0.5)
b.Position = UDim2.fromScale(0.13 + SW * (n - 0.5), 0.5)
b.Size = UDim2.new(SW, -6, 0.9, 0)
b.ZIndex = 4
b.Parent = colorRow
Theme.corner(b, 12)
local st = Theme.stroke(b, Theme.LINE, 2)
local ok = Theme.icon(b, "Done", "check")
ok.AnchorPoint = Vector2.new(0.5, 0.5)
ok.Position = UDim2.fromScale(0.5, 0.5)
ok.Size = UDim2.fromScale(0.7, 0.7)
ok.SizeConstraint = Enum.SizeConstraint.RelativeYY
ok.ZIndex = 5
return { button = b, stroke = st, check = ok }
end
for n, c in Economy.NAME_COLORS do
local sw = makeSwatch("Color" .. n, n, Color3.fromRGB(c[1], c[2], c[3]))
swatches[n] = sw
on(sw.button.Activated, function()
local now = Info.attr(state, "NameColor", 0)
local rainbowOn = Info.attr(state, "RainbowOwned", false) == true
and Info.attr(state, "Rainbow", true) == true
send("nameColor", if now == n and not rainbowOn then 0 else n)
end)
end
local rainbowSw = makeSwatch("Rainbow", 11, Theme.WHITE)
local rainbowGrad = Instance.new("UIGradient")
rainbowGrad.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 70, 90)),
@@ -470,16 +450,13 @@ function ShopWindow.build(
ColorSequenceKeypoint.new(0.75, Color3.fromRGB(60, 140, 255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(180, 80, 255)),
})
rainbowGrad.Parent = rainbowTitle
local rainbowBtn, rainbowValue = Theme.textButton(rainbowRow, "Toggle", Theme.MINT, 18)
rainbowBtn.button.Position = UDim2.fromScale(0.5, 0)
rainbowBtn.button.Size = UDim2.fromScale(0.24, 1)
rainbowBtn.button.ZIndex = 4
local rainbowPrice, rainbowPriceText = pill(rainbowRow, "Price", Theme.LAVENDER)
rainbowPrice.AnchorPoint = Vector2.new(0, 0.5)
rainbowPrice.Position = UDim2.fromScale(0.77, 0.5)
rainbowPrice.Size = UDim2.fromScale(0.2, 0.7)
on(rainbowBtn.button.Activated, function()
rainbowGrad.Parent = rainbowSw.button
local rainbowPrice, rainbowPriceText = pill(rainbowSw.button, "Price", Theme.LAVENDER)
rainbowPrice.AnchorPoint = Vector2.new(0.5, 1)
rainbowPrice.Position = UDim2.new(0.5, 0, 0, 4)
rainbowPrice.Size = UDim2.fromScale(1.6, 0.4)
on(rainbowSw.button.Activated, function()
-- 게임패스가 없으면 결제 창, 있으면 켜기/끄기
send("rainbow", Info.attr(state, "Rainbow", true) ~= true or Info.attr(state, "RainbowOwned", false) ~= true)
end)
@@ -592,60 +569,6 @@ function ShopWindow.build(
return any
end
local function refreshDecor(stats: Economy.Stats, money: number): boolean
local seats = Info.attr(state, "Seats", 1)
local tables = Info.attr(state, "Tables", 1)
local layout = Info.layout(state)
local seatCap = Economy.seatCap(stats.stage)
local tableCap = Economy.tableCap(stats.stage)
decorPanel.title.Text = L("decorateTitle")
placeLabel.Text = L("moveItems")
placeCount.Text = L("seatsNow", { n = seats, max = seatCap })
local counts: { [string]: number } = {}
for _, d in layout.decor do
counts[d.k] = (counts[d.k] or 0) + 1
end
local any = false
local function buyable(c: Card, cost: number)
local can = money >= cost
any = any or can
setCard(c, "buy", cost, can)
end
for id, c in decorCards do
if id == "Table" then
c.title.Text = L("thing_Table")
c.tagText.Text = `{tables}/{tableCap}`
c.tag.Visible = true
if tables >= tableCap then
setCard(c, "off", nil, nil, L("full"))
else
buyable(c, Economy.tableCost(tables))
end
elseif id == "Seat" then
c.title.Text = L("thing_Seat")
c.tagText.Text = `{seats}/{seatCap}`
c.tag.Visible = true
if seats >= seatCap then
setCard(c, "off", nil, nil, L("full"))
else
buyable(c, Economy.seatCost(seats + 1))
end
else
local d = Economy.decor(id)
c.title.Text = L("decor_" .. id)
local n = counts[id] or 0
c.tag.Visible = n > 0
c.tagText.Text = `x{n}`
if #layout.decor >= Economy.DECOR_MAX or not d then
setCard(c, "off", nil, nil, L("full"))
else
buyable(c, d.cost)
end
end
end
return any
end
local function refreshStaff(stats: Economy.Stats, money: number)
staffOpen.Visible = stats.staffUnlocked
staffLocked.Visible = not stats.staffUnlocked
@@ -701,11 +624,18 @@ function ShopWindow.build(
box.Text = name
lastName = name
end
rainbowTitle.Text = "🌈 " .. L("rainbow")
colorTitle.Text = L("nameColor")
local owned = Info.attr(state, "RainbowOwned", false) == true
local onNow = owned and Info.attr(state, "Rainbow", true) == true
rainbowValue.Text = L(if onNow then "on" else "off")
rainbowBtn.setColor(if onNow then Theme.MINT else Theme.GRAY)
local chosen = if onNow then 11 else Info.attr(state, "NameColor", 0)
for n, sw in swatches do
sw.check.Visible = n == chosen
sw.stroke.Color = if n == chosen then Theme.edge(Theme.MINT) else Theme.LINE
sw.stroke.Thickness = if n == chosen then 4 else 2
end
rainbowSw.check.Visible = onNow
rainbowSw.stroke.Color = if onNow then Theme.edge(Theme.MINT) else Theme.LINE
rainbowSw.stroke.Thickness = if onNow then 4 else 2
local price = Info.robux("RAINBOW_NAME_PASS")
rainbowPrice.Visible = not owned and price ~= nil
rainbowPriceText.Text = price or ""
@@ -750,7 +680,6 @@ function ShopWindow.build(
end
-- 살 수 있는 것이 있는 탭에 ! 배지
tabBadges.upgrade.Visible = refreshUpgrade(levels, stats, money)
refreshDecor(stats, money)
refreshStaff(stats, money)
refreshMine(stats)
end
@@ -773,31 +702,11 @@ function ShopWindow.build(
page.Position = UDim2.fromOffset(c.x, c.y)
page.Size = UDim2.fromOffset(c.w, c.h)
end
decorFrame.AnchorPoint = Vector2.new(0.5, 0.5)
decorFrame.Position = frame.Position
decorFrame.Size = frame.Size
decorPanel.close.button.Size = UDim2.fromOffset(lay.rows.closeH, lay.rows.closeH)
local dc = lay.decorContent
decorPage.Position = UDim2.fromOffset(dc.x, dc.y)
decorPage.Size = UDim2.fromOffset(dc.w, dc.h)
end
return {
frame = frame,
closeButton = shopPanel.close.button,
decorFrame = decorFrame,
decorCloseButton = decorPanel.close.button,
openDecor = function()
decorFrame.Visible = true
Theme.pop(decorFrame)
refresh()
end,
closeDecor = function()
decorFrame.Visible = false
end,
decorOpen = function()
return decorFrame.Visible
end,
open = function(tab: string?)
if tab and TAB_INFO[tab] then
current = tab

View File

@@ -19,6 +19,7 @@ Data.TEMPLATE = {
Staff = {} :: { [string]: number }, -- 고용한 알바 수
ShopName = "", -- 가게 이름 원문("" = 기본 이름)
Rainbow = true, -- 무지개 이름 켜기(게임패스가 있을 때만 보임)
NameColor = 0, -- 가게 이름 글자색(Economy.NAME_COLORS 번호, 0 = 디자인 기본색)
Design = "Basic",
RushLeft = 0, -- 손님 러시 남은 초
KickCredits = 0, -- 산 "손님 쫓아내기" 남은 횟수

View File

@@ -34,6 +34,10 @@ local guestAt: { [Player]: PlotController.PlotController } = {} -- 손님으로
local bonusAt: { [Player]: number } = {} -- 다음 시식 보너스를 받을 수 있는 시각
local kickTarget: { [Player]: { index: number, expires: number } } = {} -- 결제 창을 띄운 쫓아내기 대상
local adBusy: { [Player]: boolean } = {}
local devFree: { [Player]: boolean } = {} -- 개발자 결제 테스트 모드(로벅스 버튼이 결제 없이 바로 지급, 이번 접속만)
-- 아래에서 정의(결제 테스트 모드에서 앞쪽 함수가 부름)
local grantProduct: (Player, PlotController.PlotController, number) -> boolean
local onPassBought: (Player, number, boolean) -> ()
local COOK_RANGE = 20 -- 요리 화면에서 만든 접시는 조리대에서 이만큼 안에 있어야 받습니다
local VISIT_RANGE = 16 -- 입구에서 이만큼 안에 있어야 손님으로 들어가거나 쫓아낼 수 있습니다
@@ -263,6 +267,35 @@ local function visit(player: Player, index: any)
target:notify("guestArrived", { name = player.DisplayName })
end
-- 결제 테스트 모드(게임 주인만)
local function isFree(player: Player): boolean
return devFree[player] == true and isDev(player)
end
-- 개발자 상품 사기: 결제 테스트 모드면 결제 창 없이 바로 지급
local function buyProduct(player: Player, controller: PlotController.PlotController, id: number)
if id == 0 then
return
end
if isFree(player) then
grantProduct(player, controller, id)
else
MarketplaceService:PromptProductPurchase(player, id)
end
end
-- 게임패스 사기: 결제 테스트 모드면 결제 창 없이 이번 접속 동안 가진 것으로
local function buyPass(player: Player, passId: number)
if passId == 0 then
return
end
if isFree(player) then
onPassBought(player, passId, true)
else
MarketplaceService:PromptGamePassPurchase(player, passId)
end
end
-- 홍보 실행(광고 보상 또는 무료). 데려온 수를 돌려줍니다.
local function doPromote(controller: PlotController.PlotController): number
local sources = {}
@@ -307,6 +340,11 @@ local function promote(player: Player, controller: PlotController.PlotController
controller:notify("promoteNone")
return
end
if isFree(player) then
-- 결제 테스트 모드: 광고 없이 광고 보상을 바로 줍니다.
grantProduct(player, controller, Products.PROMOTE_AD_PRODUCT)
return
end
adBusy[player] = true
task.spawn(function()
local ok, result = pcall(function()
@@ -377,7 +415,7 @@ local function kick(player: Player, controller: PlotController.PlotController, i
doKick(player, controller, index)
elseif Products.KICK_PRODUCT ~= 0 then
kickTarget[player] = { index = index, expires = os.clock() + KICK_TARGET_TTL }
MarketplaceService:PromptProductPurchase(player, Products.KICK_PRODUCT)
buyProduct(player, controller, Products.KICK_PRODUCT)
end
end
@@ -448,6 +486,7 @@ local function onPlayerRemoving(player: Player)
bonusAt[player] = nil
kickTarget[player] = nil
adBusy[player] = nil
devFree[player] = nil
local host = guestAt[player]
if host then
host:releaseGuestByUser(player.UserId)
@@ -559,8 +598,21 @@ local function onAction(player: Player, kind: any, arg: any)
if typeof(arg) == "boolean" then
if controller.rainbowOwned then
controller:setRainbow(arg)
elseif Products.RAINBOW_NAME_PASS ~= 0 then
MarketplaceService:PromptGamePassPurchase(player, Products.RAINBOW_NAME_PASS)
else
buyPass(player, Products.RAINBOW_NAME_PASS)
end
end
elseif kind == "nameColor" then
if typeof(arg) == "number" and arg == math.floor(arg) and (arg == 0 or Economy.NAME_COLORS[arg]) then
controller:setNameColor(arg)
end
elseif kind == "remove" then
-- 꾸미기에서 지우기: { kind = "table"|"chair"|"decor", i }
if typeof(arg) == "table" and (arg.kind == "table" or arg.kind == "chair" or arg.kind == "decor") then
local i = num(arg.i)
if i and i == math.floor(i) then
local itemKind: string = arg.kind
controller:removeItem(itemKind, i)
end
end
elseif kind == "design" then
@@ -568,10 +620,7 @@ local function onAction(player: Player, kind: any, arg: any)
local d = Economy.design(arg)
local ok, why = controller:setDesign(arg)
if not ok and why == "locked" and d and d.pass then
local passId = (Products :: any)[d.pass] or 0
if passId ~= 0 then
MarketplaceService:PromptGamePassPurchase(player, passId)
end
buyPass(player, (Products :: any)[d.pass] or 0)
end
end
elseif kind == "promote" then
@@ -579,9 +628,7 @@ local function onAction(player: Player, kind: any, arg: any)
elseif kind == "kick" then
kick(player, controller, arg)
elseif kind == "rush" then
if Products.RUSH_PRODUCT ~= 0 then
MarketplaceService:PromptProductPurchase(player, Products.RUSH_PRODUCT)
end
buyProduct(player, controller, Products.RUSH_PRODUCT)
elseif kind == "visit" then
visit(player, arg)
elseif kind == "lang" then
@@ -597,7 +644,9 @@ local function onAction(player: Player, kind: any, arg: any)
end
elseif kind == "pass" then
-- 이미 가진 게임패스(로블록스 소유 확인이 늦었거나, 개발자 테스트로 꺼 둔 경우)면 결제 창 대신 바로 켭니다.
if Products.DOUBLE_MONEY_PASS ~= 0 and controller.shop.moneyMult == 1 then
if Products.DOUBLE_MONEY_PASS ~= 0 and controller.shop.moneyMult == 1 and isFree(player) then
buyPass(player, Products.DOUBLE_MONEY_PASS)
elseif Products.DOUBLE_MONEY_PASS ~= 0 and controller.shop.moneyMult == 1 then
task.spawn(function()
if ownsPass(player, Products.DOUBLE_MONEY_PASS) then
if controllers[player] == controller then
@@ -613,6 +662,23 @@ local function onAction(player: Player, kind: any, arg: any)
controller:addMoney(1000)
elseif kind == "dev_double" and isDev(player) then
controller:setDouble(controller.shop.moneyMult == 1)
elseif kind == "dev_free" and isDev(player) then
-- 결제 테스트 모드: 켜면 게임패스를 안 가진 상태로 바꾸고(사는 흐름을 볼 수 있게) 로벅스 버튼이 바로 지급됩니다.
-- 끄면 실제로 가진 게임패스로 되돌립니다.
local on = not devFree[player]
devFree[player] = on
player:SetAttribute("DevFree", on)
controller:setDouble(false)
controller:setRainbowOwned(false)
for _, d in Economy.DESIGNS do
if d.pass then
controller:setDesignOwned(d.id, false)
end
end
if not on then
task.spawn(checkPasses, player, controller)
end
controller:notify(if on then "devFreeOn" else "devFreeOff")
elseif kind == "dev_reset" and isDev(player) then
resetData(controller.data)
local slot = controller.slot
@@ -632,9 +698,7 @@ local function onAction(player: Player, kind: any, arg: any)
fresh:sync()
fresh:notify("devResetDone")
elseif kind == "boost" then
if Products.MONEY_BOOST_PRODUCT ~= 0 then
MarketplaceService:PromptProductPurchase(player, Products.MONEY_BOOST_PRODUCT)
end
buyProduct(player, controller, Products.MONEY_BOOST_PRODUCT)
end
end
@@ -647,7 +711,17 @@ function Game.processReceipt(info: { [string]: any }): Enum.ProductPurchaseDecis
if not controller or not player then
return false
end
local id = info.ProductId
return grantProduct(player, controller, info.ProductId)
end)
if decision == "Granted" then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
return Enum.ProductPurchaseDecision.NotProcessedYet
end
-- 개발자 상품 하나를 지급합니다(결제 확인 뒤, 또는 개발자 결제 테스트 모드). 지급했으면 true
function grantProduct(player: Player, controller: PlotController.PlotController, id: number): boolean
do
if id == Products.MONEY_BOOST_PRODUCT then
local amount = Economy.boostAmount(controller.shop.stats)
controller:addMoney(amount)
@@ -683,14 +757,10 @@ function Game.processReceipt(info: { [string]: any }): Enum.ProductPurchaseDecis
return true
end
return false
end)
if decision == "Granted" then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local function onPassBought(player: Player, passId: number, purchased: boolean)
function onPassBought(player: Player, passId: number, purchased: boolean)
local controller = controllers[player]
if not controller or passId == 0 then
return

View File

@@ -112,6 +112,15 @@ local function makeSound(parent: Instance, id: string, volume: number): Sound
return s
end
-- 저장된 가게 이름 색 번호(없거나 이상하면 0 = 기본색)
local function nameColorOf(data: any): number
local n = data.NameColor
if typeof(n) == "number" and Economy.NAME_COLORS[n] then
return n
end
return 0
end
local function serverNow(): number
return workspace:GetServerTimeNow()
end
@@ -168,6 +177,7 @@ function PlotController.new(slot: Slot, owner: Instance, opts: Options): PlotCon
end
model:SetAttribute("ShopName", "")
model:SetAttribute("Rainbow", false)
model:SetAttribute("NameColor", 0)
model:SetAttribute("ShieldUntil", 0)
-- 튜토리얼 화살표가 가리킬 보이지 않는 표시
@@ -256,6 +266,7 @@ function PlotController.sync(self: PlotController)
o:SetAttribute("ShopName", self.data.ShopName or "")
o:SetAttribute("Rainbow", self.data.Rainbow ~= false)
o:SetAttribute("RainbowOwned", self.rainbowOwned)
o:SetAttribute("NameColor", nameColorOf(self.data))
o:SetAttribute("Design", self.data.Design or "Basic")
local owned = {}
for _, d in Economy.DESIGNS do
@@ -271,6 +282,7 @@ function PlotController.sync(self: PlotController)
model:SetAttribute("PriceMult", stats.price)
model:SetAttribute("Design", self.data.Design or "Basic")
model:SetAttribute("Rainbow", self.rainbowOwned and self.data.Rainbow ~= false)
model:SetAttribute("NameColor", nameColorOf(self.data))
end
function PlotController.syncLayout(self: PlotController)
@@ -1100,6 +1112,35 @@ function PlotController.buyDecor(self: PlotController, kind: string): boolean
return self:buyItem("decor", kind, nil, nil)
end
-- 꾸미기에서 물건 지우기. 산 값을 돌려줍니다(지금 다시 살 때 값과 같음).
-- 실패 이유(removeFail why): stove, last, hasChairs, busy(손님이 앉아 있거나 오는 중), 그 밖은 Floor.validate 이유
function PlotController.removeItem(self: PlotController, kind: string, i: number): boolean
local layout, why = Floor.remove(self.layout, self:stage(), kind, i)
if not layout then
self:notify("removeFail", { why = why or "none" })
return false
end
local refund = 0
if kind == "chair" then
if not Shop.removeSeat(self.shop, i) then
self:notify("removeFail", { why = "busy" })
return false
end
refund = Economy.seatCost(#self.layout.chairs)
elseif kind == "table" then
refund = Economy.tableCost(#self.layout.tables - 1)
elseif kind == "decor" then
local d = Economy.decor(self.layout.decor[i].k)
refund = if d then d.cost else 0
end
self.layout = layout
Shop.addMoney(self.shop, refund)
self:applyLayout()
self:notify("removed", { thing = kind, money = Locale.number(refund) })
self:sync()
return true
end
-- 화면 아래 추천 막대의 [사기]
function PlotController.buyOffer(self: PlotController, id: string): boolean
if id == "Seat" then
@@ -1173,6 +1214,17 @@ function PlotController.setRainbow(self: PlotController, on: boolean)
self:sync()
end
function PlotController.nameColor(self: PlotController): number
return nameColorOf(self.data)
end
-- 가게 이름 글자색(0 = 기본). 색을 고르면 무지개는 끕니다.
function PlotController.setNameColor(self: PlotController, n: number)
self.data.NameColor = if Economy.NAME_COLORS[n] then n else 0
self.data.Rainbow = false
self:sync()
end
function PlotController.setRainbowOwned(self: PlotController, owned: boolean)
self.rainbowOwned = owned
self:sync()
@@ -1380,7 +1432,19 @@ function PlotController.destroy(self: PlotController)
end
PlotBuilder.placeStall(refs, self.slot.cf, Floor.default().stove)
for _, key in
{ "OwnerId", "OwnerName", "Npc", "Level", "Stage", "Menus", "PriceMult", "ShopName", "Rainbow", "Design" }
{
"OwnerId",
"OwnerName",
"Npc",
"Level",
"Stage",
"Menus",
"PriceMult",
"ShopName",
"Rainbow",
"NameColor",
"Design",
}
do
self.slot.model:SetAttribute(key, nil)
end

View File

@@ -237,6 +237,21 @@ end
Economy.NAME_MAX = 20 -- 가게 이름 최대 글자 수
-- 가게 이름 글자색(무료 10가지). 0 = 건물 디자인 기본색. 무지개(게임패스)를 켜면 무지개가 먼저 보입니다.
-- 이름은 Locale "color_<번호>"
Economy.NAME_COLORS = {
{ 230, 50, 50 }, -- 빨강
{ 255, 140, 30 }, -- 주황
{ 255, 210, 40 }, -- 노랑
{ 60, 185, 80 }, -- 초록
{ 70, 200, 230 }, -- 하늘
{ 50, 100, 230 }, -- 파랑
{ 150, 80, 220 }, -- 보라
{ 255, 110, 170 }, -- 분홍
{ 255, 255, 255 }, -- 흰색
{ 30, 30, 35 }, -- 검정
} :: { { number } }
function Economy.level(levels: Levels, id: string): number
return levels[id] or 0
end

View File

@@ -712,6 +712,46 @@ function Floor.add(layout: Layout, stage: number, a: Add): (Layout?, string?, nu
return test, nil, index
end
-- 물건 하나를 뺀 새 배치(꾸미기에서 삭제). 문제없으면 (새 배치, nil), 아니면 (nil, 이유)
-- 이유: "stove"(조리대는 못 지움), "last"(마지막 테이블·의자), "hasChairs"(이 테이블을 보는 의자가 있음), "none"
function Floor.remove(layout: Layout, stage: number, kind: string, i: number): (Layout?, string?)
local test = Floor.clone(layout)
if kind == "stove" then
return nil, "stove"
elseif kind == "table" then
if not test.tables[i] then
return nil, "none"
end
if #test.tables <= 1 then
return nil, "last"
end
if chairsByTable(layout)[i] then
return nil, "hasChairs"
end
table.remove(test.tables, i)
elseif kind == "chair" then
if not test.chairs[i] then
return nil, "none"
end
if #test.chairs <= 1 then
return nil, "last"
end
table.remove(test.chairs, i)
elseif kind == "decor" then
if not test.decor[i] then
return nil, "none"
end
table.remove(test.decor, i)
else
return nil, "none"
end
local why = Floor.validate(test, stage)
if why then
return nil, why
end
return test, nil
end
-- 2층 건물로 올릴 때처럼 배치가 더 이상 맞지 않으면, 문제 있는 물건을 빈 곳으로 옮깁니다.
-- 테이블은 자기를 보는 의자와 같이 옮기고, 남은 의자는 빈 테이블 쪽에 다시 붙입니다(자리 수는 그대로).
function Floor.repair(layout: Layout, stage: number): Layout

View File

@@ -135,6 +135,25 @@ local STRINGS: { [string]: { [string]: string } } = {
moveItems = "옮기기",
decoKeys = "(R 돌리기 · F 놓기)",
why_money = "돈이 모자라요",
btnMove = "이동",
btnDelete = "삭제",
decoChoose = "아래에서 놓을 물건을 골라요. [이동]·[삭제]로 놓은 가구를 고쳐요",
decoPickMove = "이동할 가구를 고르세요(누르기)",
decoPickDelete = "삭제할 가구를 고르세요(누르기)",
decoDeleteAsk = "[삭제]를 누르면 지우고 {money}원을 돌려받아요",
why_stove = "조리대는 지울 수 없어요(이동은 돼요)",
why_last = "마지막 테이블·의자는 지울 수 없어요",
why_hasChairs = "이 테이블을 보는 의자를 먼저 옮기거나 지워요",
why_busy = "손님이 앉아 있는 의자예요. 다 먹고 나면 지워요",
removed = "{name}을(를) 지우고 {money}원을 돌려받았어요",
removeFail = "못 지워요: {reason}",
thing_Decor = "소품",
nameColor = "이름 색",
devFree = "결제 테스트 켜기",
devFreeBtnOn = "결제 테스트 켜기",
devFreeBtnOff = "결제 테스트 끄기",
devFreeOn = "결제 테스트 모드: 로벅스 버튼이 결제 없이 바로 돼요(이번 접속만). 게임패스는 안 가진 상태로 바꿨어요",
devFreeOff = "결제 테스트 모드를 껐어요. 실제로 가진 게임패스로 돌아가요",
seatsNow = "자리 {n}/{max}",
decorNow = "소품 {n}/{max}",
staffLockedCard = "알바생 기능 업그레이드를 사면 열려요",
@@ -349,6 +368,25 @@ local STRINGS: { [string]: { [string]: string } } = {
moveItems = "Move",
decoKeys = "(R turn · F place)",
why_money = "Not enough money",
btnMove = "Move",
btnDelete = "Delete",
decoChoose = "Pick something below to place. Use [Move]/[Delete] to fix furniture",
decoPickMove = "Tap the furniture to move",
decoPickDelete = "Tap the furniture to delete",
decoDeleteAsk = "Tap [Delete] to remove it and get {money} back",
why_stove = "The stove can't be deleted (you can move it)",
why_last = "You can't delete your last table or chair",
why_hasChairs = "Move or delete the chairs facing this table first",
why_busy = "A customer is sitting there. Try after they finish",
removed = "Removed {name} and got {money} back",
removeFail = "Can't delete: {reason}",
thing_Decor = "Decor",
nameColor = "Name color",
devFree = "Test pay ON",
devFreeBtnOn = "Test pay ON",
devFreeBtnOff = "Test pay OFF",
devFreeOn = "Test pay mode: Robux buttons work for free (this session). Game passes were reset to not owned",
devFreeOff = "Test pay mode off. Back to the game passes you really own",
seatsNow = "Seats {n}/{max}",
decorNow = "Decor {n}/{max}",
staffLockedCard = "Buy the Staff Unlock upgrade to open this",
@@ -563,6 +601,25 @@ local STRINGS: { [string]: { [string]: string } } = {
moveItems = "動かす",
decoKeys = "(R 回す · F 置く)",
why_money = "お金が足りないよ",
btnMove = "移動",
btnDelete = "削除",
decoChoose = "下から置く物を選んでね。[移動]・[削除]で家具をなおせるよ",
decoPickMove = "移動する家具をタップしてね",
decoPickDelete = "削除する家具をタップしてね",
decoDeleteAsk = "[削除]を押すと消して{money}円もどってくるよ",
why_stove = "コンロは消せないよ(移動はできるよ)",
why_last = "最後のテーブル・いすは消せないよ",
why_hasChairs = "このテーブルを向いたいすを先に動かすか消してね",
why_busy = "お客さんが座っているいすだよ。食べ終わったら消してね",
removed = "{name}を消して{money}円もどってきたよ",
removeFail = "消せないよ: {reason}",
thing_Decor = "小物",
nameColor = "名前の色",
devFree = "課金テスト オン",
devFreeBtnOn = "課金テスト オン",
devFreeBtnOff = "課金テスト オフ",
devFreeOn = "課金テストモード: Robuxボタンが支払いなしで使えます(今回だけ)。ゲームパスは持っていない状態にしました",
devFreeOff = "課金テストモードをオフにしました。実際に持っているゲームパスに戻ります",
seatsNow = "席 {n}/{max}",
decorNow = "かざり {n}/{max}",
staffLockedCard = "「アルバイト解放」を買うと開くよ",
@@ -777,6 +834,25 @@ local STRINGS: { [string]: { [string]: string } } = {
moveItems = "移动",
decoKeys = "(R 旋转 · F 放下)",
why_money = "钱不够",
btnMove = "移动",
btnDelete = "删除",
decoChoose = "从下面选要摆放的东西。用[移动]·[删除]调整家具",
decoPickMove = "点要移动的家具",
decoPickDelete = "点要删除的家具",
decoDeleteAsk = "按[删除]就会删掉并退回{money}元",
why_stove = "灶台不能删除(可以移动)",
why_last = "最后一张桌子或椅子不能删除",
why_hasChairs = "先移动或删除朝向这张桌子的椅子",
why_busy = "有客人坐在这把椅子上。吃完再删吧",
removed = "删除了{name},退回{money}元",
removeFail = "不能删除: {reason}",
thing_Decor = "摆件",
nameColor = "名字颜色",
devFree = "付费测试 开",
devFreeBtnOn = "付费测试 开",
devFreeBtnOff = "付费测试 关",
devFreeOn = "付费测试模式: Robux按钮无需付款即可使用(仅本次)。游戏通行证已改为未拥有",
devFreeOff = "已关闭付费测试模式。恢复为实际拥有的游戏通行证",
seatsNow = "座位 {n}/{max}",
decorNow = "装饰 {n}/{max}",
staffLockedCard = "购买“解锁店员”升级后开放",

View File

@@ -507,6 +507,36 @@ function Shop.setSeats(self: Shop, seats: number)
self.nextSpawn = math.min(self.nextSpawn, self.now + 1)
end
-- 자리(의자) 하나를 뺍니다(꾸미기에서 의자 삭제). 누가 앉아 있거나 오는 중이면 false.
-- 뒤 번호 자리의 손님·걷는 시간은 한 칸씩 당깁니다(배치의 chairs 목록에서 빠진 것과 같게).
function Shop.removeSeat(self: Shop, seat: number): boolean
if self.seatTaken[seat] ~= nil or seat < 1 or seat > self.stats.seats or self.stats.seats <= 1 then
return false
end
local taken: { [number]: number } = {}
for _, c in self.customers do
if c.seat > seat then
c.seat -= 1
end
taken[c.seat] = c.id
end
self.seatTaken = taken
local walk: { [number]: number } = {}
for s, w in self.seatWalk do
if s < seat then
walk[s] = w
elseif s > seat then
walk[s - 1] = w
end
end
self.seatWalk = walk
if self.lastSeat >= seat then
self.lastSeat = math.max(0, self.lastSeat - 1)
end
Shop.setSeats(self, self.stats.seats - 1)
return true
end
-- 알바생 고용·해고. 고용은 고용비를 냅니다. 실패 이유: "locked", "max", "money", "none"
function Shop.hire(self: Shop, roleId: string): (boolean, string?)
local r = Economy.role(roleId)

View File

@@ -182,6 +182,22 @@ T.check(Floor.addDecor(d, 1, "Rug") ~= nil, "러그 놓기")
T.eq(Floor.addDecor(d, 1, "Stove"), nil, "조리대는 소품 아님")
T.eq(Floor.validate(d, 1), nil, "소품 배치 통과")
-- 지우기
local rm = Floor.clone(base)
Floor.addTable(rm, 1)
Floor.addChair(rm, 1, 1)
Floor.addDecor(rm, 1, "Plant")
T.eq(select(2, Floor.remove(rm, 1, "stove", 1)), "stove", "조리대는 못 지움")
T.eq(select(2, Floor.remove(rm, 1, "table", 1)), "hasChairs", "의자가 보는 테이블은 못 지움")
local noTable2 = Floor.remove(rm, 1, "table", 2)
T.check(noTable2 ~= nil and #noTable2.tables == 1, "의자 없는 테이블 지우기")
local oneChair = Floor.remove(rm, 1, "chair", 1)
T.check(oneChair ~= nil and #oneChair.chairs == 1, "의자 지우기")
T.eq(oneChair and select(2, Floor.remove(oneChair, 1, "chair", 1)), "last", "마지막 의자는 못 지움")
local noPlant = Floor.remove(rm, 1, "decor", 1)
T.check(noPlant ~= nil and #noPlant.decor == 0, "소품 지우기")
T.eq(#rm.decor, 1, "원래 배치는 그대로")
-- 저장값 정리
local cleaned =
Floor.clean({ stove = { x = "a" }, tables = { { x = 1, z = 2, f = 9 } }, chairs = { { t = 5, s = 1 } } })

View File

@@ -109,6 +109,34 @@ for _, d in DEVICES do
-- 꾸미기 화면 버튼: 화면 안, 서로 안 겹침, 누르기 쉬움
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

View File

@@ -226,4 +226,24 @@ T.eq(Shop.removeGuest(r, rg.id), nil, "두 번은 안 됨")
Shop.tick(r, 0)
T.eq(Shop.removeGuest(r, 2), nil, "NPC 손님은 removeGuest로 못 뺌")
-- 자리 빼기(꾸미기에서 의자 삭제): 앉은 자리는 못 빼고, 뒤 번호 손님은 한 칸 당겨짐
local rs = Shop.new({ money = 0, now = 0, seats = 3 })
rs.seatWalk = { 2, 3, 4 }
Shop.tick(rs, 0) -- 첫 손님
local first = next(rs.customers)
local c1 = first and rs.customers[first]
T.check(c1 ~= nil, "손님 1명")
if c1 then
c1.seat = 3
rs.seatTaken = { [3] = c1.id }
T.check(not Shop.removeSeat(rs, 3), "손님이 있는 자리는 못 뺌")
T.check(Shop.removeSeat(rs, 1), "빈 자리 빼기")
T.eq(rs.stats.seats, 2, "자리 2")
T.eq(c1.seat, 2, "뒤 손님 자리 번호가 당겨짐")
T.eq(rs.seatTaken[2], c1.id, "앉은 자리 표시도 당겨짐")
T.eq(rs.seatWalk[1], 3, "걷는 시간도 당겨짐")
end
local last = Shop.new({ money = 0, now = 0, seats = 1 })
T.check(not Shop.removeSeat(last, 1), "마지막 자리는 못 뺌")
T.done("Shop.spec")

View File

@@ -5,6 +5,7 @@ local StarterPlayer = game:GetService("StarterPlayer")
local Client = StarterPlayer.StarterPlayerScripts.Client
local Hud = require(Client.Hud)
local Decorate = require(Client.Decorate)
local Layout = require(Client.Layout)
local Icons = require(game:GetService("ReplicatedStorage").Shared.Icons)
@@ -176,8 +177,8 @@ local SHOTS = {
),
shot("phone_tut", PHONE, shopState("", 1, 1, { Money = 15, Tut = 3 })),
shot("phone_shop", PHONE, shopState(EARLY, 2, 1, { Money = 150 }), { open = "shop" }),
shot("phone_decor", PHONE, shopState(MID, 3, 2, { Money = 400, Layout = LAYOUT }), { open = "decor" }),
shot("pc_decor", PC, shopState(MID, 3, 2, { Money = 60, Layout = LAYOUT }), { open = "decor" }),
shot("phone_deco", PHONE, shopState(MID, 3, 2, { Money = 120, Layout = LAYOUT }), { deco = true }),
shot("pc_deco", PC, shopState(MID, 3, 2, { Money = 120, Layout = LAYOUT }), { deco = true }),
shot("pc_tut", PC, shopState("", 1, 1, { Money = 15, Tut = 3 })),
shot(
"phone_shop_staff",
@@ -314,6 +315,17 @@ for _, s in SHOTS do
end
end
hud.refresh()
local gui = hud.gui
local deco = nil
if s.deco then
-- 꾸미기 모드: 화면 UI는 숨기고 꾸미기 화면만
local plotStub = Instance.new("Model")
plotStub:SetAttribute("Origin", CFrame.new())
deco = Decorate.build(holder, state, plotStub, function() end)
deco.setLayout(hud.layout())
deco.open()
gui = deco.gui
end
task.wait(0.3)
local zones = Layout.touchZones(s.w, s.h)
table.insert(shots, {
@@ -323,8 +335,11 @@ for _, s in SHOTS do
inset = s.inset,
touch = s.touch,
zones = zones,
gui = dump(hud.gui, 1),
gui = dump(gui, 1),
})
if deco then
deco.destroy()
end
hud.destroy()
end

View File

@@ -161,22 +161,7 @@ for _, id in Economy.TRACK_ORDER do
end
local tray = page("upgrade"):FindFirstChild("Track_Tray", true) :: Frame
check((tray:FindFirstChild("Lock", true) :: ImageLabel).Visible, "쟁반은 포장마차에서 잠김")
hud.open("decor")
local decorPanel = root:FindFirstChild("DecorPanel") :: Frame
check(decorPanel.Visible and not panel.Visible and hud.menuOpen(), "가게 꾸미기 창(상점과 따로)")
local decorPage = decorPanel:FindFirstChild("Page_decor", true) :: Frame
check(decorPage ~= nil, "가게 꾸미기 카드 자리")
eq(label(decorPage:FindFirstChild("Place", true)), "옮기기", "옮기기 버튼")
for _, id in { "Table", "Seat" } do
check(decorPage:FindFirstChild("Decor_" .. id, true) ~= nil, `{id} 카드`)
end
for _, d in Economy.DECOR do
check(decorPage:FindFirstChild("Decor_" .. d.id, true) ~= nil, `소품 카드 {d.id}`)
end
local tableCost = (decorPage:FindFirstChild("Decor_Table", true) :: Frame):FindFirstChild("Buy", true)
eq(label(tableCost), Locale.number(Economy.tableCost(1)), "테이블 값(의자 없이)")
hud.open("shop", "upgrade")
check(not decorPanel.Visible and panel.Visible, "창은 하나만 열림(꾸미기 → 상점)")
check(root:FindFirstChild("DecorPanel") == nil, "가게 꾸미기 창 없음(바로 꾸미기 모드)")
hud.open("shop", "staff")
check((page("staff"):FindFirstChild("Locked", true) :: Frame).Visible, "알바생 기능 전에는 잠김")
state:SetAttribute("Levels", "Staff=1")
@@ -188,6 +173,17 @@ for _, r in Economy.ROLES do
end
hud.open("shop", "mine")
check(page("mine"):FindFirstChild("NameBox", true) ~= nil, "가게 이름 입력칸")
for n = 1, #Economy.NAME_COLORS do
check(page("mine"):FindFirstChild("Color" .. n, true) ~= nil, `이름 색 {n}`)
end
local rainbowSw = page("mine"):FindFirstChild("Rainbow", true)
check(rainbowSw ~= nil, "무지개 칸")
state:SetAttribute("NameColor", 4)
check((page("mine"):FindFirstChild("Color4", true) :: Frame):FindFirstChild("Done").Visible, "고른 색에 체크")
check(
not (page("mine"):FindFirstChild("Color3", true) :: Frame):FindFirstChild("Done").Visible,
"안 고른 색은 체크 없음"
)
for _, d in Economy.DESIGNS do
check(page("mine"):FindFirstChild("Design_" .. d.id, true) ~= nil, `디자인 {d.id}`)
end
@@ -235,6 +231,10 @@ local SAMPLES = {
rushOn = { min = 10 },
notEnough = { need = "100" },
doubleOwned = {},
removed = { thing = "chair", money = "45" },
removeFail = { why = "hasChairs" },
devFreeOn = {},
devFreeOff = {},
}
for _, lang in { "ko", "en", "ja", "zh" } do
for key, args in SAMPLES do
@@ -292,6 +292,22 @@ for _, name in { "Exit", "Info", "Rotate", "Cancel", "Place" } do
end
check(droot:FindFirstChild("Floor") == nil and droot:FindFirstChild("Side1") == nil, "예전 층·쪽 버튼 없음")
check(not deco.isOpen() and not deco.holding(), "처음엔 닫힘")
local items = droot:FindFirstChild("Items") :: ScrollingFrame
check(items ~= nil, "아래 물건 줄")
for _, it in Decorate.ITEMS do
check(items:FindFirstChild("Item_" .. (it.k or it.kind)) ~= nil, `물건 줄 {it.k or it.kind}`)
end
deco.open()
check(deco.isOpen() and items.Visible, "꾸미기 모드: 물건 줄 보임")
check((droot:FindFirstChild("Move") :: GuiObject).Visible, "이동 버튼")
check((droot:FindFirstChild("Delete") :: GuiObject).Visible, "삭제 버튼")
check(not (droot:FindFirstChild("Place") :: GuiObject).Visible, "고를 때는 배치 버튼 숨김")
local itemTable = items:FindFirstChild("Item_table") :: TextButton
eq((itemTable:FindFirstChild("Price") :: TextLabel).Text, Locale.number(Economy.tableCost(1)), "테이블 값")
local infoT = (droot:FindFirstChild("Info") :: Frame):FindFirstChild("Text") :: TextLabel
check(string.find(infoT.Text, "이동") ~= nil, `안내 글 ({infoT.Text})`)
deco.close()
check(not deco.isOpen(), "나가기")
deco.destroy()
section("요리 창(메뉴 고르기 → 조리 과정 → 완성)")

View File

@@ -312,6 +312,30 @@ for _, d in { { 0, -4 }, { 0, 4 }, { 4, 0 }, { -4, 0 }, { 6, 6 }, { -6, -6 } } d
end
end
check(movedWith, "의자 붙은 테이블 옮기기")
-- 지우기(산 값 돌려받기)
local decorN = #c.layout.decor
local m0 = c.shop.money
check(c:removeItem("decor", 1), "소품 지우기")
eq(#c.layout.decor, decorN - 1, "소품 하나 줄어듦")
check(c.shop.money > m0, "소품 값 돌려받음")
check(noted("removed"), "지운 알림")
check(not c:removeItem("stove", 1), "조리대는 못 지움")
check(noted("removeFail"), "못 지우는 이유 알림")
local freeChair = nil
for ci in c.layout.chairs do
if c.shop.seatTaken[ci] == nil then
freeChair = ci
end
end
local seatsN = #c.layout.chairs
check(freeChair ~= nil and c:removeItem("chair", freeChair), "빈 의자 지우기")
eq(owner:GetAttribute("Seats"), seatsN - 1, "자리 수 줄어듦")
eq(c.shop.stats.seats, seatsN - 1, "손님 자리 수도 줄어듦")
check(furniture:FindFirstChild("Chair" .. seatsN) == nil, "의자 모형도 줄어듦")
local busy = next(c.shop.seatTaken)
if busy then
check(not c:removeItem("chair", busy), "손님이 앉은 의자는 못 지움")
end
c.shop.money = 0
check(not c:buyTable(), "돈 모자라면 테이블 못 삼")
check(not c:buyItem("chair", nil, { kind = "chair", x = 0, z = 0, f = 1, r = 0 }), "돈 모자라면 의자 못 놓음")
@@ -338,6 +362,14 @@ c:setRainbowOwned(true)
eq(slots[1].model:GetAttribute("Rainbow"), true, "게임패스 있으면 무지개")
c:setRainbow(false)
eq(slots[1].model:GetAttribute("Rainbow"), false, "무지개 끄기")
c:setRainbow(true)
c:setNameColor(3)
eq(slots[1].model:GetAttribute("NameColor"), 3, "이름 색 속성(모두에게)")
eq(owner:GetAttribute("NameColor"), 3, "이름 색 속성(내 화면)")
eq(slots[1].model:GetAttribute("Rainbow"), false, "색을 고르면 무지개는 꺼짐")
eq(data.NameColor, 3, "세이브에 이름 색")
c:setNameColor(99)
eq(owner:GetAttribute("NameColor"), 0, "없는 색은 기본색")
local Game = require(Server.Game)
eq(Game._cleanName(" 가나다\n라 "), "가나다 라", "이름 공백 정리")
eq(utf8.len(Game._cleanName(string.rep("가", 30)) :: string), Economy.NAME_MAX, "이름 길이 자르기")