コード例 #1
0
        private void TopOpenStationDirectoryOnEventClick(UIComponent uiComponent, UIMouseEventParameter uiMouseEventParameter)
        {
            var data = AudioManagerHelper.GetActiveChannelData();

            if (data != null)
            {
                var info = AudioManagerHelper.GetUserChannelInfo(data.Value.Info);
                var dir  = DataLocation.gameContentPath;

                if (info != null)
                {
                    dir = info.m_DefinitionDirectory;
                }

                DesktopHelper.OpenFileExternally(dir);
            }
        }
コード例 #2
0
        /// <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);
                            }
                        }
                    }
                }
            }
        }