MatchmakingService

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

作成できません
サービス
複製されていません

MatchmakingService は、カスタムマッチメイキング属性の管理に責任があります。それを使用して、マッチメイキングデータを読み込み、書き込みます。

概要

方法

プロパティ

方法

GetServerAttribute

特定のサーバー属性の値を取得します。

パラメータ

name: string

サーバー属性の名前。最大 50文字まで。

既定値: ""

戻り値

属性が見つかり、エラーが nil である場合、サーバー属性値を返します。そうでない場合、属性値とエラーメッセージに対して nil を返します。

InitializeServerAttributesForStudio

スタジオでテストするサーバー属性スキームとその値を開始します。この方法はオプションであり、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

イベント