API Reference of GS2-Exchange SDK for Game Engine
Model
EzRateModel
Exchange Rate Model
The exchange rate is an entity that defines the rate used to exchange resources for resources.
In addition to the rate at which a resource can be exchanged immediately, a rate can also be set at which a resource can be exchanged after a certain amount of time in real time has elapsed. Exchange rates that require an elapse of time in real time can further define the resources required to perform an immediate exchange.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Exchange Rate Name | |
metadata | string | ~ 2048 chars | metadata | ||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128 chars | Type of exchange |
lockTime | int | {timingType} == “await” | ~ 538214400 | Waiting time (minutes) from the execution of the exchange until the reward is actually received | |
verifyActions | List<EzVerifyAction> | [] | ~ 10 items | List of Verify Action | |
consumeActions | List<EzConsumeAction> | [] | ~ 10 items | List of Consume Action | |
acquireActions | List<EzAcquireAction> | [] | ~ 100 items | List of Acquire Action |
Enumeration type definition to specify as timingType
Enumerator String Definition | Description |
---|---|
immediate | Immediate |
await | Waiting for reality time to elapse |
EzIncrementalRateModel
Cost increase type exchange rate model
Normal exchange rates always provide exchanges at a constant rate. With incremental exchange rates, you can define a rate that increases in cost as the number of exchanges increases. For example, the first exchange can be exchanged at a rate of 1:1, but the second exchange can be exchanged at a rate of 2:1. By defining such a rate, you can increase the value of the resources obtained by the player as the game progresses.
The number of exchanges can be reset by the passage of real time. This is useful for resetting the number of exchanges on a daily or weekly basis.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Cost Increase Type Exchange Rate Name | |
metadata | string | ~ 2048 chars | metadata | ||
calculateType | enum { “linear”, “power”, “gs2_script” } | ✓ | ~ 128 chars | Calculation method for cost increase amount | |
consumeAction | EzConsumeAction | ✓ | Consumption Action (Quantity/Value is overwritten so no setting is required) | ||
baseValue | long | {calculateType} == “linear” | ~ 9223372036854775805 | Base Value | |
coefficientValue | long | {calculateType} in [“linear”, “power”] | ~ 9223372036854775805 | Coefficient Value” | |
exchangeCountId | string | ✓ | ~ 1024 chars | GRN of GS2-Limit model that manages the number of exchanges | |
maximumExchangeCount | int | ✓ | 2147483646 | ~ 2147483646 | Maximum number of exchanges |
acquireActions | List<EzAcquireAction> | [] | ~ 100 items | List of Acquire Action |
Enumeration type definition to specify as calculateType
Enumerator String Definition | Description |
---|---|
linear | Base Value + (Coefficient * Number of Exchanges) |
power | Coefficient * (Number of Exchanges + 1) ^ 2 |
gs2_script | Any logic with GS2-Script |
EzAwait
Standby for exchange
Waiting for exchange is an entity that represents the execution state of the exchange process, where the elapse of time in real time is a condition for exchange.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | |
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name | |
name | string | ✓ | UUID | ~ 36 chars | Exchange standby name |
skipSeconds | int | ✓ | 0 | ~ 2147483646 | Skip seconds |
config | List<EzConfig> | [] | ~ 32 items | Default value to apply when obtaining rewards | |
exchangedAt | long | ✓ | Now | Datetime of creation (Unix time unit:milliseconds) | |
acquirableAt | long | Time when rewards can be received (Unix time unit:milliseconds) |
EzConfig
Configration
Set values to be applied to transaction variables
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
key | string | ✓ | ~ 64 chars | Name | |
value | string | ~ 51200 chars | Value |
EzAcquireAction
Acquire Action
EzConsumeAction
Consume Action
EzVerifyAction
Verify Action
Methods
acquire
Get rewarded for waiting for exchange
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name |
Result
Type | Description | |
---|---|---|
item | EzAwait | Standby for exchange |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheet used to execute the reward acquisition process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool | Is transaction auto-execution enabled? |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
var result = await domain.AcquireAsync(
);
// 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.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
var future = domain.AcquireFuture(
);
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->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Await(
"await-0001" // awaitName
);
const auto Future = Domain->Acquire(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
deleteAwait
Get exchange standby information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name |
Result
Type | Description | |
---|---|---|
item | EzAwait | Standby for exchange |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
var result = await domain.DeleteAwaitAsync(
);
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
var future = domain.DeleteAwaitFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Await(
"await-0001" // awaitName
);
const auto Future = Domain->DeleteAwait(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
getAwait
Get exchange standby information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name |
Result
Type | Description | |
---|---|---|
item | EzAwait | Standby for exchange |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Await(
"await-0001" // awaitName
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Await(
awaitName: "await-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Await(
"await-0001" // awaitName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Exchange::Model::FAwait> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
listAwaits
Get list of exchange standby information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
rateName | string | ~ 128 chars | Exchange Rate Name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data |
Result
Type | Description | |
---|---|---|
items | List<EzAwait> | List of Standby for exchange |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.AwaitsAsync(
rateName: "material_n_to_r"
).ToListAsync();
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Awaits(
rateName: "material_n_to_r"
);
List<EzAwait> items = new List<EzAwait>();
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->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto It = Domain->Awaits(
"material_n_to_r" // rateName
);
TArray<Gs2::UE5::Exchange::Model::FEzAwaitPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
Value change event handling
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeAwaits(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeAwaits(callbackId);
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Awaits(
rateName: "material_n_to_r"
);
List<EzAwait> items = new List<EzAwait>();
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->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
// Start event handling
const auto CallbackId = Domain->SubscribeAwaits(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeAwaits(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
getRateModel
Get exchange rate model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name |
Result
Type | Description | |
---|---|---|
item | EzRateModel | Exchange rate model |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
var item = await domain.ModelAsync();
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Exchange->Namespace(
"namespace-0001" // namespaceName
)->RateModel(
"character-level" // rateName
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).RateModel(
rateName: "character-level"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Exchange->Namespace(
"namespace-0001" // namespaceName
)->RateModel(
"character-level" // rateName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Exchange::Model::FRateModel> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
listRateModels
Get list of exchange rate model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzRateModel> | List of exchange rate models |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.RateModelsAsync(
).ToListAsync();
var domain = gs2.Exchange.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->Exchange->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->RateModels(
);
TArray<Gs2::UE5::Exchange::Model::FEzRateModelPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
Value change event handling
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeRateModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeRateModels(callbackId);
var domain = gs2.Exchange.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->Exchange->Namespace(
"namespace-0001" // namespaceName
);
// Start event handling
const auto CallbackId = Domain->SubscribeRateModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeRateModels(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
getIncrementalRateModel
Get exchange rate model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
rateName | string | ✓ | ~ 128 chars | Cost Increase Type Exchange Rate Name |
Result
Type | Description | |
---|---|---|
item | EzIncrementalRateModel | Cost increase type cost increase type exchange rate model |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).IncrementalRateModel(
rateName: "character-level"
);
var item = await domain.ModelAsync();
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).IncrementalRateModel(
rateName: "character-level"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Exchange->Namespace(
"namespace-0001" // namespaceName
)->IncrementalRateModel(
"character-level" // rateName
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).IncrementalRateModel(
rateName: "character-level"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).IncrementalRateModel(
rateName: "character-level"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Exchange->Namespace(
"namespace-0001" // namespaceName
)->IncrementalRateModel(
"character-level" // rateName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Exchange::Model::FIncrementalRateModel> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
listIncrementalRateModels
Get list of exchange rate model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzIncrementalRateModel> | List of cost increase type exchange rate models |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.IncrementalRateModelsAsync(
).ToListAsync();
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.IncrementalRateModels(
);
List<EzIncrementalRateModel> items = new List<EzIncrementalRateModel>();
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->Exchange->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->IncrementalRateModels(
);
TArray<Gs2::UE5::Exchange::Model::FEzIncrementalRateModelPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
Value change event handling
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeIncrementalRateModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeIncrementalRateModels(callbackId);
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.IncrementalRateModels(
);
List<EzIncrementalRateModel> items = new List<EzIncrementalRateModel>();
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->Exchange->Namespace(
"namespace-0001" // namespaceName
);
// Start event handling
const auto CallbackId = Domain->SubscribeIncrementalRateModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeIncrementalRateModels(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
exchange
Perform exchange
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
count | int | ✓ | 1 ~ 1073741821 | Number of lots to be exchanged | |
config | List<EzConfig> | [] | ~ 32 items | Set values to be applied to transaction variables |
Result
Type | Description | |
---|---|---|
item | EzRateModel | Exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool | Is transaction auto-execution enabled? |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Exchange(
);
var result = await domain.ExchangeAsync(
rateName: "rate-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.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Exchange(
);
var future = domain.ExchangeFuture(
rateName: "rate-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->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Exchange(
);
const auto Future = Domain->Exchange(
"rate-0001", // rateName
1 // count
// config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
incrementalExchange
Perform cost increase type exchange
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
rateName | string | ✓ | ~ 128 chars | Cost Increase Type Exchange Rate Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
count | int | ✓ | 1 ~ 1073741821 | Number of lots to be exchanged | |
config | List<EzConfig> | [] | ~ 32 items | Set values to be applied to transaction variables |
Result
Type | Description | |
---|---|---|
item | EzIncrementalRateModel | Cost increase type exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool | Is transaction auto-execution enabled? |
Implementation Example
var domain = gs2.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Exchange(
);
var result = await domain.IncrementalExchangeAsync(
rateName: "rate-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.Exchange.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Exchange(
);
var future = domain.IncrementalExchangeFuture(
rateName: "rate-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->Exchange->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Exchange(
);
const auto Future = Domain->IncrementalExchange(
"rate-0001", // rateName
1 // count
// config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}