-- 클라이언트 진입점: 화면 UI, 내 조리대 버튼, 튜토리얼 화살표, 부지 글자·손님 방문 버튼, 마우스 회전, 효과음 설정. local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local SoundService = game:GetService("SoundService") 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 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) 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, } notifyRemote.OnClientEvent:Connect(function(key, args) if typeof(key) == "string" then hud.notify(key, if typeof(args) == "table" then args else nil) 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, send) Plots.start(world:WaitForChild("Plots"), player, player.UserId, send) Guide.start(player) MouseLook.start(player, hud.menuOpen) if player:GetAttribute("MouseLook") == true and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then hud.notify("mouseHint") end