feat(bunsik): 휴대폰·태블릿 화면 배치

- Layout 모듈: 안전 영역(상단 바·노치 제외) 크기와 터치 여부로 배율·위치 계산
- 휴대폰: 기준 화면 900x400으로 글자·버튼 크게, 결제 버튼은 왼쪽 위, 사기 버튼은
  조이스틱(왼쪽 40%×아래 2/3)과 점프 버튼 자리 사이, 마우스 회전 줄 숨김
- 루트가 화면을 꽉 채우고, 배율을 상단 바 뺀 영역 기준으로 계산(아래 카드 잘림 수정)
- 개발자 테스트 버튼을 설정 창 안으로 이동
- 기기 12종 배치 단위 테스트, 배치 미리보기 도구(tools/hud_preview.py)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-12 13:57:32 +09:00
parent 4d861b8fd3
commit 998b2467d6
8 changed files with 524 additions and 52 deletions

View File

@@ -25,12 +25,34 @@ while not player:GetAttribute("Ready") do
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 function rescale()
hud.setScale(Hud.scaleFor(camera.ViewportSize))
-- 휴대폰·태블릿 배치: 마지막 입력이 터치면 켜고, 마우스·게임패드면 끕니다(키보드 입력은 채팅일 수 있어 무시).
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
camera:GetPropertyChangedSignal("ViewportSize"):Connect(rescale)
rescale()
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
@@ -76,7 +98,6 @@ Plots.start(world:WaitForChild("Plots"), player, player.UserId, send)
Guide.start(player)
MouseLook.start(player, hud.menuOpen)
local UserInputService = game:GetService("UserInputService")
if player:GetAttribute("MouseLook") == true and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then
hud.notify("mouseHint")
end