SDK を使用したゲームクライアントへの法的文書の統合
Last updated on February 4, 2026
注釈:本資料はAI技術を用いて翻訳されています。
概要
このガイドでは、ゲームクライアント内の AccelByte::Api::Agreement の関数を通じて AccelByte Legal Agreement API を利用して、AccelByte Gaming Services(AGS)で法的文書を統合する方法を説明します。
プレイヤーの適格性の確認
特定のネームスペースのプレイヤーが法的契約に同意したかどうかを確認するには、次の関数を使用します:
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->QueryLegalEligibilities(
// 指定されたネームスペース
,
THandler < TArray < FAccelByteModelsRetrieveUserEligibilitiesResponse >> ::
CreateLambda(
[](TArray < FAccelByteModelsRetrieveUserElegibilitiesResponse > Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().QueryLegalEligibilities(eligibilitiesResult =>
{
if (eligibilitiesResult.IsError)
{
// Query Legal Eligibilities にエラーがある場合に何かを行う
Debug.Log($"Query Legal Eligibility failed : {eligibilitiesResult.Error.Code} Description : {eligibilitiesResult.Error.Message}");
return;
}
bool isEligible = true;
foreach(var eligibility in eligibilitiesResult.Value)
{
if (!eligibility.isAccepted)
{
isEligible = false;
break;
}
}
if (isEligible)
{
Debug.Log($"Query Legal Eligibility Success");
}
else
{
Debug.Log($"Contains player who don't accept legal eligibility");
}
});
法的文書コンテンツの取得
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->GetLegalDocument(
// 指定された URL
,
THandler < FString > ::CreateLambda([](FString Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
Result <string> docResult = null;
String localizedPolicyUrl = policyVersion.localizedPolicyVersions[0].attachmentLocation; // GetLegalPolicies の結果から
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().GetLegalDocument(localizedPolicyUrl, docResult =>
{
if (docResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Get Legal Document failed : {docResult.Error.Code} Description : {docResult.Error.Message}");
return;
}
// 成功時に何かを行う
});
法的文書ポリシーの取得
このセクションでは、特定の基準に基づいて文書ポリシーを取得するために利用可能なすべての関数の概要を示します。
すべての最新のアクティブなポリシーの取得
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->GetLegalPolicies(
// 指定されたポリシータイプ
,
// 空のフラグでデフォルト
,
THandler < TArray < FAccelByteModelsPublicPolicy >> ::
CreateLambda([](TArray < FAccelByteModelsPublicPolicy > Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().GetLegalPolicies(AgreementPolicyType.EMPTY, false, publicPoliciesResult =>
{
if (publicPoliciesResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Get Legal Policies failed : {publicPoliciesResult.Error.Code} Description : {publicPoliciesResult.Error.Message}");
return;
}
// 成功時に何かを行う
});
ネームスペース別のポリシーリストの取得
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->GetLegalPolicies(
// 指定されたネームスペース
,
// 指定されたポリシータイプ
,
// 空のフラグでデフォルト
,
THandler < TArray < FAccelByteModelsPublicPolicy >> ::
CreateLambda([](TArray < FAccelByteModelsPublicPolicy > Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
// ネームスペースは設定ファイルに既に保存されています
string[] tags = new string[] {
"game",
"NDA"
};
bool defaultOnEmpty = true; // あなたの国にローカライズされたポリシーが設定されていない場合、デフォルトの国を取得します
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().GetLegalPolicies(AgreementPolicyType.EMPTY, tags, defaultOnEmpty, publicPoliciesResult =>
{
if (publicPoliciesResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Get Legal Policies failed : {publicPoliciesResult.Error.Code} Description : {publicPoliciesResult.Error.Message}");
return;
}
// 成功時に何かを行う
foreach(var publicPolicy in publicPoliciesResult.Value)
{
Debug.Log("PolicyName: " + publicPolicy.policyName + " | Description: " + publicPolicy.description);
foreach(var policyVersion in publicPolicy.policyVersions)
{
Debug.Log("PolicyVersion: " + policyVersion.displayVersion + " | LocalizedPolicyUrl: " + policyVersion.localizedPolicyVersions[0].attachmentLocation);
}
}
});
タグ別のポリシーリストの取得
ゲーム設定のネームスペースとユーザープロファイルの国コードに基づいて、指定されたタグを持つすべての最新のアクティブなポリシーを取得します。
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->GetLegalPolicies(
// 指定されたポリシータイプ
,
// タグのリスト
,
// 空のフラグでデフォルト
,
THandler < TArray < FAccelByteModelsPublicPolicy >> ::
CreateLambda([](TArray < FAccelByteModelsPublicPolicy > Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
string[] tags = new string[2] {
"beta",
"newsletter"
};
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().GetLegalPolicies(AgreementPolicyType.EMPTY, tags, false, publicPoliciesResult =>
{
if (publicPoliciesResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Get Legal Policies failed : {publicPoliciesResult.Error.Code} Description : {publicPoliciesResult.Error.Message}");
return;
}
// 成功時に何かを行う
});
国別のポリシーリストの取得
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->GetLegalPolicies(
// 指定された国コード
,
// 指定されたポリシータイプ
,
// 空のフラグでデフォルト
,
THandler < TArray < FAccelByteModelsPublicPolicy >> ::
CreateLambda([](TArray < FAccelByteModelsPublicPolicy > Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
string countryCode = "US"; // 適格性の戻り値から国コードを取得できます
string[] tags = new string[] {
"game",
"NDA"
};
bool defaultOnEmpty = true; // あなたの国にローカライズされたポリシーがない場合、デフォルトの国を取得します
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().GetLegalPoliciesByCountry(countryCode, AgreementPolicyType.EMPTY, tags, defaultOnEmpty, publicPoliciesResult =>
{
if (publicPoliciesResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Get Legal Policies failed : {publicPoliciesResult.Error.Code} Description : {publicPoliciesResult.Error.Message}");
return;
}
// 成功時に何かを行う
foreach(var publicPolicy in publicPoliciesResult.Value)
{
Debug.Log("PolicyName: " + publicPolicy.policyName + " | Description: " + publicPolicy.description);
foreach(var policyVersion in publicPolicy.policyVersions)
{
Debug.Log("PolicyVersion: " + policyVersion.displayVersion + " | LocalizedPolicyUrl: " + policyVersion.localizedPolicyVersions[0].attachmentLocation);
}
}
});
国とタグ別のポリシーリストの取得
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->GetLegalPolicies(
// 指定された国コード
,
// 指定されたポリシータイプ
,
// タグのリスト
,
// 空のフラグでデフォルト
,
THandler < TArray < FAccelByteModelsPublicPolicy >> ::
CreateLambda([](TArray < FAccelByteModelsPublicPolicy > Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
string countryCode = "US";
string[] tags = new string[2] {
"beta",
"newsletter"
};
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().GetLegalPoliciesByCountry(countryCode, AgreementPolicyType.EMPTY, tags, false, publicPoliciesResult =>
{
if (publicPoliciesResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Get Legal Policies failed : {publicPoliciesResult.Error.Code} Description : {publicPoliciesResult.Error.Message}");
return;
}
// 成功時に何かを行う
});
ポリシーの受け入れ
ポリシーは、1 つずつまたは一括で受け入れることができます。
単一のポリシーの受け入れ
ローカライズされたバージョン ID を使用してローカライズされたポリシー文書を受け入れるには、次の関数を使用します:
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->AcceptPolicyVersion(
// 指定されたローカライズされたポリシーバージョン ID
,
FVoidHandler::CreateLambda([]() {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
string localizedPolicyVersionId = policyVersion.localizedPolicyVersions[0].id; // GetLegalPolicies の結果から
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().AcceptPolicyVersion(localizedPolicyVersionId, acceptPolicyVersionResult =>
{
if (acceptPolicyVersionResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Accept Policy Version failed : {acceptPolicyVersionResult.Error.Code} Description : {acceptPolicyVersionResult.Error.Message}");
return;
}
// 成功時に何かを行う
});
ポリシーの一括受け入れ
複数のローカライズされたポリシーを一度に受け入れるには、次の関数を使用します:
- Unreal Engine
- Unity
auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto AgreementApi = ApiClient->GetAgreementApi().Pin();
AgreementApi->BulkAcceptPolicyVersions(
// ローカライズされたポリシーバージョンのリスト
,
THandler < FAccelByteModelsAcceptAgreementResponse > ::
CreateLambda([](FAccelByteModelsAcceptAgreementResponse Result) {
// 成功時に何かを行う
}),
FError::CreateLambda([](int32 ErrorCode, FString ErrorMessage) {
// 失敗した場合に何かを行う
})
);
//ポリシー
AcceptAgreementRequest[] acceptAgreementRequests = new AcceptAgreementRequest[]
{
new AcceptAgreementRequest
{
isAccepted = true,
policyId = policy.policyId,
policyVersionId = policyVersion.id,
localizedPolicyVersionId = policyVersion.localizedPolicyVersions[0].id
}
};
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().BulkAcceptPolicyVersions(acceptAgreementRequests, acceptAgreementResponseResult =>
{
if (acceptAgreementResponseResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Accept Policy Version failed : {acceptAgreementResponseResult.Error.Code} Description : {acceptAgreementResponseResult.Error.Message}");
return;
}
// 成功時に何かを行う
});
既存のポリシーの更新
以下は、既存のポリシーに変更を加える方法を示しています。
マーケティング設定同意の更新
注記
プレイヤーの現在のマーケティング設定同意を更新するには、次のスニペットのコードを使用します:
- Unity
// ポリシーのリストを取得します。
Result<PublicPolicy[]> publicPoliciesResult;
// 取得したポリシーリストから、最初のポリシーのみが受け入れられると仮定します
AcceptAgreementRequest[] acceptAgreementRequests = new AcceptAgreementRequest[]
{
new AcceptAgreementRequest
{
isAccepted = true,
policyId = publicPoliciesResult.Value[0].id,
policyVersionId = publicPoliciesResult.Value[0].policyVersions[0].id,
localizedPolicyVersionId = publicPoliciesResult.Value[0].policyVersions[0].localizedPolicyVersions[0].id
}
};
AccelByteSDK.GetClientRegistry().GetApi().GetAgreement().BulkAcceptPolicyVersions(acceptAgreementRequests, acceptAgreementResponseResult =>
{
if (acceptAgreementResponseResult.IsError)
{
// 失敗した場合に何かを行う
Debug.Log($"Accept Policy Version failed : {acceptAgreementResponseResult.Error.Code} Description : {acceptAgreementResponseResult.Error.Message}");
return;
}
// 成功時に何かを行う
});