private void Awake() { //add listeners btnMultiplayer.onClick.AddListener(OnMultiplayerButtonClick); btnOffline.onClick.AddListener(OnOfflineButtonClick); btnSettings.onClick.AddListener(OnSettingsButtonClick); lobbyListItems.AddListener(OnLobbyItemSelect); roomListItems.AddListener(OnRoomItemSelect); //create dictionary entries using group name as key foreach (CanvasGroup group in canvasGroups) { canvasGroupDictionary.Add(group.name, group); } //add listeners for callbacks NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.Disconnected, OnDisconnected); NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.JoinedLobby, OnJoinedLobby); NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.JoinedRoom, OnJoinedRoom); NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.LeftRoom, OnLeftRoom); NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.LeftLobby, OnLeftLobby); NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.CreatedRoom, OnCreatedRoom); //change group focus to menu buttons ChangeGroupFocus("MenuButtons"); }
private void Awake() { playerColorPicker.OnColorPicked += OnColorPicked; playerColorPicker.OnCancel += ToggleInteractabilityOfColorButton; MultiplayerRegistrations.Register(); NetworkingService.AddCallbackListener(MatchmakingCallbackEvent.JoinedRoom, OnJoinedRoom); NetworkingService.AddCallbackListener(InRoomCallbackEvent.ClientJoined, OnRoomUpdate); NetworkingService.AddCallbackListener(InRoomCallbackEvent.ClientLeft, OnRoomUpdate); NetworkingService.AddCallbackListener(InRoomCallbackEvent.HostChanged, OnRoomUpdate); NetworkingService.AddClientPropertyUpdateListener(OnClientPropertyUpdate); }