GS2-Version
GS2-SDK for Game Engine のリファレンス
ゲームエンジン向けSDK
モデル
EzVersion
型 | 説明 | |
---|---|---|
major | int | メジャーバージョン |
minor | int | マイナーバージョン |
micro | int | マイクロバージョン |
EzVersionModel
バージョンモデル
ログインを受け入れるが、バージョンアップ出来ることを通知する警告バージョンと、ログインを受け入れないエラーバージョンを設定できます。
現在のバージョンをクライアントに申告させるのに、署名の有無を指定できます。
署名付きを選択した場合、クライアントは嘘のバージョン申告を出来なくなります。
型 | 説明 | |
---|---|---|
name | string | バージョンモデル名 |
metadata | string | メタデータ |
warningVersion | EzVersion | バージョンアップを促すバージョン |
errorVersion | EzVersion | バージョンチェックを蹴るバージョン |
scope | enum ['passive', 'active'] | 判定に使用するバージョン値の種類 |
currentVersion | EzVersion | 現在のバージョン |
needSignature | bool | 判定するバージョン値に署名検証を必要とするか |
EzAcceptVersion
承認したバージョン
アプリバージョンや、アセットバージョンのようなデータに紐づいたバージョンではなく
同意した利用規約のバージョンのようなユーザ毎にバージョン管理が必要なエンティティで使用します。
型 | 説明 | |
---|---|---|
versionName | string | 承認したバージョン名 |
userId | string | ユーザーID |
version | EzVersion | 承認したバージョン |
EzStatus
型 | 説明 | |
---|---|---|
versionModel | EzVersionModel | バージョンモデル |
currentVersion | EzVersion | 現在のバージョン |
EzTargetVersion
型 | 説明 | |
---|---|---|
versionName | string | バージョンの名前 |
version | EzVersion | バージョン |
body | string | ボディ |
signature | string | 署名 |
メソッド
getVersionModel
getVersionModel
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->version.getVersionModel(
[](gs2::ez::account::AsyncEzGetVersionModelResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "version.getVersionModel failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
TCHAR_TO_ANSI("namespace1"), // namespaceName
TCHAR_TO_ANSI("version-0001") // versionName
);
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
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.Version.Namespace(
namespaceName: "namespace1"
).VersionModel(
versionName: "version-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<EzGetVersionModelResult> asyncResult = null;
var current = gs2.Version.GetVersionModel(
callback: r => { asyncResult = r; },
namespaceName: "namespace1",
versionName: "version-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文字 | ネームスペース名 | |
versionName | string | ✓ | ~ 128文字 | バージョンモデル名 |
Result
型 | 説明 | |
---|---|---|
item | EzVersionModel | バージョンモデル |
listVersionModels
listVersionModels
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->version.describeVersionModels(
[](gs2::ez::account::AsyncEzDescribeVersionModelsResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "version.describeVersionModels failed.");
}
else
{
Items = r.getResult()->getItems();
}
},
TCHAR_TO_ANSI("namespace1") // namespaceName
);
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
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.Version.Namespace(
namespaceName: "namespace1"
);
var items = await domain.VersionModelsAsync(
).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<EzListVersionModelsResult> asyncResult = null;
var current = gs2.Version.ListVersionModels(
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 | List<EzVersionModel> | バージョンモデルのリスト |
accept
accept
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->version.accept(
[](gs2::ez::account::AsyncEzAcceptResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "version.accept failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace1"), // namespaceName
TCHAR_TO_ANSI("eula") // versionName
);
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
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.Version.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
).AcceptVersion(
versionName: "eula"
);
var result = await domain.AcceptAsync(
);
var item = await result.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<EzAcceptResult> asyncResult = null;
var current = gs2.Version.Accept(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace1",
versionName: "eula"
);
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 | |
versionName | string | ✓ | ~ 128文字 | 承認したバージョン名 |
Result
型 | 説明 | |
---|---|---|
item | EzAcceptVersion | 承認したバージョン |
delete
delete
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->version.deleteAcceptVersion(
[](gs2::ez::account::AsyncEzDeleteAcceptVersionResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "version.deleteAcceptVersion failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace1"), // namespaceName
TCHAR_TO_ANSI("eula") // versionName
);
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
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.Version.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
).AcceptVersion(
versionName: "eula"
);
var result = await domain.DeleteAsync(
);
}
///////////////////////////////////////////////////////////////
// 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<EzDeleteResult> asyncResult = null;
var current = gs2.Version.Delete(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace1",
versionName: "eula"
);
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 | |
versionName | string | ✓ | ~ 128文字 | 承認したバージョン名 |
Result
型 | 説明 | |
---|---|---|
item | EzAcceptVersion | 削除した承認バージョン |
list
list
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->version.describeAcceptVersions(
[](gs2::ez::account::AsyncEzDescribeAcceptVersionsResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "version.describeAcceptVersions 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;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
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.Version.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
);
var items = await domain.AcceptVersionsAsync(
).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<EzListResult> asyncResult = null;
var current = gs2.Version.List(
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 | List<EzAcceptVersion> | 承認したバージョンのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
checkVersion
checkVersion
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->version.checkVersion(
[](gs2::ez::account::AsyncEzCheckVersionResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "version.checkVersion failed.");
}
else
{
ProjectToken = r.getResult()->getProjectToken();
Warnings = r.getResult()->getWarnings();
Errors = r.getResult()->getErrors();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace1") // namespaceName,
new Gs2.Gs2Version.Model.TargetVersion[] {
{'versionName': 'app', 'version': {'major': 1, 'minor': 2, 'micro': 3}},
{'versionName': 'asset', 'version': {'major': 1, 'minor': 2, 'micro': 3}}
} // targetVersions
);
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
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.Version.Namespace(
namespaceName: "namespace1"
).Me(
gameSession: gameSession
).Checker(
);
var result = await domain.CheckVersionAsync(
targetVersions: new Gs2.Unity.Gs2Version.Model.EzTargetVersion[] {
{'versionName': 'app', 'version': {'major': 1, 'minor': 2, 'micro': 3}},
{'versionName': 'asset', 'version': {'major': 1, 'minor': 2, 'micro': 3}}
}
);
var projectToken = result.ProjectToken;
var warnings = result.Warnings;
var errors = result.Errors;
}
///////////////////////////////////////////////////////////////
// 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<EzCheckVersionResult> asyncResult = null;
var current = gs2.Version.CheckVersion(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace1",
targetVersions: new List<Gs2.Unity.Gs2Version.Model.EzTargetVersion> {
{'versionName': 'app', 'version': {'major': 1, 'minor': 2, 'micro': 3}},
{'versionName': 'asset', 'version': {'major': 1, 'minor': 2, 'micro': 3}}
}
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var projectToken = result.ProjectToken;
var warnings = result.Warnings;
var errors = result.Errors;
}
バージョンチェックを実行
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
targetVersions | List<EzTargetVersion> | [] | 検証するバージョンリスト |
Result
型 | 説明 | |
---|---|---|
projectToken | string | プロジェクトトークン |
warnings | List<EzStatus> | バージョンの検証結果 警告のリスト |
errors | List<EzStatus> | バージョンの検証結果 エラーのリスト |