private void UseMicProfileWhereNeeded(MicProfile micProfile)
    {
        if (micProfile == null ||
            !micProfile.IsEnabled)
        {
            return;
        }

        SongSelectPlayerProfileListEntry listEntryWithMatchingMicProfile = listEntries.FirstOrDefault(it =>
                                                                                                      it.MicProfile != null &&
                                                                                                      it.MicProfile.ConnectedClientId == micProfile.ConnectedClientId);

        if (listEntryWithMatchingMicProfile != null)
        {
            // Already in use. Cannot be assign to other players.
            return;
        }

        SongSelectPlayerProfileListEntry listEntryWithMissingMicProfile = listEntries.FirstOrDefault(it => it.PlayerProfile.IsSelected && it.MicProfile == null);

        if (listEntryWithMissingMicProfile != null)
        {
            listEntryWithMissingMicProfile.MicProfile = micProfile;
        }
    }
Esempio n. 2
0
    private void CreateListEntry(PlayerProfile playerProfile)
    {
        SongSelectPlayerProfileListEntry listEntry = Instantiate(listEntryPrefab);

        listEntry.transform.SetParent(scrollViewContent.transform);
        listEntry.Init(playerProfile);

        listEntry.isSelectedToggle.OnValueChangedAsObservable().Subscribe(newValue => OnSelectionStatusChanged(listEntry, newValue));

        listEntries.Add(listEntry);
    }
Esempio n. 3
0
 private void OnSelectionStatusChanged(SongSelectPlayerProfileListEntry listEntry, bool newValue)
 {
     if (newValue == false)
     {
         listEntry.MicProfile = null;
     }
     else
     {
         List <MicProfile> unusedMicProfiles = FindUnusedMicProfiles();
         if (!unusedMicProfiles.IsNullOrEmpty())
         {
             listEntry.MicProfile = unusedMicProfiles[0];
         }
     }
 }
    public bool TrySelectPreviousControl()
    {
        if ((eventSystem.currentSelectedGameObject == null ||
             eventSystem.currentSelectedGameObject.GetComponentInParent <SongSelectPlayerProfileListEntry>() == null) &&
            PlayerProfileControls.Count > 0)
        {
            PlayerProfileControls.Last().isSelectedToggle.Select();
            return(true);
        }

        SongSelectPlayerProfileListEntry nextEntry = PlayerProfileControls.GetElementBefore(FocusedPlayerProfileControl, false);

        if (nextEntry != null)
        {
            nextEntry.isSelectedToggle.Select();
            return(true);
        }

        return(false);
    }