CDK

信頼できる大人の設定

信頼できる大人は、子供の同意と権限を管理する方法についての設定を構成できます。これらの設定はFamily Connectで構成され、同意チャレンジの提示と処理方法に影響します。

APIでの設定の仕組み

信頼できる大人の設定は、セッションオブジェクトの一部であり、/session/getエンドポイントを通じてアクセスできます。設定は、セッションレスポンス内のallowances配列に保存されます。

セッションでのallowancesへのアクセス

/session/getを使用してセッションを取得すると、レスポンスには、そのプレイヤー用に構成された信頼できる大人の設定を含むallowances配列が含まれます。各allowanceは、信頼できる大人が構成した設定設定を表します。

allowancesを含むセッションレスポンスの例

{
  "session": {
    "sessionId": "b1a6482d-5242-4b4a-aa88-3fa52595a672",
    "kuid": "12b9fa0e-6d6d-4903-a1fc-f2233027b71d",
    "ageStatus": "LEGAL_ADULT",
    "ageCategory": "adult",
    "etag": "e889efb9e8a985308e82bed78c5aef7f37f50cf36b7337bf654980d0bab7a574",
    "status": "ACTIVE",
    "dateOfBirth": "2005-04-15",
    "jurisdiction": "US-CA",
    "managedBy": "PLAYER",
    "permissions": [
      {
        "name": "text-chat-public",
        "enabled": false,
        "managedBy": "GUARDIAN"
      },
      {
        "name": "text-chat-private",
        "enabled": true,
        "managedBy": "PLAYER"
      },
      {
        "name": "forums",
        "enabled": false,
        "managedBy": "PROHIBITED"
      }
    ],
    "allowances": [
      {
        "name": "3516-7b2e",
        "numericalValue": 5,
        "type": "numerical"
      },
      {
        "name": "63d3-90ac",
        "selectionValue": "733c-ca11",
        "type": "selection"
      }
    ]
  },
  "status": "PASS"
}

Allowance構造

allowances配列内の各allowanceには、以下の構造があります:

フィールドタイプ説明
namestringallowance設定の一意の識別子(Compliance Studioで設定)
typestringallowanceのタイプ:"numerical"または"selection"
numericalValuenumber数値(typeが"numerical"の場合にのみ存在)
selectionValuestring選択された値の識別子(typeが"selection"の場合にのみ存在)

Allowanceタイプ

数値allowances

数値allowancesは、数値を持つ設定を表します。例:

  • 最大1日のプレイ時間(時間)
  • 最大支出制限
  • 時間ベースの制限

例:

{
  "name": "3516-7b2e",
  "numericalValue": 5,
  "type": "numerical"
}

選択allowances

選択allowancesは、信頼できる大人が事前定義されたオプションから選択した設定を表します。例:

  • コンテンツレーティング設定
  • 通信設定
  • 機能アクセスレベル

例:

{
  "name": "63d3-90ac",
  "selectionValue": "733c-ca11",
  "type": "selection"
}

アプリケーションでのallowancesの使用

allowancesを使用して、信頼できる大人の設定を尊重するゲームロジックを実装できます:

  1. セッションを取得: /session/getを呼び出して、allowancesを含む現在のセッションを取得する
  2. allowancesをチェック: セッションレスポンスでallowances配列を探す
  3. 各allowanceを処理: allowancesを反復処理し、設定値をゲームロジックに適用する
  4. allowanceタイプを処理: typeフィールドをチェックして、numericalValueまたはselectionValueを使用するかどうかを決定する

実装の例

async function getPlayerAllowances(sessionId) {
  const response = await fetch(`/api/v1/session/get?sessionId=${sessionId}`, {
    headers: {
      'Authorization': `Bearer ${apiKey}`
    }
  });
  
  const data = await response.json();
  const allowances = data.session?.allowances || [];
  
  // allowancesを処理
  const preferences = {};
  allowances.forEach(allowance => {
    if (allowance.type === 'numerical') {
      preferences[allowance.name] = allowance.numericalValue;
    } else if (allowance.type === 'selection') {
      preferences[allowance.name] = allowance.selectionValue;
    }
  });
  
  return preferences;
}

Allowancesが適用される場合

Allowancesは、以下の場合にセッションに自動的に含まれます:

  • 同意チャレンジが作成され、承認されたとき
  • セッションが作成または更新されたとき
  • 権限がアップグレードされたとき

Allowancesは、信頼できる大人がFamily Connectでそのプレイヤー用に構成した設定を反映します。

Allowancesの設定

Allowancesは、Compliance Studioで設定され、以下を定義します:

  • allowance名(識別子)
  • allowanceタイプ(数値または選択)
  • 選択タイプのallowancesの利用可能なオプション

信頼できる大人の設定の詳細情報(設定方法と統合への影響を含む)については、コアコンセプトセクションの信頼できる大人の設定を参照してください。

On this page