跳到主要内容

Client World API Reference

World is an entity that players can move in and out of freely and smoothly. PGOS divides players who enter the world into several world buckets based on the world filter. PGOS will allocate players from the world bucket to multiple battle sessions based on factors such as player count, player latency, and the configured capacity of battle sessions in the world.

API List

APIDescription
JoinWorldRequest to join a world. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.
InviteJoinWorldInvite other players to join a world together. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.
LeaveWorldRequest to leave a world
InviteLeaveWorldInvite other players to leave a world together.
JoinWorldBattleSessionRequest to join a world battle session directly. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.
InviteJoinWorldBattleSessionInvite other players to join a world battle session directly together. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.
AcceptJoinWorldInvitationAccept the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.
RejectJoinWorldInvitationReject the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.
AcceptLeaveWorldInvitationAccept the leave world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.
RejectLeaveWorldInvitationReject the join world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.
QueryMyWorldBattleSessionsSpecify the world config names to query if the current player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.
QueryPlayerWorldBattleSessionsSpecify the world config names to query if a player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.
QueryJoinWorldInvitationQuery the detail information of the join world invitation for the specified invitation ticket.

Event List

EventDescription
OnWorldBattleSessionUpdatedThe event will be triggered when battle session status changed.
OnWorldBattlePropertiesUpdatedThe event will be triggered when battle properties updated.
OnJoinWorldInvitationUpdatedThe event is triggered when someone invites you to join a world or the invitation info has been updated.
OnLeaveWorldInvitationUpdatedThe event is triggered when someone invites you to leave a world or the invitation info has been updated.

API Details

JoinWorld

Request to join a world. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.

/// <summary>
/// Request to join a world.
/// Tips: In order to enhance the reliability of the service event reception, after calling this API,
/// the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period.
/// This ensures that the service continues to function even when the persistent connection is disconnected.
/// </summary>
/// <param name="pgos_params">Request struct for join a world.</param>
public void JoinWorld(JoinWorldParams pgos_params, WorldDelegate0 callback);

Parameters:

ParamTypeDescription
pgos_paramsJoinWorldParamsRequest struct for join a world.
callbackWorldDelegate0

Return: void

InviteJoinWorld

Invite other players to join a world together. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.

/// <summary>
/// Invite other players to join a world together.
/// Tips: In order to enhance the reliability of the service event reception, after calling this API,
/// the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period.
/// This ensures that the service continues to function even when the persistent connection is disconnected.
/// </summary>
/// <param name="pgos_params">Request struct for inviting other players to join a world together.</param>
public void InviteJoinWorld(InviteJoinWorldParams pgos_params, WorldDelegate1 callback);

Parameters:

ParamTypeDescription
pgos_paramsInviteJoinWorldParamsRequest struct for inviting other players to join a world together.
callbackWorldDelegate1

Return: void

LeaveWorld

Request to leave a world

/// <summary>Request to leave a world</summary>
/// <param name="pgos_params">Request struct for leave a world.</param>
public void LeaveWorld(LeaveWorldParams pgos_params, WorldDelegate2 callback);

Parameters:

ParamTypeDescription
pgos_paramsLeaveWorldParamsRequest struct for leave a world.
callbackWorldDelegate2

Return: void

InviteLeaveWorld

Invite other players to leave a world together.

/// <summary>Invite other players to leave a world together.</summary>
/// <param name="pgos_params">Request struct for inviting other players to leave a world together.</param>
public void InviteLeaveWorld(InviteLeaveWorldParams pgos_params, WorldDelegate3 callback);

Parameters:

ParamTypeDescription
pgos_paramsInviteLeaveWorldParamsRequest struct for inviting other players to leave a world together.
callbackWorldDelegate3

Return: void

JoinWorldBattleSession

Request to join a world battle session directly. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.

/// <summary>
/// Request to join a world battle session directly.
/// The API will return failure when there are not enough slots left in the battle session.
/// The API will return failure when the battle session is locked.
/// </summary>
/// <param name="pgos_params">Request struct for join a world battle session.</param>
public void JoinWorldBattleSession(JoinWorldBattleSessionParams pgos_params, WorldDelegate4 callback);

Parameters:

ParamTypeDescription
pgos_paramsJoinWorldBattleSessionParamsRequest struct for join a world battle session.
callbackWorldDelegate4

Return: void

InviteJoinWorldBattleSession

Invite other players to join a world battle session directly together. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.

/// <summary>
/// Invite other players to join a world battle session directly together.
/// The API will return failure when there are not enough slots left in the battle session.
/// The API will return failure when the battle session is locked.
/// </summary>
/// <param name="pgos_params">Request struct for inviting other players to join a world battle session.</param>
public void InviteJoinWorldBattleSession(InviteJoinWorldBattleSessionParams pgos_params, WorldDelegate5 callback);

Parameters:

ParamTypeDescription
pgos_paramsInviteJoinWorldBattleSessionParamsRequest struct for inviting other players to join a world battle session.
callbackWorldDelegate5

Return: void

AcceptJoinWorldInvitation

Accept the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.

/// <summary>
/// Accept the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event.
/// Note: Once you have made your choice, you cannot change your decision.
/// Tips: In order to enhance the reliability of the service event reception, after calling this API,
/// the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period.
/// This ensures that the service continues to function even when the persistent connection is disconnected.
/// </summary>
/// <param name="pgos_params">Request params for accept the join world invitation.</param>
public void AcceptJoinWorldInvitation(AcceptJoinWorldInvitationParams pgos_params, WorldDelegate2 callback);

Parameters:

ParamTypeDescription
pgos_paramsAcceptJoinWorldInvitationParamsRequest params for accept the join world invitation.
callbackWorldDelegate2

Return: void

RejectJoinWorldInvitation

Reject the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.

/// <summary>
/// Reject the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event.
/// Note: Once you have made your choice, you cannot change your decision.
/// </summary>
/// <param name="pgos_params">Request params for reject the join world invitation.</param>
public void RejectJoinWorldInvitation(RejectJoinWorldInvitationParams pgos_params, WorldDelegate2 callback);

Parameters:

ParamTypeDescription
pgos_paramsRejectJoinWorldInvitationParamsRequest params for reject the join world invitation.
callbackWorldDelegate2

Return: void

AcceptLeaveWorldInvitation

Accept the leave world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.

/// <summary>
/// Accept the leave world invitation when receive the 'OnLeaveWorldInvitationUpdated' event.
/// Note: Once you have made your choice, you cannot change your decision.
/// </summary>
/// <param name="pgos_params">Request params for accept the leave world invitation.</param>
public void AcceptLeaveWorldInvitation(AcceptLeaveWorldInvitationParams pgos_params, WorldDelegate2 callback);

Parameters:

ParamTypeDescription
pgos_paramsAcceptLeaveWorldInvitationParamsRequest params for accept the leave world invitation.
callbackWorldDelegate2

Return: void

RejectLeaveWorldInvitation

Reject the join world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.

/// <summary>
/// Reject the join world invitation when receive the 'OnLeaveWorldInvitationUpdated' event.
/// Note: Once you have made your choice, you cannot change your decision.
/// </summary>
/// <param name="pgos_params">Request params for reject the leave world invitation.</param>
public void RejectLeaveWorldInvitation(RejectLeaveWorldInvitationParams pgos_params, WorldDelegate2 callback);

Parameters:

ParamTypeDescription
pgos_paramsRejectLeaveWorldInvitationParamsRequest params for reject the leave world invitation.
callbackWorldDelegate2

Return: void

QueryMyWorldBattleSessions

Specify the world config names to query if the current player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.

/// <summary>
/// Specify the world config names to query if the current player has joined them.
/// Corresponding battle session id will be returned for the worlds in which the player has joined.
/// </summary>
public void QueryMyWorldBattleSessions(QueryMyWorldBattleSessionsParams pgos_params, WorldDelegate6 callback);

Parameters:

ParamTypeDescription
pgos_paramsQueryMyWorldBattleSessionsParams
callbackWorldDelegate6

Return: void

QueryPlayerWorldBattleSessions

Specify the world config names to query if a player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.

/// <summary>
/// Specify the world config names to query if a player has joined them.
/// Corresponding battle session id will be returned for the worlds in which the player has joined.
/// </summary>
public void QueryPlayerWorldBattleSessions(QueryPlayerWorldBattleSessionsParams pgos_params, WorldDelegate7 callback);

Parameters:

ParamTypeDescription
pgos_paramsQueryPlayerWorldBattleSessionsParams
callbackWorldDelegate7

Return: void

QueryJoinWorldInvitation

Query the detail information of the join world invitation for the specified invitation ticket.

/// <summary>Query the detail information of the join world invitation for the specified invitation ticket.</summary>
public void QueryJoinWorldInvitation(QueryJoinWorldInvitationParams pgos_params, WorldDelegate8 callback);

Parameters:

ParamTypeDescription
pgos_paramsQueryJoinWorldInvitationParams
callbackWorldDelegate8

Return: void

Event Details

OnWorldBattleSessionUpdated

The event will be triggered when battle session status changed.

/// <summary>The event will be triggered when battle session status changed.</summary>
public event WorldDelegate9 OnWorldBattleSessionUpdated;

Type Reference:

OnWorldBattlePropertiesUpdated

The event will be triggered when battle properties updated.

/// <summary>The event will be triggered when battle properties updated.</summary>
public event WorldDelegate10 OnWorldBattlePropertiesUpdated;

Type Reference:

OnJoinWorldInvitationUpdated

The event is triggered when someone invites you to join a world or the invitation info has been updated.

/// <summary>The event is triggered when someone invites you to join a world or the invitation info has been updated.</summary>
public event WorldDelegate11 OnJoinWorldInvitationUpdated;

Type Reference:

OnLeaveWorldInvitationUpdated

The event is triggered when someone invites you to leave a world or the invitation info has been updated.

/// <summary>The event is triggered when someone invites you to leave a world or the invitation info has been updated.</summary>
public event WorldDelegate12 OnLeaveWorldInvitationUpdated;

Type Reference:

All Delegates

public delegate void WorldDelegate0(PgosResult a0, JoinWorldResult a1);
public delegate void WorldDelegate1(PgosResult a0, InviteJoinWorldResult a1);
public delegate void WorldDelegate2(PgosResult a0);
public delegate void WorldDelegate3(PgosResult a0, InviteLeaveWorldResult a1);
public delegate void WorldDelegate4(PgosResult a0, JoinWorldBattleSessionResult a1);
public delegate void WorldDelegate5(PgosResult a0, InviteJoinWorldBattleSessionResult a1);
public delegate void WorldDelegate6(PgosResult a0, QueryMyWorldBattleSessionsResult a1);
public delegate void WorldDelegate7(PgosResult a0, QueryPlayerWorldBattleSessionsResult a1);
public delegate void WorldDelegate8(PgosResult a0, QueryJoinWorldInvitationResult a1);
public delegate void WorldDelegate9(WorldBattleSessionUpdatedEvt a0);
public delegate void WorldDelegate10(WorldBattlePropertiesUpdatedEvt a0);
public delegate void WorldDelegate11(JoinWorldInvitationUpdatedEvt a0);
public delegate void WorldDelegate12(LeaveWorldInvitationUpdatedEvt a0);

Type Reference: