-- 클라이언트 진입점: 화면 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