MatchMakeManager
Namespace: SynicSugar.MatchMake
This is used like MatchMakeManager.Instance.XXX().
Description
This script is Mono's Singleton attached to NetworkManager. To generate NetworkManager, right-click on the Hierarchy and click SynicSugar/NetworkManager.
NetworkManager has DontDestroy, so NetworkManager will not be destroyed by scene transitions. This is used for re-connection, and also needed for p2p scene.
If this is no longer needed, we call CancelCurrentMatchMake, ExitSession and CloseSession.
Properity
| API | description |
|---|---|
| IsMatchmaking | Whether the user is in matchmaking |
| maxSearchResult | The amount of search results |
| timeoutSec | Timeout seconds for user to exit no-filled lobby |
| p2pSetupTimeoutSec | Timeout sec for prep init connection |
| enableHostmigrationInMatchmaking | If true, pass host authority to others when local user leave the lobby |
| BasicInfoPacketCompressionLevel | The quality level of BrotliCompressor for compressing the BasicInfo |
| sessionTimestampFileName | The file name to save the session start time |
| lobbyIdSaveType | The way to return to the disconnected lobby |
| playerprefsSaveKey | The key to save LobbyID |
| customSaveLobbyID | UnityEvent to save LobbyID |
| customDeleteLobbyID | UnityEvent to delete LobbyID |
| lobbyIDMethod | Actions to recconect Lobby |
| asyncLobbyIDMethod | Func<UniTask> to recconect Lobby |
| MatchMakingGUIEvents | To manage GUI in matchmaking |
| MemberUpdatedNotifier | Notify when a user attributes is updated |
| isLooking | This local user is waiting for opponents? |
| isConcluding | This local user is preparing for p2p connection? |
| timeUntilTimeout | Sec until stopping the process to wait for opponents |
| isHost | Whether this local user is the owner of current Lobby |
Function
| API | description |
|---|---|
| SetTimeoutSec | Set timeout of matchmake and prep conenction |
| SearchAndCreateLobby | Search lobby and, if can't join, create lobby |
| SearchLobby | Search lobby and join it as Guest |
| CreateLobby | Create lobby as Host and wait for Guest |
| ConcludeMatchMake | Host finishes a matchmaking by hand |
| ReconnectLobby | Join the Lobby with saved LobbyID |
| ExitCurrentMatchMake | Stop the current matchmaking |
| CloseCurrentMatchMake | (Host) destroys lobby to stop the matchmaking |
| KickTargetFromLobby | (Host) kicks target from Lobby |
| CreateOfflineLobby | Create fake-lobby as Host for tutorial |
| GetCurrentLobbyID | Get LobbyID that a user participating |
| GetReconnectLobbyID | Get LobbyID by Playerprefs |
| GetCurrentLobbyMemberCount | Get the current member count in Lobby |
| GetMaxLobbyMemberCount | Get the current lobby's member limit |
| GenerateLobbyObject | Generate a lobby object for conditions |
| GetTargetAttributeData | Get attribute(s) of a member |
| isLocalUserId | Whether the argument is the id of local user or not |
using SynicSugar.MatchMake;
public class MatchMake {
void SetMatchMakeCondition(){
string LobbyID = MatchMakeManager.Instance.GetReconnectLobbyID();
}
}