API Reference of GS2-Experience SDK for Game Engine
Model
EzExperienceModel
Experience Model
An experience model is an entity that sets the threshold of experience required for rank advancement and for each default and maximum rank cap.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Experience Model Name | |
metadata | string | ~ 2048 chars | metadata | ||
defaultExperience | long | ✓ | 0 | ~ 9223372036854775805 | Initial Experience Value |
defaultRankCap | long | ✓ | ~ 9223372036854775805 | Initial value of rank cap | |
maxRankCap | long | ✓ | ~ 9223372036854775805 | Maximum rank cap | |
rankThreshold | EzThreshold | ✓ | rank-up threshold | ||
acquireActionRates | List<EzAcquireActionRate> | ~ 100 items | List of Remuneration addition table |
EzThreshold
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
metadata | string | ~ 2048 chars | metadata | ||
values | List<long> | ✓ | 1 ~ 1024 items | List of Rank Up Experience Threshold |
EzStatus
Status
Status is an entity that exists for each property ID. Holds the current experience and rank cap values.
Property ID is a status-specific ID and can be set to any value by the developer. In GS2, the itemset GRN of a GS2-Inventory or entry GRN of a GS2-Dictionary that has an experience value is followed by a It is recommended that the property ID be the value to which the suffix that serves as the experience value model is added.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
experienceName | string | ✓ | ~ 128 chars | Experience Model Name | |
propertyId | string | ✓ | ~ 1024 chars | Property ID | |
experienceValue | long | ✓ | 0 | ~ 9223372036854775805 | Cumulative experience gained |
rankValue | long | ✓ | 0 | ~ 9223372036854775805 | Current Rank |
rankCapValue | long | ✓ | ~ 9223372036854775805 | Current Rank Cap | |
nextRankUpExperienceValue | long | ✓ | 0 | ~ 9223372036854775805 | Total amount of experience for the next rank up |
EzAcquireAction
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum [] | ✓ | ~ 128 chars | Types of actions to be performed in the stamp sheet | |
request | string | ✓ | ~ 1048576 chars | JSON of request |
EzAcquireActionRate
Remuneration addition table master
You can adjust the amount of rewards according to the rank.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Remuneration addition table name | |
mode | enum [‘double’, ‘big’] | ✓ | “double” | ~ 128 chars | Remuneration addition table type |
rates | List<double> | {mode} == “double” | 1 ~ 1000 items | Amount added per rank (multiplier) | |
bigRates | List<string> | {mode} == “big” | 1 ~ 1000 items | Amount added per rank (multiplier) |
Methods
getExperienceModel
Obtain experience and rank-up threshold model information
Get rank cap information and rank-up threshold information by specifying experience type name
.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
experienceName | string | ✓ | ~ 128 chars | Experience Model Name |
Result
Type | Description | |
---|---|---|
item | EzExperienceModel | Experience Model |
Implementation Example
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).ExperienceModel(
experienceName: "experience-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).ExperienceModel(
experienceName: "experience-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Experience->Namespace(
"namespace-0001" // namespaceName
)->ExperienceModel(
"experience-0001" // experienceName
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).ExperienceModel(
experienceName: "experience-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.Experience.Namespace(
namespaceName: "namespace-0001"
).ExperienceModel(
experienceName: "experience-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Experience->Namespace(
"namespace-0001" // namespaceName
)->ExperienceModel(
"experience-0001" // experienceName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Experience::Model::FExperienceModel> 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.
listExperienceModels
Get list of experience and rank-up threshold model information
Obtain information on rank caps and rank advancement thresholds. Use this model data if you want to display in-game information such as the amount of experience required to gain before the next rank-up.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzExperienceModel> | List of Experience Model |
Implementation Example
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.ExperienceModelsAsync(
).ToListAsync();
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.ExperienceModels(
);
List<EzExperienceModel> items = new List<EzExperienceModel>();
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->Experience->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->ExperienceModels(
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeExperienceModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeExperienceModels(callbackId);
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.ExperienceModels(
);
List<EzExperienceModel> items = new List<EzExperienceModel>();
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->Experience->Namespace(
"namespace-0001" // namespaceName
);
// Start event handling
const auto CallbackId = Domain->SubscribeExperienceModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeExperienceModels(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 status information by experience type
and property ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
experienceName | string | ✓ | ~ 128 chars | Experience Model Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
propertyId | string | ✓ | ~ 1024 chars | Property ID |
Result
Type | Description | |
---|---|---|
item | EzStatus | Status |
Implementation Example
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
experienceName: "character_ssr",
propertyId: "property-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
experienceName: "character_ssr",
propertyId: "property-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Experience->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Status(
"character_ssr", // experienceName
"property-0001" // propertyId
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
experienceName: "character_ssr",
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.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
experienceName: "character_ssr",
propertyId: "property-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Experience->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Status(
"character_ssr", // experienceName
"property-0001" // propertyId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Experience::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.
getStatusWithSignature
Get signature of status value
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
experienceName | string | ✓ | ~ 128 chars | Experience Model Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
propertyId | string | ✓ | ~ 1024 chars | Property ID | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | EzStatus | Status |
body | string | Object to be verified |
signature | string | signature |
Implementation Example
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
experienceName: "character_ssr",
propertyId: "property-0001"
);
var result = await domain.GetStatusWithSignatureAsync(
keyId: "key-0001"
);
var item = await result.ModelAsync();
var body = result.Body;
var signature = result.Signature;
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Status(
experienceName: "character_ssr",
propertyId: "property-0001"
);
var future = domain.GetStatusWithSignatureFuture(
keyId: "key-0001"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
var body = future.Result.Body;
var signature = future.Result.Signature;
const auto Domain = Gs2->Experience->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Status(
"character_ssr", // experienceName
"property-0001" // propertyId
);
const auto Future = Domain->GetStatusWithSignature(
"key-0001"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
const auto Body = Result->Body;
const auto Signature = Result->Signature;
listStatuses
Get list of status information
The experience type name is optional; if not specified, all status information belonging to the game player is retrieved.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
experienceName | string | ~ 128 chars | Experience Model Name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<EzStatus> | List of Status |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.StatusesAsync(
).ToListAsync();
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Statuses(
);
List<EzStatus> items = new List<EzStatus>();
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->Experience->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Statuses( // experienceName
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeStatuses(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeStatuses(callbackId);
var domain = gs2.Experience.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Statuses(
);
List<EzStatus> items = new List<EzStatus>();
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->Experience->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
// Start event handling
const auto CallbackId = Domain->SubscribeStatuses(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeStatuses(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.