GS2-Enhance SDK for Game Engine API リファレンス
モデル
EzRateModel
強化レート
強化レートは強化に使用する素材と強化対象を定義したデータです。
素材データ、強化対象データは共に GS2-Inventory で管理されている必要があります。
強化で得られる経験値は GS2-Inventory のメタデータにJSON形式で記録します。
ここではメタデータのどの階層に経験値の値が格納されているかを記載する必要があります。
強化時に一定の確率で 大成功
といった形で入手できる経験値量に補正値をかけることができます。
その抽選確率もこのエンティティで定義します。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
name | string | ✓ | | ~ 128文字 | 強化レート名 |
metadata | string | | | ~ 2048文字 | メタデータ |
targetInventoryModelId | string | ✓ | | ~ 1024文字 | 強化対象に使用できるインベントリ |
acquireExperienceSuffix | string | ✓ | | ~ 1024文字 | GS2-Experience で入手した経験値を格納する プロパティID に付与するサフィックス |
materialInventoryModelId | string | ✓ | | ~ 1024文字 | インベントリモデルGRN |
experienceModelId | string | ✓ | | ~ 1024文字 | 経験値モデルGRN |
EzProgress
強化進行状況
強化の開始時に作成され、終了時に削除されます。
強化の途中でアプリを終了した際にはこのデータが残った状態となり
エンティティが保持する進行中の強化情報からゲームをリジュームすることが可能です。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
name | string | ✓ | UUID | ~ 36文字 | 進行ID |
rateName | string | ✓ | | ~ 128文字 | レートモデル名 |
propertyId | string | ✓ | | ~ 1024文字 | 強化対象のプロパティID |
experienceValue | int | ✓ | | ~ 2147483646 | 入手できる経験値 |
rate | float | ✓ | | ~ 100.0 | 経験値倍率 |
EzConfig
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
key | string | | | ~ 64文字 | 名前 |
value | string | | | ~ 51200文字 | 値 |
EzMaterial
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
materialItemSetId | string | ✓ | | ~ 1024文字 | 有効期限ごとのアイテム所持数量GRN |
count | int | ✓ | 1 | ~ 2147483646 | 消費数量 |
メソッド
getRateModel
強化レートモデル情報を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
rateName | string | ✓ | | ~ 128文字 | 強化レート名 |
Result
実装例
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
var item = await domain.ModelAsync();
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->RateModel(
"character-level" // rateName
);
const auto item = Domain.Model();
listRateModels
強化レートモデル情報の一覧を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
Result
実装例
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.RateModelsAsync(
).ToListAsync();
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;
}
}
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->RateModels(
);
for (auto Item : *It)
{
}
deleteProgress
強化の進行情報を削除。
強化の開始時に force
オプションを使うのではなく、明示的に進行情報を削除したい場合に使用してください。
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var result = await domain.DeleteProgressAsync(
);
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;
}
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto Future = Domain->DeleteProgress(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
end
強化の完了を報告
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=ボーナスなし) |
実装例
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().
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().
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto Future = Domain->End(
nullptr // config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
getProgress
強化の進行情報を取得。
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var item = await domain.ModelAsync();
var domain = gs2.Enhance.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Progress(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto item = Domain.Model();
start
強化を開始
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 | スタンプシートの自動実行が有効か |
実装例
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().
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().
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Progress(
);
const auto Future = Domain->Start(
"character-level",
"item-set-0001",
[]
{
const auto v = MakeShared<TArray<TSharedPtr<Gs2::Enhance::Model::FMaterial>>>();
v->Add({'materialItemSetId': 'material-0001', 'count': 1});
return v;
}(), // materials
nullptr, // force
nullptr // config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
enhance
強化を実行
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=ボーナスなし) |
実装例
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().
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().
const auto Domain = Gs2->Enhance->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Enhance(
);
const auto Future = Domain->Enhance(
"rate-0001",
"item-set-0001",
[]
{
const auto v = MakeShared<TArray<TSharedPtr<Gs2::Enhance::Model::FMaterial>>>();
v->Add({'materialItemSetId': 'material-0001', 'count': 1});
return v;
}(),
nullptr // config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}