void OnLocalUserChanged(NetworkUserData localUser) { var matchmakerId = localUser.matchmakerId; if (!string.IsNullOrEmpty(matchmakerId) && m_CurrentUserId != matchmakerId) { m_CurrentUserId = matchmakerId; } }
void OnLocalUserChanged(NetworkUserData localUser) { var voiceData = localUser.voiceStateData; var muted = voiceData.isServerMuted; m_MicToggleOnImage.SetActive(!muted); m_MicToggleOffImage.SetActive(muted); if (!muted && m_MicLevel != null) { m_MicLevel.fillAmount = voiceData.micVolume; } }
protected static void AddUserToRoom(NetworkUserData user) { var identity = UIStateManager.current.GetUserIdentityFromSession(user.matchmakerId); var multiplayerController = Resources.FindObjectsOfTypeAll <MultiplayerController>().First(); var color = (UIStateManager.current.stateData.colorPalette.Length > identity.colorIndex) ? UIStateManager.current.stateData.colorPalette[identity.colorIndex] : Color.blue; //temp fix for palettes user.visualRepresentation = multiplayerController.CreateVisualRepresentation(UIStateManager.current.m_RootNode.transform); user.visualRepresentation.avatarName = identity.fullName; user.visualRepresentation.color = color; user.visualRepresentation.avatarInitials = UIUtils.CreateInitialsFor(identity.fullName); UIStateManager.current.roomConnectionStateData.users.Add(user); UIStateManager.current.ForceSendConnectionChangedEvent(); }
protected static void AddUserToRoom(NetworkUserData user) { using (var rootSelector = UISelectorFactory.createSelector <Transform>(PipelineContext.current, nameof(IPipelineDataProvider.rootNode))) using (var usersSelector = UISelectorFactory.createSelector <List <NetworkUserData> >(RoomConnectionContext.current, nameof(IRoomConnectionDataProvider <NetworkUserData> .users))) { var identity = UIStateManager.current.GetUserIdentityFromSession(user.matchmakerId); var multiplayerController = Resources.FindObjectsOfTypeAll <MultiplayerController>().First(); using (var colorGetter = UISelectorFactory.createSelector <Color[]>(UIStateContext.current, nameof(IUIStateDataProvider.colorPalette))) { var color = colorGetter.GetValue().Length > identity.colorIndex ? colorGetter.GetValue()[identity.colorIndex] : Color.blue; //temp fix for palettes user.visualRepresentation = multiplayerController.CreateVisualRepresentation(rootSelector.GetValue()); user.visualRepresentation.avatarName = identity.fullName; user.visualRepresentation.color = color; user.visualRepresentation.avatarInitials = UIUtils.CreateInitialsFor(identity.fullName); } usersSelector.GetValue().Add(user); RoomConnectionContext.current.ForceOnStateChanged(); } }
void OnLocalUserChanged(NetworkUserData localUser) { // Check if current user had change Id var matchmakerId = localUser.matchmakerId; if (!string.IsNullOrEmpty(matchmakerId) && m_CurrentUserId != matchmakerId) { if (m_SelectedDatas.Any(s => s.userId == m_CurrentUserId)) { var selectedData = m_SelectedDatas.First(s => s.userId == m_CurrentUserId); var selectedObject = selectedData.selectedObject; //Unselect current local selection var info = new ObjectSelectionInfo(); info.currentIndex = 0; info.selectedObjects = new List <GameObject>(); info.userId = m_CurrentUserId; info.colorId = 0; DispatchSelection(info); m_CurrentUserId = matchmakerId; //Reselect it with new id info.userId = matchmakerId; info.selectedObjects = new List <GameObject>() { selectedObject }; DispatchSelection(info); } else { m_CurrentUserId = matchmakerId; } UpdateMultiSelection(); } }