GS2-Formation
GS2-SDK for Game Engine のリファレンス
ゲームエンジン向けSDK
モデル
EzFormModel
編成モデル
編成状況を表すエンティティです。
編成できる領域として スロット
を定義できます。
武器・防具 であれば 「右手」「左手」「胴」「腕」のような部位をスロットとし、
パーティであれば「前衛」「中衛」「後衛」のようなポジションをスロットとして表現できます。
型 | 説明 | |
---|---|---|
name | string | 編成名 |
metadata | string | メタデータ |
slots | EzSlotModel[] | スロットモデルリスト |
EzMoldModel
編成の情報を保存する領域
パーティ編成であれば「火属性パーティ」「水属性パーティ」のような形で保存することを想定しています。
保存できる領域の数は制限することができ、個別に拡張することもできます。
型 | 説明 | |
---|---|---|
name | string | 編成モデル名 |
metadata | string | メタデータ |
formModel | EzFormModel | |
initialMaxCapacity | int | フォームを保存できる初期キャパシティ |
maxCapacity | int | フォームを保存できる最大キャパシティ |
EzMold
保存したフォーム
ゲームプレイヤーが編成した情報を保持するエンティティです。
編成情報(Form) は 編成モデル(Mold) ごとに複数保持することができ、いくつ保持できるかのキャパシティをゲームプレイヤー×編成モデル ごとに個別に設定できます。
型 | 説明 | |
---|---|---|
name | string | 編成モデルの名前 |
userId | string | ユーザーID |
capacity | int | 現在のキャパシティ |
EzForm
編成
編成状況を表すエンティティです。
編成できる領域として スロット
を定義できます。
武器・防具 であれば 「右手」「左手」「胴」「腕」のような部位をスロットとし、
パーティであれば「前衛」「中衛」「後衛」のようなポジションをスロットとして表現できます。
型 | 説明 | |
---|---|---|
name | string | 編成の名前 |
index | int | 保存領域のインデックス |
slots | EzSlot[] | スロットリスト |
EzSlot
型 | 説明 | |
---|---|---|
name | string | スロットモデル名 |
propertyId | string | プロパティID |
metadata | string | メタデータ |
EzSlotModel
型 | 説明 | |
---|---|---|
name | string | スロットモデル名 |
propertyRegex | string | プロパティとして設定可能な値の正規表現 |
metadata | string | メタデータ |
EzSlotWithSignature
型 | 説明 | |
---|---|---|
name | string | スロットモデル名 |
propertyType | enum ['gs2_inventory', 'gs2_dictionary'] | プロパティの種類 |
body | string | ペイロード |
signature | string | プロパティIDのリソースを所有していることを証明する署名 |
metadata | string | メタデータ |
EzAcquireActionConfig
型 | 説明 | |
---|---|---|
name | string | スロット名 |
config | EzConfig[] | スタンプシートに使用するコンフィグ |
EzConfig
型 | 説明 | |
---|---|---|
key | string | 名前 |
value | string | 値 |
EzAcquireAction
型 | 説明 | |
---|---|---|
action | enum [] | スタンプシートを使用して実行するアクションの種類 |
request | string | リクエストのJSON |
メソッド
getMoldModel
getMoldModel
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->formation.getMoldModel(
[](gs2::ez::account::AsyncEzGetMoldModelResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.getMoldModel failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
TCHAR_TO_ANSI("namespace1"), // namespaceName
TCHAR_TO_ANSI("mold-0001") // moldName
);
///////////////////////////////////////////////////////////////
// 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.Formation.Namespace(
namespaceName: "namespace1"
).MoldModel(
moldName: "mold-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<EzGetMoldModelResult> asyncResult = null;
var current = gs2.Formation.GetMoldModel(
callback: r => { asyncResult = r; },
namespaceName: "namespace1",
moldName: "mold-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文字 | ネームスペース名 | |
moldName | string | ✓ | ~ 128文字 | 編成モデル名 |
Result
型 | 説明 | |
---|---|---|
item | EzMoldModel | フォームの保存領域 |
listMoldModels
listMoldModels
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->formation.describeMoldModels(
[](gs2::ez::account::AsyncEzDescribeMoldModelsResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.describeMoldModels failed.");
}
else
{
Items = r.getResult()->getItems();
}
},
TCHAR_TO_ANSI("namespace1") // 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.Formation.Namespace(
namespaceName: "namespace1"
);
var items = await domain.MoldModelsAsync(
).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<EzListMoldModelsResult> asyncResult = null;
var current = gs2.Formation.ListMoldModels(
callback: r => { asyncResult = r; },
namespaceName: "namespace1"
);
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 | EzMoldModel[] | フォームの保存領域のリスト |
getMold
getMold
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->formation.getMold(
[](gs2::ez::account::AsyncEzGetMoldResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.getMold failed.");
}
else
{
Item = r.getResult()->getItem();
MoldModel = r.getResult()->getMoldModel();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace1"), // namespaceName
TCHAR_TO_ANSI("mold-0001") // moldName
);
///////////////////////////////////////////////////////////////
// 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.Formation.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
).Mold(
moldName: "mold-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<EzGetMoldResult> asyncResult = null;
var current = gs2.Formation.GetMold(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace1",
moldName: "mold-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
var moldModel = result.MoldModel;
}
フォームの保存領域
と プロパティID
を指定して保存したフォーム情報を取得
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
moldName | string | ✓ | ~ 128文字 | 編成モデルの名前 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | EzMold | 保存したフォーム |
moldModel | EzMoldModel | フォームの保存領域 |
listMolds
listMolds
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->formation.describeMolds(
[](gs2::ez::account::AsyncEzDescribeMoldsResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.describeMolds failed.");
}
else
{
Items = r.getResult()->getItems();
NextPageToken = r.getResult()->getNextPageToken();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace1"), // 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.Formation.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
);
var items = await domain.MoldsAsync(
).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<EzListMoldsResult> asyncResult = null;
var current = gs2.Formation.ListMolds(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace1",
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 | |
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | ||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | EzMold[] | 保存したフォームのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
getForm
getForm
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->formation.getForm(
[](gs2::ez::account::AsyncEzGetFormResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.getForm failed.");
}
else
{
Item = r.getResult()->getItem();
Mold = r.getResult()->getMold();
MoldModel = r.getResult()->getMoldModel();
FormModel = r.getResult()->getFormModel();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace1"), // namespaceName
TCHAR_TO_ANSI("mold-0001"), // moldName
0 // index
);
///////////////////////////////////////////////////////////////
// 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.Formation.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
).Mold(
moldName: "mold-0001"
).Form(
index: 0
);
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<EzGetFormResult> asyncResult = null;
var current = gs2.Formation.GetForm(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace1",
moldName: "mold-0001",
index: 0
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
var mold = result.Mold;
var moldModel = result.MoldModel;
var formModel = result.FormModel;
}
フォームを取得
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
moldName | string | ✓ | ~ 128文字 | フォームの保存領域の名前 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
index | int | ✓ | ~ 2147483646 | 保存領域のインデックス |
Result
型 | 説明 | |
---|---|---|
item | EzForm | フォーム |
mold | EzMold | 保存したフォーム |
moldModel | EzMoldModel | フォームの保存領域 |
formModel | EzFormModel | フォームモデル |
getFormWithSignature
getFormWithSignature
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->formation.getFormWithSignature(
[](gs2::ez::account::AsyncEzGetFormWithSignatureResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.getFormWithSignature failed.");
}
else
{
Item = r.getResult()->getItem();
Body = r.getResult()->getBody();
Signature = r.getResult()->getSignature();
Mold = r.getResult()->getMold();
MoldModel = r.getResult()->getMoldModel();
FormModel = r.getResult()->getFormModel();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace2"), // namespaceName
TCHAR_TO_ANSI("mold-0001"), // moldName
0, // index
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.Formation.Namespace(
namespaceName: "namespace2"
).Me(
gameSession: gameSession
).Mold(
moldName: "mold-0001"
).Form(
index: 0
);
var result = await domain.GetFormWithSignatureAsync(
keyId: "$key1.keyId"
);
var item = await result.ModelAsync();
var body = result.Body;
var signature = result.Signature;
var mold = result.Mold;
var moldModel = result.MoldModel;
var formModel = result.FormModel;
}
///////////////////////////////////////////////////////////////
// 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<EzGetFormWithSignatureResult> asyncResult = null;
var current = gs2.Formation.GetFormWithSignature(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace2",
moldName: "mold-0001",
index: 0,
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;
var mold = result.Mold;
var moldModel = result.MoldModel;
var formModel = result.FormModel;
}
署名と共にフォームを取得
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
moldName | string | ✓ | ~ 128文字 | フォームの保存領域の名前 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
index | int | ✓ | ~ 2147483646 | 保存領域のインデックス | |
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | EzForm | フォーム |
body | string | 署名対象の値 |
signature | string | 署名 |
mold | EzMold | 保存したフォーム |
moldModel | EzMoldModel | フォームの保存領域 |
formModel | EzFormModel | フォームモデル |
listForms
listForms
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->formation.describeForms(
[](gs2::ez::account::AsyncEzDescribeFormsResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.describeForms failed.");
}
else
{
Items = r.getResult()->getItems();
NextPageToken = r.getResult()->getNextPageToken();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace1"), // namespaceName
TCHAR_TO_ANSI("mold-0001"), // moldName
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.Formation.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
).Mold(
moldName: "mold-0001"
);
var items = await domain.FormsAsync(
).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<EzListFormsResult> asyncResult = null;
var current = gs2.Formation.ListForms(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace1",
moldName: "mold-0001",
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文字 | ネームスペース名 | |
moldName | string | ✓ | ~ 128文字 | フォームの保存領域の名前 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | ||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | EzForm[] | フォームのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
setForm
setForm
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->formation.setFormWithSignature(
[](gs2::ez::account::AsyncEzSetFormWithSignatureResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "formation.setFormWithSignature failed.");
}
else
{
Item = r.getResult()->getItem();
Mold = r.getResult()->getMold();
MoldModel = r.getResult()->getMoldModel();
FormModel = r.getResult()->getFormModel();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace2"), // namespaceName
TCHAR_TO_ANSI("mold-0001"), // moldName
0, // index
new Gs2.Gs2Formation.Model.SlotWithSignature[] {
{'name': 'slot-0001', 'propertyType': 'gs2_dictionary', 'body': 'body', 'signature': 'signature'}
}, // slots
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.Formation.Namespace(
namespaceName: "namespace2"
).Me(
gameSession: gameSession
).Mold(
moldName: "mold-0001"
).Form(
index: 0
);
var result = await domain.SetFormAsync(
slots: new Gs2.Unity.Gs2Formation.Model.EzSlotWithSignature[] {
{'name': 'slot-0001', 'propertyType': 'gs2_dictionary', 'body': 'body', 'signature': 'signature'}
},
keyId: "$key1.keyId"
);
var item = await result.ModelAsync();
var mold = result.Mold;
var moldModel = result.MoldModel;
var formModel = result.FormModel;
}
///////////////////////////////////////////////////////////////
// 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<EzSetFormResult> asyncResult = null;
var current = gs2.Formation.SetForm(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace2",
moldName: "mold-0001",
index: 0,
slots: new Gs2.Unity.Gs2Formation.Model.EzSlotWithSignature[] {
{'name': 'slot-0001', 'propertyType': 'gs2_dictionary', 'body': 'body', 'signature': 'signature'}
},
keyId: "$key1.keyId"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
var mold = result.Mold;
var moldModel = result.MoldModel;
var formModel = result.FormModel;
}
フォームを更新
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
moldName | string | ✓ | ~ 128文字 | フォームの保存領域の名前 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
index | int | ✓ | ~ 2147483646 | 保存領域のインデックス | |
slots | EzSlotWithSignature[] | ✓ | スロットリスト | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | EzForm | フォーム |
mold | EzMold | 保存したフォーム |
moldModel | EzMoldModel | フォームの保存領域 |
formModel | EzFormModel | フォームモデル |