NAV
Unity Unreal Engine 4

GS2-Dictionary

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

ゲームエンジン向けモデル

EzEntryModel

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

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

EzEntry

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

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

EzConfig

説明
key string 名前
value string

ゲームエンジン向けメソッド

getEntryModel

getEntryModel

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;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    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;
}
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
);

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

Request

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

Result

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

listEntryModels

listEntryModels

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;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzDescribeEntryModelsResult> asyncResult = null;
    var current = gs2.Dictionary.DescribeEntryModels(
        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;
}
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
);

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

Request

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

Result

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

getEntry

getEntry

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;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    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;
}
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
);

エントリーを取得

Request

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

Result

説明
item EzEntry エントリー

getEntryWithSignature

getEntryWithSignature

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;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    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;
}
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
);

エントリーを取得

Request

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

Result

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

listEntries

listEntries

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;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzDescribeEntriesResult> asyncResult = null;
    var current = gs2.Dictionary.DescribeEntries(
        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;
}
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
);

エントリーの一覧を取得

Request

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

Result

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