Пример #1
0
        public void ApplySmoothTransition()
        {
            RadioChannelData?channel = AudioManagerHelper.GetActiveChannelData();

            if (channel != null)
            {
                ushort index = channel.Value.m_infoIndex;

                if (m_currentChannel == index)
                {
                    return;
                }

                m_currentChannel = index;

                if (index == 0)
                {
                    if (m_musicFileBackup != null)
                    {
                        AudioManager mgr = Singleton <AudioManager> .instance;
                        ReflectionHelper.SetPrivateField(mgr, "m_musicFiles", m_musicFileBackup);
                    }
                }
                else
                {
                    AudioManager mgr = Singleton <AudioManager> .instance;
                    ReflectionHelper.SetPrivateField(mgr, "m_musicFiles", null);
                }
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        /// <summary>
        /// Applies the content sensitivity
        /// </summary>
        public void ApplyDisallowedContentRestrictions()
        {
            if (!ModOptions.Instance.EnableContextSensitivity && !ModOptions.Instance.EnableDisabledContent)
            {
                return;
            }

            RebuildDisallowedContent();

            // Find the current content and check if it is in the list of allowed content
            // Otherwise trigger radio content rebuild and stop playback
            RadioChannelData?currentchannel = AudioManagerHelper.GetActiveChannelData();

            if (currentchannel != null)
            {
                RadioContentData?currentcontent = AudioManagerHelper.GetActiveContentInfo();

                if (currentcontent != null && currentcontent.Value.Info != null)
                {
                    HashSet <RadioContentInfo> disallowed;

                    if (DisallowedContent.TryGetValue(currentchannel.Value.Info, out disallowed))
                    {
                        if (ModOptions.Instance.EnableDebugInfo)
                        {
                            foreach (var v in disallowed)
                            {
                                CSLMusicMod.Log("Disallowed:" + v.name + "," + v.m_displayName);
                            }
                        }

                        if (disallowed != null && disallowed.Contains(currentcontent.Value.Info))
                        {
                            AudioManagerHelper.TriggerRebuildInternalSongList();
                            CSLMusicMod.Log("Wrong context for " + currentcontent.Value.Info.m_fileName);
                            AudioManagerHelper.NextTrack();
                        }
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Rebuilds the list of allowed content
        /// </summary>
        public void RebuildDisallowedContent()
        {
            if (m_WatcherUpdateTicker++ % 10 == 0)
            {
                AudioManager mgr = Singleton <AudioManager> .instance;

                for (int i = 0; i < mgr.m_radioChannels.m_size; ++i)
                {
                    RebuildDisallowedContentForChannel(mgr.m_radioChannels[i]);
                }
            }
            else
            {
                RadioChannelData?currentchannel = AudioManagerHelper.GetActiveChannelData();

                if (currentchannel != null)
                {
                    RebuildDisallowedContentForChannel(currentchannel.Value);
                }
            }
        }