Example #1
0
    private void HandleClientConnectedEvent(ClientConnectionEvent connectionEvent)
    {
        // Find existing or create new MicProfile for the newly connected device
        MicProfile micProfile = settings.MicProfiles.FirstOrDefault(it => it.ConnectedClientId == connectionEvent.ConnectedClientHandler.ClientId);

        if (micProfile == null)
        {
            micProfile = new MicProfile(connectionEvent.ConnectedClientHandler.ClientName, connectionEvent.ConnectedClientHandler.ClientId);
            settings.MicProfiles.Add(micProfile);
        }

        SongSelectMicListEntry matchingListEntry = listEntries.FirstOrDefault(listEntry =>
                                                                              listEntry.MicProfile != null &&
                                                                              listEntry.MicProfile.ConnectedClientId == connectionEvent.ConnectedClientHandler.ClientId &&
                                                                              listEntry.MicProfile.IsEnabled);

        if (connectionEvent.IsConnected && matchingListEntry == null && micProfile.IsEnabled)
        {
            // Add to UI
            CreateListEntry(micProfile);
        }
        else if (!connectionEvent.IsConnected && matchingListEntry != null)
        {
            // Remove from UI
            RemoveListEntry(matchingListEntry);
        }
    }
    private void CreateListEntry(MicProfile micProfile)
    {
        SongSelectMicListEntry listEntry = Instantiate(listEntryPrefab, scrollViewContent.transform);

        injector.InjectAllComponentsInChildren(listEntry);
        listEntry.Init(micProfile);
    }
Example #3
0
 private void RemoveListEntry(SongSelectMicListEntry listEntry)
 {
     Destroy(listEntry.gameObject);
     listEntries.Remove(listEntry);
     if (listEntries.IsNullOrEmpty())
     {
         emptyListLabel.SetActive(true);
     }
 }
Example #4
0
    private void CreateListEntry(MicProfile micProfile)
    {
        SongSelectMicListEntry listEntry = Instantiate(listEntryPrefab, scrollViewContent.transform);

        injector.InjectAllComponentsInChildren(listEntry);
        listEntry.MicProfile = micProfile;

        listEntries.Add(listEntry);

        emptyListLabel.SetActive(false);
    }
Example #5
0
    private void CreateListEntry(MicProfile micProfile)
    {
        SongSelectMicListEntry listEntry = Instantiate(listEntryPrefab, scrollViewContent.transform);

        listEntry.Init(micProfile);
    }