NAV
Unity Unreal Engine 4

GS2-Dictionary

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

ゲームエンジン向けSDK

モデル

EzEntryModel

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

説明
name string エントリー名
metadata string メタデータ

EzEntry

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

説明
entryId string エントリーGRN
userId string ユーザーID
name string エントリーの名
acquiredAt long 入手日時

EzConfig

説明
key string 名前
value string

メソッド

getEntryModel

getEntryModel

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->dictionary.getEntryModel(
    [](gs2::ez::account::AsyncEzGetEntryModelResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "dictionary.getEntryModel failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
        }
    },
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("entry-0001") // entryName
);

///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////

using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);

// Up to this line is the initialization process.

{
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace2"
    ).EntryModel(
        entryName: "entry-0001"
    );
    var item = await domain.ModelAsync();
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////

using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}
var gs2 = new Gs2.Unity.Client(profile);

// Up to this line is the initialization process.

{
    AsyncResult<EzGetEntryModelResult> asyncResult = null;
    var current = gs2.Dictionary.GetEntryModel(
        callback: r => { asyncResult = r; },
        namespaceName: "namespace2",
        entryName: "entry-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

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

Request

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

Result

説明
item EzEntryModel エントリーモデル

listEntryModels

listEntryModels

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->dictionary.describeEntryModels(
    [](gs2::ez::account::AsyncEzDescribeEntryModelsResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "dictionary.describeEntryModels failed.");
        }
        else
        {
            Items = r.getResult()->getItems();
        }
    },
    TCHAR_TO_ANSI("namespace2") // namespaceName
);

///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////

using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);

// Up to this line is the initialization process.

{
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace2"
    );
    var items = await domain.EntryModelsAsync(
    ).ToListAsync();
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////

using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}
var gs2 = new Gs2.Unity.Client(profile);

// Up to this line is the initialization process.

{
    AsyncResult<EzListEntryModelsResult> asyncResult = null;
    var current = gs2.Dictionary.ListEntryModels(
        callback: r => { asyncResult = r; },
        namespaceName: "namespace2"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var items = result.Items;
}

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

Request

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

Result

説明
items EzEntryModel[] エントリーモデルのリスト

getEntry

getEntry

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->dictionary.getEntry(
    [](gs2::ez::account::AsyncEzGetEntryResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "dictionary.getEntry failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("entry-0001") // entryModelName
);

///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////

using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);

// Up to this line is the initialization process.

{
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace2"
    ).Me(
        gameSession: gameSession
    ).Entry(
        entryModelName: "entry-0001"
    );
    var item = await domain.ModelAsync();
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////

using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}
var gs2 = new Gs2.Unity.Client(profile);

// Up to this line is the initialization process.

{
    AsyncResult<EzGetEntryResult> asyncResult = null;
    var current = gs2.Dictionary.GetEntry(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        entryModelName: "entry-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

エントリーを取得

Request

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

Result

説明
item EzEntry エントリー

getEntryWithSignature

getEntryWithSignature

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->dictionary.getEntryWithSignature(
    [](gs2::ez::account::AsyncEzGetEntryWithSignatureResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "dictionary.getEntryWithSignature failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
            Body = r.getResult()->getBody();
            Signature = r.getResult()->getSignature();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("entry-0001"), // entryModelName
    TCHAR_TO_ANSI("$key1.keyId") // keyId
);

///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////

using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);

// Up to this line is the initialization process.

{
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace2"
    ).Me(
        gameSession: gameSession
    ).Entry(
        entryModelName: "entry-0001"
    );
    var result = await domain.GetEntryWithSignatureAsync(
        keyId: "$key1.keyId"
    );
    var item = await result.ModelAsync();
    var body = result.Body;
    var signature = result.Signature;
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////

using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}
var gs2 = new Gs2.Unity.Client(profile);

// Up to this line is the initialization process.

{
    AsyncResult<EzGetEntryWithSignatureResult> asyncResult = null;
    var current = gs2.Dictionary.GetEntryWithSignature(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        entryModelName: "entry-0001",
        keyId: "$key1.keyId"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
    var body = result.Body;
    var signature = result.Signature;
}

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

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
entryModelName string ~ 128文字 エントリーの名
keyId string ~ 1024文字 暗号鍵GRN

Result

説明
item EzEntry エントリー
body string 署名対象のエントリー情報
signature string 署名

listEntries

listEntries

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->dictionary.describeEntries(
    [](gs2::ez::account::AsyncEzDescribeEntriesResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "dictionary.describeEntries failed.");
        }
        else
        {
            Items = r.getResult()->getItems();
            NextPageToken = r.getResult()->getNextPageToken();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    null // limit,
    TCHAR_TO_ANSI(null) // pageToken
);

///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////

using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);

// Up to this line is the initialization process.

{
    var domain = gs2.Dictionary.Namespace(
        namespaceName: "namespace2"
    ).Me(
        gameSession: gameSession
    );
    var items = await domain.EntriesAsync(
    ).ToListAsync();
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////

using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}
var gs2 = new Gs2.Unity.Client(profile);

// Up to this line is the initialization process.

{
    AsyncResult<EzListEntriesResult> asyncResult = null;
    var current = gs2.Dictionary.ListEntries(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        limit: null,
        pageToken: null
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var items = result.Items;
    var nextPageToken = result.NextPageToken;
}

エントリーの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
limit int 30 1 ~ 10000 データの取得件数
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン

Result

説明
items EzEntry[] エントリーのリスト
nextPageToken string リストの続きを取得するためのページトークン