NAV
Unity Unreal Engine 4

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

説明
progressId string 実行GRN
rateName string レートモデル名
propertyId string 強化対象のプロパティID
experienceValue int 入手できる経験値
rate float 経験値倍率

EzConfig

説明
key string 名前
value string

EzMaterial

説明
materialItemSetId string 有効期限ごとのアイテム所持数量GRN
count int 消費数量

メソッド

getRateModel

getRateModel

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("namespace1"), // namespaceName
    TCHAR_TO_ANSI("character-level") // rateName
);

///////////////////////////////////////////////////////////////
// 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: "namespace1"
    ).RateModel(
        rateName: "character-level"
    );
    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<EzGetRateModelResult> asyncResult = null;
    var current = gs2.Enhance.GetRateModel(
        callback: r => { asyncResult = r; },
        namespaceName: "namespace1",
        rateName: "character-level"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

強化レートモデル情報を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
rateName string ~ 128文字 強化レート名

Result

説明
item EzRateModel 強化レートモデル

listRateModels

listRateModels

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("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.Enhance.Namespace(
        namespaceName: "namespace1"
    );
    var items = await domain.RateModelsAsync(
    ).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<EzListRateModelsResult> asyncResult = null;
    var current = gs2.Enhance.ListRateModels(
        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<EzRateModel> 強化レートモデルのリスト

deleteProgress

deleteProgress

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("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.Enhance.Namespace(
        namespaceName: "namespace1"
    ).Me(
        gameSession: gameSession
    ).Progress(
        rateName: "character-level",
        progressName: "progress-0001"
    );
    var result = await domain.DeleteProgressAsync(
    );
}
///////////////////////////////////////////////////////////////
// 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: "namespace1"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

強化の進行情報を削除。

強化の開始時に force オプションを使うのではなく、明示的に進行情報を削除したい場合に使用してください。

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID

Result

説明
item EzProgress 実行中の強化

end

end

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("namespace2") // namespaceName,
    null // config
);

///////////////////////////////////////////////////////////////
// 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: "namespace2"
    ).Me(
        gameSession: gameSession
    ).Progress(
        rateName: "character-level",
        progressName: "progress-0001"
    );
    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().
}
///////////////////////////////////////////////////////////////
// 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: "namespace2",
        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;
}

強化の完了を報告

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

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();
            RateModel = r.getResult()->getRateModel();
        }
    },
    ProfilePtr->getGs2Session(),
    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.Enhance.Namespace(
        namespaceName: "namespace1"
    ).Me(
        gameSession: gameSession
    ).Progress(
        rateName: "character-level",
        progressName: "progress-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<EzGetProgressResult> asyncResult = null;
    var current = gs2.Enhance.GetProgress(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace1"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
    var rateModel = result.RateModel;
}

強化の進行情報を取得。

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID

Result

説明
item EzProgress 実行中の強化
rateModel EzRateModel 強化レートモデル

start

start

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("namespace1"), // 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
);

///////////////////////////////////////////////////////////////
// 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: "namespace1"
    ).Me(
        gameSession: gameSession
    );
    var result = await domain.StartAsync(
        rateName: "character-level",
        targetItemSetId: "item-set-0001",
        materials: 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().
}
///////////////////////////////////////////////////////////////
// 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: "namespace1",
        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;
}

強化を開始

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

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("namespace1"), // 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
);

///////////////////////////////////////////////////////////////
// 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: "namespace1"
    ).Me(
        gameSession: gameSession
    ).Enhance(
    );
    var result = await domain.EnhanceAsync(
        rateName: "rate-0001",
        targetItemSetId: "item-set-0001",
        materials: 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().
}
///////////////////////////////////////////////////////////////
// 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: "namespace1",
        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;
}

強化を実行

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=ボーナスなし)