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 | ||
| acquireExperienceHierarchy | List<string> | 0 ~ 10 items | ItemModelのメタデータに格納する、入手経験値を定義するJSONデータの階層構造の定義 | |||
| experienceModelId | string | ✓ | ~ 1024文字 | 経験値モデルGRN | 
関連するメソッド
EzProgress
強化進行状況
強化の開始時に作成され、終了時に削除されます。
強化の途中でアプリを終了した際にはこのデータが残った状態となり
エンティティが保持する進行中の強化情報からゲームをリジュームすることが可能です。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | UUID | ~ 36文字 | 進行ID | |
| rateName | string | ✓ | ~ 128文字 | レートモデル名 | ||
| propertyId | string | ✓ | ~ 1024文字 | 強化対象のプロパティID | ||
| experienceValue | long | ✓ | 0 ~ 9223372036854775805 | 入手できる経験値 | ||
| rate | float | ✓ | 0 ~ 100.0 | 経験値倍率 | 
関連するメソッド
EzConfig
コンフィグ設定
トランザクションの変数に適用する設定値
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| key | string | ✓ | ~ 64文字 | 名前 | ||
| value | string | ~ 51200文字 | 値 | 
関連するメソッド
EzMaterial
強化素材
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| materialItemSetId | string | ✓ | ~ 1024文字 | 強化の素材となるアイテムセット(有効期限ごとのアイテム所持数量)のGRN | ||
| count | int | ✓ | 1 | 0 ~ 2147483645 | 消費数量 | 
関連するメソッド
EzVerifyActionResult
検証アクションの実行結果
関連するモデル
EzConsumeActionResult
消費アクションの実行結果
関連するモデル
EzAcquireActionResult
入手アクションの実行結果
関連するモデル
EzTransactionResult
トランザクション実行結果
サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | ||
| verifyResults | List<EzVerifyActionResult> | 0 ~ 10 items | 検証アクションの実行結果リスト | |||
| consumeResults | List<EzConsumeActionResult> | [] | 0 ~ 10 items | 消費アクションの実行結果リスト | ||
| acquireResults | List<EzAcquireActionResult> | [] | 0 ~ 100 items | 入手アクションの実行結果リスト | 
関連するメソッド
メソッド
getRateModel
強化レートモデル情報を取得
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| rateName | string | ✓ | ~ 128文字 | 強化レート名 | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzRateModel | 強化レートモデル | 
実装例
    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.ModelFuture();
    yield return future;
    var item = future.Result;    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->RateModel(
        "character-level" // rateName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }値の変更イベントハンドリング
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).RateModel(
        rateName: "character-level"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).RateModel(
        rateName: "character-level"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->RateModel(
        "character-level" // rateName
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Enhance::Model::FRateModel> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
listRateModels
強化レートモデル情報の一覧を取得
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | 
Result
| 型 | 説明 | |
|---|---|---|
| items | List<EzRateModel> | 強化レートモデルのリスト | 
実装例
    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(
    );
    TArray<Gs2::UE5::Enhance::Model::FEzRateModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }値の変更イベントハンドリング
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeRateModels(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );
    // イベントハンドリングを停止
    domain.UnsubscribeRateModels(callbackId);    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 CallbackId = Domain->SubscribeRateModels(
        []() {
            // リストの要素が変化した時に呼び出される
        }
    );
    // イベントハンドリングを停止
    Domain->UnsubscribeRateModels(CallbackId);Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
deleteProgress
強化の進行情報を削除。
強化の開始時に force オプションを使うのではなく、明示的に進行情報を削除したい場合に使用してください。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzProgress | 実行中の強化 | 
実装例
    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.DeleteProgressFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->DeleteProgress(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();end
強化の完了を報告
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| config | List<EzConfig> | [] | 0 ~ 32 items | トランザクションの変数に適用する設定値 | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzProgress | 実行中の強化 | 
| transactionId | string | 発行されたトランザクションID | 
| stampSheet | string | 報酬付与処理の実行に使用するスタンプシート | 
| stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN | 
| autoRunStampSheet | bool | トランザクションの自動実行が有効か | 
| atomicCommit | bool | トランザクションをアトミックにコミットするか | 
| transaction | string | 発行されたトランザクション | 
| transactionResult | EzTransactionResult | トランザクション実行結果 | 
| 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() でリトライが可能です。    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.EndFuture(
        config: null
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    // New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
    // エラーが発生すると TransactionException がスローされます。
    // TransactionException::Retry() でリトライが可能です。    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->End(
        // config
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }getProgress
強化の進行情報を取得。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzProgress | 実行中の強化 | 
実装例
    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.ModelFuture();
    yield return future;
    var item = future.Result;    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }値の変更イベントハンドリング
    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Enhance::Model::FProgress> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
start
強化を開始
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| rateName | string | ✓ | ~ 128文字 | レートモデル名 | ||
| targetItemSetId | string | ✓ | ~ 1024文字 | 強化対象のアイテムセット(有効期限ごとのアイテム所持数量)のGRN | ||
| materials | List<EzMaterial> | 0 ~ 10 items | 強化素材リスト | |||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| force | bool | ✓ | false | すでに開始している強化がある場合にそれを破棄して開始するか | ||
| config | List<EzConfig> | [] | 0 ~ 32 items | トランザクションの変数に適用する設定値 | 
Result
| 型 | 説明 | |
|---|---|---|
| transactionId | string | 発行されたトランザクションID | 
| stampSheet | string | 強化の開始処理の実行に使用するスタンプシート | 
| stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN | 
| autoRunStampSheet | bool | トランザクションの自動実行が有効か | 
| atomicCommit | bool | トランザクションをアトミックにコミットするか | 
| transaction | string | 発行されたトランザクション | 
| transactionResult | EzTransactionResult | トランザクション実行結果 | 
実装例
    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 List<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() でリトライが可能です。    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    );
    var future = domain.StartFuture(
        rateName: "character-level",
        targetItemSetId: "item-set-0001",
        materials: new List<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() でリトライが可能です。    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Progress(
    );
    const auto Future = Domain->Start(
        "character-level", // rateName
        "item-set-0001", // targetItemSetId
        []
        {
            auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Enhance::Model::FEzMaterial>>>();
            v->Add(
                MakeShared<Gs2::UE5::Enhance::Model::FEzMaterial>()
                ->WithMaterialItemSetId(TOptional<FString>("material-0001"))
                ->WithCount(TOptional<int32>(1))
            );
            return v;
        }() // materials
        // force
        // config
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }enhance
強化を実行
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| rateName | string | ✓ | ~ 128文字 | 強化レート名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| targetItemSetId | string | ✓ | ~ 1024文字 | 強化対象のアイテムセット(有効期限ごとのアイテム所持数量)のGRN | ||
| materials | List<EzMaterial> | ✓ | 1 ~ 10 items | 強化素材リスト | ||
| config | List<EzConfig> | [] | 0 ~ 32 items | トランザクションの変数に適用する設定値 | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzRateModel | 強化レートモデル | 
| transactionId | string | 発行されたトランザクションID | 
| stampSheet | string | 強化処理の実行に使用するスタンプシート | 
| stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN | 
| autoRunStampSheet | bool | トランザクションの自動実行が有効か | 
| atomicCommit | bool | トランザクションをアトミックにコミットするか | 
| transaction | string | 発行されたトランザクション | 
| transactionResult | EzTransactionResult | トランザクション実行結果 | 
| 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 List<Gs2.Unity.Gs2Enhance.Model.EzMaterial> {
            new Gs2.Unity.Gs2Enhance.Model.EzMaterial() {
                MaterialItemSetId = "material-0001",
                Count = 1,
            },
        },
        config: null
    );
    // New Experience ではスタンプシートはSDKレベルで自動的に実行されます。
    // エラーが発生すると TransactionException がスローされます。
    // TransactionException::Retry() でリトライが可能です。    var domain = gs2.Enhance.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Enhance(
    );
    var future = domain.EnhanceFuture(
        rateName: "rate-0001",
        targetItemSetId: "item-set-0001",
        materials: new List<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() でリトライが可能です。    const auto Domain = Gs2->Enhance->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Enhance(
    );
    const auto Future = Domain->Enhance(
        "rate-0001", // rateName
        "item-set-0001", // targetItemSetId
        []
        {
            auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Enhance::Model::FEzMaterial>>>();
            v->Add(
                MakeShared<Gs2::UE5::Enhance::Model::FEzMaterial>()
                ->WithMaterialItemSetId(TOptional<FString>("material-0001"))
                ->WithCount(TOptional<int32>(1))
            );
            return v;
        }() // materials
        // config
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }