GKTurnBasedMatchmakerViewController¶
Inherits: RefCounted < Object
Presents Apple’s turn-based matchmaking UI.
Description¶
Wrapper around GKTurnBasedMatchmakerViewController. Use create_controller() when you want to keep the controller instance and listen to its signals, or request_match() for a one-shot request/callback flow.
Keep the controller to close its UI later:
var request := GKMatchRequest.new()
request.min_players = 2
request.max_players = 2
var controller := GKTurnBasedMatchmakerViewController.create_controller(request)
controller.present()
# Later, from your own event handler:
controller.dismiss()
Properties¶
|
||
|
Methods¶
create_controller(request: GKMatchRequest) static |
|
void |
dismiss() |
void |
present() |
void |
request_match(request: GKMatchRequest, callback: Callable) static |
Signals¶
Emitted when the matchmaking UI is canceled.
did_find_match(match: GKTurnBasedMatch) 🔗
Emitted when a turn-based match is found.
failed_with_error(message: String) 🔗
Emitted when matchmaking fails with an error message.
player_quit_for_match(match: GKTurnBasedMatch) 🔗
Emitted when a player quits the specified turn-based match from the matchmaking UI flow.
Enumerations¶
enum MatchmakingMode: 🔗
MatchmakingMode DEFAULT = 0
Use Apple’s default turn-based matchmaking behavior.
MatchmakingMode NEARBY_ONLY = 1
Restrict matchmaking to nearby players.
MatchmakingMode AUTOMATCH_ONLY = 2
Restrict to automatch players only.
MatchmakingMode INVITE_ONLY = 3
Restrict to invited players only.
Property Descriptions¶
Controls how players are matched. See MatchmakingMode.
bool show_existing_matches = true 🔗
If true, the UI can show the player’s existing turn-based matches.
Method Descriptions¶
GKTurnBasedMatchmakerViewController create_controller(request: GKMatchRequest) static 🔗
Creates a controller for the provided GKMatchRequest. Call present() to show it and connect to signals such as did_find_match and failed_with_error.
void dismiss() 🔗
Closes this controller’s matchmaking UI. This method does not emit cancelled. Keep the controller returned by create_controller() to call this method.
void present() 🔗
Presents this controller’s matchmaking UI.
void request_match(request: GKMatchRequest, callback: Callable) static 🔗
Shows turn-based matchmaking UI and returns the result through callback. The callback receives (GKTurnBasedMatch match, Variant error). On failure or cancel, match is null and error contains a GKError.