Ejemplo n.º 1
0
        private void _LoadVideo()
        {
            if (_Song == null)
            {
                return;
            }

            if (_Video != null || !SongHasVideo)
            {
                return;
            }
            string videoFilePath = Path.Combine(_Song.Folder, _Song.VideoFileName);

            _Video = CBase.Video.Load(videoFilePath);
            if (_Video == null)
            {
                return;
            }

            _VideoFading = new CFading(0f, 1f, 3f);

            if (IsPlaying)
            {
                CBase.Video.Skip(_Video, Position, _Song.VideoGap);
                CBase.Video.Resume(_Video);
            }
            else
            {
                CBase.Video.Skip(_Video, 0f, _Song.VideoGap);
            }
        }
Ejemplo n.º 2
0
        public virtual void Update()
        {
            if (_Fading != null)
            {
                bool finished;
                Volume = _Fading.GetValue(out finished);
                if (finished)
                {
                    switch (_AfterFadeAction)
                    {
                    case EStreamAction.Close:
                        Close();
                        break;

                    case EStreamAction.Stop:
                        Stop();
                        break;

                    case EStreamAction.Pause:
                        IsPaused = true;
                        break;
                    }
                    _Fading = null;
                }
            }
        }
Ejemplo n.º 3
0
 private static void _FinishScreenFading()
 {
     if (_Fading == null)
     {
         return;
     }
     Debug.Assert(NextScreen != null);
     CurrentScreen.OnClose();
     CurrentScreen = NextScreen;
     NextScreen    = null;
     CurrentScreen.OnShowFinish();
     CSound.SetGlobalVolume(CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType));
     if (CurrentScreen.CurrentMusicType == EMusicType.Background || CurrentScreen.CurrentMusicType == EMusicType.Preview || CurrentScreen.CurrentMusicType == EMusicType.BackgroundPreview)
     {
         CBackgroundMusic.Disabled         = false;
         CBackgroundMusic.IsPlayingPreview = CurrentScreen.CurrentMusicType == EMusicType.Preview || CurrentScreen.CurrentMusicType == EMusicType.BackgroundPreview;
     }
     _Fading = null;
 }
Ejemplo n.º 4
0
 public CTextureRef GetVideoTexture()
 {
     if (_Video == null || _Song == null)
     {
         return(null);
     }
     if (CBase.Video.GetFrame(_Video, CBase.Sound.GetPosition(_StreamID)))
     {
         if (_VideoFading != null)
         {
             bool finished;
             _Video.Texture.Color.A = _VideoFading.GetValue(out finished);
             if (finished)
             {
                 _VideoFading = null;
             }
         }
         return(_Video.Texture);
     }
     return(null);
 }
Ejemplo n.º 5
0
        public void Draw()
        {
            if (_Movetimer.ElapsedMilliseconds > CSettings.MouseMoveOffTime)
            {
                Deactivate();
            }

            if (_Fading != null)
            {
                bool finished;
                _Cursor.Color.A = _Fading.GetValue(out finished);
                if (finished)
                {
                    _Fading = null;
                }
            }

            if (Visible && (CSettings.ProgramState == EProgramState.EditTheme || ShowCursor))
            {
                CDraw.DrawTexture(_Cursor);
            }
        }
Ejemplo n.º 6
0
        public static bool Draw()
        {
            if (NextScreen != null && _Fading == null)
            {
                _Fading = new CFading(0f, 1f, CConfig.Config.Graphics.FadeTime);

                if (NextScreen.PartyModeID != -1)
                {
                    CFonts.PartyModeID = NextScreen.PartyModeID;
                    NextScreen.OnShow();
                    CFonts.PartyModeID = -1;
                }
                else
                {
                    NextScreen.OnShow();
                }
                if (_Cursor.IsActive)
                {
                    NextScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y);
                }

                HidePopup(EPopupScreens.PopupPlayerControl);
                if (NextScreen.CurrentMusicType != EMusicType.Background && NextScreen.CurrentMusicType != EMusicType.Preview && NextScreen.CurrentMusicType != EMusicType.BackgroundPreview)
                {
                    CBackgroundMusic.Disabled = true;
                }
            }

            if (_Fading != null)
            {
                Debug.Assert(NextScreen != null);
                bool  finished;
                float newAlpha = _Fading.GetValue(out finished);

                if (!finished)
                {
                    ZOffset = CSettings.ZFar / 2;
                    _DrawScreen(CurrentScreen);

                    GlobalAlpha = newAlpha;
                    ZOffset     = 0f;
                    _DrawScreen(NextScreen);

                    GlobalAlpha = 1f;
                    int oldVol = CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType);
                    int newVol = CConfig.GetVolumeByType(NextScreen.CurrentMusicType);
                    CSound.SetGlobalVolume((int)((newVol - oldVol) * newAlpha + oldVol));
                }
                else
                {
                    _FinishScreenFading();
                    if (_Cursor.IsActive)
                    {
                        CurrentScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y);
                    }

                    _DrawScreen(CurrentScreen);
                }
            }
            else
            {
                _DrawScreen(CurrentScreen);
            }

            foreach (IMenu popup in _PopupScreens)
            {
                popup.Draw();
            }

            _Cursor.Draw();
            _DrawDebugInfos();

            return(true);
        }
Ejemplo n.º 7
0
 public void CancelFading()
 {
     _Fading = null;
 }
Ejemplo n.º 8
0
 public void Fade(float targetVolume, float seconds, EStreamAction afterFadeAction)
 {
     _Fading          = new CFading(Volume, targetVolume, seconds);
     _AfterFadeAction = afterFadeAction;
 }
Ejemplo n.º 9
0
 private void _Fade(float targetAlpha, float time)
 {
     _Fading = new CFading(_Cursor.Color.A, targetAlpha, time);
 }