- 아래 추천 [사기] 막대를 없애고 튜토리얼 말풍선을 아래 가운데로. 튜토리얼 3단계는 [가게 꾸미기]에서 의자 놓기
- 상점에서 꾸미기 탭을 빼고 따로 [가게 꾸미기] 버튼·창. 카드를 고르면 캐릭터 앞에 투명 미리보기가 붙어 다니고
[돌리기](R)·[놓기](F)로 그 자리에 놓음(놓을 때 돈). [옮기기]로 놓은 물건·조리대를 들어서 옮김
- 의자를 테이블에서 떼어 {x,z,f,r}로 저장(등받이로 방향 보임). 의자는 보는 쪽 앞에 테이블이 있어야 하고,
테이블을 옮기거나 돌리면 그 테이블을 보는 의자도 같이. 예전 {t,s} 저장은 자동 변환. 새 요청 buyAt
- 테이블은 의자 없이 따로 판매(20 + 15×테이블 수²)
- 손님 간격 10초 → 20초(손님 속도 갈래도 2배), 대신 음식값 2배로 1분 매출 유지. 실내 11분·2층 50분(봇)
- 2배 돈: 게임 주인은 게임패스를 자동 보유하는데 [처음부터]·2배 끄기 뒤 버튼이 결제 창을 띄워 "이미 보유"가 나옴.
누르면 먼저 보유를 확인해 바로 켜고, [처음부터]도 2배를 유지
- 검사 위치 0.5칸 자리 길 검사 오류 수정(touches가 막힌 칸 안쪽을 보던 문제)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
170 lines
5.9 KiB
Lua
170 lines
5.9 KiB
Lua
-- 클라이언트 진입점: 화면 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)
|
|
local Plots = require(script.Parent.Plots)
|
|
local Stove = require(script.Parent.Stove)
|
|
|
|
local player = Players.LocalPlayer
|
|
local remotes = ReplicatedStorage:WaitForChild("Remotes")
|
|
local action = remotes:WaitForChild("Action") :: RemoteEvent
|
|
local notifyRemote = remotes:WaitForChild("Notify") :: RemoteEvent
|
|
|
|
local function send(kind: string, arg: any?)
|
|
action:FireServer(kind, arg)
|
|
end
|
|
|
|
-- 서버가 세이브를 불러오고 부지를 줄 때까지 기다립니다.
|
|
while not player:GetAttribute("Ready") do
|
|
player:GetAttributeChangedSignal("Ready"):Wait()
|
|
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
|
|
-- 휴대폰·태블릿 배치: 마지막 입력이 터치면 켜고, 마우스·게임패드면 끕니다(키보드 입력은 채팅일 수 있어 무시).
|
|
local touch = UserInputService.TouchEnabled and not UserInputService.MouseEnabled
|
|
local function relayout()
|
|
-- ScreenGui 크기는 상단 바·노치를 뺀 영역입니다. 첫 프레임 전이라 0이면 화면 크기에서 상단 바만 뺍니다.
|
|
local size = hud.gui.AbsoluteSize
|
|
if size.X < 2 or size.Y < 2 then
|
|
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
|
|
if t == Enum.UserInputType.Touch then
|
|
isTouch = true
|
|
elseif t.Name:sub(1, 5) == "Mouse" or t.Name:sub(1, 7) == "Gamepad" then
|
|
isTouch = false
|
|
end
|
|
if isTouch ~= nil and isTouch ~= touch then
|
|
touch = isTouch
|
|
relayout()
|
|
end
|
|
end)
|
|
hud.gui:GetPropertyChangedSignal("AbsoluteSize"):Connect(relayout)
|
|
camera:GetPropertyChangedSignal("ViewportSize"):Connect(relayout)
|
|
relayout()
|
|
-- 구매·확장 효과음은 내 화면에서만 크게(위치 없이) 들립니다.
|
|
local Sounds = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Sounds"))
|
|
local sfxGroup = SoundService:WaitForChild("Sfx") :: SoundGroup
|
|
local function applySfx()
|
|
sfxGroup.Volume = if player:GetAttribute("Sfx") == false then 0 else 1
|
|
end
|
|
player:GetAttributeChangedSignal("Sfx"):Connect(applySfx)
|
|
applySfx()
|
|
local function uiSound(id: string, volume: number): Sound
|
|
local s = Instance.new("Sound")
|
|
s.SoundId = id
|
|
s.Volume = volume
|
|
s.SoundGroup = sfxGroup
|
|
s.Parent = SoundService
|
|
return s
|
|
end
|
|
local buySound = uiSound(Sounds.BUY, 0.7)
|
|
local levelSound = uiSound(Sounds.LEVELUP, 0.8)
|
|
local NOTIFY_SOUND: { [string]: Sound } = {
|
|
purchased = buySound,
|
|
newMenu = buySound,
|
|
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
|
|
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()
|
|
end
|
|
end
|
|
end)
|
|
|
|
local plotIndex = player:GetAttribute("Plot")
|
|
local world = workspace:WaitForChild("BunsikWorld")
|
|
local plot = world:WaitForChild("Plots"):WaitForChild("Plot" .. tostring(plotIndex))
|
|
local stove = plot:WaitForChild("Base"):WaitForChild("Stall"):WaitForChild("Stove") :: BasePart
|
|
Stove.attach(stove, player, function()
|
|
hud.open("kitchen")
|
|
end)
|
|
-- 요리 창이 열려 있는 동안은 캐릭터가 움직이지 않게(휴대폰에서 문지르다 조이스틱이 움직이지 않게) 조작을 멈추고,
|
|
-- 조리대 버튼(E)도 꺼서 E 키를 요리 동작(톡톡·꾹)에 씁니다.
|
|
local ProximityPromptService = game:GetService("ProximityPromptService")
|
|
local controls: any = nil
|
|
pcall(function()
|
|
local PlayerModule = require(player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")) :: any
|
|
controls = PlayerModule:GetControls()
|
|
end)
|
|
hud.kitchen.onOpen(function()
|
|
ProximityPromptService.Enabled = false
|
|
if controls then
|
|
controls:Disable()
|
|
end
|
|
end)
|
|
hud.kitchen.onClose(function()
|
|
ProximityPromptService.Enabled = true
|
|
if controls then
|
|
controls:Enable()
|
|
end
|
|
end)
|
|
Plots.start(world:WaitForChild("Plots"), player, player.UserId, send)
|
|
|
|
-- 꾸미기(놓기) 화면: [가게 꾸미기] 창에서 물건이나 [옮기기]를 고르면 엽니다.
|
|
-- 캐릭터는 걸어 다니며 투명 미리보기를 옮기고, 그동안 다른 화면 UI와 조리대 버튼(E)은 숨깁니다.
|
|
local deco = Decorate.build(player:WaitForChild("PlayerGui"), player, plot, send)
|
|
decorate = deco
|
|
deco.setLayout(hud.layout())
|
|
hud.onDecorate(function(kind: string, k: string?)
|
|
hud.open(nil)
|
|
deco.start(kind, k)
|
|
end)
|
|
deco.onOpen(function()
|
|
hud.gui.Enabled = false
|
|
ProximityPromptService.Enabled = false
|
|
end)
|
|
deco.onClose(function(placed: string?)
|
|
hud.gui.Enabled = true
|
|
ProximityPromptService.Enabled = true
|
|
-- 새 물건을 놓았으면 더 살 수 있게 가게 꾸미기 창을 다시 엽니다.
|
|
if placed == "new" then
|
|
hud.open("decor")
|
|
end
|
|
end)
|
|
|
|
Guide.start(player)
|
|
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
|