GS2-Enhance
GS2-SDK for Game Engine のリファレンス
ゲームエンジン向けSDK
モデル
EzRateModel
強化レート
強化レートは強化に使用する素材と強化対象を定義したデータです。
素材データ、強化対象データは共に GS2-Inventory で管理されている必要があります。
強化で得られる経験値は GS2-Inventory のメタデータにJSON形式で記録します。
ここではメタデータのどの階層に経験値の値が格納されているかを記載する必要があります。
強化時に一定の確率で 大成功
といった形で入手できる経験値量に補正値をかけることができます。
その抽選確率もこのエンティティで定義します。
型 | 説明 | |
---|---|---|
name | string | 強化レート名 |
metadata | string | メタデータ |
targetInventoryModelId | string | 強化対象に使用できるインベントリ |
acquireExperienceSuffix | string | GS2-Experience で入手した経験値を格納する プロパティID に付与するサフィックス |
materialInventoryModelId | string | インベントリモデルGRN |
experienceModelId | string | 経験値モデルGRN |
EzProgress
強化進行状況
強化の開始時に作成され、終了時に削除されます。
強化の途中でアプリを終了した際にはこのデータが残った状態となり
エンティティが保持する進行中の強化情報からゲームをリジュームすることが可能です。
型 | 説明 | |
---|---|---|
name | string | 進行ID |
rateName | string | レートモデル名 |
propertyId | string | 強化対象のプロパティID |
experienceValue | int | 入手できる経験値 |
rate | float | 経験値倍率 |
EzConfig
型 | 説明 | |
---|---|---|
key | string | 名前 |
value | string | 値 |
EzMaterial
型 | 説明 | |
---|---|---|
materialItemSetId | string | 有効期限ごとのアイテム所持数量GRN |
count | int | 消費数量 |
メソッド
getRateModel
getRateModel
///////////////////////////////////////////////////////////////
// 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.Enhance.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
var item = await domain.ModelAsync();
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
var future = domain.Model();
yield return future;
var item = future.Result;
}
///////////////////////////////////////////////////////////////
// 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<EzGetRateModelResult> asyncResult = null;
var current = gs2.Enhance.GetRateModel(
callback: r => { asyncResult = r; },
namespaceName: "namespace-0001",
rateName: "character-level"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->RateModel(
"character-level" // rateName
);
const auto item = Domain.Model();
}
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->enhance.getRateModel(
[](gs2::ez::account::AsyncEzGetRateModelResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "enhance.getRateModel failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("character-level") // rateName
);
強化レートモデル情報を取得
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
rateName | string | ✓ | ~ 128文字 | 強化レート名 |
Result
型 | 説明 | |
---|---|---|
item | EzRateModel | 強化レートモデル |
listRateModels
listRateModels
///////////////////////////////////////////////////////////////
// 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.Enhance.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.RateModelsAsync(
).ToListAsync();
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.RateModels(
);
List<EzRateModel> items = new List<EzRateModel>();
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;
}
}
}
///////////////////////////////////////////////////////////////
// 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<EzListRateModelsResult> asyncResult = null;
var current = gs2.Enhance.ListRateModels(
callback: r => { asyncResult = r; },
namespaceName: "namespace-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var items = result.Items;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->RateModels(
);
for (auto Item : *It)
{
}
}
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->enhance.describeRateModels(
[](gs2::ez::account::AsyncEzDescribeRateModelsResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "enhance.describeRateModels failed.");
}
else
{
Items = r.getResult()->getItems();
}
},
TCHAR_TO_ANSI("namespace-0001") // namespaceName
);
強化レートモデル情報の一覧を取得
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
items | List<EzRateModel> | 強化レートモデルのリスト |
deleteProgress
deleteProgress
///////////////////////////////////////////////////////////////
// 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.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var result = await domain.DeleteProgressAsync(
);
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var future = domain.DeleteProgress(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
}
///////////////////////////////////////////////////////////////
// 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<EzDeleteProgressResult> asyncResult = null;
var current = gs2.Enhance.DeleteProgress(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto Future = Domain->DeleteProgress(
);
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
}
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->enhance.deleteProgress(
[](gs2::ez::account::AsyncEzDeleteProgressResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "enhance.deleteProgress failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace-0001") // namespaceName
);
強化の進行情報を削除。
強化の開始時に force
オプションを使うのではなく、明示的に進行情報を削除したい場合に使用してください。
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | EzProgress | 実行中の強化 |
end
end
///////////////////////////////////////////////////////////////
// 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.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var result = await domain.EndAsync(
config: null
);
// New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
// エラーが発生すると TransactionException がスローされます。
// TransactionException::Retry() でリトライが可能です。
// In New Experience, stamp sheets are automatically executed at the SDK level.
// If an error occurs, a TransactionException is thrown.
// you can retry with TransactionException::Retry().
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var future = domain.End(
config: null
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
// New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
// エラーが発生すると TransactionException がスローされます。
// TransactionException::Retry() でリトライが可能です。
// In New Experience, stamp sheets are automatically executed at the SDK level.
// If an error occurs, a TransactionException is thrown.
// you can retry with TransactionException::Retry().
}
///////////////////////////////////////////////////////////////
// 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<EzEndResult> asyncResult = null;
var current = gs2.Enhance.End(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace-0001",
config: null
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var acquireExperience = result.AcquireExperience;
var bonusRate = result.BonusRate;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto Future = Domain->End(
nullptr // config
);
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
}
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->enhance.end(
[](gs2::ez::account::AsyncEzEndResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "enhance.end failed.");
}
else
{
Item = r.getResult()->getItem();
TransactionId = r.getResult()->getTransactionId();
StampSheet = r.getResult()->getStampSheet();
StampSheetEncryptionKeyId = r.getResult()->getStampSheetEncryptionKeyId();
AutoRunStampSheet = r.getResult()->getAutoRunStampSheet();
AcquireExperience = r.getResult()->getAcquireExperience();
BonusRate = r.getResult()->getBonusRate();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace-0001") // namespaceName,
null // config
);
強化の完了を報告
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
config | List<EzConfig> | [] | スタンプシートの変数に適用する設定値 |
Result
型 | 説明 | |
---|---|---|
item | EzProgress | 実行中の強化 |
transactionId | string | 発行されたスタンプシートのトランザクションID |
stampSheet | string | 報酬付与処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool | スタンプシートの自動実行が有効か |
acquireExperience | long | 獲得経験値量 |
bonusRate | float | 経験値ボーナスの倍率(1.0=ボーナスなし) |
getProgress
getProgress
///////////////////////////////////////////////////////////////
// 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.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var item = await domain.ModelAsync();
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var future = domain.Model();
yield return future;
var item = future.Result;
}
///////////////////////////////////////////////////////////////
// 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<EzGetProgressResult> asyncResult = null;
var current = gs2.Enhance.GetProgress(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto item = Domain.Model();
}
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->enhance.getProgress(
[](gs2::ez::account::AsyncEzGetProgressResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "enhance.getProgress failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace-0001") // namespaceName
);
強化の進行情報を取得。
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | EzProgress | 実行中の強化 |
start
start
///////////////////////////////////////////////////////////////
// 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.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var result = await domain.StartAsync(
rateName: "character-level",
targetItemSetId: "item-set-0001",
materials: new Gs2.Unity.Gs2Enhance.Model.EzMaterial[] {
new Gs2.Unity.Gs2Enhance.Model.EzMaterial
{
MaterialItemSetId = "material-0001",
Count = 1,
},
},
force: null,
config: null
);
// New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
// エラーが発生すると TransactionException がスローされます。
// TransactionException::Retry() でリトライが可能です。
// In New Experience, stamp sheets are automatically executed at the SDK level.
// If an error occurs, a TransactionException is thrown.
// you can retry with TransactionException::Retry().
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var future = domain.Start(
rateName: "character-level",
targetItemSetId: "item-set-0001",
materials: new Gs2.Unity.Gs2Enhance.Model.EzMaterial[] {
new Gs2.Unity.Gs2Enhance.Model.EzMaterial
{
MaterialItemSetId = "material-0001",
Count = 1,
},
},
force: null,
config: null
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
// New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
// エラーが発生すると TransactionException がスローされます。
// TransactionException::Retry() でリトライが可能です。
// In New Experience, stamp sheets are automatically executed at the SDK level.
// If an error occurs, a TransactionException is thrown.
// you can retry with TransactionException::Retry().
}
///////////////////////////////////////////////////////////////
// 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<EzStartResult> asyncResult = null;
var current = gs2.Enhance.Start(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace-0001",
rateName: "character-level",
targetItemSetId: "item-set-0001",
force: null,
materials: new List<Gs2.Unity.Gs2Enhance.Model.EzMaterial> {
{'materialItemSetId': 'material-0001', 'count': 1}
},
config: null
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto Future = Domain->Start(
"character-level",
"item-set-0001",
new Gs2.Unity.Gs2Enhance.Model.EzMaterial[] {
new Gs2.Unity.Gs2Enhance.Model.EzMaterial
{
MaterialItemSetId = "material-0001",
Count = 1,
},
}, // materials
nullptr, // force
nullptr // config
);
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
}
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->enhance.start(
[](gs2::ez::account::AsyncEzStartResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "enhance.start failed.");
}
else
{
TransactionId = r.getResult()->getTransactionId();
StampSheet = r.getResult()->getStampSheet();
StampSheetEncryptionKeyId = r.getResult()->getStampSheetEncryptionKeyId();
AutoRunStampSheet = r.getResult()->getAutoRunStampSheet();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("character-level"), // rateName
TCHAR_TO_ANSI("item-set-0001"), // targetItemSetId
null // force,
new Gs2.Gs2Enhance.Model.Material[] {
{'materialItemSetId': 'material-0001', 'count': 1}
}, // materials
null // config
);
強化を開始
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
rateName | string | ✓ | ~ 128文字 | レートモデル名 | |
targetItemSetId | string | ✓ | ~ 1024文字 | 有効期限ごとのアイテム所持数量GRN | |
materials | List<EzMaterial> | 強化素材リスト | |||
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
force | bool | ✓ | false | すでに開始している強化がある場合にそれを破棄して開始するか | |
config | List<EzConfig> | [] | スタンプシートの変数に適用する設定値 |
Result
型 | 説明 | |
---|---|---|
transactionId | string | 発行されたスタンプシートのトランザクションID |
stampSheet | string | 強化の開始処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool | スタンプシートの自動実行が有効か |
enhance
enhance
///////////////////////////////////////////////////////////////
// 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.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Enhance(
);
var result = await domain.EnhanceAsync(
rateName: "rate-0001",
targetItemSetId: "item-set-0001",
materials: new Gs2.Unity.Gs2Enhance.Model.EzMaterial[] {
new Gs2.Unity.Gs2Enhance.Model.EzMaterial
{
MaterialItemSetId = "material-0001",
Count = 1,
},
},
config: null
);
// New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
// エラーが発生すると TransactionException がスローされます。
// TransactionException::Retry() でリトライが可能です。
// In New Experience, stamp sheets are automatically executed at the SDK level.
// If an error occurs, a TransactionException is thrown.
// you can retry with TransactionException::Retry().
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Enhance(
);
var future = domain.Enhance(
rateName: "rate-0001",
targetItemSetId: "item-set-0001",
materials: new Gs2.Unity.Gs2Enhance.Model.EzMaterial[] {
new Gs2.Unity.Gs2Enhance.Model.EzMaterial
{
MaterialItemSetId = "material-0001",
Count = 1,
},
},
config: null
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
// New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
// エラーが発生すると TransactionException がスローされます。
// TransactionException::Retry() でリトライが可能です。
// In New Experience, stamp sheets are automatically executed at the SDK level.
// If an error occurs, a TransactionException is thrown.
// you can retry with TransactionException::Retry().
}
///////////////////////////////////////////////////////////////
// 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<EzEnhanceResult> asyncResult = null;
var current = gs2.Enhance.Enhance(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace-0001",
rateName: "rate-0001",
targetItemSetId: "item-set-0001",
materials: new List<Gs2.Unity.Gs2Enhance.Model.EzMaterial> {
{'materialItemSetId': 'material-0001', 'count': 1}
},
config: null
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var acquireExperience = result.AcquireExperience;
var bonusRate = result.BonusRate;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Enhance(
);
const auto Future = Domain->Enhance(
"rate-0001",
"item-set-0001",
new Gs2.Unity.Gs2Enhance.Model.EzMaterial[] {
new Gs2.Unity.Gs2Enhance.Model.EzMaterial
{
MaterialItemSetId = "material-0001",
Count = 1,
},
},
nullptr // config
);
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
}
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->enhance.directEnhance(
[](gs2::ez::account::AsyncEzDirectEnhanceResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "enhance.directEnhance failed.");
}
else
{
Item = r.getResult()->getItem();
TransactionId = r.getResult()->getTransactionId();
StampSheet = r.getResult()->getStampSheet();
StampSheetEncryptionKeyId = r.getResult()->getStampSheetEncryptionKeyId();
AutoRunStampSheet = r.getResult()->getAutoRunStampSheet();
AcquireExperience = r.getResult()->getAcquireExperience();
BonusRate = r.getResult()->getBonusRate();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("rate-0001"), // rateName
TCHAR_TO_ANSI("item-set-0001"), // targetItemSetId
new Gs2.Gs2Enhance.Model.Material[] {
{'materialItemSetId': 'material-0001', 'count': 1}
} // materials,
null // config
);
強化を実行
Request
型 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32文字 | ネームスペース名 | |
rateName | string | ✓ | ~ 128文字 | 強化レート名 | |
accessToken | string | ✓ | ~ 128文字 | ユーザーID | |
targetItemSetId | string | ✓ | ~ 1024文字 | 有効期限ごとのアイテム所持数量GRN | |
materials | List<EzMaterial> | ✓ | 強化素材リスト | ||
config | List<EzConfig> | [] | スタンプシートの変数に適用する設定値 |
Result
型 | 説明 | |
---|---|---|
item | EzRateModel | 強化レートモデル |
transactionId | string | 発行されたスタンプシートのトランザクションID |
stampSheet | string | 強化処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool | スタンプシートの自動実行が有効か |
acquireExperience | long | 獲得経験値量 |
bonusRate | float | 経験値ボーナスの倍率(1.0=ボーナスなし) |