Hey @elkraneo ! Here is an example on how you can create a custom MultiplayerDelegate. You can create a class like this by providing a default implementation of the functions:
import TabletopKit
class CustomMultiplayerDelegate: TabletopGame.MultiplayerDelegate {
func playerJoined(_ playerID: PlayerIdentifier) {}
func didRejectPlayer(_ playerID: PlayerIdentifier, reason: any Error) {}
func joinAccepted() {}
func multiplayerSessionFailed(reason: any Error) {}
}
In order to use custom MultiplayerDelegate, you can do the following:
let tabletopGame = TabletopGame(tableSetup: setup.setup)
tabletopGame.multiplayerDelegate = CustomMultiplayerDelegate()
Topic:
Spatial Computing
SubTopic:
General
Tags: