Beispiel #1
0
        void musicEntryEnableDisable(UIComponent component, int value)
        {
            RadioContentInfo info = m_CurrentContent[value];

            AudioManagerHelper.SetContentEnabled(info, !AudioManagerHelper.ContentIsEnabled(info));

            RebuildList();
        }
Beispiel #2
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);
        }
        /// <summary>
        /// Rebuilds the allowed content for a channel.
        /// </summary>
        /// <param name="channel">Channel.</param>
        private void RebuildDisallowedContentForChannel(RadioChannelData channel)
        {
            if (channel.Info == null)
            {
                return;
            }

            HashSet <RadioContentInfo> disallowed;

            if (!DisallowedContent.TryGetValue(channel.Info, out disallowed))
            {
                disallowed = new HashSet <RadioContentInfo>();
                DisallowedContent[channel.Info] = disallowed;
            }
            else
            {
                disallowed.Clear();
            }

            UserRadioChannel userchannel = AudioManagerHelper.GetUserChannelInfo(channel.Info);

            if (userchannel != null)
            {
                // If the channel is a custom channel, we can check for context and for content disabling
                // The method returns NULL if all songs apply!
                var allowedsongs = userchannel.GetApplyingSongs();

                if (allowedsongs == null)
                {
                    if (ModOptions.Instance.EnableDisabledContent && ModOptions.Instance.DisabledContent.Count != 0)
                    {
                        foreach (UserRadioContent usercontent in userchannel.m_Content)
                        {
                            if (usercontent.m_VanillaContentInfo != null)
                            {
                                bool isenabled = (!ModOptions.Instance.EnableDisabledContent || AudioManagerHelper.ContentIsEnabled(usercontent.m_VanillaContentInfo));

                                if (!isenabled)
                                {
                                    disallowed.Add(usercontent.m_VanillaContentInfo);
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (UserRadioContent usercontent in userchannel.m_Content)
                    {
                        if (usercontent.m_VanillaContentInfo != null)
                        {
                            bool isincontext = (!ModOptions.Instance.EnableContextSensitivity || allowedsongs.Contains(usercontent));
                            bool isenabled   = (!ModOptions.Instance.EnableDisabledContent || AudioManagerHelper.ContentIsEnabled(usercontent.m_VanillaContentInfo));

                            if (!isincontext || !isenabled)
                            {
                                disallowed.Add(usercontent.m_VanillaContentInfo);
                            }
                        }
                    }
                }
            }
            else
            {
                // If the channel is a vanilla channel, we can still disable content
                AudioManager mgr = Singleton <AudioManager> .instance;

                if (mgr.m_radioContents.m_size > 0)
                {
                    for (int i = 0; i < mgr.m_radioContents.m_size; ++i)
                    {
                        var content = mgr.m_radioContents[i];
                        if (content.Info != null && content.Info.m_radioChannels != null && content.Info.m_radioChannels.Contains(channel.Info))
                        {
                            if (!AudioManagerHelper.ContentIsEnabled(content.Info))
                            {
                                disallowed.Add(content.Info);
                            }
                        }
                    }
                }
            }
        }