Client Battle API Reference
Battle session is the foundation of battle service. Battle session instances can be created through services such as Lobby / Matchmaking / World or via the PGOS HTTP API, and placed in online or local DS via the DS Hosting service. The battle session also manages data such as the players in the game and the DS access information.
API List
| API | Description |
|---|---|
| GetBattleRecordList | Get a list of battle records |
| GetBattleBriefList | Get a list of battle brief |
| GetBattleData | Get all battle data |
| GetBattleDetail | Get the detail of the battle |
| DescribePlayerBattleSession | Get the player's battle session info. |
| DescribeBattleSessions | Get a list of the battle sesions that the player is participating in. |
| TerminatePlayerBattleSession | Try to terminate the player session in a P2P battle. The player session status will turn to Completed after interface is called. |
| GetDSHostingLatencies | Obtain the latencies from the client to the DS hosting data centers. In general, the first round of latency testing will be completed in approximately 2~3 seconds after logging into PGOS. If the API is called before the testing is completed, or an exception occurs, the latency data returned by the API will be empty. |
| SetCustomDSHostingLatencies | Set custom latencies for the DS hosting data centers. This API is used to set custom latency values for different DS hosting data centers, which can be useful for testing purposes. After setting custom latencies, the client will use these values instead of the actual measured latencies when selecting a DS hosting data center. |
Event List
| Event | Description |
|---|---|
| OnLatencyTestRoundCompleted | The event will be triggered when a round of latency testing is completed. |
API Details
GetBattleRecordList
Get a list of battle records
/// <summary>Get a list of battle records</summary>
/// <param name="player_id">The player id to query</param>
/// <param name="tags">Get the list for specific tags, if the tags is empty, the tag will not be filtered</param>
/// <param name="keys">Get the list for specific keys, if the keys is empty, the key will not be filtered</param>
/// <param name="offset">The starting position of the list</param>
/// <param name="count">The count of the list</param>
public void GetBattleRecordList(string player_id, List<string> tags, List<string> keys, Int32 offset, Int32 count, BattleDelegate0 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | string | The player id to query |
| tags | List<string> | Get the list for specific tags, if the tags is empty, the tag will not be filtered |
| keys | List<string> | Get the list for specific keys, if the keys is empty, the key will not be filtered |
| offset | Int32 | The starting position of the list |
| count | Int32 | The count of the list |
| callback | BattleDelegate0 |
Return: void
GetBattleBriefList
Get a list of battle brief
/// <summary>Get a list of battle brief</summary>
/// <param name="player_id">The player id to query</param>
/// <param name="tags">Get the list for specific tags, if the tags is empty, the tag will not be filtered</param>
/// <param name="offset">The starting position of the list</param>
/// <param name="count">The count of the list</param>
public void GetBattleBriefList(string player_id, List<string> tags, Int32 offset, Int32 count, BattleDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | string | The player id to query |
| tags | List<string> | Get the list for specific tags, if the tags is empty, the tag will not be filtered |
| offset | Int32 | The starting position of the list |
| count | Int32 | The count of the list |
| callback | BattleDelegate1 |
Return: void
GetBattleData
Get all battle data
/// <summary>Get all battle data</summary>
/// <param name="battle_session_id">The battle session id to query</param>
/// <param name="keys">Get the list for specific keys, if the keys is empty, the key will not be filtered</param>
public void GetBattleData(string battle_session_id, List<string> keys, BattleDelegate2 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | string | The battle session id to query |
| keys | List<string> | Get the list for specific keys, if the keys is empty, the key will not be filtered |
| callback | BattleDelegate2 |
Return: void
GetBattleDetail
Get the detail of the battle
/// <summary>Get the detail of the battle</summary>
/// <param name="battle_session_id">The battle session id to query</param>
public void GetBattleDetail(string battle_session_id, BattleDelegate3 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | string | The battle session id to query |
| callback | BattleDelegate3 |
Return: void
DescribePlayerBattleSession
Get the player's battle session info.
Deprecated, use DescribeBattleSessions instead.
/// <summary>Get the player's battle session info.</summary>
public void DescribePlayerBattleSession(BattleDelegate4 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | BattleDelegate4 |
Return: void
DescribeBattleSessions
Get a list of the battle sesions that the player is participating in.
/// <summary>Get a list of the battle sesions that the player is participating in.</summary>
public void DescribeBattleSessions(BattleDelegate5 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | BattleDelegate5 |
Return: void
TerminatePlayerBattleSession
Try to terminate the player session in a P2P battle. The player session status will turn to Completed after interface is called.
/// <summary>Try to terminate the player session in a P2P battle. The player session status will turn to Completed after interface is called.</summary>
/// <param name="battle_session_id">The battle session id</param>
/// <param name="player_battle_session_id">The player battle session id, !!! NOT BATTLE SESSION ID !!!</param>
public void TerminatePlayerBattleSession(string battle_session_id, string player_battle_session_id, BattleDelegate6 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | string | The battle session id |
| player_battle_session_id | string | The player battle session id, !!! NOT BATTLE SESSION ID !!! |
| callback | BattleDelegate6 |
Return: void
GetDSHostingLatencies
Obtain the latencies from the client to the DS hosting data centers. In general, the first round of latency testing will be completed in approximately 2~3 seconds after logging into PGOS. If the API is called before the testing is completed, or an exception occurs, the latency data returned by the API will be empty.
/// <summary>
/// Obtain the latencies from the client to the DS hosting data centers.
/// In general, the first round of latency testing will be completed in approximately 2~3 seconds after logging into PGOS.
/// If the API is called before the testing is completed, or an exception occurs, the latency data returned by the API will be empty.
/// </summary>
public DSHostingLatencies GetDSHostingLatencies();
Parameters:
(No parameters)
Return: DSHostingLatencies
The latencies from the client to the DS hosting data centers.
SetCustomDSHostingLatencies
Set custom latencies for the DS hosting data centers. This API is used to set custom latency values for different DS hosting data centers, which can be useful for testing purposes. After setting custom latencies, the client will use these values instead of the actual measured latencies when selecting a DS hosting data center.
/// <summary>
/// Set custom latencies for the DS hosting data centers.
/// This API is used to set custom latency values for different DS hosting data centers, which can be useful for testing purposes.
/// After setting custom latencies, the client will use these values instead of the actual measured latencies when selecting a DS hosting data center.
/// </summary>
/// <param name="latencies">The custom latencies to set for DS hosting data centers.</param>
public void SetCustomDSHostingLatencies(DSHostingLatencies latencies, BattleDelegate6 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| latencies | DSHostingLatencies | The custom latencies to set for DS hosting data centers. |
| callback | BattleDelegate6 |
Return: void
Event Details
OnLatencyTestRoundCompleted
The event will be triggered when a round of latency testing is completed.
/// <summary>The event will be triggered when a round of latency testing is completed.</summary>
public event BattleDelegate7 OnLatencyTestRoundCompleted;
Type Reference:
All Delegates
public delegate void BattleDelegate0(PgosResult a0, BattleListInfo a1);
public delegate void BattleDelegate1(PgosResult a0, BattleBriefListInfo a1);
public delegate void BattleDelegate2(PgosResult a0, BattleDataInfo a1);
public delegate void BattleDelegate3(PgosResult a0, BattleDetailInfo a1);
public delegate void BattleDelegate4(PgosResult a0, PlayerBattleSessionInfo a1);
public delegate void BattleDelegate5(PgosResult a0, DescribeBattleSessionsResult a1);
public delegate void BattleDelegate6(PgosResult a0);
public delegate void BattleDelegate7(LatencyTestRoundCompletedEvt a0);
Type Reference: