GS2-Dictionary SDK for Game Engine API リファレンス

モデル

EzEntryModel

エントリーモデルとは図鑑に記録するエンティティです。 ここではどんなエンティティが図鑑に記録可能かを定義します。

必須デフォルト値の制限説明
namestring~ 128文字エントリー名
metadatastring~ 2048文字メタデータ

EzEntry

ゲームプレイヤーが入手したエントリー。

必須デフォルト値の制限説明
entryIdstring~ 1024文字エントリーGRN
userIdstring~ 128文字ユーザーID
namestring~ 128文字エントリー名
acquiredAtlong現在時刻入手日時

EzConfig

コンフィグ設定

スタンプシートの変数に適用する設定値

必須デフォルト値の制限説明
keystring~ 64文字名前
valuestring~ 51200文字

メソッド

getEntryModel

エントリーモデル情報を取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
entryNamestring~ 128文字エントリー名

Result

説明
itemEzEntryModelエントリーモデル

実装例

    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).EntryModel(
        entryName: "entry-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).EntryModel(
        entryName: "entry-0001"
    );
    var future = domain.Model();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    )->EntryModel(
        "entry-0001" // entryName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
値の変更イベントハンドリング
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).EntryModel(
        entryName: "entry-0001"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).EntryModel(
        entryName: "entry-0001"
    );
    var future = domain.Model();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    )->EntryModel(
        "entry-0001" // entryName
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Dictionary::Model::FEntryModel> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

listEntryModels

エントリーモデル情報の一覧を取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
itemsList<EzEntryModel>エントリーモデルのリスト

実装例

    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    );
    var items = await domain.EntryModelsAsync(
    ).ToListAsync();
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.EntryModels(
    );
    List<EzEntryModel> items = new List<EzEntryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto It = Domain->EntryModels(
    );
    TArray<Gs2::UE5::Dictionary::Model::FEzEntryModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
値の変更イベントハンドリング
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeEntryModels(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    domain.UnsubscribeEntryModels(callbackId);
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.EntryModels(
    );
    List<EzEntryModel> items = new List<EzEntryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->SubscribeEntryModels(
        []() {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    Domain->UnsubscribeEntryModels(CallbackId);

getEntry

エントリーを取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
entryModelNamestring~ 128文字エントリー名

Result

説明
itemEzEntryエントリー

実装例

    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Entry(
        entryName: null
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Entry(
        entryName: null
    );
    var future = domain.Model();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Entry(
        nullptr // entryName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
値の変更イベントハンドリング
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Entry(
        entryName: null
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Entry(
        entryName: null
    );
    var future = domain.Model();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Entry(
        nullptr // entryName
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Dictionary::Model::FEntry> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

getEntryWithSignature

署名と一緒にエントリーを取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
entryModelNamestring~ 128文字エントリー名
keyIdstring“grn:gs2:{region}:{ownerId}:key:default:key:default”~ 1024文字暗号鍵GRN

Result

説明
itemEzEntryエントリー
bodystring署名対象のエントリー情報
signaturestring署名

実装例

    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Entry(
        entryName: null
    );
    var result = await domain.GetEntryWithSignatureAsync(
        entryModelName: "entry-0001",
        keyId: "key-0001"
    );
    var item = await result.ModelAsync();
    var body = result.Body;
    var signature = result.Signature;
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Entry(
        entryName: null
    );
    var future = domain.GetEntryWithSignatureFuture(
        entryModelName: "entry-0001",
        keyId: "key-0001"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.Model();
    yield return future2;
    if (future2.Error != null)
    {
        onError.Invoke(future2.Error, null);
        yield break;
    }
    var result = future2.Result;
    var body = future.Result.Body;
    var signature = future.Result.Signature;
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Entry(
        nullptr // entryName
    );
    const auto Future = Domain->GetEntryWithSignature(
        "entry-0001", // entryModelName
        "key-0001" // keyId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();
    const auto Body = Result->Body;
    const auto Signature = Result->Signature;

listEntries

エントリーの一覧を取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
limitint301 ~ 10000データの取得件数
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン

Result

説明
itemsList<EzEntry>エントリーのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.EntriesAsync(
    ).ToListAsync();
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.Entries(
    );
    List<EzEntry> items = new List<EzEntry>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    );
    const auto It = Domain->Entries(
    );
    TArray<Gs2::UE5::Dictionary::Model::FEzEntryPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
値の変更イベントハンドリング
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeEntries(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    domain.UnsubscribeEntries(callbackId);
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.Entries(
    );
    List<EzEntry> items = new List<EzEntry>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Dictionary->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->SubscribeEntries(
        []() {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    Domain->UnsubscribeEntries(CallbackId);