MatchmakingService

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
서비스
복제되지 않음

MatchmakingService 는 사용자 지정 매치메이킹 특성을 관리하는 책임이 있습니다. 매치메이킹 데이터를 읽고 쓰는 데 사용하십시오.

요약

메서드

속성

메서드

GetServerAttribute

특정 서버 특성의 값을 검색합니다.

매개 변수

name: string

서버 특성의 이름. 최대 50자까지 제한됩니다.

기본값: ""

반환

특성이 발견되고 오류가 nil인 경우 서버 특성 값을 반환합니다.그렇지 않으면 특성 값에 대해 nil를 반환하고 오류 메시지를 표시합니다.

InitializeServerAttributesForStudio

Studio에서 테스트할 서버 특성 스키마와 해당 값을 시작합니다. 이 방법은 선택적이며 Studio 외부에서 실행할 때 효과가 없습니다.

매개 변수

serverAttributes: Dictionary

특성 이름-값 쌍 배열.

기본값: ""

반환

호출이 성공하면 true 를 반환하고, 그렇지 않으면 false 와 오류 메시지를 반환합니다.

SetServerAttribute

특정 서버 특성에 값을 할당합니다.

매개 변수

name: string

서버 특성의 이름. 최대 50자까지 제한됩니다.

기본값: ""
value: Variant

서버 특성의 값. 최대 50자로 제한됩니다.

기본값: ""

반환

호출이 성공하면 true 를 반환하고, 그렇지 않으면 false 와 오류 메시지를 반환합니다.

코드 샘플

The following code sample:

MarketplaceService sample

local MatchmakingService = game::GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- Sets up initial attributes and schema for testing
MatchmakingService:InitializeServerAttributesForStudio(
{
Level = "Advanced",
Elo = 123.456,
TrainingMode = true
})
end
-- Retrieves the Level attribute
local currentLevel, error = MatchmakingService:GetServerAttribute("Level")
if error then
print(error)
else
print("Current level: " .. currentLevel)
end
-- Updates the Level attribute value to Advanced
local success, error = MatchmakingService:SetServerAttribute("Level", "Advanced")
if not success then
print("Failed to update server attribute [Level] to [Advanced] due to error: " .. error)
else
print("Successfully set [Level] to [Advanced]")
end

이벤트