コード例 #1
0
        private String GetEntryTextFor(RadioContentInfo content)
        {
            String name = AudioManagerHelper.GetContentName(content);

            switch (content.m_contentType)
            {
            case RadioContentInfo.ContentType.Blurb:
                name = "<sprite Blurb> " + name;
                break;

            case RadioContentInfo.ContentType.Broadcast:
                name = "<sprite Broadcast> " + name;
                break;

            case RadioContentInfo.ContentType.Commercial:
                name = "<sprite Commercial> " + name;
                break;

            case RadioContentInfo.ContentType.Music:
                name = "<sprite Music> " + name;
                break;

            case RadioContentInfo.ContentType.Talk:
                name = "<sprite Talk> " + name;
                break;
            }

            if (ModOptions.Instance.ImprovedDisableContentUI)
            {
                if (!AudioManagerHelper.ContentIsEnabled(content))
                {
                    name = "<sprite ContentUnchecked>" + name;
                }
                else
                {
                    name = "<sprite ContentChecked>" + name;
                }
            }
            else
            {
                if (!AudioManagerHelper.ContentIsEnabled(content))
                {
                    name = "<sprite ContentDisabled>" + name;
                }
            }



            return(name);
        }
コード例 #2
0
        private void RebuildList()
        {
            AudioManager mgr = Singleton <AudioManager> .instance;

            ushort activechannel = ReflectionHelper.GetPrivateField <ushort>(mgr, "m_activeRadioChannel");

            //Debug.Log("Selected active channel " + activechannel + " of " + mgr.m_radioChannelCount);

            //Dictionary<RadioContentInfo, String> entrytexts = new Dictionary<RadioContentInfo, string>();

            if (activechannel >= 0)
            {
                RadioChannelData channeldata = mgr.m_radioChannels[activechannel];
                RadioChannelInfo info        = channeldata.Info;

                m_CurrentContent.Clear();

                if (info != null)
                {
                    // Only show supported content entries
                    HashSet <RadioContentInfo.ContentType> supported_content = new HashSet <RadioContentInfo.ContentType>();

                    foreach (var state in info.m_stateChain)
                    {
                        supported_content.Add(state.m_contentType);
                    }

                    for (uint i = 0; i < PrefabCollection <RadioContentInfo> .PrefabCount(); ++i)
                    {
                        var c = PrefabCollection <RadioContentInfo> .GetPrefab(i);

                        if (c == null)
                        {
                            continue;
                        }
                        if (c.m_radioChannels == null)
                        {
                            continue;
                        }

                        if (supported_content.Contains(c.m_contentType) && c.m_radioChannels.Contains(info))
                        {
                            //entrytexts[c] = GetEntryTextFor(c);

                            //if(!IsFiltered(entrytexts[c]))
                            if (!IsFiltered(AudioManagerHelper.GetContentName(c)))
                            {
                                m_CurrentContent.Add(c);
                            }
                        }
                    }
                }

                m_RadioChannelInfo.isVisible = m_CurrentContent.Count == 0;

                //Debug.Log(m_CurrentContent.Count + " entries ");
            }

            m_CurrentContent.Sort((RadioContentInfo x, RadioContentInfo y) =>
            {
                if (m_SortAscending)
                {
                    //return string.Compare(entrytexts[x], entrytexts[y], StringComparison.CurrentCulture);
                    return(string.Compare(AudioManagerHelper.GetContentName(x), AudioManagerHelper.GetContentName(y), StringComparison.CurrentCulture));
                }
                else
                {
                    //return string.Compare(entrytexts[y], entrytexts[x], StringComparison.CurrentCulture);
                    return(string.Compare(AudioManagerHelper.GetContentName(y), AudioManagerHelper.GetContentName(x), StringComparison.CurrentCulture));
                }
            });

            RefreshListWidget();
        }