feat(bunsik): 이웃 가게·손님 방문 멀티플레이, 4개 언어, 설정 창, 마우스 회전, 김밥 해금 효과

- 빈 부지에 NPC 사장님이 운영하는 이웃 가게(크기 제각각), 플레이어가 오면 그 자리를 넘겨줌
- 다른 가게 입구에서 손님으로 앉기: 주인은 2배 값, 손님은 시식 보너스(1분에 한 번)
- 한국어·영어·일본어·중국어(계정 언어 자동 선택), 이름판·메뉴판은 보는 사람 언어로
- 오른쪽 위 언어 버튼을 설정 창으로: 언어, 마우스로 화면 돌리기(PC 기본 켜짐), 효과음
- 메뉴 해금 시 진열대 모형이 생기고 다음 손님이 바로 새 메뉴를 주문
- 통합 테스트 600개 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-12 05:37:46 +09:00
parent c7af87c646
commit 4d861b8fd3
21 changed files with 1464 additions and 135 deletions

View File

@@ -1,5 +1,5 @@
--!strict
-- 화면 UI: 돈, 다음 업그레이드, 업그레이드 목록, 2배 수익·돈 부스트 버튼, 언어 전환, 안내 문구, 알림.
-- 화면 UI: 돈, 다음 업그레이드, 업그레이드 목록, 2배 수익·돈 부스트 버튼, 설정(언어·마우스 회전·효과음), 안내 문구, 알림.
-- 상태는 `state` 인스턴스(실제 게임에서는 Player)의 속성에서 읽습니다. 서버에서도 만들 수 있어서 원격 테스트로 검사합니다.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
@@ -17,6 +17,7 @@ export type HudHandle = {
refresh: () -> (),
notify: (key: string, args: { [string]: any }?) -> (),
setScale: (number) -> (),
menuOpen: () -> boolean, -- 업그레이드·설정 창이 열려 있으면 true(마우스 커서를 풀어 줌)
destroy: () -> (),
}
@@ -250,15 +251,70 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
devButtons[key] = b
end
-- 오른쪽 위: 언어
local langBtn = button(
-- 오른쪽 위: 설정 버튼과 설정 창(언어, 마우스로 화면 돌리기, 효과음)
local settingsBtn = button(
root,
"Lang",
UDim2.fromOffset(120, 44),
"Settings",
UDim2.fromOffset(130, 44),
UDim2.new(1, -10, 0, 6),
Vector2.new(1, 0),
Color3.fromRGB(80, 140, 230)
)
local settings = frame(
root,
"SettingsPanel",
UDim2.fromOffset(520, 330),
UDim2.fromScale(0.5, 0.48),
Vector2.new(0.5, 0.5),
CREAM
)
settings.Visible = false
corner(settings, 20)
stroke(settings, Color3.fromRGB(80, 140, 230), 4)
local settingsTitle = text(settings, "Title", UDim2.new(1, -120, 0, 44), UDim2.fromOffset(16, 10))
settingsTitle.TextXAlignment = Enum.TextXAlignment.Left
local settingsClose = button(
settings,
"Close",
UDim2.fromOffset(90, 42),
UDim2.new(1, -12, 0, 10),
Vector2.new(1, 0),
Color3.fromRGB(220, 80, 70)
)
local function rowLabel(name: string, y: number): TextLabel
local t = text(settings, name, UDim2.new(1, -32, 0, 30), UDim2.fromOffset(16, y))
t.TextXAlignment = Enum.TextXAlignment.Left
return t
end
local langLabel = rowLabel("LangLabel", 64)
-- 언어 버튼: 자동("") + 네 언어
local langChoices = { "" }
for _, l in Locale.LANGS do
table.insert(langChoices, l)
end
local langButtons: { [string]: TextButton } = {}
for i, l in langChoices do
local b = button(
settings,
"Lang_" .. (if l == "" then "auto" else l),
UDim2.fromOffset(92, 44),
UDim2.fromOffset(16 + (i - 1) * 98, 100),
Vector2.zero,
GRAY
)
langButtons[l] = b
end
local mouseLabel = rowLabel("MouseLabel", 160)
local mouseBtn =
button(settings, "MouseLook", UDim2.fromOffset(110, 40), UDim2.new(1, -16, 0, 156), Vector2.new(1, 0), GRAY)
mouseLabel.Size = UDim2.new(1, -150, 0, 30)
local mouseHint =
text(settings, "MouseHint", UDim2.new(1, -32, 0, 22), UDim2.fromOffset(16, 200), Color3.fromRGB(120, 90, 60))
mouseHint.TextXAlignment = Enum.TextXAlignment.Left
local sfxLabel = rowLabel("SfxLabel", 246)
sfxLabel.Size = UDim2.new(1, -150, 0, 30)
local sfxBtn =
button(settings, "Sfx", UDim2.fromOffset(110, 40), UDim2.new(1, -16, 0, 242), Vector2.new(1, 0), GRAY)
local function lang(): string
return attr(state, "Lang", "ko")
@@ -267,7 +323,11 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
return Locale.t(lang(), key, args)
end
local function pname(p: Economy.Purchase): string
return if lang() == "ko" then p.name else p.nameEn
return Locale.itemName(lang(), p.id)
end
local function toggle(b: TextButton, on: boolean)
b.Text = L(if on then "on" else "off")
b.BackgroundColor3 = if on then GREEN else GRAY
end
local pulse: Tween? = nil
@@ -328,9 +388,23 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
end
listBtn.Text = "📋 " .. L("shop")
langBtn.Text = L("language")
settingsBtn.Text = "⚙️ " .. L("settings")
closeBtn.Text = L("close")
settingsTitle.Text = "⚙️ " .. L("settings")
settingsClose.Text = L("close")
langLabel.Text = "🌐 " .. L("language")
local current = attr(state, "LangSetting", "")
for l, b in langButtons do
b.Text = if l == "" then L("langAuto") else Locale.LANG_NAMES[l]
b.BackgroundColor3 = if l == current then Color3.fromRGB(80, 140, 230) else GRAY
end
mouseLabel.Text = "🖱️ " .. L("mouseLook")
mouseHint.Text = L("mouseHint")
toggle(mouseBtn, attr(state, "MouseLook", true) == true)
sfxLabel.Text = "🔊 " .. L("sfx")
toggle(sfxBtn, attr(state, "Sfx", true) == true)
local double = attr(state, "Double", false)
passBtn.Visible = Products.DOUBLE_MONEY_PASS ~= 0
passBtn.Text = if double then "✅ " .. L("doubleOwned") else "💰x2 " .. L("double")
@@ -378,6 +452,16 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
end
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 toast =
frame(toasts, "Toast", UDim2.fromOffset(540, 46), UDim2.new(), Vector2.zero, Color3.fromRGB(45, 45, 60))
corner(toast, 12)
@@ -402,6 +486,7 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
conns,
listBtn.Activated:Connect(function()
panel.Visible = not panel.Visible
settings.Visible = false
end)
)
table.insert(
@@ -412,8 +497,35 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
)
table.insert(
conns,
langBtn.Activated:Connect(function()
send("lang", if lang() == "ko" then "en" else "ko")
settingsBtn.Activated:Connect(function()
settings.Visible = not settings.Visible
panel.Visible = false
end)
)
table.insert(
conns,
settingsClose.Activated:Connect(function()
settings.Visible = false
end)
)
for l, b in langButtons do
table.insert(
conns,
b.Activated:Connect(function()
send("lang", l)
end)
)
end
table.insert(
conns,
mouseBtn.Activated:Connect(function()
send("mouseLook", attr(state, "MouseLook", true) ~= true)
end)
)
table.insert(
conns,
sfxBtn.Activated:Connect(function()
send("sfx", attr(state, "Sfx", true) ~= true)
end)
)
table.insert(
@@ -449,6 +561,9 @@ function Hud.build(parent: Instance, state: Instance, send: (string, any?) -> ()
setScale = function(s: number)
scale.Scale = s
end,
menuOpen = function(): boolean
return panel.Visible or settings.Visible
end,
destroy = function()
for _, c in conns do
c:Disconnect()