API Reference of GS2-Ranking SDK for Game Engine
Model
EzCategoryModel
Category Model Different rankings can be created for different categories.
Categories can have a minimum and maximum score that can be registered, and scores outside of that range are discarded. When calculating rankings, it is possible to set whether the scores are to be ranked in ascending or descending order, with the smallest scores being ranked higher (ascending order) or the largest scores being ranked lower (descending order).
You can select global
or scope
as the type of ranking.
Global is a ranking where all players see the same results, and Scope is a ranking where each game player has a different result, such as a ranking among friends or a ranking in a guild.
For global ranking, you can set the ranking interval from 15 minutes to 24 hours for each category. Scope rankings reflect the calculate results in real time.
The ranking data has a setting called “generation,” and the registered scores can be reset by changing the generation.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Category Name | |
metadata | string | ~ 1024 chars | metadata | ||
entryPeriodEventId | string | ~ 1024 chars | Event GRN | ||
accessPeriodEventId | string | ~ 1024 chars | Event GRN |
EzScore
Score
This entity holds the registered scores for each game player x category.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
categoryName | string | ✓ | ~ 128 chars | Category Name | |
userId | string | ✓ | ~ 128 chars | User Id | |
uniqueId | string | ✓ | UUID | ~ 36 chars | Score Unique ID |
scorerUserId | string | ✓ | ~ 128 chars | User Id | |
score | long | ✓ | ~ 9223372036854775805 | Score | |
metadata | string | ~ 512 chars | metadata |
EzRanking
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
rank | long | ✓ | 1 ~ 9223372036854775805 | Rank | |
index | long | ✓ | ~ 9223372036854775805 | Index from 1st place | |
userId | string | ✓ | ~ 128 chars | User Id | |
score | long | ✓ | ~ 9223372036854775805 | Score | |
metadata | string | ~ 512 chars | metadata | ||
createdAt | long | ✓ | Datetime of creation |
EzSubscribeUser
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User ID to be subscribed |
Methods
getCategory
Get Category
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name |
Result
Type | Description | |
---|---|---|
item | EzCategoryModel | Category Model |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).CategoryModel(
categoryName: "category-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).CategoryModel(
categoryName: "category-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->CategoryModel(
"category-0001" // categoryName
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).CategoryModel(
categoryName: "category-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.Ranking.Namespace(
namespaceName: "namespace-0001"
).CategoryModel(
categoryName: "category-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->CategoryModel(
"category-0001" // categoryName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Ranking::Model::FCategoryModel> 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.
listCategories
Get list of categories
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzCategoryModel> | List of Category Models |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.CategoryModelsAsync(
).ToListAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.CategoryModels(
);
List<EzCategoryModel> items = new List<EzCategoryModel>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->CategoryModels(
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeCategoryModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeCategoryModels(callbackId);
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.CategoryModels(
);
List<EzCategoryModel> items = new List<EzCategoryModel>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
);
// Start event handling
const auto CallbackId = Domain->SubscribeCategoryModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeCategoryModels(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.
listSubscribes
Get list of subscribed user IDs
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
items | List<EzSubscribeUser> | List of Subscriptions |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.SubscribeUsersAsync(
).ToListAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.SubscribeUsers(
);
List<EzSubscribeUser> items = new List<EzSubscribeUser>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->SubscribeUsers( // categoryName
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeSubscribeUsers(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeSubscribeUsers(callbackId);
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.SubscribeUsers(
);
List<EzSubscribeUser> items = new List<EzSubscribeUser>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
// Start event handling
const auto CallbackId = Domain->SubscribeSubscribeUsers(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeSubscribeUsers(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.
subscribe
Subscribe to a User ID
By subscribing to a user ID, you can receive notifications of new message posts related to that user ID. You can choose to be notified only for messages with a specific value for the category attached to the message, or If you are offline when you receive a notification, you can set up a mobile push notification to be forwarded to you.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | Target User ID |
Result
Type | Description | |
---|---|---|
item | EzSubscribeUser | Subscribed Subscription |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var result = await domain.SubscribeAsync(
categoryName: "category-0001",
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var future = domain.SubscribeFuture(
categoryName: "category-0001",
targetUserId: "user-0002"
);
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;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto Future = Domain->Subscribe(
"category-0001",
"user-0002"
);
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();
unsubscribe
Unsubscribe
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | Target User ID |
Result
Type | Description | |
---|---|---|
item | EzSubscribeUser | Unsubscribed Subscription |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SubscribeUser(
categoryName: "category-0001",
targetUserId: "user-0002"
);
var result = await domain.UnsubscribeAsync(
);
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SubscribeUser(
categoryName: "category-0001",
targetUserId: "user-0002"
);
var future = domain.UnsubscribeFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->SubscribeUser(
"category-0001", // categoryName
"user-0002" // targetUserId
);
const auto Future = Domain->Unsubscribe(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
getNearRanking
Obtain a ranking near the specified score
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
additionalScopeName | string | ~ 128 chars | Scope Name | ||
score | long | ✓ | ~ 9223372036854775805 | Score |
Result
Type | Description | |
---|---|---|
items | List<EzRanking> | List of Ranking Scores |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
);
var items = await domain.NearRankingsAsync(,,
).ToListAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
);
var it = domain.NearRankings(,,
);
List<EzRanking> items = new List<EzRanking>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
)->User(
"user-0001" // userId
);
const auto It = Domain->NearRankings(, // categoryName, // additionalScopeName // score
);
for (auto Item : *It)
{
}
getRank
Obtain rank
Unique ID can be omitted when specifying a category where only one score can be registered per user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
additionalScopeName | string | ~ 128 chars | Scope Name | ||
scorerUserId | string | ✓ | ~ 128 chars | User ID of the user who earned the score | |
accessToken | string | ✓ | ~ 128 chars | User ID from which the ranking is obtained (used to determine the duration of the GS2-Schedule). | |
uniqueId | string | ✓ | “0” | ~ 36 chars | Score Unique ID |
Result
Type | Description | |
---|---|---|
item | EzRanking | Ranking |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Ranking(
categoryName: "category-0001"
);
var item = await domain.ModelAsync(
scorerUserId : "user-0001"
);
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Ranking(
categoryName: "category-0001"
);
var future = domain.Model(
scorerUserId : "user-0001"
);
yield return future;
var item = future.Result;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Ranking(
"category-0001" // categoryName
);
const auto Future = Domain.ModelAsync(
"user-0001" // scorerUserId
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Ranking(
categoryName: "category-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.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Ranking(
categoryName: "category-0001"
);
var future = domain.Model(
scorerUserId : "user-0001"
);
yield return future;
var item = future.Result;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Ranking(
"category-0001" // categoryName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Ranking::Model::FRanking> 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.
getRanking
Get Ranking
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
additionalScopeName | string | ~ 128 chars | Scope Name | ||
accessToken | string | ~ 128 chars | User Id | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
pageToken | string | ~ 4096 chars | Token specifying the position from which to start acquiring data | ||
startIndex | long | ~ 9223372036854775805 | Index to start retrieving rankings |
Result
Type | Description | |
---|---|---|
items | List<EzRanking> | List of Ranking Scores |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.RankingsAsync(,
).ToListAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Rankings(,
);
List<EzRanking> items = new List<EzRanking>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Rankings(, // categoryName // additionalScopeName
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeRankings(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeRankings(callbackId);
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Rankings(,
);
List<EzRanking> items = new List<EzRanking>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
// Start event handling
const auto CallbackId = Domain->SubscribeRankings(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeRankings(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.
putScore
Register Score
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
score | long | ✓ | ~ 9223372036854775805 | Score | |
metadata | string | ~ 512 chars | metadata |
Result
Type | Description | |
---|---|---|
item | EzScore | Registered Scores |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Ranking(
categoryName: "category-0001"
);
var result = await domain.PutScoreAsync(
score: 1000L,
metadata: null
);
var item = await result.ModelAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Ranking(
categoryName: "category-0001"
);
var future = domain.PutScoreFuture(
score: 1000L,
metadata: null
);
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;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Ranking(
"category-0001" // categoryName
);
const auto Future = Domain->PutScore(
1000L,
nullptr // metadata
);
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();
getScore
Retrieve scores registered by game players
Unique ID can be omitted when specifying a category where only one score can be registered per user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
scorerUserId | string | ✓ | ~ 128 chars | User Id | |
uniqueId | string | ✓ | “0” | ~ 36 chars | Score Unique ID |
Result
Type | Description | |
---|---|---|
item | EzScore | Score |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Score(
categoryName: "category-0001",
scorerUserId: "user-0002",
uniqueId: "unique-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Score(
categoryName: "category-0001",
scorerUserId: "user-0002",
uniqueId: "unique-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Score(
"category-0001", // categoryName
"user-0002", // scorerUserId
"unique-0001" // uniqueId
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Score(
categoryName: "category-0001",
scorerUserId: "user-0002",
uniqueId: "unique-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.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Score(
categoryName: "category-0001",
scorerUserId: "user-0002",
uniqueId: "unique-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Score(
"category-0001", // categoryName
"user-0002", // scorerUserId
"unique-0001" // uniqueId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Ranking::Model::FScore> 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.
listScores
Get list of scores registered by game players
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
categoryName | string | ✓ | ~ 128 chars | Category Name | |
scorerUserId | string | ✓ | ~ 128 chars | User Id | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data |
Result
Type | Description | |
---|---|---|
items | List<EzScore> | List of Scores |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.ScoresAsync(,
).ToListAsync();
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Scores(,
);
List<EzScore> items = new List<EzScore>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Scores(, // categoryName // scorerUserId
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeScores(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeScores(callbackId);
var domain = gs2.Ranking.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Scores(,
);
List<EzScore> items = new List<EzScore>();
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->Ranking->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
// Start event handling
const auto CallbackId = Domain->SubscribeScores(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeScores(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.