diff --git a/bunsik-tycoon/SPEC.md b/bunsik-tycoon/SPEC.md index d55948b..0e2aace 100644 --- a/bunsik-tycoon/SPEC.md +++ b/bunsik-tycoon/SPEC.md @@ -20,7 +20,7 @@ - 1단계: 떡볶이 포장마차 1대, 테이블 1개 (튜토리얼) - 2단계: 메뉴 추가(김밥·순대·튀김·어묵), 손님 증가 - 3단계: 실내 분식집으로 확장, 직원 고용 -- 4단계: 2호점/멀티플로어, 인테리어 테마 해금 +- 4단계: 2층(2026-10-14 사용자 요청으로 2호점 대신), 인테리어 테마(건물 디자인) 해금 - 5단계: 전국 체인 + 한정 메뉴 + 별 5개 평점 제국 ## 5. 주요 시스템 @@ -117,9 +117,22 @@ - 그래서 MVP부터 한국어·영어를 같이 넣고, 홍보는 "K-푸드 타이쿤"으로 해외 유저까지 노립니다. - 콘텐츠 등급은 Minimal(가장 낮은 단계)을 목표로 합니다. Kids 계정은 Minimal·Mild만 볼 수 있습니다. +### F. 2026-10-14 개편(사용자 요청 목록 반영) +- 업그레이드를 갈래별로 나눔: 건물(포장마차 → 실내 분식집 → 2층), 메뉴, 판매 금액, 손님 속도, 화구, 쟁반, 알바생 기능. 수치는 `ECONOMY.md`, 코드는 `src/shared/Economy.luau`. +- 손님 간격 6초 → 10초(느리게). 빨리 오게 하는 방법: 손님 속도 갈래, 홍보 알바(x0.75), 손님 러시(유료, 10분 x0.5). +- 꾸미기: 테이블·의자·소품을 사서 원하는 곳에 놓고, 조리대(수레)도 옮김. 의자는 테이블의 앞·뒤·왼쪽·오른쪽 중 한 곳에 붙음(손님이 테이블을 보고 앉고 접시가 테이블 위에 놓이게). 검사는 서버가 다시 함: 부지 안, 겹침 없음, 문 앞·계단 비움, 문에서 조리대 앞과 모든 의자까지 길이 있어야 함(`src/shared/Floor.luau`). 손님은 그 길을 따라 걷고, 2층 손님은 계단을 올라감. +- 알바생: 알바생 기능 업그레이드 뒤 역할별 고용(요리·서빙·홍보). 시급은 1분마다 나가고, 돈이 모자라면 빚 없이 쉼. +- 가게 이름: 20자, TextService 필터를 거친 글만 다른 사람에게 보임(필터 실패 시 기본 이름). 무지개 이름은 게임패스. +- 건물 디자인: 실내 분식집부터. 무료 3종(기본·민트·벽돌), 유료 게임패스 2종(사탕 궁전·한옥). +- 홍보: 보상형 광고(AdService)를 보면 옆 가게 손님이 최대 3명 옴. 광고는 13세 미만·일부 지역에는 나오지 않고, 게임이 공개되고 월 방문자 2,000명 이상 등 조건을 채워야 나옵니다. 그래서 광고를 볼 수 없으면 광고 없이 3분마다 홍보할 수 있게 했습니다(광고가 진행을 막지 않게 하라는 로블록스 규칙에도 맞음). NPC 이웃 가게 손님부터 데려옵니다. +- 손님 쫓아내기(유료): 고른 옆 가게의 음식을 아직 못 받은 손님이 모두 일어나 우리 빈자리만큼 우리 가게로 옴. 다른 플레이어 가게에도 쓸 수 있어서 "돈 내고 남 괴롭히기"로 신고될 수 있습니다. 그래서 당한 가게는 3분 보호, 먹는 손님·플레이어 손님은 건드리지 않음, 당한 사람에게 알림. 출시 전에 NPC 이웃 가게에만 쓰게 바꿀지 다시 정합니다. +- 손님 외형: 사람이 가장 많이, 가끔 동물 손님. + ### E. 가격(초안, 출시 후 Managed Pricing으로 조정) | 상품 | 종류 | 가격 | |---|---|---| | 2배 수익 | 게임패스 | 199 로벅스 | | 돈 부스트 팩(현재 매출 10분치) | 개발자 상품 | 25 로벅스 | -| 자동 요리사, VIP 테마, 추가 가게 슬롯 | 게임패스(2차) | 149~299 로벅스 | +| 무지개 가게 이름 | 게임패스 | 99 로벅스 | +| 사탕 궁전·한옥 디자인 | 게임패스 | 각 149 로벅스 | +| 손님 러시(10분), 손님 쫓아내기(1회) | 개발자 상품 | 각 15 로벅스 | diff --git a/bunsik-tycoon/src/client/Decorate.luau b/bunsik-tycoon/src/client/Decorate.luau new file mode 100644 index 0000000..7fe646e --- /dev/null +++ b/bunsik-tycoon/src/client/Decorate.luau @@ -0,0 +1,772 @@ +--!strict +-- 꾸미기(배치) 화면: 상점 창 꾸미기 탭의 [배치하기]로 엽니다. +-- - 카메라가 내 가게 위에서 내려다봅니다(1층/2층 바꾸기). 위를 가리는 지붕·천장·2층 바닥은 내 화면에서만 숨깁니다. +-- - 물건(테이블·의자·소품·조리대)을 눌러 고르고, 바닥을 누르거나 끌어서 옮길 자리를 정합니다(0.5칸 단위). +-- 조리대·소품은 [돌리기], 의자는 쪽 버튼(앞·오른쪽·뒤·왼쪽)과 다른 테이블 누르기로 옮깁니다. +-- - 옮길 자리는 바닥에 초록(놓을 수 있음)/빨강(안 됨) 판으로 보이고, 안 되는 이유를 위에 씁니다. +-- 검사는 서버와 같은 Floor.move이고, [놓기]를 누르면 서버에 "move"를 보냅니다(서버가 다시 검사하고 모델을 다시 지음). +-- 캐릭터 조작 멈춤·다른 UI 숨기기는 Main이 onOpen/onClose로 합니다(요리 창과 같은 방식). + +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local UserInputService = game:GetService("UserInputService") + +local Shared = ReplicatedStorage:WaitForChild("Shared") +local Floor = require(Shared:WaitForChild("Floor")) +local Locale = require(Shared:WaitForChild("Locale")) +local Info = require(script.Parent:WaitForChild("Info")) +local Layout = require(script.Parent:WaitForChild("Layout")) +local Theme = require(script.Parent:WaitForChild("Theme")) + +local Decorate = {} + +export type Handle = { + gui: ScreenGui, + open: () -> (), + close: () -> (), + isOpen: () -> boolean, + onOpen: (fn: () -> ()) -> (), + onClose: (fn: () -> ()) -> (), + setLayout: (lay: Layout.Result) -> (), + notify: (key: string, args: { [string]: any }?) -> (), + destroy: () -> (), +} + +type Selection = { kind: string, i: number } + +local GOOD = Color3.fromRGB(70, 220, 120) +local BAD = Color3.fromRGB(255, 70, 70) +local HIDE_ABOVE = 4 -- 보는 층 바닥보다 이만큼 위에서 시작하는 부품은 숨김(천장·지붕·위층) + +local function snap(v: number): number + return math.floor(v * 2 + 0.5) / 2 +end + +-- 검사 없이 옮긴 배치(바닥 판 그리기용). Floor.move와 같은 규칙으로 바꿉니다. +local function applyMove(layout: Floor.Layout, m: Floor.Move): Floor.Layout + local test = Floor.clone(layout) + local f = if m.f == 2 then 2 else 1 + local r = math.floor(m.r or 0) % 4 + if m.kind == "stove" then + test.stove = { x = m.x, z = m.z, r = r } + elseif m.kind == "table" and test.tables[m.i] then + test.tables[m.i] = { x = m.x, z = m.z, f = f } + elseif m.kind == "decor" and test.decor[m.i] then + local d = test.decor[m.i] + test.decor[m.i] = { k = d.k, x = m.x, z = m.z, f = f, r = r } + elseif m.kind == "chair" and test.chairs[m.i] then + local c = test.chairs[m.i] + if m.z ~= 0 and test.tables[m.z] then + c.t = m.z + end + if Floor.SIDES[m.x] then + c.s = m.x + end + end + return test +end + +-- 물건의 층 +local function itemFloor(layout: Floor.Layout, kind: string, i: number): number + if kind == "table" then + local t = layout.tables[i] + return if t then t.f else 1 + elseif kind == "chair" then + local c = layout.chairs[i] + local t = c and layout.tables[c.t] + return if t then t.f else 1 + elseif kind == "decor" then + local d = layout.decor[i] + return if d then d.f else 1 + end + return 1 +end + +-- 물건의 지금 자리를 옮기기 요청 모양으로 +local function currentMove(layout: Floor.Layout, sel: Selection): Floor.Move? + if sel.kind == "stove" then + local s = layout.stove + return { kind = "stove", i = 1, x = s.x, z = s.z, f = 1, r = s.r } + elseif sel.kind == "table" then + local t = layout.tables[sel.i] + return t and { kind = "table", i = sel.i, x = t.x, z = t.z, f = t.f, r = 0 } + elseif sel.kind == "decor" then + local d = layout.decor[sel.i] + return d and { kind = "decor", i = sel.i, x = d.x, z = d.z, f = d.f, r = d.r } + elseif sel.kind == "chair" then + local c = layout.chairs[sel.i] + return c and { kind = "chair", i = sel.i, x = c.s, z = 0, f = 1, r = 0 } + end + return nil +end + +function Decorate.build(parent: Instance, state: Instance, plot: Model, send: (string, any?) -> ()): Handle + local function lang(): string + return Info.attr(state, "Lang", "ko") + end + local function L(key: string, args: { [string]: any }?): string + return Locale.t(lang(), key, args) + end + + local gui = Instance.new("ScreenGui") + gui.Name = "BunsikDecorate" + gui.ResetOnSpawn = false + gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling + gui.DisplayOrder = 5 + gui.Enabled = false + gui.Parent = parent + local root = Theme.frame(gui, "Root") + local scale = Instance.new("UIScale") + scale.Parent = root + + local exitBtn, exitLabel = Theme.iconButton(root, "Exit", Theme.RED, "close") + local floorBtn, floorLabel = Theme.textButton(root, "Floor", Theme.SKY, 22) + local infoBox = Theme.frame(root, "Info", Theme.WHITE) + Theme.round(infoBox) + local infoStroke = Theme.stroke(infoBox, Theme.edge(Theme.MINT), 4) + local infoIcon = Info.glyph(infoBox, "Icon", "hand") + infoIcon.frame.AnchorPoint = Vector2.new(0, 0.5) + infoIcon.frame.Position = UDim2.new(0, 10, 0.5, 0) + infoIcon.frame.Size = UDim2.new(0, 48, 0.8, 0) + local infoText = Theme.text(infoBox, "Text") + infoText.Position = UDim2.new(0, 64, 0.14, 0) + infoText.Size = UDim2.new(1, -80, 0.72, 0) + infoText.ZIndex = 2 + + 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 sideBtns: { Theme.Button } = {} + local sideLabels: { TextLabel } = {} + for s = 1, 4 do + local b, t = Theme.textButton(root, "Side" .. s, Theme.ORANGE, 22) + sideBtns[s] = b + sideLabels[s] = t + end + + -- 바닥 판과 고른 물건 빛 + local world = Instance.new("Folder") + world.Name = "BunsikDecorateGhost" + local highlight = Instance.new("Highlight") + highlight.FillColor = Theme.YELLOW + highlight.FillTransparency = 0.6 + highlight.OutlineColor = Theme.WHITE + highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop + highlight.Parent = world + local ghostParts: { BasePart } = {} + + local isOpen = false + local floorNow = 1 + local sel: Selection? = nil + local pending: Floor.Move? = nil + local valid = false + local why: string? = nil + local message: string? = nil + local messageToken = 0 + local dragging = false + local dragOffset = Vector2.zero + local openFns: { () -> () } = {} + local closeFns: { () -> () } = {} + local conns: { RBXScriptConnection } = {} + local openConns: { RBXScriptConnection } = {} + local hidden: { [BasePart]: boolean } = {} + local saved: { kind: Enum.CameraType, fov: number }? = nil + + local function origin(): CFrame? + local o = plot:GetAttribute("Origin") + return if typeof(o) == "CFrame" then o else nil + end + local function stage(): number + return Info.attr(state, "Stage", 1) + end + local function floorY(f: number): number + return Floor.BASE_Y + (if f == 2 then Floor.FLOOR2_Y else 0) + end + + -- 위를 가리는 부품 숨기기(내 화면에서만) + local function hideCheck(p: BasePart, o: CFrame) + local cf, sz = p.CFrame, p.Size + local halfY = math.abs(cf.RightVector.Y) * sz.X / 2 + + math.abs(cf.UpVector.Y) * sz.Y / 2 + + math.abs(cf.LookVector.Y) * sz.Z / 2 + local bottom = o:PointToObjectSpace(p.Position).Y - halfY + if bottom > floorY(floorNow) + HIDE_ABOVE then + hidden[p] = true + p.LocalTransparencyModifier = 1 + end + end + local function unhideAll() + for p in hidden do + p.LocalTransparencyModifier = 0 + end + table.clear(hidden) + end + local function hideAll() + unhideAll() + local o = origin() + local up = plot:FindFirstChild("Upgrades") + if not o or not up then + return + end + for _, d in up:GetDescendants() do + if d:IsA("BasePart") then + hideCheck(d, o) + end + end + end + + local function placeCamera() + local o = origin() + local camera = workspace.CurrentCamera + if not o or not camera then + return + end + local vp = camera.ViewportSize + local aspect = if vp.Y > 0 then vp.X / vp.Y else 16 / 9 + camera.CameraType = Enum.CameraType.Scriptable + camera.FieldOfView = 70 + local k = 2 * math.tan(math.rad(35)) + -- 깊이 56칸(+위아래 UI 자리), 너비 66칸이 다 보이는 높이 + local h = math.max(86 / k, 74 / (k * aspect)) + local center = o * CFrame.new(0, floorY(floorNow), (Floor.Z0 + Floor.Z1) / 2 + 3) + local eye = center.Position + o.UpVector * h + camera.CFrame = CFrame.lookAt(eye, center.Position, o.LookVector) + end + + -- 물건 모델 찾기 + local function itemModel(kind: string, i: number): Model? + if kind == "stove" then + local base = plot:FindFirstChild("Base") + local stall = base and base:FindFirstChild("Stall") + return if stall and stall:IsA("Model") then stall else nil + end + local up = plot:FindFirstChild("Upgrades") + local furniture = up and up:FindFirstChild("Furniture") + if not furniture then + return nil + end + for _, d in furniture:GetDescendants() do + if d:IsA("Model") and d:GetAttribute("ItemKind") == kind and d:GetAttribute("ItemIndex") == i then + return d + end + end + return nil + end + + local function clearGhost() + for _, p in ghostParts do + p:Destroy() + end + table.clear(ghostParts) + end + + local function drawGhost(layout: Floor.Layout, m: Floor.Move, ok: boolean) + clearGhost() + local o = origin() + if not o then + return + end + for _, pc in Floor.pieces(layout) do + local mine = pc.kind == m.kind and pc.index == m.i + if m.kind == "table" and pc.kind == "chair" then + local c = layout.chairs[pc.index] + mine = c ~= nil and c.t == m.i + end + if mine then + local r = pc.rect + local p = Instance.new("Part") + p.Name = "Ghost" + p.Anchored = true + p.CanCollide = false + p.CanQuery = false + p.CanTouch = false + p.CastShadow = false + p.Material = Enum.Material.SmoothPlastic + p.Color = if ok then GOOD else BAD + p.Transparency = 0.35 + p.Size = Vector3.new(math.max(0.2, r.x1 - r.x0), 0.3, math.max(0.2, r.z1 - r.z0)) + p.CFrame = o * CFrame.new((r.x0 + r.x1) / 2, floorY(r.f) + 0.3, (r.z0 + r.z1) / 2) + p.Parent = world + table.insert(ghostParts, p) + end + end + end + + local function itemName(s: Selection, layout: Floor.Layout): (string, string) + if s.kind == "stove" then + return L("stoveObject"), "flame" + elseif s.kind == "table" then + return `{L("thing_Table")} {s.i}`, "table" + elseif s.kind == "chair" then + return L("thing_Seat"), Info.SEAT_ICON + end + local d = layout.decor[s.i] + local k = if d then d.k else "" + return L("decor_" .. k), Info.DECOR_ICON[k] or "sparkle" + end + + local function place(o: GuiObject, r: Layout.Rect) + o.AnchorPoint = Vector2.new(0.5, 0.5) + o.Position = UDim2.fromOffset(r.x + r.w / 2, r.y + r.h / 2) + o.Size = UDim2.fromOffset(r.w, r.h) + end + + -- 화면 다시 그리기(안내 글, 버튼, 바닥 판) + local function redraw() + local layout = Info.layout(state) + local st = stage() + exitLabel.Text = L("exit") + floorBtn.button.Visible = st >= 3 + floorLabel.Text = L("floorN", { n = 3 - floorNow }) + rotateLabel.Text = L("rotate") + cancelLabel.Text = L("cancel") + okLabel.Text = L("placeIt") + for s = 1, 4 do + sideLabels[s].Text = L(`side_{s}`) + end + local s = sel + local kind = if s then s.kind else "" + local isChair = kind == "chair" + rotateBtn.button.Visible = kind == "stove" or kind == "decor" + for i, b in sideBtns do + b.button.Visible = isChair + local side = if pending and pending.kind == "chair" + then pending.x + elseif s and isChair and layout.chairs[s.i] then layout.chairs[s.i].s + else 0 + b.setColor(if i == side then Theme.ORANGE else Theme.lighten(Theme.ORANGE, 0.45)) + end + cancelBtn.button.Visible = pending ~= nil + okBtn.button.Visible = s ~= nil + okBtn.setColor(if pending and valid then Theme.MINT else Theme.GRAY) + + -- 안내 글 + local text: string + local color = Theme.MINT + if message then + text = message + color = Theme.ORANGE + elseif not s then + text = L("decoPick") + infoIcon.set("hand") + elseif pending and not valid then + text = L("why_" .. (why or "none")) + color = Theme.RED + elseif pending then + text = L("decoOk") + else + text = if isChair then L("decoChair") else L("decoMove") + end + if s then + local name, icon = itemName(s, layout) + infoIcon.set(icon) + text = `{name} · {text}` + end + infoText.Text = text + infoText.TextColor3 = if color == Theme.RED then Theme.edge(Theme.RED) else Theme.TEXT + infoStroke.Color = Theme.edge(color) + + -- 고른 물건 빛, 바닥 판 + highlight.Adornee = if s then itemModel(s.kind, s.i) else nil + if pending then + drawGhost(applyMove(layout, pending), pending, valid) + else + clearGhost() + end + end + + -- 옮길 자리 정하기(검사 포함) + local function setPending(m: Floor.Move?) + pending = m + message = nil + if m then + local layout = Info.layout(state) + local cur = sel and currentMove(layout, sel) + -- 제자리면 옮길 것 없음 + if cur and cur.x == m.x and cur.z == m.z and (cur.f or 1) == (m.f or 1) and (cur.r or 0) == (m.r or 0) then + pending = nil + else + local ok, reason = Floor.move(layout, stage(), m) + valid = ok ~= nil + why = reason + end + end + redraw() + end + + local function choose(s: Selection?) + sel = s + dragging = false + setPending(nil) + end + + -- 지금 옮기려는 모양(없으면 지금 자리) + local function base(): Floor.Move? + if pending then + return table.clone(pending) + end + local s = sel + return if s then currentMove(Info.layout(state), s) else nil + end + + local function floorPoint(sx: number, sy: number): Vector2? + local o = origin() + local camera = workspace.CurrentCamera + if not o or not camera then + return nil + end + local ray = camera:ScreenPointToRay(sx, sy) + local n = o.UpVector + local p0 = (o * CFrame.new(0, floorY(floorNow), 0)).Position + local denom = ray.Direction:Dot(n) + if math.abs(denom) < 1e-4 then + return nil + end + local t = (p0 - ray.Origin):Dot(n) / denom + if t < 0 then + return nil + end + local hit = o:PointToObjectSpace(ray.Origin + ray.Direction * t) + return Vector2.new(hit.X, hit.Z) + end + + local function pickItem(sx: number, sy: number): Selection? + local camera = workspace.CurrentCamera + if not camera then + return nil + end + local layout = Info.layout(state) + local list: { Instance } = {} + local up = plot:FindFirstChild("Upgrades") + local furniture = up and up:FindFirstChild("Furniture") + if furniture then + for _, d in furniture:GetDescendants() do + local kind = d:GetAttribute("ItemKind") + local i = d:GetAttribute("ItemIndex") + if + d:IsA("Model") + and typeof(kind) == "string" + and typeof(i) == "number" + and itemFloor(layout, kind, i) == floorNow + then + table.insert(list, d) + end + end + end + if floorNow == 1 then + local stall = itemModel("stove", 1) + if stall then + table.insert(list, stall) + end + end + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = list + local ray = camera:ScreenPointToRay(sx, sy) + local res = workspace:Raycast(ray.Origin, ray.Direction * 1000, params) + local inst: Instance? = res and res.Instance + while inst and inst ~= plot do + local kind = inst:GetAttribute("ItemKind") + local i = inst:GetAttribute("ItemIndex") + if inst:IsA("Model") and typeof(kind) == "string" and typeof(i) == "number" then + return { kind = kind, i = i } + end + inst = inst.Parent + end + return nil + end + + local function moveTo(p: Vector2) + local m = base() + if not m or m.kind == "chair" then + return + end + m.x = snap(p.X + dragOffset.X) + m.z = snap(p.Y + dragOffset.Y) + m.f = if m.kind == "stove" then 1 else floorNow + setPending(m) + end + + -- 누르기: 물건이면 고르기(의자를 고른 상태에서 테이블이면 그 테이블로), 바닥이면 옮기기 + local function press(sx: number, sy: number) + local hit = pickItem(sx, sy) + local s = sel + if hit and s and s.kind == "chair" and hit.kind == "table" then + local m = base() + if m then + m.z = hit.i + setPending(m) + end + return + end + if hit and s and hit.kind == s.kind and hit.i == s.i and s.kind ~= "chair" then + -- 고른 물건을 다시 누르면 끌어서 옮기기 + local p = floorPoint(sx, sy) + local m = base() + if p and m then + dragOffset = Vector2.new(m.x - p.X, m.z - p.Y) + dragging = true + end + return + end + if hit then + choose(hit) + return + end + if s and s.kind ~= "chair" then + local p = floorPoint(sx, sy) + if p then + dragOffset = Vector2.zero + moveTo(p) + dragging = true + end + end + end + + local function showMessage(text: string) + message = text + messageToken += 1 + local token = messageToken + redraw() + task.delay(3, function() + if token == messageToken then + message = nil + if isOpen then + redraw() + end + end + end) + end + + local function close() + if not isOpen then + return + end + isOpen = false + gui.Enabled = false + for _, c in openConns do + c:Disconnect() + end + table.clear(openConns) + sel = nil + pending = nil + dragging = false + clearGhost() + highlight.Adornee = nil + world.Parent = nil + unhideAll() + local camera = workspace.CurrentCamera + if camera and saved then + camera.FieldOfView = saved.fov + camera.CameraType = saved.kind + end + saved = nil + for _, fn in closeFns do + fn() + end + end + + local function open() + if isOpen or not origin() then + return + end + isOpen = true + floorNow = 1 + sel = nil + pending = nil + message = nil + local camera = workspace.CurrentCamera + if camera then + saved = { kind = camera.CameraType, fov = camera.FieldOfView } + end + world.Parent = workspace + gui.Enabled = true + hideAll() + placeCamera() + local up = plot:FindFirstChild("Upgrades") + if up then + -- 서버가 건물·가구를 다시 지으면 새 부품도 숨기고, 고른 물건 빛을 새 모델에 붙입니다. + table.insert( + openConns, + up.DescendantAdded:Connect(function(d) + task.defer(function() + local o = origin() + if isOpen and o and d:IsA("BasePart") and d.Parent then + hideCheck(d, o) + end + if isOpen and d:IsA("Model") then + redraw() + end + end) + end) + ) + end + if camera then + table.insert(openConns, camera:GetPropertyChangedSignal("ViewportSize"):Connect(placeCamera)) + end + redraw() + for _, fn in openFns do + fn() + end + end + + -- 입력 + table.insert( + conns, + UserInputService.InputBegan:Connect(function(io: InputObject, processed: boolean) + if not isOpen or processed then + return + end + local t = io.UserInputType + if t == Enum.UserInputType.MouseButton1 or t == Enum.UserInputType.Touch then + press(io.Position.X, io.Position.Y) + end + end) + ) + table.insert( + conns, + UserInputService.InputChanged:Connect(function(io: InputObject) + if not isOpen or not dragging then + return + end + local t = io.UserInputType + if t == Enum.UserInputType.MouseMovement or t == Enum.UserInputType.Touch then + local p = floorPoint(io.Position.X, io.Position.Y) + if p then + moveTo(p) + end + end + end) + ) + table.insert( + conns, + UserInputService.InputEnded:Connect(function(io: InputObject) + local t = io.UserInputType + if t == Enum.UserInputType.MouseButton1 or t == Enum.UserInputType.Touch then + dragging = false + end + end) + ) + table.insert(conns, exitBtn.button.Activated:Connect(close)) + table.insert( + conns, + floorBtn.button.Activated:Connect(function() + floorNow = 3 - floorNow + hideAll() + placeCamera() + -- 테이블·소품을 고른 채로 층을 바꾸면 그 층으로 옮기기 + local m = base() + if m and (m.kind == "table" or m.kind == "decor") then + m.f = floorNow + setPending(m) + else + redraw() + end + end) + ) + table.insert( + conns, + rotateBtn.button.Activated:Connect(function() + local m = base() + if m then + m.r = ((m.r or 0) + 1) % 4 + setPending(m) + end + end) + ) + for s, b in sideBtns do + table.insert( + conns, + b.button.Activated:Connect(function() + local m = base() + if m and m.kind == "chair" then + m.x = s + setPending(m) + end + end) + ) + end + table.insert( + conns, + cancelBtn.button.Activated:Connect(function() + setPending(nil) + end) + ) + table.insert( + conns, + okBtn.button.Activated:Connect(function() + local m = pending + if m and valid then + send("move", { kind = m.kind, i = m.i, x = m.x, z = m.z, f = m.f, r = m.r }) + pending = nil + redraw() + end + end) + ) + table.insert( + conns, + state.AttributeChanged:Connect(function(key: string) + if not isOpen then + return + end + if key == "Layout" or key == "Stage" then + local s = sel + -- 물건이 없어졌으면 고르기 해제 + if s and not currentMove(Info.layout(state), s) then + sel = nil + end + if stage() < 3 and floorNow == 2 then + floorNow = 1 + hideAll() + placeCamera() + end + setPending(pending) + elseif key == "Lang" then + redraw() + end + end) + ) + + return { + gui = gui, + open = open, + close = close, + isOpen = function() + return isOpen + end, + onOpen = function(fn) + table.insert(openFns, fn) + end, + onClose = function(fn) + table.insert(closeFns, fn) + end, + setLayout = function(lay: Layout.Result) + scale.Scale = lay.scale + root.Size = UDim2.fromOffset(math.ceil(lay.width), math.ceil(lay.height)) + local d = lay.deco + place(exitBtn.button, d.exit) + place(floorBtn.button, d.floor) + place(infoBox, d.info) + place(rotateBtn.button, d.tools[4]) + place(cancelBtn.button, d.tools[5]) + place(okBtn.button, d.tools[6]) + for s, b in sideBtns do + place(b.button, d.tools[s]) + end + end, + notify = function(key: string, args: { [string]: any }?) + if isOpen then + showMessage(Info.toast(lang(), key, args)) + end + end, + destroy = function() + close() + for _, c in conns do + c:Disconnect() + end + world:Destroy() + gui:Destroy() + end, + } +end + +return Decorate diff --git a/bunsik-tycoon/src/client/Hud.luau b/bunsik-tycoon/src/client/Hud.luau index acd9465..7f8676f 100644 --- a/bunsik-tycoon/src/client/Hud.luau +++ b/bunsik-tycoon/src/client/Hud.luau @@ -1,8 +1,10 @@ --!strict --- 화면 UI: 돈, 손에 든 접시, 다음 업그레이드 막대, 상점·2배 수익·돈 부스트 버튼, 설정, 튜토리얼 말풍선, 알림, --- 그리고 창 세 개(업그레이드 상점, 설정, 요리). 모양은 Theme("사탕" 스타일), 배치는 Layout, 요리 창은 Kitchen 모듈. +-- 화면 UI: 돈, 손에 든 접시, 다음 업그레이드 막대, 상점·2배 수익·돈 부스트 버튼, 홍보·손님 러시 버튼, 설정, +-- 튜토리얼 말풍선, 알림, 그리고 창(상점 탭 4개, 설정, 요리, 홍보 확인). +-- 모양은 Theme("사탕" 스타일), 배치는 Layout, 상점 창은 ShopWindow, 요리 창은 Kitchen 모듈. -- 상태는 `state` 인스턴스(실제 게임에서는 Player)의 속성에서 읽습니다. 서버에서도 만들 수 있어서 원격 테스트로 검사합니다. +local AdService = game:GetService("AdService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local TweenService = game:GetService("TweenService") @@ -10,8 +12,10 @@ local Shared = ReplicatedStorage:WaitForChild("Shared") local Economy = require(Shared:WaitForChild("Economy")) local Locale = require(Shared:WaitForChild("Locale")) local Products = require(Shared:WaitForChild("Products")) +local Info = require(script.Parent:WaitForChild("Info")) local Kitchen = require(script.Parent:WaitForChild("Kitchen")) local Layout = require(script.Parent:WaitForChild("Layout")) +local ShopWindow = require(script.Parent:WaitForChild("ShopWindow")) local Theme = require(script.Parent:WaitForChild("Theme")) local Hud = {} @@ -23,39 +27,51 @@ export type HudHandle = { -- UI가 쓸 수 있는 화면 크기(픽셀, 상단 바 제외)와 터치 화면 여부로 배치를 다시 잡습니다. setLayout: (size: Vector2, touch: boolean) -> (), layout: () -> Layout.Result, - open: (which: string?) -> (), -- "shop", "settings", "kitchen", nil(닫기) + -- "shop"(tab: "upgrade"/"decor"/"staff"/"mine"), "settings", "kitchen", "promote", nil(닫기) + open: (which: string?, tab: string?) -> (), menuOpen: () -> boolean, -- 창이 열려 있으면 true(마우스 커서를 풀어 줌) + onDecorate: (fn: () -> ()) -> (), -- 상점 창 [배치하기]를 눌렀을 때 kitchen: Kitchen.KitchenHandle, + shop: ShopWindow.Handle, destroy: () -> (), } --- 업그레이드 id → 아이콘 -local function itemIcon(id: string): string - local menu = id:match("^Unlock(%a+)$") - if menu then - return menu - end - for prefix, icon in - { Table = "table", Sign = "sign", Stove = "flame", Sauce = "sauce", Tray = "tray" } :: { [string]: string } - do - if id:sub(1, #prefix) == prefix then - return icon - end - end - if id == "Helper" then - return "chef" - elseif id == "Expand" then - return "store" - end - return "star" -end -Hud.itemIcon = itemIcon - -- 알림 종류별 아이콘과 색 local TOAST_STYLE: { [string]: { icon: string, color: Color3 } } = { purchased = { icon = "check", color = Theme.MINT }, newMenu = { icon = "star", color = Theme.ORANGE }, expanded = { icon = "store", color = Theme.YELLOW }, + floor2 = { icon = "store", color = Theme.YELLOW }, + upgraded = { icon = "upgrade", color = Theme.MINT }, + seatAdded = { icon = "table", color = Theme.MINT }, + tableAdded = { icon = "table", color = Theme.MINT }, + decorAdded = { icon = "sparkle", color = Theme.MINT }, + noSpace = { icon = "table", color = Theme.GRAY }, + seatMax = { icon = "table", color = Theme.GRAY }, + tableMax = { icon = "table", color = Theme.GRAY }, + tableFull = { icon = "table", color = Theme.GRAY }, + needStage = { icon = "lock", color = Theme.GRAY }, + placeFail = { icon = "close", color = Theme.RED }, + hired = { icon = "chef", color = Theme.MINT }, + fired = { icon = "chef", color = Theme.GRAY }, + staffLocked = { icon = "lock", color = Theme.GRAY }, + staffMax = { icon = "chef", color = Theme.GRAY }, + strike = { icon = "chef", color = Theme.RED }, + strikeOver = { icon = "chef", color = Theme.MINT }, + renamed = { icon = "sign", color = Theme.SKY }, + nameRejected = { icon = "sign", color = Theme.GRAY }, + designSet = { icon = "store", color = Theme.SKY }, + designLocked = { icon = "lock", color = Theme.GRAY }, + promoted = { icon = "customer", color = Theme.SKY }, + promoteNone = { icon = "customer", color = Theme.GRAY }, + promoteFull = { icon = "customer", color = Theme.GRAY }, + promoteWait = { icon = "customer", color = Theme.GRAY }, + adUnavailable = { icon = "customer", color = Theme.GRAY }, + kicked = { icon = "customer", color = Theme.MINT }, + kickedBy = { icon = "customer", color = Theme.RED }, + shielded = { icon = "lock", color = Theme.GRAY }, + kickOwn = { icon = "store", color = Theme.GRAY }, + rushOn = { icon = "bolt", color = Theme.YELLOW }, boostGot = { icon = "bolt", color = Theme.YELLOW }, guestBonus = { icon = "coin", color = Theme.MINT }, guestArrived = { icon = "customer", color = Theme.SKY }, @@ -66,13 +82,10 @@ local TOAST_STYLE: { [string]: { icon: string, color: Color3 } } = { devResetDone = { icon = "wrench", color = Theme.GRAY }, } -local function attr(state: Instance, key: string, default: any): any - local v = state:GetAttribute(key) - if v == nil then - return default - end - return v -end +local attr = Info.attr + +-- 알림 글(메뉴·갈래·역할·소품·디자인 id를 내 언어 이름으로 바꿔 씀). 꾸미기 화면도 같이 씁니다. +Hud.toastText = Info.toast local function at(o: GuiObject, x: number, y: number, w: number, h: number) o.Position = UDim2.fromOffset(x, y) @@ -215,8 +228,8 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () Theme.round(iconBox) Theme.gradient(iconBox, Color3.fromRGB(255, 236, 242), Color3.fromRGB(255, 205, 220)) Theme.stroke(iconBox, Theme.lighten(Theme.PINK, 0.3), 3) - local itemImg = Theme.icon(iconBox, "Icon", "table") - Theme.place(itemImg, 0.5, 0.5, 0.86, 0.86) + local itemImg = Info.glyph(iconBox, "Icon", "table") + Theme.place(itemImg.frame, 0.5, 0.5, 0.86, 0.86) local cardTitle = Theme.text(cardBody, "Title") cardTitle.TextXAlignment = Enum.TextXAlignment.Left cardTitle.Position = UDim2.fromOffset(84, 10) @@ -278,6 +291,31 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () boostAmount.Size = UDim2.new(1, -12, 1, -4) boostAmount.ZIndex = 9 + -- 손님 버튼 묶음: 홍보(옆 가게 손님 데려오기, 대기 시간 표시), 손님 러시(남은 시간 표시) + local promoteBtn, promoteLabel, promoteImg = Theme.iconButton(root, "Promote", Theme.SKY, "customer") + promoteImg.Visible = false + local promoteEmoji = Theme.text(promoteBtn.face, "Emoji") + Theme.place(promoteEmoji, 0.5, 0.44, 0.66, 0.62) + promoteEmoji.ZIndex = 4 + promoteEmoji.Text = "📣" + local rushBtn, rushLabel = Theme.iconButton(root, "Rush", Theme.YELLOW, "customer") + local rushBolt = Theme.icon(rushBtn.button, "Bolt", "bolt") + rushBolt.AnchorPoint = Vector2.new(0.5, 0.5) + rushBolt.Position = UDim2.new(1, -8, 0, 8) + rushBolt.Size = UDim2.fromScale(0.42, 0.42) + rushBolt.ZIndex = 8 + local rushPrice = Theme.frame(rushBtn.button, "Price", Theme.LAVENDER) + rushPrice.AnchorPoint = Vector2.new(0.5, 0.5) + rushPrice.Position = UDim2.fromOffset(10, 4) + rushPrice.Size = UDim2.new(0.56, 0, 0, 20) + rushPrice.ZIndex = 8 + Theme.round(rushPrice) + Theme.stroke(rushPrice, Theme.edge(Theme.LAVENDER), 2) + local rushPriceText = Theme.text(rushPrice, "Text", Theme.edge(Theme.LAVENDER), true) + rushPriceText.Position = UDim2.fromOffset(4, 2) + rushPriceText.Size = UDim2.new(1, -8, 1, -4) + rushPriceText.ZIndex = 9 + -- 창 뒤 어둡게(누르면 창 닫힘) local dim = Instance.new("TextButton") dim.Name = "Dim" @@ -291,23 +329,39 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () dim.ZIndex = 10 dim.Parent = root - -- 업그레이드 상점 창: 지금 단계 10개를 카드 5x2로 - local shopPanel = Theme.panel(root, "Panel", Theme.PINK) - local panel = shopPanel.frame - local stageTag = Theme.frame(shopPanel.body, "StageTag", Theme.WHITE) - stageTag.ZIndex = 3 - stageTag.AnchorPoint = Vector2.new(0, 0.5) - stageTag.Position = UDim2.fromOffset(16, Layout.HEADER_H / 2) - stageTag.Size = UDim2.fromOffset(150, 30) - stageTag.BackgroundTransparency = 0.15 - Theme.round(stageTag) - local stageText = Theme.text(stageTag, "Text") - stageText.Position = UDim2.fromOffset(10, 4) - stageText.Size = UDim2.new(1, -20, 1, -8) - stageText.ZIndex = 4 - local cards = Theme.frame(shopPanel.body, "Cards") - cards.Size = UDim2.fromScale(1, 1) - cards.ZIndex = 3 + -- 상점 창(탭 4개) + local decorateFns: { () -> () } = {} + local shop = ShopWindow.build(root, state, send, function() + for _, fn in decorateFns do + fn() + end + end) + local panel = shop.frame + + -- 홍보 확인 창: 광고를 보면 무엇을 받는지 먼저 알려 주고, 고르게 합니다(광고는 늘 선택). + local promotePanel = Theme.panel(root, "PromotePanel", Theme.SKY) + local promoteWin = promotePanel.frame + promoteWin.ZIndex = 24 + local promoteBig = Theme.text(promotePanel.body, "Emoji") + promoteBig.Text = "📣" + promoteBig.TextColor3 = Theme.WHITE + promoteBig.Position = UDim2.fromOffset(18, Layout.HEADER_H + 12) + promoteBig.Size = UDim2.fromScale(0.22, 0.36) + promoteBig.ZIndex = 3 + local promoteText = Theme.text(promotePanel.body, "Text") + promoteText.Position = UDim2.new(0.26, 0, 0, Layout.HEADER_H + 12) + promoteText.Size = UDim2.fromScale(0.7, 0.36) + promoteText.ZIndex = 3 + local adBtn, adLabel = Theme.textButton(promotePanel.body, "WatchAd", Theme.MINT, 20) + adBtn.button.AnchorPoint = Vector2.new(0, 1) + adBtn.button.Position = UDim2.new(0.04, 0, 1, -14) + adBtn.button.Size = UDim2.new(0.44, 0, 0, 62) + adBtn.button.ZIndex = 4 + local freeBtn, freeLabel = Theme.textButton(promotePanel.body, "Free", Theme.SKY, 20) + freeBtn.button.AnchorPoint = Vector2.new(1, 1) + freeBtn.button.Position = UDim2.new(0.96, 0, 1, -14) + freeBtn.button.Size = UDim2.new(0.44, 0, 0, 62) + freeBtn.button.ZIndex = 4 -- 설정 창(언어, 마우스로 화면 돌리기, 효과음, 개발자 테스트) local setPanel = Theme.panel(root, "SettingsPanel", Theme.SKY) @@ -380,8 +434,10 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () place(settingsBtn.button, lay.settings) place(passBtn.button, lay.double) place(boostBtn.button, lay.boost) - place(panel, lay.panel) + place(promoteBtn.button, lay.promote) + place(rushBtn.button, lay.rush) place(settings, lay.settingsPanel) + shop.setLayout(lay) kitchen.setLayout(lay) -- [사기] 버튼은 막대 안 좌표로 local b = lay.buy @@ -397,7 +453,8 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end pointer.Position = UDim2.fromOffset(b.x - lay.card.x + b.w / 2, b.y - lay.card.y - 2) local r = lay.rows - for _, c in { shopPanel.close, setPanel.close } do + place(promoteWin, lay.confirm) + for _, c in { setPanel.close, promotePanel.close } do c.button.Size = UDim2.fromOffset(r.closeH, r.closeH) end local i = 0 @@ -435,16 +492,13 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end relayout() - local function pname(p: Economy.Purchase): string - return Locale.itemName(lang(), p.id) - end local function toggle(b: Theme.Button, label: TextLabel, on: boolean) label.Text = L(if on then "on" else "off") b.setColor(if on then Theme.MINT else Theme.GRAY) end - local cardsKey = "" local lastMoney: number? = nil + local nextOffer: Economy.Offer? = nil -- 돈이 늘면 "+N"이 떠오르고 돈 알약이 통 튑니다. local function moneyPop(gain: number) @@ -471,86 +525,28 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end) end - -- 상점 카드 한 장 - local function shopCard(i: number, p: Economy.Purchase, bought: number, can: boolean, g: Layout.Grid) - local done = i <= bought - local isNext = i == bought + 1 - local k = (i - 1) % 10 - local col, row = k % g.cols, k // g.cols - local holder = Theme.frame(cards, "Row" .. i) - holder.ZIndex = 3 - at(holder, g.pad + col * (g.cardW + g.gap), g.top + row * (g.cardH + g.gap), g.cardW, g.cardH) - local c = Theme.frame(holder, "Card", Theme.WHITE) - c.Size = UDim2.fromScale(1, 1) - c.ZIndex = 3 - Theme.corner(c, 20) - local tint = if done then Theme.MINT elseif isNext then Theme.YELLOW else Theme.GRAY - Theme.stroke(c, if isNext then Theme.edge(Theme.YELLOW) else Theme.lighten(tint, 0.35), if isNext then 4 else 3) - Theme.gradient(c, Theme.WHITE, Theme.lighten(tint, if done then 0.75 elseif isNext then 0.6 else 0.7)) - local img = Theme.icon(c, "Icon", itemIcon(p.id)) - Theme.place(img, 0.5, 0.3, 0.62, 0.42) - img.ZIndex = 4 - local name = Theme.text(c, "Name") - name.AnchorPoint = Vector2.new(0.5, 0.5) - name.Position = UDim2.fromScale(0.5, 0.6) - name.Size = UDim2.new(1, -12, 0.2, 0) - name.ZIndex = 4 - name.Text = pname(p) - if done then - local ok = Theme.icon(c, "Done", "check") - ok.Size = UDim2.fromOffset(40, 40) - ok.AnchorPoint = Vector2.new(0.5, 0.5) - ok.Position = UDim2.new(1, -12, 0, 12) - ok.ZIndex = 5 - local t = Theme.text(c, "Cost", Theme.edge(Theme.MINT)) - t.TextColor3 = Theme.WHITE - t.AnchorPoint = Vector2.new(0.5, 0.5) - t.Position = UDim2.fromScale(0.5, 0.85) - t.Size = UDim2.fromScale(0.8, 0.16) - t.ZIndex = 4 - t.Text = L("bought") - elseif isNext then - local rb, rl = Theme.textButton(holder, "BuyRow", if can then Theme.MINT else Theme.GRAY, 16) - rb.button.AnchorPoint = Vector2.new(0.5, 1) - rb.button.Position = UDim2.new(0.5, 0, 1, -8) - rb.button.Size = UDim2.new(1, -16, 0.26, 0) - rb.button.ZIndex = 5 - rl.FontFace = Theme.NUM - rl.Text = Locale.number(p.cost) - local coinIc = Theme.icon(rb.face, "Coin", "coin") - coinIc.AnchorPoint = Vector2.new(0, 0.5) - coinIc.Position = UDim2.new(0, 2, 0.5, 0) - coinIc.Size = UDim2.fromScale(0.3, 1.1) - coinIc.ZIndex = 5 - rl.Position = UDim2.new(0.5, 10, 0.5, 0) - rl.Size = UDim2.new(1, -40, 0.62, 0) - rb.button.Activated:Connect(function() - send("buy") - end) - if can then - keep(Theme.bob(holder, 5, 0.9)) - end - else - img.ImageTransparency = 0.5 - local lockImg = Theme.icon(c, "Lock", "lock") - lockImg.Size = UDim2.fromOffset(36, 36) - lockImg.AnchorPoint = Vector2.new(0.5, 0.5) - lockImg.Position = UDim2.fromScale(0.68, 0.4) - lockImg.ZIndex = 5 - local t = Theme.text(c, "Cost", nil, true) - t.TextColor3 = Theme.SOFT - t.AnchorPoint = Vector2.new(0.5, 0.5) - t.Position = UDim2.fromScale(0.5, 0.85) - t.Size = UDim2.fromScale(0.8, 0.15) - t.ZIndex = 4 - t.Text = Locale.number(p.cost) - end + -- 홍보·러시 버튼의 남은 시간(1초마다 다시 씀) + local function timers() + local now = Info.now() + local wait = attr(state, "PromoteAt", 0) - now + local adOk = Products.PROMOTE_AD_PRODUCT ~= 0 and attr(state, "PromoteAdAt", 0) <= now + promoteLabel.Text = if wait > 0 then Info.clock(wait) else L("btnPromote") + promoteBtn.setColor(if wait > 0 and not adOk then Theme.GRAY else Theme.SKY) + local rushLeft = attr(state, "RushUntil", 0) - now + rushLabel.Text = if rushLeft > 0 then Info.clock(rushLeft) else L("btnRush") + local price = Info.robux("RUSH_PRODUCT") + rushPrice.Visible = price ~= nil and rushLeft <= 0 + rushPriceText.Text = price or "" + freeLabel.Text = if wait > 0 then Info.clock(wait) else L("promoteFree") + freeBtn.setColor(if wait > 0 then Theme.GRAY else Theme.SKY) end local function refresh() local m = attr(state, "Money", 0) - local bought = attr(state, "Bought", 0) - local stats = Economy.statsAt(bought) + local levels = Info.levels(state) + local seats = attr(state, "Seats", 1) + local tables = attr(state, "Tables", 1) + local stats = Economy.stats(levels, seats) moneyText.Text = Locale.number(m) if lastMoney and m > lastMoney then moneyPop(m - lastMoney) @@ -577,15 +573,17 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end carry.Size = UDim2.fromOffset(stats.carry * 42 + 20, layoutNow.carry.h) - local nextP = Economy.PURCHASES[bought + 1] + -- 다음 추천: 지금 살 수 있는 것 중 가장 싼 것(갈래 다음 단계, 의자, 테이블) + local offer = Economy.offers(levels, tables, seats)[1] + nextOffer = offer local can = false - if nextP then - cardTitle.Text = pname(nextP) - cardCost.Text = `{Locale.number(math.min(m, nextP.cost))} / {Locale.number(nextP.cost)}` - barFill.Size = UDim2.fromScale(math.clamp(m / nextP.cost, 0, 1), 1) - barFill.Visible = m > 0 - Theme.setIcon(itemImg, itemIcon(nextP.id)) - can = m >= nextP.cost + if offer then + cardTitle.Text = Info.offerName(lang(), levels, offer) + cardCost.Text = `{Locale.number(math.min(m, offer.cost))} / {Locale.number(offer.cost)}` + barFill.Size = UDim2.fromScale(if offer.cost > 0 then math.clamp(m / offer.cost, 0, 1) else 1, 1) + barFill.Visible = m > 0 or offer.cost == 0 + itemImg.set(Info.offerIcon(levels, offer)) + can = m >= offer.cost buyLabel.Text = L("buy") buy.setColor(if can then Theme.MINT else Theme.GRAY) buy.button.Visible = true @@ -594,7 +592,7 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () cardCost.Text = "" barFill.Size = UDim2.fromScale(1, 1) barFill.Visible = true - Theme.setIcon(itemImg, "star") + itemImg.set("star") buy.button.Visible = false end cardStroke.Color = if can then Theme.edge(Theme.MINT) else Theme.edge(Theme.PINK) @@ -612,7 +610,7 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () else hint.Visible = false end - pointer.Visible = tut == 3 and nextP ~= nil + pointer.Visible = tut == 3 and offer ~= nil if (layoutNow.rows.devY ~= nil) ~= (attr(state, "Dev", false) == true) then relayout() @@ -623,7 +621,6 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end listLabel.Text = L("btnShop") - shopPanel.title.Text = L("shop") setPanel.title.Text = L("settings") langLabel.Text = L("language") local current = attr(state, "LangSetting", "") @@ -643,43 +640,23 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () passCheck.Visible = double x2.Visible = not double passBtn.button.Active = not double - boostBtn.button.Visible = Products.MONEY_BOOST_PRODUCT ~= 0 and nextP ~= nil + boostBtn.button.Visible = Products.MONEY_BOOST_PRODUCT ~= 0 and offer ~= nil boostLabel.Text = L("btnBoost") boostAmount.Text = "+" .. Locale.number(attr(state, "Boost", Economy.BOOST_MIN)) - kitchen.refresh() + promotePanel.title.Text = L("promoteTitle") + promoteText.Text = L("promoteAdText") + adLabel.Text = L("watchAd") + timers() - -- 상점 카드(지금 단계 것만). 산 개수, 언어, 살 수 있는지, 배치가 바뀔 때만 다시 그립니다. - local g = layoutNow.grid - local key = `{bought}:{lang()}:{can}:{g.cardW}:{g.cardH}` - if key == cardsKey then - return - end - cardsKey = key - local stage = stats.stage - stageText.Text = L(if stage >= 2 then "stage2" else "stage1") - for _, c in cards:GetChildren() do - c:Destroy() - end - local from = if stage >= 2 then 11 else 1 - local to = if stage >= 2 then #Economy.PURCHASES else 10 - for i = from, to do - shopCard(i, Economy.PURCHASES[i], bought, can, g) + kitchen.refresh() + if shop.isOpen() then + shop.refresh() end end local toastN = 0 local function notify(key: string, args: { [string]: any }?) - -- 서버는 메뉴·업그레이드를 키(menu, item)로 보내고, 이름은 내 언어로 바꿔 씁니다. - if args then - args = table.clone(args) - if typeof(args.menu) == "string" then - args.menuName = Locale.menuName(lang(), args.menu) - end - if typeof(args.item) == "string" then - args.name = Locale.itemName(lang(), args.item) - end - end local style = TOAST_STYLE[key] or { icon = "sparkle", color = Theme.SKY } toastN += 1 -- 오래된 알림은 3개까지만 남깁니다. @@ -718,7 +695,7 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () t.Position = UDim2.fromOffset(52, 8) t.Size = UDim2.new(1, -68, 1, -16) t.ZIndex = 2 - t.Text = L(key, args) + t.Text = Hud.toastText(lang(), key, args) Theme.pop(toast) task.delay(2.8, function() local info = TweenInfo.new(0.4) @@ -732,40 +709,70 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end) end - local function show(which: string?) - panel.Visible = which == "shop" + local function show(which: string?, tab: string?) + if which == "shop" then + shop.open(tab) + else + shop.close() + end settings.Visible = which == "settings" + promoteWin.Visible = which == "promote" if which == "kitchen" then kitchen.open() else kitchen.close() end dim.Visible = which ~= nil - if which == "shop" then - Theme.pop(panel) - elseif which == "settings" then + if which == "settings" then Theme.pop(settings) + elseif which == "promote" then + Theme.pop(promoteWin) end end kitchen.onClose(function() - if not panel.Visible and not settings.Visible then + if not panel.Visible and not settings.Visible and not promoteWin.Visible then dim.Visible = false end end) + -- 홍보: 광고를 볼 수 있으면 먼저 물어보고(보상 안내), 아니면 바로 무료 홍보를 보냅니다. + local checkingAd = false + local function pressPromote() + if checkingAd then + return + end + local now = Info.now() + if Products.PROMOTE_AD_PRODUCT == 0 or attr(state, "PromoteAdAt", 0) > now then + send("promote", { ad = false }) + return + end + checkingAd = true + task.spawn(function() + local ok, result = pcall(function() + return AdService:GetAdAvailabilityNowAsync(Enum.AdFormat.RewardedVideo) + end) + checkingAd = false + if ok and result and result.AdAvailabilityResult == Enum.AdAvailabilityResult.IsAvailable then + timers() + show("promote") + else + send("promote", { ad = false }) + end + end) + end + local conns: { RBXScriptConnection } = {} local function on(sig: RBXScriptSignal, fn: (...any) -> ()) table.insert(conns, sig:Connect(fn)) end on(buy.button.Activated, function() - send("buy") + if nextOffer then + send("buyOffer", nextOffer.id) + end end) on(listBtn.button.Activated, function() show(if panel.Visible then nil else "shop") end) - on(shopPanel.close.button.Activated, function() - show(nil) - end) on(dim.Activated, function() -- 요리 중에는 바깥을 눌러도 닫지 않습니다(실수로 닫히지 않게). if not kitchen.isOpen() then @@ -775,7 +782,12 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () on(settingsBtn.button.Activated, function() show(if settings.Visible then nil else "settings") end) - on(setPanel.close.button.Activated, function() + for _, c in { setPanel.close, promotePanel.close } do + on(c.button.Activated, function() + show(nil) + end) + end + on(shop.closeButton.Activated, function() show(nil) end) for l, b in langButtons do @@ -797,6 +809,20 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () on(boostBtn.button.Activated, function() send("boost") end) + on(promoteBtn.button.Activated, pressPromote) + on(rushBtn.button.Activated, function() + send("rush") + end) + on(adBtn.button.Activated, function() + show(nil) + send("promote", { ad = true }) + end) + on(freeBtn.button.Activated, function() + if attr(state, "PromoteAt", 0) <= Info.now() then + show(nil) + send("promote", { ad = false }) + end + end) local devKinds: { [string]: string } = { devMoney = "dev_money", devDouble = "dev_double", devReset = "dev_reset" } for key, kind in devKinds do on(devButtons[key].button.Activated, function() @@ -805,12 +831,22 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end on(state.AttributeChanged, refresh) refresh() + local alive = true + task.spawn(function() + while alive do + task.wait(1) + if alive then + timers() + end + end + end) return { gui = gui, refresh = refresh, notify = notify, kitchen = kitchen, + shop = shop, setLayout = function(size: Vector2, isTouch: boolean) screen = size touch = isTouch @@ -822,9 +858,13 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () end, open = show, menuOpen = function(): boolean - return panel.Visible or settings.Visible or kitchen.isOpen() + return panel.Visible or settings.Visible or promoteWin.Visible or kitchen.isOpen() + end, + onDecorate = function(fn: () -> ()) + table.insert(decorateFns, fn) end, destroy = function() + alive = false for _, c in conns do c:Disconnect() end @@ -832,6 +872,7 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> () t:Cancel() end kitchen.destroy() + shop.destroy() gui:Destroy() end, } diff --git a/bunsik-tycoon/src/client/Info.luau b/bunsik-tycoon/src/client/Info.luau new file mode 100644 index 0000000..7eb7c92 --- /dev/null +++ b/bunsik-tycoon/src/client/Info.luau @@ -0,0 +1,266 @@ +--!strict +-- 화면 여러 곳(HUD, 상점 창, 요리 창, 꾸미기)에서 같이 쓰는 것: +-- 플레이어 속성(NETWORK.md)에서 갈래 레벨·능력치·알바·배치 읽기, +-- 업그레이드·물건별 그림(아이콘 그림에 없는 것은 이모지), 다음 단계 효과 글, 알림 글. + +local HttpService = game:GetService("HttpService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Shared = ReplicatedStorage:WaitForChild("Shared") +local Codec = require(Shared:WaitForChild("Codec")) +local Economy = require(Shared:WaitForChild("Economy")) +local Floor = require(Shared:WaitForChild("Floor")) +local Icons = require(Shared:WaitForChild("Icons")) +local Locale = require(Shared:WaitForChild("Locale")) +local Products = require(Shared:WaitForChild("Products")) +local Theme = require(script.Parent:WaitForChild("Theme")) + +local Info = {} + +function Info.attr(state: Instance, key: string, default: any): any + local v = state:GetAttribute(key) + if v == nil then + return default + end + return v +end + +function Info.levels(state: Instance): Economy.Levels + return Economy.cleanLevels(Codec.decodeMap(state:GetAttribute("Levels"))) +end + +function Info.stats(state: Instance): Economy.Stats + return Economy.stats(Info.levels(state), Info.attr(state, "Seats", 1)) +end + +function Info.staff(state: Instance): { [string]: number } + return Codec.decodeMap(state:GetAttribute("Staff")) +end + +function Info.layout(state: Instance): Floor.Layout + local raw = state:GetAttribute("Layout") + local decoded = nil + if typeof(raw) == "string" and raw ~= "" then + local ok, v = pcall(function() + return HttpService:JSONDecode(raw) + end) + if ok then + decoded = v + end + end + return Floor.clean(decoded) +end + +function Info.now(): number + return workspace:GetServerTimeNow() +end + +-- 초 → "2:05" +function Info.clock(sec: number): string + local s = math.max(0, math.ceil(sec)) + return string.format("%d:%02d", s // 60, s % 60) +end + +-- 1.25 → "1.25", 2 → "2" +function Info.num(n: number): string + return (string.format("%.2f", n):gsub("%.?0+$", "")) +end + +-- 그림: 아이콘 그림 이름(Icons.OFFSET) 또는 이모지 +Info.TRACK_ICON = { + Stage = "store", + Menu = "star", + Price = "sauce", + Speed = "sign", + Stove = "flame", + Tray = "tray", + Staff = "chef", +} :: { [string]: string } + +Info.ROLE_ICON = { Cook = "chef", Server = "tray", Promoter = "📣" } :: { [string]: string } + +Info.DECOR_ICON = { + Plant = "🪴", + Rug = "🧶", + Balloons = "🎈", + Lamp = "💡", + Teddy = "🧸", + Fridge = "🧊", +} :: { [string]: string } + +Info.SEAT_ICON = "🪑" + +-- 로벅스 가격(배지 글자용, Products 키별). 실제 가격은 로블록스 상품 설정이 원본입니다. +Info.ROBUX = { + RAINBOW_NAME_PASS = 99, + CANDY_DESIGN_PASS = 149, + HANOK_DESIGN_PASS = 149, + RUSH_PRODUCT = 15, + KICK_PRODUCT = 15, +} :: { [string]: number } + +-- 그 상품이 열려 있으면 "R$99" 같은 배지 글자, 아니면 nil +function Info.robux(productKey: string): string? + local id = (Products :: any)[productKey] + if typeof(id) ~= "number" or id == 0 then + return nil + end + local price = Info.ROBUX[productKey] + return if price then `R${price}` else "R$" +end + +-- 디자인 견본 색(벽, 지붕, 테두리). 서버 PlotBuilder.PALETTES와 같은 색 +Info.DESIGN_COLORS = { + Basic = { Color3.fromRGB(250, 236, 205), Color3.fromRGB(150, 70, 55), Color3.fromRGB(240, 110, 40) }, + Mint = { Color3.fromRGB(214, 245, 234), Color3.fromRGB(70, 150, 130), Color3.fromRGB(120, 210, 190) }, + Brick = { Color3.fromRGB(178, 92, 70), Color3.fromRGB(70, 62, 62), Color3.fromRGB(215, 55, 50) }, + Candy = { Color3.fromRGB(255, 205, 228), Color3.fromRGB(196, 160, 255), Color3.fromRGB(255, 120, 170) }, + Hanok = { Color3.fromRGB(246, 236, 214), Color3.fromRGB(58, 64, 76), Color3.fromRGB(150, 40, 35) }, +} :: { [string]: { Color3 } } + +-- 갈래 그림. 메뉴 갈래는 다음에 열리는 메뉴 그림 +function Info.trackIcon(levels: Economy.Levels, id: string): string + if id == "Menu" then + local nl = Economy.nextLevel(levels, id) + if nl then + return nl.value :: string + end + end + return Info.TRACK_ICON[id] or "star" +end + +function Info.offerIcon(levels: Economy.Levels, offer: Economy.Offer): string + if offer.id == "Seat" then + return Info.SEAT_ICON + elseif offer.id == "Table" then + return "table" + end + return Info.trackIcon(levels, offer.id) +end + +-- 다음 단계가 하는 일(짧은 글). 다 샀으면 nil +function Info.effect(lang: string, levels: Economy.Levels, id: string): string? + local nl = Economy.nextLevel(levels, id) + if not nl then + return nil + end + local st = Economy.stats(levels, 1) + local v = nl.value + if id == "Stage" then + return Locale.t(lang, "fx_Stage", { + from = Locale.t(lang, `stage_{st.stage}`), + to = Locale.t(lang, `stage_{v}`), + }) + elseif id == "Menu" then + return Locale.t(lang, "fx_Menu", { menuName = Locale.menuName(lang, v) }) + elseif id == "Price" then + return Locale.t(lang, "fx_Price", { from = Info.num(st.price), to = Info.num(v) }) + elseif id == "Speed" then + return Locale.t(lang, "fx_Speed", { from = Info.num(st.spawn), to = Info.num(v) }) + elseif id == "Stove" then + local function pct(c: number): string + return tostring(math.floor(c / Economy.START_COOK * 100 + 0.5)) + end + return Locale.t(lang, "fx_Stove", { from = pct(st.cook), to = pct(v) }) + elseif id == "Tray" then + return Locale.t(lang, "fx_Tray", { from = st.carry, to = v }) + end + return Locale.t(lang, "fx_" .. id) +end + +-- 화면 아래 추천 막대 이름 +function Info.offerName(lang: string, levels: Economy.Levels, offer: Economy.Offer): string + if offer.id == "Seat" or offer.id == "Table" then + return Locale.t(lang, "thing_" .. offer.id) + end + local nl = Economy.nextLevel(levels, offer.id) + if offer.id == "Menu" and nl then + return Locale.t(lang, "fx_Menu", { menuName = Locale.menuName(lang, nl.value) }) + elseif offer.id == "Stage" and nl then + return Locale.t(lang, `stage_{nl.value}`) + end + return `{Locale.t(lang, "track_" .. offer.id)} Lv{Economy.level(levels, offer.id) + 1}` +end + +-- 알림 글. 서버는 메뉴·갈래·역할·소품·디자인을 id로 보내고, 이름은 내 언어로 바꿔 씁니다. +function Info.toast(lang: string, key: string, args: { [string]: any }?): string + local a: { [string]: any }? = nil + if args then + local t = table.clone(args) + if typeof(t.menu) == "string" then + t.menuName = Locale.menuName(lang, t.menu) + end + if typeof(t.track) == "string" then + t.name = Locale.t(lang, "track_" .. t.track) + end + if typeof(t.role) == "string" then + t.name = Locale.t(lang, "role_" .. t.role) + end + if typeof(t.kind) == "string" then + t.name = Locale.t(lang, "decor_" .. t.kind) + end + if typeof(t.design) == "string" then + t.name = Locale.t(lang, "design_" .. t.design) + end + if typeof(t.why) == "string" then + t.reason = Locale.t(lang, "why_" .. t.why) + end + a = t + end + return Locale.t(lang, key, a) +end + +-- 아이콘 그림 또는 이모지를 같은 자리에 보여 주는 칸 +export type Glyph = { + frame: Frame, + image: ImageLabel, + emoji: TextLabel, + set: (key: string) -> (), + fade: (transparency: number) -> (), + zindex: (z: number) -> (), +} + +function Info.glyph(parent: Instance, name: string, key: string): Glyph + local f = Theme.frame(parent, name) + local ratio = Instance.new("UIAspectRatioConstraint") + ratio.AspectRatio = 1 + ratio.Parent = f + local img = Theme.icon(f, "Image", "star") + img.Size = UDim2.fromScale(1, 1) + local emoji = Theme.text(f, "Emoji") + emoji.Size = UDim2.fromScale(0.86, 0.86) + emoji.Position = UDim2.fromScale(0.07, 0.07) + emoji.TextColor3 = Theme.WHITE + local function set(k: string) + local offset: Vector2? = Icons.OFFSET[k] + local isIcon = offset ~= nil + img.Visible = isIcon + emoji.Visible = not isIcon + if isIcon then + Icons.apply(img, k) + else + emoji.Text = k + end + end + set(key) + local function zindex(z: number) + f.ZIndex = z + img.ZIndex = z + emoji.ZIndex = z + end + -- 처음에는 부모 위에 보이게 + zindex(if parent:IsA("GuiObject") then parent.ZIndex + 1 else 1) + return { + frame = f, + image = img, + emoji = emoji, + set = set, + fade = function(t: number) + img.ImageTransparency = t + emoji.TextTransparency = t + end, + zindex = zindex, + } +end + +return Info diff --git a/bunsik-tycoon/src/client/Kitchen.luau b/bunsik-tycoon/src/client/Kitchen.luau index 09be7b9..d19dad4 100644 --- a/bunsik-tycoon/src/client/Kitchen.luau +++ b/bunsik-tycoon/src/client/Kitchen.luau @@ -20,6 +20,7 @@ local Icons = require(Shared:WaitForChild("Icons")) local Locale = require(Shared:WaitForChild("Locale")) local Recipes = require(Shared:WaitForChild("Recipes")) local Sounds = require(Shared:WaitForChild("Sounds")) +local Info = require(script.Parent:WaitForChild("Info")) local Layout = require(script.Parent:WaitForChild("Layout")) local Theme = require(script.Parent:WaitForChild("Theme")) @@ -520,7 +521,7 @@ function Kitchen.build(root: Frame, state: Instance, send: (string, any?) -> ()) local sizzle = sound(Sounds.SIZZLE, 0.5, 1, true) local doneSound = sound(Sounds.BUY, 0.7, 1.1) - local flow = Recipes.newFlow(Economy.START.cook) + local flow = Recipes.newFlow(Economy.START_COOK) local scene: Scene? = nil local sceneMenu: string? = nil local isOpen = false @@ -532,7 +533,7 @@ function Kitchen.build(root: Frame, state: Instance, send: (string, any?) -> ()) local doneToken = 0 local function stats() - return Economy.statsAt(attr(state, "Bought", 0)) + return Info.stats(state) end local choose: (menu: string) -> boolean local function orders(): { [string]: number } diff --git a/bunsik-tycoon/src/client/Layout.luau b/bunsik-tycoon/src/client/Layout.luau index 25f09e3..9432316 100644 --- a/bunsik-tycoon/src/client/Layout.luau +++ b/bunsik-tycoon/src/client/Layout.luau @@ -2,9 +2,11 @@ -- 화면 UI 배치 계산(로블록스 서비스 없이 숫자만 다룸, lune 단위 테스트로 검사). -- 입력은 UI가 쓸 수 있는 화면 크기(상단 바·노치를 뺀 안전 영역, 픽셀)와 터치 화면 여부입니다. -- 결과 좌표는 기준 단위이고, 화면 픽셀 = 기준 단위 × scale 입니다. --- 배치 원칙(어지럽지 않게): 늘 보이는 것은 7개뿐 — 돈(위 가운데), 버튼 3개(상점·2배·부스트)는 한 묶음, --- 설정(오른쪽 위), 다음 업그레이드 막대(아래 가운데), 손에 든 접시(막대 바로 위). 나머지는 창으로 엽니다. --- PC는 버튼 묶음을 왼쪽에 세로로, 휴대폰은 왼쪽 위에 가로로 둡니다. +-- 배치 원칙(어지럽지 않게): 늘 보이는 것 — 돈(위 가운데), 버튼 3개(상점·2배·부스트)는 한 묶음, +-- 손님 버튼 2개(홍보·러시)는 다른 묶음, 설정(오른쪽 위), 다음 업그레이드 막대(아래 가운데), 손에 든 접시(막대 바로 위). +-- 나머지는 창으로 엽니다. +-- PC는 상점 묶음을 왼쪽에 세로로, 손님 묶음을 오른쪽에 세로로 둡니다. +-- 휴대폰은 상점 묶음을 왼쪽 위에, 손님 묶음을 오른쪽 위(설정 왼쪽)에 가로로 둡니다. -- 터치 화면에서는 로블록스 기본 조이스틱 자리(왼쪽 40% × 아래 2/3)와 점프 버튼 자리(오른쪽 아래)에 -- 누르는 버튼을 두지 않습니다. 두 자리의 크기는 로블록스 PlayerModule(TouchJump, DynamicThumbstick)에서 가져왔습니다. @@ -12,8 +14,6 @@ local Layout = {} export type Rect = { x: number, y: number, w: number, h: number } -export type Grid = { cols: number, rows: number, pad: number, gap: number, top: number, cardW: number, cardH: number } - export type Result = { scale: number, width: number, -- 기준 단위 화면 너비 @@ -29,10 +29,21 @@ export type Result = { list: Rect, -- 상점(업그레이드) 버튼 double: Rect, boost: Rect, - panel: Rect, -- 상점 창 - grid: Grid, -- 상점 창 안 카드 배치(창 기준) + promote: Rect, -- 홍보(옆 가게 손님 데려오기) + rush: Rect, -- 손님 러시 + panel: Rect, -- 상점 창(탭 4개) + tabs: { Rect }, -- 상점 창 왼쪽 탭 버튼(창 기준) + content: Rect, -- 상점 창 안 탭 내용 자리(창 기준). 카드는 이 안을 칸으로 나눠 씁니다 settingsPanel: Rect, kitchen: Rect, -- 요리 창 + confirm: Rect, -- 홍보 확인 창(광고 보기 / 그냥 홍보) + -- 꾸미기(배치) 화면. 이때는 다른 UI를 숨기고 캐릭터 조작을 멈춥니다(조이스틱 없음). + deco: { + exit: Rect, + floor: Rect, -- 1층/2층 바꾸기 + info: Rect, -- 고른 물건 이름과 안내 글 + tools: { Rect }, -- 아래 버튼 칸 6개(오른쪽부터 확인·취소·돌리기, 의자는 1~4칸에 쪽 버튼) + }, -- 설정 창 안쪽 줄(설정 창 기준 y) rows: { langButtonH: number, @@ -78,13 +89,15 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res local W, H = w / s, h / s local cx = W / 2 - local money, settings, list, double, boost, hint + local money, settings, list, double, boost, promote, rush, hint if touch then money = rect(cx - 125, 6, 250, 54) list = rect(8, 6, 84, 84) double = rect(100, 10, 76, 76) boost = rect(184, 10, 76, 76) settings = rect(W - 72, 6, 64, 64) + promote = rect(W - 156, 10, 76, 76) + rush = rect(W - 240, 10, 76, 76) local hintW = math.min(600, W - 40) hint = rect(cx - hintW / 2, 98, hintW, 72) else @@ -94,6 +107,8 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res list = rect(12, top, 96, 96) double = rect(18, top + 96 + 20, 84, 84) boost = rect(18, top + 96 + 20 + 84 + 30, 84, 84) -- 위에 "+금액" 꼬리표가 붙어서 더 띄움 + promote = rect(W - 102, H / 2 - 110, 84, 84) + rush = rect(W - 102, H / 2 + 10, 84, 84) local hintW = math.min(620, W - 2 * 130) hint = rect(cx - hintW / 2, 76, hintW, 72) end @@ -113,21 +128,24 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res local toastsW = math.min(480, hint.w) local toasts = rect(cx - toastsW / 2, toastsTop, toastsW, math.max(0, carry.y - 6 - toastsTop)) - -- 상점 창: 지금 단계 업그레이드 10개를 5x2 카드로(넘기지 않아도 다 보임) - local pw = if touch then math.min(820, W - 24) else 740 - local ph = math.min(if touch then 392 else 440, H - 12) + -- 상점 창: 왼쪽에 큰 탭 버튼 4개(업그레이드·꾸미기·알바생·내 가게), 오른쪽에 탭 내용 + local pw = if touch then math.min(860, W - 24) else 860 + local ph = math.min(if touch then 400 else 500, H - 12) local panel = rect(cx - pw / 2, math.max(6, H * 0.5 - ph / 2), pw, ph) - local pad, gap = 16, 10 - local top = Layout.HEADER_H + 12 - local grid: Grid = { - cols = 5, - rows = 2, - pad = pad, - gap = gap, - top = top, - cardW = (pw - 2 * pad - 4 * gap) / 5, - cardH = (ph - top - pad - gap) / 2, - } + local pad, gap = 14, 8 + local tabW = if touch then 96 else 104 + local top = Layout.HEADER_H + 10 + local tabH = (ph - top - pad - 3 * gap) / 4 + local tabs: { Rect } = {} + for i = 1, 4 do + tabs[i] = rect(pad, top + (i - 1) * (tabH + gap), tabW, tabH) + end + local content = rect(pad + tabW + 12, top, pw - (pad + tabW + 12) - pad, ph - top - pad) + + -- 홍보 확인 창 + local cw = math.min(480, W - 24) + local ch = math.min(250, H - 12) + local confirm = rect(cx - cw / 2, math.max(6, H * 0.5 - ch / 2), cw, ch) -- 설정 창 줄: 제목 띠(0~58), 언어 이름(70), 언어 버튼(106~), 마우스(PC만), 효과음, 개발자(주인만) local langButtonH = if touch then 52 else 44 @@ -154,6 +172,26 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res local kh = math.min(if touch then 396 else 480, H - 8) local kitchen = rect(cx - kw / 2, math.max(4, H * 0.5 - kh / 2), kw, kh) + -- 꾸미기 화면: 왼쪽 위 나가기, 오른쪽 위 층 바꾸기, 위 가운데 안내, 아래 버튼 6칸 + local bs = if touch then 76 else 84 + local exit = rect(8, 6, bs, bs) + local floorBtn = rect(W - 8 - bs, 6, bs, bs) + local infoW = math.min(560, W - 2 * (bs + 24)) + local info = rect(cx - infoW / 2, 8, infoW, if touch then 64 else 70) + local toolGap = 10 + local toolsW = 6 * bs + 5 * toolGap + local toolX = cx - toolsW / 2 + if touch then + -- 점프 버튼 자리는 피합니다(조이스틱은 조작을 멈춰서 안 보임). + local zones = Layout.touchZones(w, h) + toolX = math.min(toolX, zones.jump.x / s - 8 - toolsW) + end + toolX = math.max(toolX, 8) + local tools: { Rect } = {} + for i = 1, 6 do + tools[i] = rect(toolX + (i - 1) * (bs + toolGap), H - 8 - bs, bs, bs) + end + return { scale = s, width = W, @@ -169,10 +207,15 @@ function Layout.compute(w: number, h: number, touch: boolean, dev: boolean): Res list = list, double = double, boost = boost, + promote = promote, + rush = rush, panel = panel, - grid = grid, + tabs = tabs, + content = content, settingsPanel = settingsPanel, kitchen = kitchen, + confirm = confirm, + deco = { exit = exit, floor = floorBtn, info = info, tools = tools }, rows = { langButtonH = langButtonH, mouseY = mouseY, diff --git a/bunsik-tycoon/src/client/Main.client.luau b/bunsik-tycoon/src/client/Main.client.luau index 1efd26c..4da3c88 100644 --- a/bunsik-tycoon/src/client/Main.client.luau +++ b/bunsik-tycoon/src/client/Main.client.luau @@ -1,9 +1,11 @@ --- 클라이언트 진입점: 화면 UI, 내 조리대 버튼, 튜토리얼 화살표, 부지 글자·손님 방문 버튼, 마우스 회전, 효과음 설정. +-- 클라이언트 진입점: 화면 UI, 내 조리대 버튼, 튜토리얼 화살표, 부지 글자·손님 방문·쫓아내기 버튼, 꾸미기 화면, +-- 마우스 회전, 효과음 설정. local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local SoundService = game:GetService("SoundService") +local Decorate = require(script.Parent.Decorate) local Guide = require(script.Parent.Guide) local Hud = require(script.Parent.Hud) local MouseLook = require(script.Parent.MouseLook) @@ -25,6 +27,7 @@ while not player:GetAttribute("Ready") do end local hud = Hud.build(player:WaitForChild("PlayerGui"), player, send) +local decorate: Decorate.Handle? = nil local UserInputService = game:GetService("UserInputService") local GuiService = game:GetService("GuiService") local camera = workspace.CurrentCamera @@ -37,6 +40,9 @@ local function relayout() size = camera.ViewportSize - Vector2.new(0, GuiService:GetGuiInset().Y) end hud.setLayout(size, touch) + if decorate then + decorate.setLayout(hud.layout()) + end end UserInputService.LastInputTypeChanged:Connect(function(t) local isTouch: boolean? = nil @@ -77,11 +83,25 @@ local NOTIFY_SOUND: { [string]: Sound } = { boostGot = buySound, guestBonus = buySound, expanded = levelSound, + floor2 = levelSound, + upgraded = buySound, + seatAdded = buySound, + tableAdded = buySound, + decorAdded = buySound, + hired = buySound, + designSet = buySound, + promoted = buySound, + kicked = buySound, + rushOn = levelSound, } notifyRemote.OnClientEvent:Connect(function(key, args) if typeof(key) == "string" then - hud.notify(key, if typeof(args) == "table" then args else nil) + local a = if typeof(args) == "table" then args else nil + hud.notify(key, a) + if decorate then + decorate.notify(key, a) + end local s = NOTIFY_SOUND[key] if s then s:Play() @@ -118,8 +138,34 @@ hud.kitchen.onClose(function() end) Plots.start(world:WaitForChild("Plots"), player, player.UserId, send) +-- 꾸미기(배치) 화면: 상점 창 [배치하기]로 열고, 여는 동안은 요리 창처럼 캐릭터 조작을 멈추고 화면 UI를 숨깁니다. +local deco = Decorate.build(player:WaitForChild("PlayerGui"), player, plot, send) +decorate = deco +deco.setLayout(hud.layout()) +hud.onDecorate(function() + hud.open(nil) + deco.open() +end) +deco.onOpen(function() + hud.gui.Enabled = false + ProximityPromptService.Enabled = false + if controls then + controls:Disable() + end +end) +deco.onClose(function() + hud.gui.Enabled = true + ProximityPromptService.Enabled = true + if controls then + controls:Enable() + end + hud.open("shop", "decor") +end) + Guide.start(player) -MouseLook.start(player, hud.menuOpen) +MouseLook.start(player, function() + return hud.menuOpen() or deco.isOpen() +end) if player:GetAttribute("MouseLook") == true and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then hud.notify("mouseHint") end diff --git a/bunsik-tycoon/src/client/Plots.luau b/bunsik-tycoon/src/client/Plots.luau index 297aa37..5794eb7 100644 --- a/bunsik-tycoon/src/client/Plots.luau +++ b/bunsik-tycoon/src/client/Plots.luau @@ -1,12 +1,17 @@ --!strict --- 부지 이름판·메뉴판 글자를 보는 사람 언어로 쓰고, 다른 가게 입구에 "손님으로 들어가기" 버튼을 붙입니다. --- 서버는 부지 모델 속성(OwnerId, OwnerName, Npc, Level)만 바꾸고, 글자는 각 클라이언트가 만듭니다. +-- 부지 이름판·메뉴판 글자를 보는 사람 언어로 쓰고, 다른 가게 입구에 버튼 두 개를 붙입니다: +-- "손님으로 들어가기"(visit), "손님 쫓아내기"(kick, 유료 횟수 또는 결제 창). +-- 서버는 부지 모델 속성(OwnerId, OwnerName, Npc, Level, ShopName, Rainbow, Menus, PriceMult, ShieldUntil)만 바꾸고, +-- 글자는 각 클라이언트가 만듭니다. 가게 이름은 이름판과 서버가 만든 "ShopNameLabel" 글자(포장마차 천막, 지붕 간판)에 씁니다. +-- 무지개 이름(게임패스)이면 그 글자들에 무지개 그러데이션이 돌아갑니다. local ReplicatedStorage = game:GetService("ReplicatedStorage") +local TweenService = game:GetService("TweenService") local Shared = ReplicatedStorage:WaitForChild("Shared") local Economy = require(Shared:WaitForChild("Economy")) local Locale = require(Shared:WaitForChild("Locale")) +local Products = require(Shared:WaitForChild("Products")) local Plots = {} @@ -23,40 +28,96 @@ local function labels(part: Instance): { TextLabel } return out end --- 이름판 글자: 플레이어 가게, 이웃 가게, 빈 자리 -function Plots.nameText(plot: Instance, lang: string): string - local level = plot:GetAttribute("Level") - local tail = if typeof(level) == "number" and level > 0 then ` ⭐Lv.{level}` else "" +-- 가게 이름만(레벨 없이): 정한 이름, 아니면 기본 이름 +function Plots.shopName(plot: Instance, lang: string): string + local custom = plot:GetAttribute("ShopName") + if typeof(custom) == "string" and custom ~= "" then + return custom + end local ownerName = plot:GetAttribute("OwnerName") if typeof(ownerName) == "string" then - return Locale.t(lang, "plotOwner", { name = ownerName }) .. tail + return Locale.t(lang, "plotOwner", { name = ownerName }) end local npc = plot:GetAttribute("Npc") if typeof(npc) == "number" then - local key = `npcShop{npc}` - return Locale.t(lang, key) .. tail + return Locale.t(lang, `npcShop{npc}`) end return Locale.t(lang, "plotEmpty") end --- 메뉴판 글자: 파는 메뉴와 지금 값 -function Plots.menuText(plot: Instance, lang: string): string +-- 이름판 글자: 가게 이름 + 레벨 +function Plots.nameText(plot: Instance, lang: string): string + local open = plot:GetAttribute("OwnerName") ~= nil or plot:GetAttribute("Npc") ~= nil + if not open then + return Locale.t(lang, "plotEmpty") + end local level = plot:GetAttribute("Level") - if typeof(level) ~= "number" then + local tail = if typeof(level) == "number" and level > 0 then ` ⭐Lv.{level}` else "" + return Plots.shopName(plot, lang) .. tail +end + +-- 메뉴판 글자: 파는 메뉴(Menus)와 값(메뉴 값 x PriceMult) +function Plots.menuText(plot: Instance, lang: string): string + local menus = plot:GetAttribute("Menus") + if typeof(menus) ~= "string" or menus == "" then return "" end - local stats = Economy.statsAt(level) + local mult = plot:GetAttribute("PriceMult") + local k = if typeof(mult) == "number" then mult else 1 + local list = string.split(menus, ",") local lines = {} for _, key in Economy.MENU_ORDER do - if table.find(stats.menus, key) then - local price = Locale.t(lang, "money", { money = Locale.number(Economy.dishPrice(key, stats, 1)) }) - table.insert(lines, `{Economy.MENUS[key].icon} {Locale.menuName(lang, key)} {price}`) + if table.find(list, key) then + local m = Economy.MENUS[key] + local price = Locale.t(lang, "money", { money = Locale.number(math.floor(m.price * k)) }) + table.insert(lines, `{m.icon} {Locale.menuName(lang, key)} {price}`) end end return table.concat(lines, "\n") end --- 부지 하나에 연결합니다. state는 Lang 속성을 가진 인스턴스(실제로는 Player). +local RAINBOW = ColorSequence.new({ + ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 60, 80)), + ColorSequenceKeypoint.new(0.2, Color3.fromRGB(255, 160, 40)), + ColorSequenceKeypoint.new(0.4, Color3.fromRGB(255, 230, 60)), + ColorSequenceKeypoint.new(0.6, Color3.fromRGB(60, 210, 100)), + ColorSequenceKeypoint.new(0.8, Color3.fromRGB(60, 140, 255)), + ColorSequenceKeypoint.new(1, Color3.fromRGB(190, 80, 255)), +}) + +-- 무지개 켜기/끄기. 글자색은 흰색으로 바꿔야 그러데이션 색이 그대로 보이고, 끄면 원래 색으로 돌립니다. +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 + ng.Parent = t + local tw = TweenService:Create( + ng, + TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1), + { Rotation = 360 } + ) + tw:Play() + spinning[ng] = tw + t.TextColor3 = Color3.new(1, 1, 1) + end + elseif g then + local tw = spinning[g] + if tw then + tw:Cancel() + end + g:Destroy() + t.TextColor3 = original[t] or t.TextColor3 + original[t] = nil + end +end + +-- 부지 하나에 연결합니다. state는 Lang·KickCredits 속성을 가진 인스턴스(실제로는 Player). function Plots.attach(plot: Model, state: Instance, myId: number, send: (string, any?) -> ()): () -> () local base = plot:WaitForChild("Base") local nameBoard = base:WaitForChild("NameBoard") @@ -64,19 +125,48 @@ function Plots.attach(plot: Model, state: Instance, myId: number, send: (string, local visitPoint = base:WaitForChild("VisitPoint") :: BasePart local index = tonumber(string.match(plot.Name, "%d+")) - local prompt = Instance.new("ProximityPrompt") - prompt.Name = "VisitPrompt" - prompt.KeyboardKeyCode = Enum.KeyCode.E - prompt.MaxActivationDistance = 12 - prompt.RequiresLineOfSight = false - prompt.HoldDuration = 0 - prompt.Parent = visitPoint + local function prompt(name: string, key: Enum.KeyCode, offset: number): ProximityPrompt + local p = Instance.new("ProximityPrompt") + p.Name = name + p.KeyboardKeyCode = key + p.MaxActivationDistance = 12 + p.RequiresLineOfSight = false + p.HoldDuration = 0 + p.UIOffset = Vector2.new(0, offset) + p.Parent = visitPoint + return p + end + local visit = prompt("VisitPrompt", Enum.KeyCode.E, 0) + -- 쫓아내기는 실수로 누르지 않게 다른 키(F)와 짧게 꾹 누르기. 버튼 그림은 들어가기 버튼 아래에 + local kick = prompt("KickPrompt", Enum.KeyCode.F, 90) + kick.HoldDuration = 0.6 - local function refresh() + local shopLabels: { TextLabel } = {} + local function collect() + table.clear(shopLabels) + for _, d in plot:GetDescendants() do + if d:IsA("TextLabel") and d.Name == "ShopNameLabel" then + table.insert(shopLabels, d) + end + end + end + + local shieldToken = 0 + local refresh: () -> () + function refresh() local lang = (state:GetAttribute("Lang") :: string?) or "ko" + local rainbow = plot:GetAttribute("Rainbow") == true local nameText = Plots.nameText(plot, lang) for _, t in labels(nameBoard) do t.Text = nameText + setRainbow(t, rainbow) + end + local shopName = Plots.shopName(plot, lang) + for _, t in shopLabels do + if t.Parent then + t.Text = shopName + setRainbow(t, rainbow) + end end local menuText = Plots.menuText(plot, lang) for _, t in labels(menuBoard) do @@ -84,24 +174,61 @@ function Plots.attach(plot: Model, state: Instance, myId: number, send: (string, end local ownerId = plot:GetAttribute("OwnerId") local open = ownerId ~= nil or plot:GetAttribute("Npc") ~= nil - prompt.Enabled = open and ownerId ~= myId - prompt.ActionText = Locale.t(lang, "visitAction") - prompt.ObjectText = if ownerId ~= nil then Locale.t(lang, "visitor") else Locale.t(lang, "neighbor") + local other = open and ownerId ~= myId + visit.Enabled = other + visit.ActionText = Locale.t(lang, "visitAction") + visit.ObjectText = if ownerId ~= nil then Locale.t(lang, "visitor") else Locale.t(lang, "neighbor") + + -- 쫓아내기: 산 횟수가 있거나 상품이 열려 있을 때만. 보호 중(ShieldUntil)이면 끕니다. + local credits = state:GetAttribute("KickCredits") + local n = if typeof(credits) == "number" then credits else 0 + local shield = plot:GetAttribute("ShieldUntil") + local left = if typeof(shield) == "number" then shield - workspace:GetServerTimeNow() else 0 + kick.Enabled = other and (n > 0 or Products.KICK_PRODUCT ~= 0) and left <= 0 + kick.ActionText = if n > 0 then `{Locale.t(lang, "kickAction")} x{n}` else `💎 {Locale.t(lang, "kickAction")}` + kick.ObjectText = visit.ObjectText + -- 보호가 끝나면 다시 켜지게 + if left > 0 then + shieldToken += 1 + local token = shieldToken + task.delay(left + 0.1, function() + if token == shieldToken and plot.Parent then + refresh() + end + end) + end end + collect() local conns = { plot.AttributeChanged:Connect(refresh), state:GetAttributeChangedSignal("Lang"):Connect(refresh), - prompt.Triggered:Connect(function() + state:GetAttributeChangedSignal("KickCredits"):Connect(refresh), + -- 건물을 다시 지으면 간판 글자가 새로 생깁니다. + plot.DescendantAdded:Connect(function(d) + if d:IsA("TextLabel") then + task.defer(function() + if d.Name == "ShopNameLabel" and d.Parent and not table.find(shopLabels, d) then + collect() + refresh() + end + end) + end + end), + visit.Triggered:Connect(function() send("visit", index) end), + kick.Triggered:Connect(function() + send("kick", index) + end), } refresh() return function() for _, c in conns do c:Disconnect() end - prompt:Destroy() + visit:Destroy() + kick:Destroy() end end diff --git a/bunsik-tycoon/src/client/ShopWindow.luau b/bunsik-tycoon/src/client/ShopWindow.luau new file mode 100644 index 0000000..de67655 --- /dev/null +++ b/bunsik-tycoon/src/client/ShopWindow.luau @@ -0,0 +1,798 @@ +--!strict +-- 상점 창: 왼쪽 큰 탭 버튼 4개와 탭 내용. +-- 업그레이드: 갈래(건물·메뉴·판매 금액·손님 속도·화구·쟁반·알바생 기능)마다 카드 한 장. 다음 단계 효과와 값, [사기] +-- 꾸미기: 테이블·의자·소품 사기, 큰 [배치하기] 버튼(꾸미기 화면 열기) +-- 알바생: 역할(요리·서빙·홍보)별 고용·빼기, 시급 +-- 내 가게: 가게 이름, 무지개 이름, 건물 디자인 +-- 카드는 처음에 다 만들어 두고 속성이 바뀌면 글자·색만 바꿉니다. 칸 위치는 탭 내용 자리 비율이라 배치가 바뀌어도 그대로입니다. + +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Shared = ReplicatedStorage:WaitForChild("Shared") +local Economy = require(Shared:WaitForChild("Economy")) +local Locale = require(Shared:WaitForChild("Locale")) +local Info = require(script.Parent:WaitForChild("Info")) +local Layout = require(script.Parent:WaitForChild("Layout")) +local Theme = require(script.Parent:WaitForChild("Theme")) + +local ShopWindow = {} + +export type Handle = { + frame: Frame, + closeButton: TextButton, + open: (tab: string?) -> (), + close: () -> (), + isOpen: () -> boolean, + tab: () -> string, + setLayout: (lay: Layout.Result) -> (), + refresh: () -> (), + destroy: () -> (), +} + +ShopWindow.TABS = { "upgrade", "decor", "staff", "mine" } +local TAB_INFO: { [string]: { key: string, icon: string, color: Color3 } } = { + upgrade = { key = "tabUpgrade", icon = "upgrade", color = Theme.PINK }, + decor = { key = "tabDecor", icon = "table", color = Theme.MINT }, + staff = { key = "tabStaff", icon = "chef", color = Theme.ORANGE }, + mine = { key = "tabMine", icon = "store", color = Theme.SKY }, +} + +local GAP = 8 -- 카드 사이 간격(tests/Layout.spec.luau와 같음) + +-- 칸 배치(비율): cols x rows 칸 중 (col, row)부터 spanC x spanR 칸 +local function cell(o: GuiObject, col: number, row: number, cols: number, rows: number, spanC: number?, spanR: number?) + o.Position = UDim2.new((col - 1) / cols, GAP / 2, (row - 1) / rows, GAP / 2) + o.Size = UDim2.new((spanC or 1) / cols, -GAP, (spanR or 1) / rows, -GAP) +end + +-- 작은 알약 글자(오른쪽 위 "Lv 1/4", 로벅스 가격 등) +local function pill(parent: Instance, name: string, color: Color3): (Frame, TextLabel) + local f = Theme.frame(parent, name, color) + f.AnchorPoint = Vector2.new(1, 0) + f.Position = UDim2.new(1, -6, 0, 6) + f.Size = UDim2.fromScale(0.46, 0.15) + f.ZIndex = 6 + Theme.round(f) + Theme.stroke(f, Theme.edge(color), 2) + local t = Theme.text(f, "Text", Theme.edge(color), true) + t.Position = UDim2.new(0, 6, 0.12, 0) + t.Size = UDim2.new(1, -12, 0.76, 0) + t.ZIndex = 7 + return f, t +end + +type Card = { + holder: Frame, + body: Frame, + stroke: UIStroke, + glyph: Info.Glyph, + title: TextLabel, + tag: Frame, + tagText: TextLabel, + note: TextLabel, + buy: Theme.Button, + buyLabel: TextLabel, + status: TextLabel, + lock: ImageLabel, + check: ImageLabel, +} + +-- 카드 한 장: 그림, 이름, 오른쪽 위 꼬리표, 짧은 설명, 아래 [값] 버튼(또는 상태 글자) +local function makeCard(parent: Instance, name: string): Card + local holder = Theme.frame(parent, name) + holder.ZIndex = 3 + local body = Theme.frame(holder, "Card", Theme.WHITE) + body.Size = UDim2.fromScale(1, 1) + body.ZIndex = 3 + Theme.corner(body, 18) + local stroke = Theme.stroke(body, Theme.LINE, 3) + local glyph = Info.glyph(body, "Icon", "star") + glyph.frame.AnchorPoint = Vector2.new(0.5, 0.5) + glyph.frame.Position = UDim2.fromScale(0.5, 0.25) + glyph.frame.Size = UDim2.fromScale(0.6, 0.34) + glyph.zindex(4) + local tag, tagText = pill(body, "Tag", Theme.LAVENDER) + local title = Theme.text(body, "Name") + title.AnchorPoint = Vector2.new(0.5, 0.5) + title.Position = UDim2.fromScale(0.5, 0.5) + title.Size = UDim2.new(1, -12, 0.14, 0) + title.ZIndex = 4 + local note = Theme.text(body, "Note") + note.TextColor3 = Theme.SOFT + note.AnchorPoint = Vector2.new(0.5, 0.5) + note.Position = UDim2.fromScale(0.5, 0.635) + note.Size = UDim2.new(1, -12, 0.12, 0) + note.ZIndex = 4 + local buy, buyLabel = Theme.textButton(holder, "Buy", Theme.MINT, 14) + buy.button.AnchorPoint = Vector2.new(0.5, 1) + buy.button.Position = UDim2.new(0.5, 0, 1, -6) + buy.button.Size = UDim2.new(1, -14, 0.24, 0) + buy.button.ZIndex = 5 + buyLabel.FontFace = Theme.NUM + buyLabel.Position = UDim2.new(0.5, 12, 0.5, 0) + buyLabel.Size = UDim2.new(1, -44, 0.62, 0) + local coin = Theme.icon(buy.face, "Coin", "coin") + coin.AnchorPoint = Vector2.new(0, 0.5) + coin.Position = UDim2.new(0, 4, 0.5, 0) + coin.Size = UDim2.fromScale(0.26, 1.1) + coin.SizeConstraint = Enum.SizeConstraint.RelativeYY + coin.ZIndex = 5 + local status = Theme.text(holder, "Status") + status.TextColor3 = Theme.SOFT + status.AnchorPoint = Vector2.new(0.5, 1) + status.Position = UDim2.new(0.5, 0, 1, -10) + status.Size = UDim2.new(1, -16, 0.17, 0) + status.ZIndex = 5 + local lock = Theme.icon(body, "Lock", "lock") + lock.AnchorPoint = Vector2.new(0.5, 0.5) + lock.Position = UDim2.fromScale(0.5, 0.25) + lock.Size = UDim2.fromScale(0.3, 0.3) + lock.SizeConstraint = Enum.SizeConstraint.RelativeYY + lock.ZIndex = 6 + local check = Theme.icon(body, "Done", "check") + check.AnchorPoint = Vector2.new(0.5, 0.5) + check.Position = UDim2.fromOffset(18, 18) + check.Size = UDim2.fromOffset(36, 36) + check.ZIndex = 6 + return { + holder = holder, + body = body, + stroke = stroke, + glyph = glyph, + title = title, + tag = tag, + tagText = tagText, + note = note, + buy = buy, + buyLabel = buyLabel, + status = status, + lock = lock, + check = check, + } +end + +-- 카드 상태: "buy"(값 버튼), "locked"(자물쇠 + 글자), "done"(체크 + 글자), "off"(글자만, 예: 꽉 참) +local function setCard(c: Card, mode: string, cost: number?, can: boolean?, statusText: string?) + local buyMode = mode == "buy" + c.buy.button.Visible = buyMode + c.status.Visible = not buyMode + c.lock.Visible = mode == "locked" + c.check.Visible = mode == "done" + c.glyph.fade(if mode == "locked" then 0.55 else 0) + if buyMode then + c.buyLabel.Text = Locale.number(cost or 0) + c.buy.setColor(if can then Theme.MINT else Theme.GRAY) + else + c.status.Text = statusText or "" + c.status.TextColor3 = if mode == "done" then Theme.edge(Theme.MINT) else Theme.SOFT + end + local tint = if mode == "done" then Theme.MINT elseif buyMode and can then Theme.YELLOW else nil + c.stroke.Color = if tint then Theme.edge(tint) else Theme.LINE + c.stroke.Thickness = if tint then 4 else 3 + if tint then + Theme.gradient(c.body, Theme.WHITE, Theme.lighten(tint, 0.7)) + else + Theme.gradient(c.body, Theme.WHITE, Color3.fromRGB(250, 246, 250)) + end +end + +function ShopWindow.build(root: Frame, state: Instance, send: (string, any?) -> (), onDecorate: () -> ()): Handle + local function lang(): string + return Info.attr(state, "Lang", "ko") + end + local function L(key: string, args: { [string]: any }?): string + return Locale.t(lang(), key, args) + end + + local conns: { RBXScriptConnection } = {} + local function on(sig: RBXScriptSignal, fn: (...any) -> ()) + table.insert(conns, sig:Connect(fn)) + end + + local shopPanel = Theme.panel(root, "Panel", Theme.PINK) + local frame = shopPanel.frame + local body = shopPanel.body + local current = "upgrade" + local refresh: () -> () + + -- 탭 버튼과 탭 내용 자리 + local tabButtons: { [string]: Theme.Button } = {} + local tabLabels: { [string]: TextLabel } = {} + local tabBadges: { [string]: Frame } = {} + local pages: { [string]: Frame } = {} + for _, id in ShopWindow.TABS do + local ti = TAB_INFO[id] + local b, label = Theme.iconButton(body, "Tab_" .. id, ti.color, ti.icon) + b.button.ZIndex = 4 + label.Size = UDim2.fromScale(1, 0.28) + tabButtons[id] = b + tabLabels[id] = label + local badge, badgeText = Theme.badge(b.button, "Badge") + badgeText.Text = "!" + badge.Visible = false + tabBadges[id] = badge + local page = Theme.frame(body, "Page_" .. id) + page.ZIndex = 3 + page.Visible = false + pages[id] = page + on(b.button.Activated, function() + current = id + refresh() + end) + end + + -- 1) 업그레이드: 건물 카드는 두 칸(위 왼쪽), 나머지 6장 + local upgradeCards: { [string]: Card } = {} + local SPOTS: { [string]: { number } } = { + Stage = { 1, 1, 2 }, + Menu = { 3, 1, 1 }, + Price = { 4, 1, 1 }, + Speed = { 1, 2, 1 }, + Stove = { 2, 2, 1 }, + Tray = { 3, 2, 1 }, + Staff = { 4, 2, 1 }, + } + for i, id in Economy.TRACK_ORDER do + local c = makeCard(pages.upgrade, "Track_" .. id) + local spot = SPOTS[id] or { (i - 1) % 4 + 1, (i - 1) // 4 + 1, 1 } + cell(c.holder, spot[1], spot[2], 4, 2, spot[3], 1) + if id == "Stage" then + -- 건물은 크게: 그림과 글자를 왼쪽·오른쪽으로 + c.glyph.frame.Position = UDim2.fromScale(0.22, 0.4) + c.glyph.frame.Size = UDim2.fromScale(0.36, 0.6) + c.lock.Position = UDim2.fromScale(0.22, 0.4) + for _, t in { c.title, c.note } do + t.AnchorPoint = Vector2.new(0, 0.5) + t.Size = UDim2.fromScale(0.56, 0.16) + end + c.title.Position = UDim2.fromScale(0.42, 0.34) + c.note.Position = UDim2.fromScale(0.42, 0.52) + c.buy.button.AnchorPoint = Vector2.new(1, 1) + c.buy.button.Position = UDim2.new(1, -8, 1, -6) + c.buy.button.Size = UDim2.fromScale(0.56, 0.24) + c.status.AnchorPoint = Vector2.new(1, 1) + c.status.Position = UDim2.new(1, -8, 1, -10) + c.status.Size = UDim2.fromScale(0.56, 0.17) + c.tag.Size = UDim2.fromScale(0.22, 0.15) + end + upgradeCards[id] = c + on(c.buy.button.Activated, function() + send("upgrade", id) + end) + end + + -- 2) 꾸미기: 왼쪽 큰 [배치하기], 오른쪽 4x2 카드(테이블, 의자, 소품 6개) + local placeBtn = Theme.button(pages.decor, "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() + 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(pages.decor, "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 + send("buyTable") + elseif id == "Seat" then + send("buySeat") + else + send("buyDecor", id) + end + end) + end + + -- 3) 알바생: 위 띠(시급 합계 또는 파업 안내), 역할 카드 3장 / 아직 안 열렸으면 자물쇠 카드 + local staffOpen = Theme.frame(pages.staff, "Open") + staffOpen.Size = UDim2.fromScale(1, 1) + staffOpen.ZIndex = 3 + local banner = Theme.frame(staffOpen, "Banner", Theme.CREAM) + banner.Position = UDim2.fromOffset(GAP / 2, GAP / 2) + banner.Size = UDim2.new(1, -GAP, 0.15, 0) + banner.ZIndex = 3 + Theme.round(banner) + local bannerStroke = Theme.stroke(banner, Theme.LINE, 3) + local bannerText = Theme.text(banner, "Text") + bannerText.Position = UDim2.new(0, 14, 0.15, 0) + bannerText.Size = UDim2.new(1, -28, 0.7, 0) + bannerText.ZIndex = 4 + local roleRow = Theme.frame(staffOpen, "Roles") + roleRow.Position = UDim2.fromScale(0, 0.17) + roleRow.Size = UDim2.fromScale(1, 0.83) + roleRow.ZIndex = 3 + type RoleCard = { card: Card, wage: TextLabel, fire: Theme.Button, fireLabel: TextLabel } + local roleCards: { [string]: RoleCard } = {} + for i, r in Economy.ROLES do + local c = makeCard(roleRow, "Role_" .. r.id) + cell(c.holder, i, 1, #Economy.ROLES, 1) + c.glyph.set(Info.ROLE_ICON[r.id] or "chef") + c.glyph.frame.Position = UDim2.fromScale(0.5, 0.2) + c.glyph.frame.Size = UDim2.fromScale(0.5, 0.26) + c.title.Position = UDim2.fromScale(0.5, 0.42) + c.title.Size = UDim2.new(1, -12, 0.1, 0) + c.note.Position = UDim2.fromScale(0.5, 0.53) + c.note.Size = UDim2.new(1, -12, 0.09, 0) + c.tag.Size = UDim2.fromScale(0.3, 0.1) + local wage = Theme.text(c.body, "Wage") + wage.TextColor3 = Theme.edge(Theme.ORANGE) + wage.AnchorPoint = Vector2.new(0.5, 0.5) + wage.Position = UDim2.fromScale(0.5, 0.64) + wage.Size = UDim2.new(1, -12, 0.08, 0) + wage.ZIndex = 4 + c.buy.button.Size = UDim2.new(1, -14, 0.2, 0) + c.status.Size = UDim2.new(1, -16, 0.14, 0) + local fire, fireLabel = Theme.textButton(c.holder, "Fire", Theme.RED, 14) + fire.button.AnchorPoint = Vector2.new(0, 1) + fire.button.Position = UDim2.new(0, 7, 1, -6) + fire.button.Size = UDim2.new(0.36, -7, 0.2, 0) + fire.button.ZIndex = 5 + roleCards[r.id] = { card = c, wage = wage, fire = fire, fireLabel = fireLabel } + local roleId = r.id + on(c.buy.button.Activated, function() + send("hire", roleId) + end) + on(fire.button.Activated, function() + send("fire", roleId) + end) + end + local staffLocked = Theme.frame(pages.staff, "Locked", Theme.WHITE) + staffLocked.AnchorPoint = Vector2.new(0.5, 0.5) + staffLocked.Position = UDim2.fromScale(0.5, 0.5) + staffLocked.Size = UDim2.fromScale(0.7, 0.8) + staffLocked.ZIndex = 3 + Theme.corner(staffLocked, 24) + Theme.stroke(staffLocked, Theme.LINE, 3) + local lockedChef = Theme.icon(staffLocked, "Chef", "chef") + Theme.place(lockedChef, 0.5, 0.26, 0.3, 0.36) + lockedChef.ImageTransparency = 0.5 + lockedChef.ZIndex = 4 + local lockedLock = Theme.icon(staffLocked, "Lock", "lock") + Theme.place(lockedLock, 0.62, 0.32, 0.16, 0.2) + lockedLock.ZIndex = 5 + local lockedText = Theme.text(staffLocked, "Text") + Theme.place(lockedText, 0.5, 0.58, 0.86, 0.14) + lockedText.ZIndex = 4 + local goUp, goUpLabel = Theme.textButton(staffLocked, "GoUpgrade", Theme.PINK, 18) + goUp.button.AnchorPoint = Vector2.new(0.5, 1) + goUp.button.Position = UDim2.new(0.5, 0, 1, -12) + goUp.button.Size = UDim2.fromScale(0.6, 0.22) + goUp.button.ZIndex = 5 + on(goUp.button.Activated, function() + current = "upgrade" + refresh() + end) + + -- 4) 내 가게: 이름, 무지개, 디자인 + local mine = pages.mine + local function row(name: string, y: number, h: number): Frame + local f = Theme.frame(mine, name) + f.Position = UDim2.new(0, GAP / 2, y, 0) + f.Size = UDim2.new(1, -GAP, h, 0) + f.ZIndex = 3 + return f + end + local nameRow = row("NameRow", 0.01, 0.19) + local nameTitle = Theme.text(nameRow, "Title") + nameTitle.TextXAlignment = Enum.TextXAlignment.Left + nameTitle.Position = UDim2.fromScale(0, 0.2) + nameTitle.Size = UDim2.fromScale(0.2, 0.6) + nameTitle.ZIndex = 4 + local boxBack = Theme.frame(nameRow, "BoxBack", Theme.WHITE) + boxBack.Position = UDim2.fromScale(0.21, 0.05) + boxBack.Size = UDim2.fromScale(0.56, 0.9) + boxBack.ZIndex = 4 + Theme.round(boxBack) + Theme.stroke(boxBack, Theme.edge(Theme.SKY), 3) + local box = Instance.new("TextBox") + box.Name = "NameBox" + box.BackgroundTransparency = 1 + box.ClearTextOnFocus = false + box.FontFace = Theme.FONT + box.TextScaled = true + box.TextColor3 = Theme.TEXT + box.PlaceholderColor3 = Theme.SOFT + box.Text = "" + box.Position = UDim2.new(0, 16, 0.18, 0) + box.Size = UDim2.new(1, -32, 0.64, 0) + box.ZIndex = 5 + box.Parent = boxBack + local saveBtn, saveLabel = Theme.textButton(nameRow, "Save", Theme.SKY, 18) + saveBtn.button.Position = UDim2.fromScale(0.79, 0) + saveBtn.button.Size = UDim2.fromScale(0.21, 1) + saveBtn.button.ZIndex = 4 + -- 이름은 최대 Economy.NAME_MAX 글자 + on(box:GetPropertyChangedSignal("Text"), function() + local s = box.Text + local n = utf8.len(s) + if n and n > Economy.NAME_MAX then + local cut = utf8.offset(s, Economy.NAME_MAX + 1) + if cut then + box.Text = string.sub(s, 1, cut - 1) + end + end + end) + on(saveBtn.button.Activated, function() + send("rename", box.Text) + box:ReleaseFocus() + end) + on(box.FocusLost, function(enter: boolean) + if enter then + send("rename", box.Text) + 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 + local rainbowGrad = Instance.new("UIGradient") + rainbowGrad.Color = ColorSequence.new({ + ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 70, 90)), + ColorSequenceKeypoint.new(0.25, Color3.fromRGB(255, 170, 40)), + ColorSequenceKeypoint.new(0.5, Color3.fromRGB(60, 200, 90)), + 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() + send("rainbow", Info.attr(state, "Rainbow", true) ~= true or Info.attr(state, "RainbowOwned", false) ~= true) + end) + + local designHead = row("DesignHead", 0.43, 0.11) + local designTitle = Theme.text(designHead, "Title") + designTitle.TextXAlignment = Enum.TextXAlignment.Left + designTitle.Size = UDim2.fromScale(0.4, 1) + designTitle.ZIndex = 4 + local designNote = Theme.text(designHead, "Note") + designNote.TextXAlignment = Enum.TextXAlignment.Right + designNote.TextColor3 = Theme.SOFT + designNote.Position = UDim2.fromScale(0.4, 0.1) + designNote.Size = UDim2.fromScale(0.6, 0.8) + designNote.ZIndex = 4 + local designRow = Theme.frame(mine, "Designs") + designRow.Position = UDim2.fromScale(0, 0.55) + designRow.Size = UDim2.fromScale(1, 0.45) + designRow.ZIndex = 3 + type DesignCard = { + button: Theme.Button, + label: TextLabel, + swatch: Frame, + check: ImageLabel, + lock: ImageLabel, + price: Frame, + priceText: TextLabel, + } + local designCards: { [string]: DesignCard } = {} + for i, d in Economy.DESIGNS do + local b = Theme.button(designRow, "Design_" .. d.id, Theme.GRAY, 18) + cell(b.button, i, 1, #Economy.DESIGNS, 1) + b.button.ZIndex = 4 + -- 견본: 지붕 / 벽 / 차양 색 띠 + local swatch = Theme.frame(b.face, "Swatch", Theme.WHITE) + swatch.AnchorPoint = Vector2.new(0.5, 0) + swatch.Position = UDim2.fromScale(0.5, 0.1) + swatch.Size = UDim2.fromScale(0.74, 0.56) + swatch.ZIndex = 4 + swatch.ClipsDescendants = true + Theme.corner(swatch, 12) + Theme.stroke(swatch, Theme.LINE, 2) + local colors = Info.DESIGN_COLORS[d.id] or Info.DESIGN_COLORS.Basic + local bands = { { 0, 0.34 }, { 0.34, 0.4 }, { 0.74, 0.26 } } + local bandColors = { colors[2], colors[1], colors[3] } + for j, part in bands do + local band = Theme.frame(swatch, "Band" .. j, bandColors[j]) + band.Position = UDim2.fromScale(0, part[1]) + band.Size = UDim2.fromScale(1, part[2]) + band.ZIndex = 5 + end + local label = Theme.text(b.face, "Label", Theme.edge(Theme.GRAY)) + label.AnchorPoint = Vector2.new(0.5, 0.5) + label.Position = UDim2.fromScale(0.5, 0.82) + label.Size = UDim2.fromScale(0.9, 0.2) + label.ZIndex = 5 + local ok = Theme.icon(b.button, "Done", "check") + ok.AnchorPoint = Vector2.new(0.5, 0.5) + ok.Position = UDim2.new(1, -8, 0, 8) + ok.Size = UDim2.fromOffset(36, 36) + ok.ZIndex = 8 + local lock = Theme.icon(b.face, "Lock", "lock") + Theme.place(lock, 0.5, 0.38, 0.4, 0.4) + lock.SizeConstraint = Enum.SizeConstraint.RelativeYY + lock.ZIndex = 7 + local price, priceText = pill(b.button, "Price", Theme.LAVENDER) + price.AnchorPoint = Vector2.new(0.5, 0.5) + price.Position = UDim2.new(0.5, 0, 0, 2) + price.Size = UDim2.fromScale(0.7, 0.16) + price.ZIndex = 8 + designCards[d.id] = { + button = b, + label = label, + swatch = swatch, + check = ok, + lock = lock, + price = price, + priceText = priceText, + } + local id = d.id + on(b.button.Activated, function() + if Info.attr(state, "Stage", 1) >= 2 then + send("design", id) + end + end) + end + + local lastName: string? = nil + + local function refreshUpgrade(levels: Economy.Levels, stats: Economy.Stats, money: number): boolean + local any = false + for _, id in Economy.TRACK_ORDER do + local c = upgradeCards[id] + local t = Economy.track(id) :: Economy.Track + local lv = Economy.level(levels, id) + local nl = Economy.nextLevel(levels, id) + c.title.Text = L("track_" .. id) + c.tagText.Text = `Lv {lv}/{#t.levels}` + c.glyph.set(Info.trackIcon(levels, id)) + c.note.Text = Info.effect(lang(), levels, id) or (if id == "Stage" then L(`stage_{stats.stage}`) else "") + if not nl then + setCard(c, "done", nil, nil, L("bought")) + elseif nl.stage > stats.stage then + setCard(c, "locked", nil, nil, L(`lockStage{nl.stage}`)) + else + local can = money >= nl.cost + any = any or can + setCard(c, "buy", nl.cost, can) + end + end + 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) + placeLabel.Text = L("place") + 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 or seats >= seatCap then + setCard(c, "off", nil, nil, L("full")) + else + buyable(c, Economy.tableCost(tables, seats)) + 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")) + elseif seats >= tables * Economy.CHAIRS_PER_TABLE then + setCard(c, "off", nil, nil, L("needTable")) + 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 + lockedText.Text = L("staffLockedCard") + goUpLabel.Text = L("goUpgrade") + local strike = Info.attr(state, "Strike", false) == true + local color = if strike then Theme.RED else Theme.ORANGE + banner.BackgroundColor3 = if strike then Theme.lighten(Theme.RED, 0.75) else Theme.CREAM + bannerStroke.Color = Theme.lighten(color, 0.3) + bannerText.TextColor3 = if strike then Theme.edge(Theme.RED) else Theme.TEXT + bannerText.Text = if strike + then L("strikeBanner") + else L("wageTotal", { wage = Locale.number(Info.attr(state, "Wage", 0)) }) + local staff = Info.staff(state) + for _, r in Economy.ROLES do + local rc = roleCards[r.id] + local c = rc.card + local n = staff[r.id] or 0 + c.title.Text = L("role_" .. r.id) + c.note.Text = L("roleDesc_" .. r.id) + c.tagText.Text = `{n}/{r.max}` + rc.wage.Text = L("wage", { wage = Locale.number(Economy.wage(r.id, stats)) }) + rc.fire.button.Visible = n > 0 + rc.fireLabel.Text = L("fire") + -- 고용 버튼은 빼기 버튼이 있으면 오른쪽 2/3만 + if n > 0 then + c.buy.button.AnchorPoint = Vector2.new(1, 1) + c.buy.button.Position = UDim2.new(1, -7, 1, -6) + c.buy.button.Size = UDim2.new(0.64, -7, 0.2, 0) + else + c.buy.button.AnchorPoint = Vector2.new(0.5, 1) + c.buy.button.Position = UDim2.new(0.5, 0, 1, -6) + c.buy.button.Size = UDim2.new(1, -14, 0.2, 0) + end + if n >= r.max then + setCard(c, "off", nil, nil, L("full")) + c.status.Position = UDim2.new(0.68, 0, 1, -12) + c.status.Size = UDim2.fromScale(0.6, 0.12) + else + c.status.Position = UDim2.new(0.5, 0, 1, -10) + setCard(c, "buy", r.hire, money >= r.hire) + end + c.check.Visible = false + end + end + + local function refreshMine(stats: Economy.Stats) + nameTitle.Text = L("shopName") + box.PlaceholderText = L("namePlaceholder") + saveLabel.Text = L("save") + local name = Info.attr(state, "ShopName", "") :: string + if name ~= lastName and not box:IsFocused() then + box.Text = name + lastName = name + end + rainbowTitle.Text = "🌈 " .. L("rainbow") + 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 price = Info.robux("RAINBOW_NAME_PASS") + rainbowPrice.Visible = not owned and price ~= nil + rainbowPriceText.Text = price or "" + designTitle.Text = L("designs") + local open = stats.stage >= 2 + designNote.Text = if open then "" else L("designLocked") + local selected = Info.attr(state, "Design", "Basic") + local ownedList = string.split(Info.attr(state, "DesignsOwned", "") :: string, ",") + for _, d in Economy.DESIGNS do + local dc = designCards[d.id] + local isSel = d.id == selected + local color = if isSel then Theme.MINT else Theme.GRAY + dc.button.setColor(if open then color else Color3.fromRGB(150, 145, 165)) + local st = dc.label:FindFirstChildOfClass("UIStroke") + if st then + st.Color = Theme.edge(dc.button.color()) + end + dc.label.Text = L("design_" .. d.id) + dc.check.Visible = isSel and open + dc.lock.Visible = not open + for _, band in dc.swatch:GetChildren() do + if band:IsA("Frame") then + band.BackgroundTransparency = if open then 0 else 0.5 + end + end + local p = if d.pass and not table.find(ownedList, d.id) then Info.robux(d.pass) else nil + dc.price.Visible = p ~= nil + dc.priceText.Text = p or "" + end + end + + function refresh() + local levels = Info.levels(state) + local stats = Economy.stats(levels, Info.attr(state, "Seats", 1)) + local money = Info.attr(state, "Money", 0) + shopPanel.title.Text = L(TAB_INFO[current].key) + for _, id in ShopWindow.TABS do + local ti = TAB_INFO[id] + pages[id].Visible = id == current + tabButtons[id].setColor(if id == current then ti.color else Theme.lighten(ti.color, 0.55)) + tabLabels[id].Text = L(ti.key) + end + -- 살 수 있는 것이 있는 탭에 ! 배지 + tabBadges.upgrade.Visible = refreshUpgrade(levels, stats, money) + tabBadges.decor.Visible = refreshDecor(stats, money) + refreshStaff(stats, money) + refreshMine(stats) + end + + local function setLayout(lay: Layout.Result) + local r = lay.panel + frame.AnchorPoint = Vector2.new(0.5, 0.5) + frame.Position = UDim2.fromOffset(r.x + r.w / 2, r.y + r.h / 2) + frame.Size = UDim2.fromOffset(r.w, r.h) + shopPanel.close.button.Size = UDim2.fromOffset(lay.rows.closeH, lay.rows.closeH) + for i, id in ShopWindow.TABS do + local t = lay.tabs[i] + local b = tabButtons[id].button + b.AnchorPoint = Vector2.new(0.5, 0.5) + b.Position = UDim2.fromOffset(t.x + t.w / 2, t.y + t.h / 2) + b.Size = UDim2.fromOffset(t.w, t.h) + end + local c = lay.content + for _, page in pages do + page.Position = UDim2.fromOffset(c.x, c.y) + page.Size = UDim2.fromOffset(c.w, c.h) + end + end + + return { + frame = frame, + closeButton = shopPanel.close.button, + open = function(tab: string?) + if tab and TAB_INFO[tab] then + current = tab + end + frame.Visible = true + Theme.pop(frame) + refresh() + end, + close = function() + frame.Visible = false + box:ReleaseFocus() + end, + isOpen = function() + return frame.Visible + end, + tab = function() + return current + end, + setLayout = function(lay: Layout.Result) + setLayout(lay) + refresh() + end, + refresh = refresh, + destroy = function() + for _, cn in conns do + cn:Disconnect() + end + end, + } +end + +return ShopWindow diff --git a/bunsik-tycoon/src/shared/Locale.luau b/bunsik-tycoon/src/shared/Locale.luau index e7205e3..a17f9dc 100644 --- a/bunsik-tycoon/src/shared/Locale.luau +++ b/bunsik-tycoon/src/shared/Locale.luau @@ -1,6 +1,7 @@ --!strict -- 화면 글자(한국어·영어·일본어·중국어 간체). 키가 없으면 영어, 그것도 없으면 키 이름을 그대로 보여 줘서 빠진 번역이 바로 보입니다. --- 메뉴 이름은 "menu_<메뉴 키>", 업그레이드 이름은 "item_<구매 id>" 키에 있습니다. +-- 메뉴 이름은 "menu_<메뉴 키>", 업그레이드 갈래는 "track_", 알바 역할은 "role_", 소품은 "decor_", +-- 디자인은 "design_", 배치 실패 이유는 "why_<이유>" 키에 있습니다. local Locale = {} @@ -8,14 +9,11 @@ local STRINGS: { [string]: { [string]: string } } = { ko = { title = "분식집 타이쿤", money = "{money}원", - shop = "업그레이드", buy = "사기", bought = "완료", locked = "잠김", notEnough = "돈이 {need}원 더 필요해요", - maxed = "모든 업그레이드를 샀어요! 2호점은 다음 업데이트에서 열려요", - stage1 = "1단계 · 포장마차", - stage2 = "2단계 · 실내 분식집", + maxed = "모든 업그레이드 완료!", next = "다음", nextUp = "다음 업그레이드", doubleOn = "적용 중", @@ -49,7 +47,7 @@ local STRINGS: { [string]: { [string]: string } } = { stoveObject = "조리대", tut1 = "손님이 왔어요! 빛나는 조리대로 가서 요리를 시작해요", tut2 = "다 만들었어요! 접시를 손님 자리로 가져가세요", - tut3 = "돈을 벌었어요! 아래 [사기] 버튼으로 테이블을 사세요", + tut3 = "돈을 벌었어요! 아래 [사기] 버튼으로 의자를 사세요", tutDone = "잘했어요! 계속 손님을 받고 가게를 키워 보세요", double = "2배 수익", doubleOwned = "2배 수익 적용 중", @@ -59,7 +57,7 @@ local STRINGS: { [string]: { [string]: string } } = { boostGot = "돈 부스트 {amount}원을 받았어요!", purchased = "{name} 구매 완료!", newMenu = "새 메뉴 {menuName}! 이제 손님이 {menuName}도 주문해요", - expanded = "실내 분식집으로 확장했어요! 새 업그레이드가 열렸어요", + expanded = "실내 분식집으로 확장했어요! 디자인도 바꿀 수 있어요", plotOwner = "{name}의 분식집", plotEmpty = "빈 가게 자리", neighbor = "이웃 가게", @@ -98,38 +96,133 @@ local STRINGS: { [string]: { [string]: string } } = { menu_Sundae = "순대", menu_Eomuk = "어묵", menu_Twigim = "튀김", - item_Table2 = "테이블 2", - item_UnlockGimbap = "김밥 해금", - item_Sign1 = "간판 Lv1", - item_Stove1 = "화구 Lv1", - item_Table3 = "테이블 3", - item_UnlockSundae = "순대 해금", - item_Sauce1 = "양념 비법 Lv1", - item_Helper = "알바생 고용", - item_Table4 = "테이블 4", - item_Expand = "실내 분식집 확장", - item_Tray1 = "쟁반", - item_Table5 = "테이블 5", - item_UnlockEomuk = "어묵 해금", - item_Sign2 = "간판 Lv2", - item_Table6 = "테이블 6", - item_Stove2 = "화구 Lv2", - item_UnlockTwigim = "튀김 해금", - item_Sauce2 = "양념 비법 Lv2", - item_Tray2 = "큰 쟁반", - item_Table8 = "테이블 7·8", + stage_1 = "포장마차", + stage_2 = "실내 분식집", + stage_3 = "2층 분식집", + tabUpgrade = "업그레이드", + tabDecor = "꾸미기", + tabStaff = "알바생", + tabMine = "내 가게", + track_Stage = "가게 건물", + track_Menu = "새 메뉴", + track_Price = "판매 금액", + track_Speed = "손님 속도", + track_Stove = "화구", + track_Tray = "쟁반", + track_Staff = "알바생 기능", + fx_Stage = "{from} → {to}", + fx_Menu = "새 메뉴 {menuName}", + fx_Price = "판매 금액 x{from} → x{to}", + fx_Speed = "손님 간격 {from}초 → {to}초", + fx_Stove = "요리 일 {from}% → {to}%", + fx_Tray = "접시 {from}개 → {to}개", + fx_Staff = "알바생을 고용할 수 있어요", + lockStage2 = "실내 분식집부터", + lockStage3 = "2층부터", + full = "꽉 찼어요", + needTable = "테이블 먼저", + thing_Seat = "의자", + thing_Table = "테이블", + decor_Plant = "화분", + decor_Rug = "카펫", + decor_Balloons = "풍선", + decor_Lamp = "전등", + decor_Teddy = "곰인형", + decor_Fridge = "냉장고", + place = "배치하기", + seatsNow = "자리 {n}/{max}", + decorNow = "소품 {n}/{max}", + staffLockedCard = "알바생 기능 업그레이드를 사면 열려요", + goUpgrade = "업그레이드 보기", + role_Cook = "요리 알바", + role_Server = "서빙 알바", + role_Promoter = "홍보 알바", + roleDesc_Cook = "접시를 만들어 둬요", + roleDesc_Server = "손님에게 날라 줘요", + roleDesc_Promoter = "손님이 더 빨리 와요", + hire = "고용", + fire = "빼기", + wage = "시급 {wage}원 · 1분마다", + wageTotal = "시급 합계 {wage}원 · 1분마다", + strikeBanner = "돈이 모자라서 알바생이 쉬고 있어요", + shopName = "가게 이름", + namePlaceholder = "이름을 써 주세요", + save = "저장", + rainbow = "무지개 이름", + designs = "가게 디자인", + design_Basic = "기본", + design_Mint = "민트", + design_Brick = "벽돌", + design_Candy = "사탕 궁전", + design_Hanok = "한옥", + inUse = "사용 중", + btnPromote = "홍보", + btnRush = "러시", + promoteTitle = "홍보하기", + promoteAdText = "광고를 보면 옆 가게 손님이 우리 가게로 와요", + watchAd = "광고 보기", + promoteFree = "그냥 홍보", + kickAction = "손님 쫓아내기", + decoPick = "옮길 물건을 눌러요", + decoMove = "바닥을 눌러 옮겨요", + decoChair = "쪽을 고르거나 다른 테이블을 눌러요", + decoOk = "여기 좋아요! [놓기]를 눌러요", + rotate = "돌리기", + placeIt = "놓기", + cancel = "취소", + exit = "나가기", + floorN = "{n}층", + side_1 = "앞", + side_2 = "오른쪽", + side_3 = "뒤", + side_4 = "왼쪽", + why_bounds = "가게 밖이에요", + why_overlap = "다른 물건과 겹쳐요", + why_reserved = "문 앞과 계단은 비워 둬요", + why_floor = "2층이 아직 없어요", + why_blocked = "손님 길이 막혀요", + why_chair = "그쪽엔 의자를 놓을 수 없어요", + why_none = "다시 골라 주세요", + upgraded = "{name} Lv{level}!", + floor2 = "2층이 생겼어요! 테이블을 더 놓을 수 있어요", + seatAdded = "의자를 놓았어요! 손님 자리가 늘었어요", + tableAdded = "테이블을 놓았어요!", + decorAdded = "{name} 설치 완료!", + noSpace = "놓을 곳이 없어요. [배치하기]로 옮겨 보세요", + seatMax = "자리가 꽉 찼어요. 건물을 키워 보세요", + tableMax = "테이블을 더 놓을 수 없어요", + tableFull = "테이블마다 의자가 꽉 찼어요. 테이블을 사요", + needStage = "건물을 먼저 키워요", + placeFail = "여기는 안 돼요: {reason}", + hired = "{name} 고용!", + fired = "{name} 한 명을 뺐어요", + staffLocked = "알바생 기능을 먼저 사요", + staffMax = "더 고용할 수 없어요", + strike = "돈이 모자라 알바생이 쉬어요", + strikeOver = "알바생이 다시 일해요!", + renamed = "가게 이름을 바꿨어요!", + nameRejected = "그 이름은 쓸 수 없어요", + designSet = "{name} 디자인으로 바꿨어요!", + designLocked = "실내 분식집부터 바꿀 수 있어요", + promoted = "손님 {n}명이 우리 가게로 와요!", + promoteNone = "데려올 손님이 없어요", + promoteFull = "빈자리가 없어요", + promoteWait = "{sec}초 뒤에 다시 할 수 있어요", + adUnavailable = "지금은 광고를 볼 수 없어요", + kicked = "손님 {n}명이 우리 가게로 왔어요!", + kickedBy = "{name}님이 우리 손님을 데려갔어요!", + shielded = "그 가게는 잠깐 보호 중이에요", + kickOwn = "내 가게에는 쓸 수 없어요", + rushOn = "손님 러시 {min}분 시작!", }, en = { title = "Bunsik Tycoon", money = "₩{money}", - shop = "Upgrades", buy = "Buy", bought = "Done", locked = "Locked", notEnough = "Need ₩{need} more", - maxed = "All upgrades bought! Shop #2 opens in the next update", - stage1 = "Stage 1 · Street Stall", - stage2 = "Stage 2 · Indoor Shop", + maxed = "All upgrades done!", next = "Next", nextUp = "Next Upgrade", doubleOn = "Active", @@ -163,7 +256,7 @@ local STRINGS: { [string]: { [string]: string } } = { stoveObject = "Stove", 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", + tut3 = "You earned money! Tap [Buy] at the bottom to get a chair", tutDone = "Great job! Keep serving and grow your shop", double = "Double Money", doubleOwned = "Double Money active", @@ -173,7 +266,7 @@ local STRINGS: { [string]: { [string]: string } } = { boostGot = "Money Boost: +₩{amount}!", purchased = "{name} bought!", newMenu = "New menu: {menuName}! Customers will start ordering it", - expanded = "Your shop moved indoors! New upgrades unlocked", + expanded = "Your shop moved indoors! You can change its design now", plotOwner = "{name}'s Bunsik Shop", plotEmpty = "Empty lot", neighbor = "Neighbor shop", @@ -212,38 +305,133 @@ local STRINGS: { [string]: { [string]: string } } = { menu_Sundae = "Sundae", menu_Eomuk = "Fish Cake", menu_Twigim = "Twigim", - item_Table2 = "Table 2", - item_UnlockGimbap = "Unlock Gimbap", - item_Sign1 = "Sign Lv1", - item_Stove1 = "Stove Lv1", - item_Table3 = "Table 3", - item_UnlockSundae = "Unlock Sundae", - item_Sauce1 = "Secret Sauce Lv1", - item_Helper = "Hire Helper", - item_Table4 = "Table 4", - item_Expand = "Indoor Shop", - item_Tray1 = "Tray", - item_Table5 = "Table 5", - item_UnlockEomuk = "Unlock Fish Cake", - item_Sign2 = "Sign Lv2", - item_Table6 = "Table 6", - item_Stove2 = "Stove Lv2", - item_UnlockTwigim = "Unlock Twigim", - item_Sauce2 = "Secret Sauce Lv2", - item_Tray2 = "Big Tray", - item_Table8 = "Tables 7-8", + stage_1 = "Street Stall", + stage_2 = "Indoor Shop", + stage_3 = "2-Floor Shop", + tabUpgrade = "Upgrades", + tabDecor = "Decorate", + tabStaff = "Staff", + tabMine = "My Shop", + track_Stage = "Building", + track_Menu = "New Menu", + track_Price = "Prices", + track_Speed = "Customer Speed", + track_Stove = "Stove", + track_Tray = "Tray", + track_Staff = "Staff Unlock", + fx_Stage = "{from} → {to}", + fx_Menu = "New: {menuName}", + fx_Price = "Prices x{from} → x{to}", + fx_Speed = "Customer every {from}s → {to}s", + fx_Stove = "Cooking work {from}% → {to}%", + fx_Tray = "Carry {from} → {to} dishes", + fx_Staff = "You can hire staff", + lockStage2 = "From Indoor Shop", + lockStage3 = "From 2nd Floor", + full = "Full", + needTable = "Table first", + thing_Seat = "Chair", + thing_Table = "Table", + decor_Plant = "Plant", + decor_Rug = "Rug", + decor_Balloons = "Balloons", + decor_Lamp = "Lamp", + decor_Teddy = "Teddy Bear", + decor_Fridge = "Fridge", + place = "Arrange", + seatsNow = "Seats {n}/{max}", + decorNow = "Decor {n}/{max}", + staffLockedCard = "Buy the Staff Unlock upgrade to open this", + goUpgrade = "See upgrades", + role_Cook = "Cook", + role_Server = "Server", + role_Promoter = "Promoter", + roleDesc_Cook = "Makes dishes for you", + roleDesc_Server = "Brings food to customers", + roleDesc_Promoter = "Customers come faster", + hire = "Hire", + fire = "Remove", + wage = "Pay ₩{wage} · every min", + wageTotal = "Total pay ₩{wage} · every min", + strikeBanner = "Not enough money, so staff are resting", + shopName = "Shop name", + namePlaceholder = "Type a name", + save = "Save", + rainbow = "Rainbow name", + designs = "Shop design", + design_Basic = "Classic", + design_Mint = "Mint", + design_Brick = "Brick", + design_Candy = "Candy Palace", + design_Hanok = "Hanok", + inUse = "In use", + btnPromote = "Promote", + btnRush = "Rush", + promoteTitle = "Promote", + promoteAdText = "Watch an ad and customers from other shops come to yours", + watchAd = "Watch ad", + promoteFree = "Just promote", + kickAction = "Shoo customers", + decoPick = "Tap something to move", + decoMove = "Tap the floor to move it", + decoChair = "Pick a side or tap another table", + decoOk = "Looks good! Tap [Place]", + rotate = "Turn", + placeIt = "Place", + cancel = "Cancel", + exit = "Exit", + floorN = "{n}F", + side_1 = "Front", + side_2 = "Right", + side_3 = "Back", + side_4 = "Left", + why_bounds = "That's outside the shop", + why_overlap = "It overlaps something", + why_reserved = "Keep the door and stairs clear", + why_floor = "No 2nd floor yet", + why_blocked = "It blocks the customers' path", + why_chair = "Can't put a chair there", + why_none = "Please pick again", + upgraded = "{name} Lv{level}!", + floor2 = "You built a 2nd floor! Room for more tables", + seatAdded = "Chair placed! One more seat", + tableAdded = "Table placed!", + decorAdded = "{name} placed!", + noSpace = "No space. Move things with [Arrange]", + seatMax = "Seats are full. Upgrade your building", + tableMax = "Can't add more tables", + tableFull = "Every table is full of chairs. Buy a table", + needStage = "Upgrade your building first", + placeFail = "Can't go here: {reason}", + hired = "Hired a {name}!", + fired = "Removed a {name}", + staffLocked = "Buy the Staff Unlock first", + staffMax = "Can't hire more", + strike = "Not enough money, so staff stopped working", + strikeOver = "Staff are back to work!", + renamed = "Shop renamed!", + nameRejected = "That name can't be used", + designSet = "Changed to {name}!", + designLocked = "Unlocks with the Indoor Shop", + promoted = "{n} customers are coming to your shop!", + promoteNone = "No customers to bring", + promoteFull = "No free seats", + promoteWait = "Try again in {sec}s", + adUnavailable = "No ad right now", + kicked = "{n} customers came to your shop!", + kickedBy = "{name} took your customers!", + shielded = "That shop is protected for now", + kickOwn = "Not on your own shop", + rushOn = "Customer rush for {min} min!", }, ja = { title = "ブンシク・タイクーン", money = "₩{money}", - shop = "アップグレード", buy = "買う", bought = "完了", locked = "ロック中", notEnough = "あと₩{need}必要です", - maxed = "アップグレードを全部買いました!2号店は次のアップデートで登場します", - stage1 = "ステージ1 · 屋台", - stage2 = "ステージ2 · 室内のお店", + maxed = "アップグレードぜんぶ完了!", next = "次", nextUp = "次のアップグレード", doubleOn = "適用中", @@ -277,7 +465,7 @@ local STRINGS: { [string]: { [string]: string } } = { stoveObject = "コンロ", tut1 = "お客さんが来たよ!光っているコンロに行って料理を始めよう", tut2 = "できた!お皿をお客さんの席まで運んでね", - tut3 = "お金をかせいだよ!下の[買う]ボタンでテーブルを買ってね", + tut3 = "お金をかせいだよ!下の[買う]ボタンでいすを買ってね", tutDone = "よくできました!お客さんを迎えて、お店を大きくしよう", double = "収益2倍", doubleOwned = "収益2倍 適用中", @@ -287,7 +475,7 @@ local STRINGS: { [string]: { [string]: string } } = { boostGot = "マネーブースト ₩{amount}をもらいました!", purchased = "{name}を買いました!", newMenu = "新メニュー「{menuName}」!お客さんが{menuName}も注文するようになるよ", - expanded = "室内のお店に広げました!新しいアップグレードが開きました", + expanded = "室内のお店に広げました!デザインも変えられるよ", plotOwner = "{name}のブンシク店", plotEmpty = "空き地", neighbor = "となりのお店", @@ -326,38 +514,133 @@ local STRINGS: { [string]: { [string]: string } } = { menu_Sundae = "スンデ", menu_Eomuk = "おでん", menu_Twigim = "天ぷら", - item_Table2 = "テーブル2", - item_UnlockGimbap = "キンパ解放", - item_Sign1 = "看板 Lv1", - item_Stove1 = "コンロ Lv1", - item_Table3 = "テーブル3", - item_UnlockSundae = "スンデ解放", - item_Sauce1 = "秘伝のタレ Lv1", - item_Helper = "アルバイトを雇う", - item_Table4 = "テーブル4", - item_Expand = "室内のお店に拡張", - item_Tray1 = "おぼん", - item_Table5 = "テーブル5", - item_UnlockEomuk = "おでん解放", - item_Sign2 = "看板 Lv2", - item_Table6 = "テーブル6", - item_Stove2 = "コンロ Lv2", - item_UnlockTwigim = "天ぷら解放", - item_Sauce2 = "秘伝のタレ Lv2", - item_Tray2 = "大きなおぼん", - item_Table8 = "テーブル7・8", + stage_1 = "屋台", + stage_2 = "室内のお店", + stage_3 = "2階建てのお店", + tabUpgrade = "アップグレード", + tabDecor = "かざる", + tabStaff = "アルバイト", + tabMine = "わたしのお店", + track_Stage = "お店の建物", + track_Menu = "新メニュー", + track_Price = "売る値段", + track_Speed = "お客さんの速さ", + track_Stove = "コンロ", + track_Tray = "おぼん", + track_Staff = "アルバイト解放", + fx_Stage = "{from} → {to}", + fx_Menu = "新メニュー {menuName}", + fx_Price = "値段 x{from} → x{to}", + fx_Speed = "お客さん {from}秒ごと → {to}秒ごと", + fx_Stove = "料理の手間 {from}% → {to}%", + fx_Tray = "お皿 {from}枚 → {to}枚", + fx_Staff = "アルバイトをやとえるよ", + lockStage2 = "室内のお店から", + lockStage3 = "2階から", + full = "いっぱい", + needTable = "先にテーブル", + thing_Seat = "いす", + thing_Table = "テーブル", + decor_Plant = "植木", + decor_Rug = "じゅうたん", + decor_Balloons = "ふうせん", + decor_Lamp = "ランプ", + decor_Teddy = "くまのぬいぐるみ", + decor_Fridge = "れいぞうこ", + place = "ならべる", + seatsNow = "席 {n}/{max}", + decorNow = "かざり {n}/{max}", + staffLockedCard = "「アルバイト解放」を買うと開くよ", + goUpgrade = "アップグレードを見る", + role_Cook = "料理係", + role_Server = "配膳係", + role_Promoter = "宣伝係", + roleDesc_Cook = "お皿を作っておくよ", + roleDesc_Server = "お客さんに運ぶよ", + roleDesc_Promoter = "お客さんが早く来るよ", + hire = "やとう", + fire = "へらす", + wage = "時給 ₩{wage}・1分ごと", + wageTotal = "時給の合計 ₩{wage}・1分ごと", + strikeBanner = "お金が足りなくてアルバイトが休んでいるよ", + shopName = "お店の名前", + namePlaceholder = "名前を書いてね", + save = "保存", + rainbow = "にじ色の名前", + designs = "お店のデザイン", + design_Basic = "基本", + design_Mint = "ミント", + design_Brick = "レンガ", + design_Candy = "キャンディ城", + design_Hanok = "韓屋", + inUse = "使用中", + btnPromote = "宣伝", + btnRush = "ラッシュ", + promoteTitle = "宣伝する", + promoteAdText = "広告を見ると、となりのお店のお客さんがこっちに来るよ", + watchAd = "広告を見る", + promoteFree = "ふつうに宣伝", + kickAction = "お客さんを追い出す", + decoPick = "動かす物をタップしてね", + decoMove = "床をタップして動かそう", + decoChair = "向きを選ぶか、別のテーブルをタップ", + decoOk = "いいね![置く]をタップ", + rotate = "回す", + placeIt = "置く", + cancel = "キャンセル", + exit = "出る", + floorN = "{n}階", + side_1 = "前", + side_2 = "右", + side_3 = "後ろ", + side_4 = "左", + why_bounds = "お店の外だよ", + why_overlap = "ほかの物と重なるよ", + why_reserved = "ドアと階段の前はあけてね", + why_floor = "2階がまだないよ", + why_blocked = "お客さんの道がふさがるよ", + why_chair = "そこにはいすを置けないよ", + why_none = "もう一度選んでね", + upgraded = "{name} Lv{level}!", + floor2 = "2階ができたよ!テーブルをもっと置けるよ", + seatAdded = "いすを置いたよ!席がふえたよ", + tableAdded = "テーブルを置いたよ!", + decorAdded = "{name}を置いたよ!", + noSpace = "置く場所がないよ。[ならべる]で動かしてみて", + seatMax = "席がいっぱい。建物を大きくしよう", + tableMax = "これ以上テーブルを置けないよ", + tableFull = "どのテーブルもいすがいっぱい。テーブルを買おう", + needStage = "先に建物を大きくしよう", + placeFail = "ここはだめ:{reason}", + hired = "{name}をやとったよ!", + fired = "{name}を一人へらしたよ", + staffLocked = "先に「アルバイト解放」を買おう", + staffMax = "これ以上やとえないよ", + strike = "お金が足りなくてアルバイトが休んでるよ", + strikeOver = "アルバイトがまた働くよ!", + renamed = "お店の名前を変えたよ!", + nameRejected = "その名前は使えないよ", + designSet = "{name}デザインにしたよ!", + designLocked = "室内のお店から変えられるよ", + promoted = "お客さんが{n}人来るよ!", + promoteNone = "連れてこられるお客さんがいないよ", + promoteFull = "空いている席がないよ", + promoteWait = "{sec}秒後にまたできるよ", + adUnavailable = "今は広告を見られないよ", + kicked = "お客さんが{n}人こっちに来たよ!", + kickedBy = "{name}さんがお客さんを連れていったよ!", + shielded = "そのお店は今守られているよ", + kickOwn = "自分のお店には使えないよ", + rushOn = "お客さんラッシュ{min}分スタート!", }, zh = { title = "韩式小吃大亨", money = "₩{money}", - shop = "升级", buy = "购买", bought = "已完成", locked = "未解锁", notEnough = "还差₩{need}", - maxed = "所有升级都买完了!2号店将在下次更新开放", - stage1 = "第1阶段 · 路边摊", - stage2 = "第2阶段 · 室内小吃店", + maxed = "所有升级都完成了!", next = "下一个", nextUp = "下一个升级", doubleOn = "已生效", @@ -391,7 +674,7 @@ local STRINGS: { [string]: { [string]: string } } = { stoveObject = "灶台", tut1 = "客人来了!走到发光的灶台开始做菜吧", tut2 = "做好了!把盘子端到客人的座位上", - tut3 = "赚到钱了!点下面的[购买]按钮买一张桌子", + tut3 = "赚到钱了!点下面的[购买]按钮买一把椅子", tutDone = "做得好!继续招待客人,把店做大吧", double = "双倍收益", doubleOwned = "双倍收益生效中", @@ -401,7 +684,7 @@ local STRINGS: { [string]: { [string]: string } } = { boostGot = "金钱加速:获得₩{amount}!", purchased = "已购买{name}!", newMenu = "新菜品:{menuName}!客人会开始点{menuName}了", - expanded = "搬进室内小吃店了!新的升级已解锁", + expanded = "搬进室内小吃店了!现在可以更换设计", plotOwner = "{name}的小吃店", plotEmpty = "空地", neighbor = "邻居的店", @@ -440,26 +723,124 @@ local STRINGS: { [string]: { [string]: string } } = { menu_Sundae = "血肠", menu_Eomuk = "鱼饼", menu_Twigim = "炸物", - item_Table2 = "桌子2", - item_UnlockGimbap = "解锁紫菜包饭", - item_Sign1 = "招牌 Lv1", - item_Stove1 = "灶台 Lv1", - item_Table3 = "桌子3", - item_UnlockSundae = "解锁血肠", - item_Sauce1 = "秘制酱料 Lv1", - item_Helper = "雇佣店员", - item_Table4 = "桌子4", - item_Expand = "扩建室内小吃店", - item_Tray1 = "托盘", - item_Table5 = "桌子5", - item_UnlockEomuk = "解锁鱼饼", - item_Sign2 = "招牌 Lv2", - item_Table6 = "桌子6", - item_Stove2 = "灶台 Lv2", - item_UnlockTwigim = "解锁炸物", - item_Sauce2 = "秘制酱料 Lv2", - item_Tray2 = "大托盘", - item_Table8 = "桌子7·8", + stage_1 = "路边摊", + stage_2 = "室内小吃店", + stage_3 = "两层小吃店", + tabUpgrade = "升级", + tabDecor = "装饰", + tabStaff = "店员", + tabMine = "我的店", + track_Stage = "店铺建筑", + track_Menu = "新菜品", + track_Price = "售价", + track_Speed = "客人速度", + track_Stove = "灶台", + track_Tray = "托盘", + track_Staff = "解锁店员", + fx_Stage = "{from} → {to}", + fx_Menu = "新菜品 {menuName}", + fx_Price = "售价 x{from} → x{to}", + fx_Speed = "每{from}秒 → 每{to}秒来客", + fx_Stove = "做菜步骤 {from}% → {to}%", + fx_Tray = "盘子 {from}个 → {to}个", + fx_Staff = "可以雇佣店员", + lockStage2 = "室内小吃店解锁", + lockStage3 = "两层后解锁", + full = "已满", + needTable = "先买桌子", + thing_Seat = "椅子", + thing_Table = "桌子", + decor_Plant = "盆栽", + decor_Rug = "地毯", + decor_Balloons = "气球", + decor_Lamp = "台灯", + decor_Teddy = "泰迪熊", + decor_Fridge = "冰箱", + place = "摆放", + seatsNow = "座位 {n}/{max}", + decorNow = "装饰 {n}/{max}", + staffLockedCard = "购买“解锁店员”升级后开放", + goUpgrade = "查看升级", + role_Cook = "厨师", + role_Server = "服务员", + role_Promoter = "宣传员", + roleDesc_Cook = "帮你做好菜", + roleDesc_Server = "把菜端给客人", + roleDesc_Promoter = "客人来得更快", + hire = "雇佣", + fire = "减少", + wage = "时薪 ₩{wage}・每分钟", + wageTotal = "时薪合计 ₩{wage}・每分钟", + strikeBanner = "钱不够,店员在休息", + shopName = "店名", + namePlaceholder = "输入店名", + save = "保存", + rainbow = "彩虹店名", + designs = "店铺设计", + design_Basic = "经典", + design_Mint = "薄荷", + design_Brick = "砖墙", + design_Candy = "糖果宫殿", + design_Hanok = "韩屋", + inUse = "使用中", + btnPromote = "宣传", + btnRush = "客潮", + promoteTitle = "宣传", + promoteAdText = "看广告后,邻店的客人会来你的店", + watchAd = "看广告", + promoteFree = "直接宣传", + kickAction = "赶走客人", + decoPick = "点要移动的东西", + decoMove = "点地面来移动", + decoChair = "选方向或点另一张桌子", + decoOk = "很好!点[放下]", + rotate = "旋转", + placeIt = "放下", + cancel = "取消", + exit = "退出", + floorN = "{n}楼", + side_1 = "前", + side_2 = "右", + side_3 = "后", + side_4 = "左", + why_bounds = "在店外面", + why_overlap = "和别的东西重叠了", + why_reserved = "门口和楼梯要空着", + why_floor = "还没有二楼", + why_blocked = "挡住了客人的路", + why_chair = "那边不能放椅子", + why_none = "请重新选择", + upgraded = "{name} Lv{level}!", + floor2 = "盖好二楼了!可以放更多桌子", + seatAdded = "放好椅子了!座位多了一个", + tableAdded = "放好桌子了!", + decorAdded = "{name}放好了!", + noSpace = "没有空位。用[摆放]挪一挪吧", + seatMax = "座位满了。升级建筑吧", + tableMax = "不能再放桌子了", + tableFull = "每张桌子都放满椅子了。买张桌子吧", + needStage = "先升级建筑吧", + placeFail = "这里不行:{reason}", + hired = "雇了{name}!", + fired = "减少了一名{name}", + staffLocked = "先购买“解锁店员”", + staffMax = "不能再雇了", + strike = "钱不够,店员停工了", + strikeOver = "店员回来工作了!", + renamed = "店名改好了!", + nameRejected = "不能用这个名字", + designSet = "换成{name}设计了!", + designLocked = "室内小吃店后可以更换", + promoted = "{n}位客人要来你的店了!", + promoteNone = "没有可以拉来的客人", + promoteFull = "没有空座位", + promoteWait = "{sec}秒后可以再来", + adUnavailable = "现在没有广告", + kicked = "{n}位客人来你的店了!", + kickedBy = "{name}把你的客人拉走了!", + shielded = "那家店暂时受保护", + kickOwn = "不能对自己的店用", + rushOn = "客潮开始,持续{min}分钟!", }, } @@ -500,10 +881,6 @@ function Locale.menuName(lang: string, menu: string): string return Locale.t(lang, "menu_" .. menu) end -function Locale.itemName(lang: string, id: string): string - return Locale.t(lang, "item_" .. id) -end - function Locale.keys(lang: string): { string } local out = {} for k in STRINGS[lang] do diff --git a/bunsik-tycoon/tests/Layout.spec.luau b/bunsik-tycoon/tests/Layout.spec.luau index d0f69f0..92ea33d 100644 --- a/bunsik-tycoon/tests/Layout.spec.luau +++ b/bunsik-tycoon/tests/Layout.spec.luau @@ -53,6 +53,8 @@ for _, d in DEVICES do list = L.list, double = L.double, boost = L.boost, + promote = L.promote, + rush = L.rush, } for name, r in hud do T.check(inside(r, L.width, L.height), `{tag}: {name} 화면 안`) @@ -75,19 +77,50 @@ for _, d in DEVICES do T.check(inside(L.panel, L.width, L.height), `{tag}: 업그레이드 창 화면 안`) T.check(inside(L.settingsPanel, L.width, L.height), `{tag}: 설정 창 화면 안`) T.check(inside(L.kitchen, L.width, L.height), `{tag}: 요리 창 화면 안`) - local g = L.grid - T.check( - g.pad * 2 + g.cols * g.cardW + (g.cols - 1) * g.gap <= L.panel.w + 1e-6, - `{tag}: 상점 카드가 창 너비 안` - ) - T.check( - g.top + g.rows * g.cardH + (g.rows - 1) * g.gap + g.pad <= L.panel.h + 1e-6, - `{tag}: 상점 카드가 창 높이 안` - ) - T.check( - g.cardW * L.scale >= 90 and g.cardH * L.scale >= 90, - `{tag}: 상점 카드가 손가락으로 누를 만큼 큼` - ) + T.check(inside(L.confirm, L.width, L.height), `{tag}: 홍보 확인 창 화면 안`) + + -- 상점 창 안: 탭 4개와 내용 자리가 창 안에, 서로 안 겹침 + local panelBox = { x = 0, y = 0, w = L.panel.w, h = L.panel.h } + T.eq(#L.tabs, 4, `{tag}: 탭 4개`) + for i, t in L.tabs do + T.check(inside(t, panelBox.w, panelBox.h), `{tag}: 탭 {i} 창 안`) + T.check(not overlap(t, L.content), `{tag}: 탭 {i}와 내용 안 겹침`) + T.check(t.y >= Layout.HEADER_H, `{tag}: 탭 {i}는 제목 띠 아래`) + T.check(t.h * L.scale >= 44 and t.w * L.scale >= 44, `{tag}: 탭 {i} 누르기 쉬움`) + if i > 1 then + T.check(not overlap(t, L.tabs[i - 1]), `{tag}: 탭 {i - 1}·{i} 안 겹침`) + end + end + T.check(inside(L.content, panelBox.w, panelBox.h), `{tag}: 탭 내용 창 안`) + -- 카드 칸(업그레이드 4x2, 꾸미기 5x2, 알바생 3x1): 손가락으로 누를 만큼 큼 + for _, grid in { { 4, 2 }, { 5, 2 }, { 3, 1 } } do + -- ShopWindow의 칸: 내용 자리를 똑같이 나누고 칸마다 8씩 띄움 + local cw = L.content.w / grid[1] - 8 + local chh = L.content.h / grid[2] - 8 + T.check( + cw * L.scale >= 90 and chh * L.scale >= 90, + `{tag}: {grid[1]}x{grid[2]} 카드가 손가락으로 누를 만큼 큼({math.floor(cw * L.scale)}x{math.floor( + chh * L.scale + )}px)` + ) + end + + -- 꾸미기 화면 버튼: 화면 안, 서로 안 겹침, 누르기 쉬움 + local deco: { [string]: Rect } = { exit = L.deco.exit, floor = L.deco.floor, info = L.deco.info } + for i, r in L.deco.tools do + deco["tool" .. i] = r + end + local dnames = {} + for name, r in deco do + T.check(inside(r, L.width, L.height), `{tag}: 꾸미기 {name} 화면 안`) + table.insert(dnames, name) + end + table.sort(dnames) + for i, a in dnames do + for j = i + 1, #dnames do + T.check(not overlap(deco[a], deco[dnames[j]]), `{tag}: 꾸미기 {a}와 {dnames[j]} 안 겹침`) + end + end T.check(L.kitchen.w * L.scale >= 0.6 * d.w or L.kitchen.w >= 780, `{tag}: 요리 창이 충분히 큼`) T.eq(L.rows.devY ~= nil, dev, `{tag}: 개발자 줄은 주인에게만`) T.eq(L.rows.mouseY == nil, d.touch, `{tag}: 마우스 회전 줄은 PC만`) @@ -100,6 +133,8 @@ for _, d in DEVICES do list = L.list, double = L.double, boost = L.boost, + promote = L.promote, + rush = L.rush, } for name, r in buttons do local p = px(r, L.scale) @@ -107,6 +142,13 @@ for _, d in DEVICES do T.check(not overlap(p, zones.jump), `{tag}: {name} 버튼이 점프 버튼 자리 피함`) T.check(p.h >= 44, `{tag}: {name} 버튼 높이 {math.floor(p.h)}px ≥ 44(어린이 손가락)`) end + for name, r in deco do + local p = px(r, L.scale) + T.check(not overlap(p, zones.jump), `{tag}: 꾸미기 {name}이 점프 버튼 자리 피함`) + if name ~= "info" then + T.check(p.h >= 44, `{tag}: 꾸미기 {name} 버튼 높이 {math.floor(p.h)}px ≥ 44`) + end + end T.check(L.rows.langButtonH * L.scale >= 36, `{tag}: 언어 버튼 누르기 쉬움`) T.check(L.rows.toggleH * L.scale >= 34, `{tag}: 켜기/끄기 버튼 누르기 쉬움`) end diff --git a/bunsik-tycoon/tests/Locale.spec.luau b/bunsik-tycoon/tests/Locale.spec.luau index 0b09056..721fd92 100644 --- a/bunsik-tycoon/tests/Locale.spec.luau +++ b/bunsik-tycoon/tests/Locale.spec.luau @@ -5,6 +5,52 @@ local Locale = require("../src/shared/Locale") local Recipes = require("../src/shared/Recipes") local T = require("./check") +local NOTIFY = { + "upgraded", + "newMenu", + "expanded", + "floor2", + "seatAdded", + "tableAdded", + "decorAdded", + "noSpace", + "seatMax", + "tableMax", + "tableFull", + "needStage", + "placeFail", + "hired", + "fired", + "staffLocked", + "staffMax", + "strike", + "strikeOver", + "renamed", + "nameRejected", + "designSet", + "designLocked", + "promoted", + "promoteNone", + "promoteFull", + "promoteWait", + "adUnavailable", + "kicked", + "kickedBy", + "shielded", + "kickOwn", + "rushOn", + "notEnough", + "boostGot", + "guestBonus", + "guestArrived", + "guestSeated", + "guestAte", + "guestHungry", + "visitFull", + "tutDone", + "devResetDone", +} + local ko = Locale.keys("ko") table.sort(ko) for _, lang in Locale.LANGS do @@ -25,8 +71,38 @@ for _, lang in Locale.LANGS do T.check(Locale.t(lang, st.key) ~= st.key, `{lang} 요리 안내 {st.key}`) end end - for _, p in Economy.PURCHASES do - T.check(Locale.itemName(lang, p.id) ~= "item_" .. p.id, `{lang} 업그레이드 이름 {p.id}`) + local function has(key: string, what: string) + T.check(Locale.t(lang, key) ~= key, `{lang} {what} {key}`) + end + for _, t in Economy.TRACKS do + has("track_" .. t.id, "업그레이드 갈래 이름") + has("fx_" .. t.id, "업그레이드 효과") + for _, lv in t.levels do + if t.id == "Stage" then + has(`stage_{lv.value}`, "건물 단계 이름") + end + end + end + has("stage_1", "건물 단계 이름") + for _, r in Economy.ROLES do + has("role_" .. r.id, "알바 역할") + has("roleDesc_" .. r.id, "알바 역할 설명") + end + for _, d in Economy.DECOR do + has("decor_" .. d.id, "소품 이름") + end + for _, d in Economy.DESIGNS do + has("design_" .. d.id, "디자인 이름") + end + for _, why in { "bounds", "overlap", "reserved", "floor", "blocked", "chair", "none" } do + has("why_" .. why, "배치 실패 이유") + end + for i = 1, 4 do + has(`side_{i}`, "의자 쪽") + end + -- 서버가 보내는 알림 키(NETWORK.md) + for _, key in NOTIFY do + has(key, "알림") end -- 치환 자리({money} 등)가 한국어와 같아야 함 for _, k in ko do @@ -76,7 +152,7 @@ T.eq( "같은 자리 두 번 치환" ) T.eq(Locale.menuName("zh", "Gimbap"), "紫菜包饭", "중국어 메뉴 이름") -T.eq(Locale.itemName("en", "Expand"), "Indoor Shop", "영어 업그레이드 이름") +T.eq(Locale.t("en", "track_Speed"), "Customer Speed", "영어 갈래 이름") T.eq(Locale.number(1234567), "1,234,567", "쉼표") T.eq(Locale.number(999), "999", "쉼표 없음") T.eq(Locale.number(0), "0", "0") diff --git a/bunsik-tycoon/tests/cloud/dump_gui.luau b/bunsik-tycoon/tests/cloud/dump_gui.luau index d18bceb..09f7761 100644 --- a/bunsik-tycoon/tests/cloud/dump_gui.luau +++ b/bunsik-tycoon/tests/cloud/dump_gui.luau @@ -152,67 +152,124 @@ local function shot(name: string, dev: { [string]: any }, attrs: { [string]: any end return t end +-- 상태 묶음(NETWORK.md 플레이어 속성). 갈래 레벨은 Levels 글자로 +local function shopState(levels: string, seats: number, tables: number, extra: { [string]: any }): { [string]: any } + local t: { [string]: any } = { Levels = levels, Seats = seats, Tables = tables } + local stage = 1 + (tonumber(string.match(levels, "Stage=(%d)")) or 0) + t.Stage = stage + for k, v in extra do + t[k] = v + end + return t +end +local EARLY = "Stage=0,Menu=1,Price=0,Speed=1,Stove=0,Tray=0,Staff=0" +local MID = "Stage=1,Menu=2,Price=2,Speed=3,Stove=1,Tray=1,Staff=1" +local LATE = "Stage=2,Menu=4,Price=4,Speed=5,Stove=3,Tray=2,Staff=1" +local LAYOUT = '{"stove":{"x":0,"z":-26,"r":0},"tables":[{"x":-9,"z":-10,"f":1},{"x":9,"z":-10,"f":1}],' + .. '"chairs":[{"t":1,"s":1},{"t":1,"s":3},{"t":2,"s":1}],"decor":[{"k":"Plant","x":-31,"z":-35,"f":1,"r":0}]}' local SHOTS = { - shot("phone_main", PHONE, { Money = 85, Bought = 4, Carry = 1, Hand = "Gimbap", Tut = 0 }, { toast = true }), - shot("phone_tut", PHONE, { Money = 15, Bought = 0, Tut = 3 }), - shot("phone_shop", PHONE, { Money = 150, Bought = 5 }, { open = "shop" }), - shot("phone_settings", PHONE, { Money = 150, Bought = 5 }, { open = "settings" }), + shot( + "phone_main", + PHONE, + shopState(EARLY, 2, 1, { Money = 85, Carry = 1, Hand = "Gimbap", Tut = 0 }), + { toast = true } + ), + 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_shop_decor", + PHONE, + shopState(MID, 3, 2, { Money = 400, Layout = LAYOUT }), + { open = "shop", tab = "decor" } + ), + shot( + "phone_shop_staff", + PHONE, + shopState(MID, 3, 2, { Money = 600, Staff = "Cook=1,Server=0,Promoter=0", Wage = 18 }), + { open = "shop", tab = "staff" } + ), + shot( + "phone_shop_mine", + PHONE, + shopState(MID, 3, 2, { Money = 600, ShopName = "떡볶이 천국", Design = "Mint", RainbowOwned = false }), + { open = "shop", tab = "mine" } + ), + shot("phone_promote", PHONE, shopState(EARLY, 2, 1, { Money = 150 }), { open = "promote" }), + shot("phone_settings", PHONE, shopState(EARLY, 2, 1, { Money = 150 }), { open = "settings" }), shot( "phone_kitchen_menu", PHONE, - { Money = 300, Bought = 6, Orders = "Tteokbokki=1,Gimbap=2", Tut = 1 }, + shopState(EARLY, 2, 1, { Money = 300, Orders = "Tteokbokki=1,Gimbap=2", Tut = 1 }), { kitchen = { menu = nil } } ), shot( "phone_kitchen_tteok", PHONE, - { Money = 300, Bought = 6, Orders = "Tteokbokki=1" }, + shopState(EARLY, 2, 1, { Money = 300, Orders = "Tteokbokki=1" }), { kitchen = { menu = "Tteokbokki", step = 3, frac = 0.5 } } ), - shot("pc_main", PC, { Money = 1234, Bought = 4, Carry = 1, Hand = "Tteokbokki" }, { toast = true }), - shot("pc_buyable", PC, { Money = 160, Bought = 5, Carry = 0, Tut = 0 }), - shot("pc_shop", PC, { Money = 760, Bought = 12, Double = true }, { open = "shop" }), - shot("pc_settings", PC, { Money = 760, Bought = 12, Dev = true }, { open = "settings" }), + shot("pc_main", PC, shopState(EARLY, 2, 1, { Money = 1234, Carry = 1, Hand = "Tteokbokki" }), { toast = true }), + shot("pc_buyable", PC, shopState(EARLY, 2, 1, { Money = 160, Carry = 0, Tut = 0 })), + shot("pc_shop", PC, shopState(MID, 4, 2, { Money = 760, Double = true }), { open = "shop" }), + shot("pc_shop_staff_locked", PC, shopState(EARLY, 2, 1, { Money = 760 }), { open = "shop", tab = "staff" }), + shot( + "pc_shop_staff_strike", + PC, + shopState(LATE, 10, 4, { Money = 0, Staff = "Cook=2,Server=1,Promoter=1", Strike = true, Wage = 120 }), + { open = "shop", tab = "staff" } + ), + shot( + "pc_shop_mine", + PC, + shopState( + LATE, + 10, + 4, + { Money = 760, Design = "Candy", DesignsOwned = "Candy", RainbowOwned = true, Rainbow = true } + ), + { open = "shop", tab = "mine" } + ), + shot("pc_settings", PC, shopState(MID, 4, 2, { Money = 760, Dev = true }), { open = "settings" }), shot( "pc_kitchen_menu", PC, - { Money = 300, Bought = 13, Orders = "Gimbap=1,Sundae=2,Eomuk=1" }, + shopState(MID, 4, 2, { Money = 300, Orders = "Gimbap=1,Sundae=2,Eomuk=1" }), { kitchen = { menu = nil } } ), shot( "pc_kitchen_gimbap", PC, - { Money = 300, Bought = 13, Orders = "Gimbap=1" }, + shopState(MID, 4, 2, { Money = 300, Orders = "Gimbap=1" }), { kitchen = { menu = "Gimbap", step = 2, frac = 0.6 } } ), shot( "pc_kitchen_sundae", PC, - { Money = 300, Bought = 13, Orders = "Sundae=1" }, + shopState(MID, 4, 2, { Money = 300, Orders = "Sundae=1" }), { kitchen = { menu = "Sundae", step = 2, frac = 0.7 } } ), shot( "pc_kitchen_eomuk", PC, - { Money = 300, Bought = 13, Orders = "Eomuk=1" }, + shopState(LATE, 4, 2, { Money = 300, Orders = "Eomuk=1" }), { kitchen = { menu = "Eomuk", step = 2, frac = 0.4 } } ), shot( "pc_kitchen_twigim", PC, - { Money = 300, Bought = 17, Orders = "Twigim=1" }, + shopState(LATE, 4, 2, { Money = 300, Orders = "Twigim=1" }), { kitchen = { menu = "Twigim", step = 3, frac = 0.5 } } ), shot( "pc_kitchen_done", PC, - { Money = 300, Bought = 6, Orders = "Tteokbokki=1" }, + shopState(EARLY, 2, 1, { Money = 300, Orders = "Tteokbokki=1" }), { kitchen = { menu = "Tteokbokki", step = "done" } } ), shot( "tablet_ipad", { w = 1024, h = 710, inset = 58, touch = true }, - { Money = 98765, Bought = 15, Carry = 2, Hand = "Eomuk,Sundae" } + shopState(LATE, 10, 4, { Money = 98765, Carry = 2, Hand = "Eomuk,Sundae" }) ), } @@ -231,10 +288,10 @@ for _, s in SHOTS do state:SetAttribute("Tut", 0) end if s.toast then - hud.notify("purchased", { item = "Stove1" }) + hud.notify("upgraded", { track = "Speed", level = 2 }) end if s.open then - hud.open(s.open) + hud.open(s.open, s.tab) end local k = s.kitchen if k then diff --git a/bunsik-tycoon/tools/hud_preview.py b/bunsik-tycoon/tools/hud_preview.py index 039a490..f8026ad 100644 --- a/bunsik-tycoon/tools/hud_preview.py +++ b/bunsik-tycoon/tools/hud_preview.py @@ -30,6 +30,8 @@ BOXES = [ ("list", "업그레이드 목록", (255, 130, 50)), ("double", "2배 수익", (150, 80, 220)), ("boost", "돈 부스트", (240, 170, 30)), + ("promote", "홍보", (74, 172, 255)), + ("rush", "손님 러시", (255, 196, 48)), ]