예제 #1
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();
                        }
                    }
                }
            }
        }
예제 #2
0
 void buttonNextTrackClicked(UIComponent component, UIMouseEventParameter eventParam)
 {
     AudioManagerHelper.NextTrack();
 }
예제 #3
0
        public void Update()
        {
            // Check if some other UI has the focus
            if (UIView.HasInputFocus())
            {
                m_NextTrackKey_IsDown   = false;
                m_OpenPanelKey_IsDown   = false;
                m_NextStationKey_IsDown = false;
                return;
            }

            m_ModifierCtrl  = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl));
            m_ModifierShift = (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift));
            m_ModiferAlt    = (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt));

            //Next track
            if (ShortcutDown(ModOptions.Instance.ShortcutNextTrack))
            {
                m_NextTrackKey_IsDown = true;
            }
            else if (m_NextTrackKey_IsDown && ShortcutUp(ModOptions.Instance.ShortcutNextTrack))
            {
                m_NextTrackKey_IsDown = false;
                CSLMusicMod.Log("Pressed shortcut for next track");
                AudioManagerHelper.NextTrack();
            }

            //Next station
            if (ShortcutDown(ModOptions.Instance.ShortcutNextStation))
            {
                m_NextStationKey_IsDown = true;
            }
            else if (m_NextStationKey_IsDown && ShortcutUp(ModOptions.Instance.ShortcutNextStation))
            {
                CSLMusicMod.Log("Pressed shortcut for next station");
                m_NextStationKey_IsDown = false;
                AudioManagerHelper.NextStation();
            }

            //Panel
            if (ShortcutDown(ModOptions.Instance.ShortcutOpenRadioPanel))
            {
                m_OpenPanelKey_IsDown = true;
            }
            else if (m_OpenPanelKey_IsDown && ShortcutUp(ModOptions.Instance.ShortcutOpenRadioPanel))
            {
                m_OpenPanelKey_IsDown = false;
                CSLMusicMod.Log("Pressed shortcut for hide/show panel");

                var radiopanel = CurrentRadioPanel;
                if (radiopanel != null)
                {
                    var visible = ReflectionHelper.GetPrivateField <bool>(radiopanel, "m_isVisible");

                    if (visible)
                    {
                        radiopanel.HideRadio();
                    }
                    else
                    {
                        radiopanel.ShowRadio();
                    }
                }
            }
        }