API Reference of GS2-SkillTree SDK for Game Engine
Model
EzNodeModel
node model
The node model is the entity to be recorded in the skill tree. This section defines what kind of entities can be recorded in the skill tree.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Node Model Name | |
metadata | string | ~ 2048 chars | metadata | ||
releaseVerifyActions | List<EzVerifyAction> | [] | ~ 10 items | List of verify actions required to determine the conditions for release | |
releaseConsumeActions | List<EzConsumeAction> | ✓ | [] | 1 ~ 10 items | List of consume actions required for release |
returnAcquireActions | List<EzAcquireAction> | ~ 10 items | List of acquire actions required for return | ||
restrainReturnRate | float | ✓ | 1 | ~ 1 | Return Rate |
EzStatus
Status of skill tree
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
statusId | string | ✓ | ~ 1024 chars | Status GRN | |
userId | string | ✓ | ~ 128 chars | User Id | |
releasedNodeNames | List<string> | [] | ~ 1000 items | List of released node model name |
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
EzVerifyActionResult
Verify action execution result
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128 chars | Types of actions to be performed in the verify task | |
verifyRequest | string | ✓ | ~ 1048576 chars | JSON of request | |
statusCode | int | ~ 999 | Status code | ||
verifyResult | string | ~ 1048576 chars | Result payload |
Enumeration type definition to specify as action
Enumerator String Definition | Description |
---|
EzConsumeActionResult
Consume action execution result
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128 chars | Types of actions to be performed in the consume action | |
consumeRequest | string | ✓ | ~ 1048576 chars | JSON of request | |
statusCode | int | ~ 999 | Status code | ||
consumeResult | string | ~ 1048576 chars | Result payload |
Enumeration type definition to specify as action
Enumerator String Definition | Description |
---|
EzAcquireActionResult
Acquire action execution result
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128 chars | Types of actions to be performed in the acquire action | |
acquireRequest | string | ✓ | ~ 1048576 chars | JSON of request | |
statusCode | int | ~ 999 | Status code | ||
acquireResult | string | ~ 1048576 chars | Result payload |
Enumeration type definition to specify as action
Enumerator String Definition | Description |
---|
EzTransactionResult
Transaction execution results
Transaction execution results executed using server-side transaction auto-execution functionality
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID | |
verifyResults | List<EzVerifyActionResult> | ~ 10 items | List of verify action execution results | ||
consumeResults | List<EzConsumeActionResult> | ~ 10 items | List of consume action execution results | ||
acquireResults | List<EzAcquireActionResult> | ~ 100 items | List of acquire action execution results |
Methods
getNodeModel
Get status model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
nodeModelName | string | ✓ | ~ 128 chars | Node Model Name |
Result
Type | Description | |
---|---|---|
item | EzNodeModel | Node model |
Implementation Example
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).NodeModel(
nodeModelName: "status-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).NodeModel(
nodeModelName: "status-0001"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result;
const auto Domain = Gs2->SkillTree->Namespace(
"namespace-0001" // namespaceName
)->NodeModel(
"status-0001" // nodeModelName
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).NodeModel(
nodeModelName: "status-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.SkillTree.Namespace(
namespaceName: "namespace-0001"
).NodeModel(
nodeModelName: "status-0001"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result;
const auto Domain = Gs2->SkillTree->Namespace(
"namespace-0001" // namespaceName
)->NodeModel(
"status-0001" // nodeModelName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::SkillTree::Model::FNodeModel> 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.
listNodeModels
Get list of status model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzNodeModel> | List of Node models |
Implementation Example
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.NodeModelsAsync(
).ToListAsync();
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.NodeModels(
);
List<EzNodeModel> items = new List<EzNodeModel>();
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->SkillTree->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->NodeModels(
);
TArray<Gs2::UE5::SkillTree::Model::FEzNodeModelPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
Value change event handling
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeNodeModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeNodeModels(callbackId);
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.NodeModels(
);
List<EzNodeModel> items = new List<EzNodeModel>();
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->SkillTree->Namespace(
"namespace-0001" // namespaceName
);
// Start event handling
const auto CallbackId = Domain->SubscribeNodeModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeNodeModels(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.
getStatus
Get a release status
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
propertyId | string | ✓ | ~ 1024 chars | Property ID |
Result
Type | Description | |
---|---|---|
item | EzStatus | Status |
Implementation Example
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result;
const auto Domain = Gs2->SkillTree->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Status(
"property-0001" // propertyId
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-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.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result;
const auto Domain = Gs2->SkillTree->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Status(
"property-0001" // propertyId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::SkillTree::Model::FStatus> 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.
release
Release nodes
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
nodeModelNames | List<string> | ✓ | 1 ~ 1000 items | List of node model names | |
propertyId | string | ✓ | ~ 1024 chars | Property ID |
Result
Type | Description | |
---|---|---|
item | EzStatus | Status |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the release process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool | Is transaction auto-execution enabled? |
atomicCommit | bool | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | EzTransactionResult | Transaction execution result |
Implementation Example
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var result = await domain.ReleaseAsync(
nodeModelNames: new List<string> {
"node-0001",
}
);
// 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.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var future = domain.ReleaseFuture(
nodeModelNames: new List<string> {
"node-0001",
}
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
// 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->SkillTree->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Status(
"property-0001" // propertyId
);
const auto Future = Domain->Release(
[]
{
auto v = TOptional<TArray<FString>>();
v->Add("node-0001");
return v;
}() // nodeModelNames
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
reset
Reset node status
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
propertyId | string | ✓ | ~ 1024 chars | Property ID |
Result
Type | Description | |
---|---|---|
item | EzStatus | Status |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the reset process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool | Is transaction auto-execution enabled? |
atomicCommit | bool | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | EzTransactionResult | Transaction execution result |
Implementation Example
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var result = await domain.ResetAsync(
);
// 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.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var future = domain.ResetFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
// 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->SkillTree->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Status(
"property-0001" // propertyId
);
const auto Future = Domain->Reset(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
restrain
Restrain nodes
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
nodeModelNames | List<string> | ✓ | 1 ~ 1000 items | List of node model names | |
propertyId | string | ✓ | ~ 1024 chars | Property ID |
Result
Type | Description | |
---|---|---|
item | EzStatus | Status |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the restrain process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool | Is transaction auto-execution enabled? |
atomicCommit | bool | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | EzTransactionResult | Transaction execution result |
Implementation Example
var domain = gs2.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var result = await domain.RestrainAsync(
nodeModelNames: new List<string> {
"node-0001",
}
);
// 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.SkillTree.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
propertyId: "property-0001"
);
var future = domain.RestrainFuture(
nodeModelNames: new List<string> {
"node-0001",
}
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
// 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->SkillTree->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Status(
"property-0001" // propertyId
);
const auto Future = Domain->Restrain(
[]
{
auto v = TOptional<TArray<FString>>();
v->Add("node-0001");
return v;
}() // nodeModelNames
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}