포토 부스

멋진 체험은 사진을 찍어 완벽하게 기념할 수 있습니다. PhotoBooth 개발자 모듈은 플레이어가 체험을 나타내는 배경 앞에서 독특한 포즈를 취할 수 있게 해주는 사용이 간편한 사진 촬영 도구입니다.

모듈 사용

설치

체험에서 PhotoBooth 모듈을 사용하는 방법

  1. 보기 탭에서 도구 상자를 열고 마켓플레이스 탭을 선택합니다.

    Studio의 도구상자 토글 버튼
  2. 모델 정렬이 선택되었는지 확인한 다음 카테고리에서 모두 보기 버튼을 클릭합니다.

  3. DEV MODULES 타일을 찾아 클릭합니다.

  4. 사진 부스 모듈을 찾아 클릭하거나 3D 보기로 끌어다 놓습니다.

  5. 탐색기 창에서 전체 PhotoBooth 모델을 ServerScriptService로 이동합니다. 체험을 실행하면 모듈이 다양한 서비스에 배포되고 실행되기 시작합니다.

부스 위치 지정

모듈은 3D 월드에서 위치를 지정할 수 있는 한 개의 PhotoBooth 모델과 함께 제공됩니다. 플레이어들은 이 모델과 상호 작용하면서 사진을 설정합니다.

  1. 모듈의 기본 폴더에서 Workspace 폴더 안의 PhotoBooth 메시를 찾습니다.

  2. 최상위 Workspace 계층으로 옮긴 다음 원하는 위치에 놓습니다.

구성

이러한 모듈은 대부분의 사용 사례에서 작동하도록 미리 구성되어 있지만, 구성 함수를 통해 더욱 쉽게 사용자 지정할 수 있습니다. 예를 들어, 사진 하단의 기본 메시지를 변경하는 방법은 다음과 같습니다.

  1. StarterPlayerScripts에서 새로운 LocalScript를 만들고 이름을 ConfigurePhotoBooth로 변경합니다.

  2. 새로운 스크립트에 다음의 코드를 붙여 넣습니다.

    LocalScript - ConfigurePhotoBooth

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
    PhotoBooth.configure({
    frameMessage = "First Photo Booth Capture!",
    })

이벤트에 연결

사진 부스가 로컬 클라이언트에 새로운 화면을 표시할 때마다 해당 이벤트가 발생합니다. 본인의 사용자 지정 논리로 응답할 수 있도록 LocalScript에서 이러한 이벤트를 연결할 수 있습니다.

LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
PhotoBooth.countdownStarted:Connect(function()
print("The countdown has started")
end)
PhotoBooth.printoutShown:Connect(function()
print("The printout is showing")
end)
PhotoBooth.promptShown:Connect(function()
print("The camera prompt is showing")
end)

GUI 가시성

기본값에 따라, 사진이 준비될 때 사진 부스는 모든 ScreenGuisCoreGuis를 숨깁니다. 해당 자동 숨기기 동작을 무효화하고 프로그래밍 방식으로 가시화할 GUI를 결정하려면, hideOtherGuisshowOtherGuis 콜백을 포함시켜 고유한 사용자 지정 논리로 대응하십시오.

LocalScript

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local hiddenInstances = {}
-- Create a screen GUI that will not be hidden
local specialGuiInstance = Instance.new("ScreenGui")
-- Draw the screen GUI above the photo booth GUI
specialGuiInstance.DisplayOrder = 1
specialGuiInstance.Parent = playerGui
-- Set attribute on screen GUI to prevent hiding
specialGuiInstance:SetAttribute("ShowInPhotoBooth", true)
-- Add text label to the GUI
local specialLabel = Instance.new("TextLabel")
specialLabel.Size = UDim2.fromScale(1, 0.1)
specialLabel.Text = "Remains visible when taking a photo"
specialLabel.Font = Enum.Font.GothamMedium
specialLabel.TextSize = 24
specialLabel.Parent = specialGuiInstance
PhotoBooth.hideOtherGuis(function()
-- Hide all developer-defined screen GUIs except those marked with attribute
local instances = playerGui:GetChildren()
for _, instance in pairs(instances) do
if instance:IsA("ScreenGui") and not instance:GetAttribute("ShowInPhotoBooth") and instance.Enabled then
instance.Enabled = false
table.insert(hiddenInstances, instance)
end
end
-- Hide specific core GUIs
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
end)
PhotoBooth.showOtherGuis(function()
-- Show all developer-defined screen GUIs that were hidden
for _, instance in pairs(hiddenInstances) do
instance.Enabled = true
end
hiddenInstances = {}
-- Show specific core GUIs that were hidden
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
end)

API 참조

함수

구성

configure(config:table):nil

config 테이블의 다음 키/값을 통해 기본 구성 옵션을 무효화합니다. 해당 함수는 LocalScript에서만 호출할 수 있습니다.

외형

설명기본
frameMessage사진 하단에 표시되는 메시지입니다. 표시되는 시간은 fadeUiDelay 속성을 통해 제어할 수 있습니다."Use your device to take a screenshot and share!"
fadeUiDelay프레임 메시지가 점차 희미해지며 사라지기 전에 표시되는 시간입니다(단위: 초). 음수를 설정하면 메시지가 사라지지 않습니다.3
closeButtonImage사진 닫기 버튼을 위한 이미지로, closeButtonBackgroundImage 이미지 위에 배치됩니다."rbxassetid://7027440823"
closeButtonBackgroundImage사진 닫기 버튼에 사용할 배경 이미지입니다."rbxassetid://7027440891"
cameraLandscapePosition가로 모드에서 사진을 찍을 때 캐릭터의 앞과 위쪽에서 보는 사진 부스 카메라와의 거리입니다(Vector2).(5, 2)
cameraPortraitPosition세로 모드에서 사진을 찍을 때 캐릭터의 앞과 위쪽에서 보는 사진 부스 카메라와의 거리입니다(Vector2).(10, 1)
countdownFont카운트다운의 숫자에 사용할 글꼴입니다(Enum.Font).GothamBlack
countdownTextColor카운트다운에서 숫자의 색상입니다(Color3).[255, 255, 255]
printoutCharacterPosition출력물이 표시될 때 화면에서 캐릭터의 위치입니다(UDim2).(0.5, 0, 0.5, 0)
printoutCharacterSize출력물에서 캐릭터가 차지하는 화면 공간의 양입니다(UDim2).(1, 0, 1, 0)
characterAnimation캐릭터가 사진에서 사용하는 애니메이션(시작 프레임에서 일시 정지함)의 애셋 ID입니다."rbxassetid://6899663224"
filterImage사진 위에 필터로 적용할 이미지입니다. nil인 경우, 이미지 가장자리를 어둡게 하는 기본 필터가 사용됩니다.nil

행동

설명기본
maxActivationDistance프롬프트 표시를 위해 가능한 플레이어 캐릭터와 사진 부스 간의 최대 거리입니다(단위: 스터드).10
countdownBeepSound카운트다운에 표시된 각 숫자에 대해 재생할 Sound의 애셋 ID입니다."rbxassetid://7743999789"
countdownFlashSound플래시 효과가 표시될 때 재생할 Sound의 애셋 ID입니다."rbxassetid://7744000850"
countdownSeconds카운트다운에 사용되는 초 단위 시간입니다.3

기타

설명기본
photoboothTag플레이스의 모든 '부스'를 찾기 위해 CollectionService가 사용하는 태그입니다."PhotoBooth"
LocalScript - ConfigurePhotoBooth

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
PhotoBooth.configure({
frameMessage = "What a cool pose!",
fadeUiDelay = 5,
maxActivationDistance = 5,
printoutCharacterSize = UDim2.fromScale(1.5, 1.5),
})

setBackgrounds

setBackgrounds(backgrounds:table):nil

사진 부스가 제공하는 기본 배경을 재정의합니다. 최상의 체험을 위해 배경 이미지는 16:9의 가로세로 비율이어야(1024×768) 하고 해당 애셋 ID가 배경 배열에 포함되어야 합니다. 1~4개의 배경을 제공할 수 있습니다.

LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
PhotoBooth.setBackgrounds({
"rbxassetid://7018713114",
"rbxassetid://950538356",
})

이벤트

countdownStarted

countdownStarted(): RBXScriptSignal

카운트다운이 시작될 때 발생합니다. 해당 이벤트는 LocalScript에서만 연결할 수 있습니다.

LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
PhotoBooth.countdownStarted:Connect(function()
print("The countdown has started")
end)

printoutShown

printoutShown(): RBXScriptSignal

출력물이 사용자에게 표시될 때 발생합니다. 해당 이벤트는 LocalScript에서만 연결할 수 있습니다.

LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
PhotoBooth.printoutShown:Connect(function()
print("The printout is showing")
end)

promptShown

promptShown(): RBXScriptSignal

출력물이 닫히고 카메라 버튼이 다시 표시될 때 발생합니다. 해당 이벤트는 LocalScript에서만 연결할 수 있습니다.

LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhotoBooth = require(ReplicatedStorage:WaitForChild("PhotoBooth"))
PhotoBooth.promptShown:Connect(function()
print("The camera prompt is showing")
end)

콜백

hideOtherGuis

hideOtherGuis(callback:function)

이 콜백은 출력물이 표시되기 직전에 실행되므로 전체 ScreenGuis 또는 그 안의 요소를 출력물이 표시되기 전에 비활성화할 수 있습니다. 사진 부스가 사용하는 GUI는 ShowInPhotoBooth 속성이 true로 설정되어 있습니다. 자세한 내용과 샘플 코드는 GUI 가시성을 참조해 주세요.

showOtherGuis

showOtherGuis(callback:function)

이 콜백은 출력물이 닫힌 후에 실행되므로 전체 ScreenGuis 또는 그 안의 요소를 다시 활성화할 수 있습니다. 사진 부스가 사용하는 GUI는 ShowInPhotoBooth 속성이 true로 설정되어 있습니다. 자세한 내용과 샘플 코드는 GUI 가시성을 참조해 주세요.