Beispiel #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);
            }
        }
Beispiel #2
0
        public static void ResetToTime(float time, float nextStart, int soundStream, CVideoStream vidStream)
        {
            if (time < 0)
            {
                time = 0;
            }

            CurrentBeatF = GetBeatFromTime(time, GetSong().BPM, GetSong().Gap);

            for (int p = 0; p < _NumPlayers; p++)
            {
                Players[p].Points            = 0;
                Players[p].PointsGoldenNotes = 0;
                Players[p].PointsLineBonus   = 0;
                int l          = 0;
                int deleteLine = 0;
                foreach (CSungLine line in Players[p].SungLines)
                {
                    int n          = -1;
                    int deleteNote = 0;
                    Players[p].PointsLineBonus += line.BonusPoints;
                    foreach (CSungNote note in line.Notes)
                    {
                        if (note.StartBeat < nextStart)
                        {
                            if (note.Hit && note.HitNote.Type == ENoteType.Golden)
                            {
                                Players[p].PointsGoldenNotes += note.Points;
                            }
                            Players[p].Points += note.Points;
                        }
                        else if (deleteNote != -1)
                        {
                            deleteNote = n;
                        }
                        n++;
                    }
                    while (line.NoteCount > n && n >= 0)
                    {
                        if (line.Notes[n].Hit && line.Notes[n].HitNote.Type == ENoteType.Golden)
                        {
                            Players[p].PointsGoldenNotes -= line.Notes[n].Points;
                        }
                        Players[p].Points -= line.Notes[n].Points;
                        line.DeleteNote(n);
                    }

                    if (line.LastNoteBeat > CurrentBeat && deleteLine == 0)
                    {
                        deleteLine = l;
                    }
                    l++;
                }
                Players[p].SungLines.RemoveRange(deleteLine, Players[p].SungLines.Count - deleteLine);
            }

            CSound.SetPosition(soundStream, time);
            CVideo.Skip(vidStream, time, GetSong().VideoGap);
        }
Beispiel #3
0
 public static void Close(ref CVideoStream stream)
 {
     //Check for null because the videostreams may close themselves on destroy (GC)
     if (_VideoDecoder != null)
     {
         _VideoDecoder.Close(ref stream);
     }
 }
Beispiel #4
0
        public void SetLoop(CVideoStream stream, bool loop)
        {
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                decoder.Loop = loop;
            }
        }
Beispiel #5
0
        public void Pause(CVideoStream stream)
        {
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                decoder.Paused = true;
            }
        }
Beispiel #6
0
        public void Resume(CVideoStream stream)
        {
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                decoder.Paused = false;
            }
        }
Beispiel #7
0
 private bool _TryGetDecoder(CVideoStream stream, out CDecoder decoder)
 {
     if (stream == null)
     {
         decoder = null;
         return(false);
     }
     return(_Decoder.TryGetValue(stream.ID, out decoder));
 }
Beispiel #8
0
 public void Load(string videoName)
 {
     _VideoStream = CThemes.GetSkinVideo(videoName, -1, false);
     if (_VideoStream == null)
     {
         return;
     }
     _Loaded = true;
     CVideo.Pause(_VideoStream);
 }
Beispiel #9
0
        public float GetLength(CVideoStream stream)
        {
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                return(decoder.Length);
            }
            return(0f);
        }
Beispiel #10
0
        public bool Finished(CVideoStream stream)
        {
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                return(decoder.Finished);
            }
            return(true);
        }
Beispiel #11
0
        public bool Skip(CVideoStream stream, float start, float gap)
        {
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                return(decoder.Skip(start, gap));
            }
            return(false);
        }
Beispiel #12
0
 public void Pause(CVideoStream stream)
 {
     try
     {
         CVideo.Pause(stream);
     }
     catch (NotSupportedException e)
     {
         CLog.LogError($"Clould not pause the background video: {e.Message}");
     }
 }
Beispiel #13
0
        public bool GetFrame(CVideoStream stream, float time)
        {
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                return(decoder.GetFrame(ref stream.Texture, time, out stream.VideoTime));
            }
            stream.VideoTime = 0;
            return(false);
        }
Beispiel #14
0
 public void Resume(CVideoStream stream)
 {
     try
     {
         CVideo.Resume(stream);
     }
     catch (NotSupportedException e)
     {
         CLog.Error($"Clould not resume the background video: {e.Message}");
     }
 }
Beispiel #15
0
 public void Close(ref CVideoStream stream)
 {
     try
     {
         CVideo.Close(ref stream);
     }
     catch (NotSupportedException e)
     {
         CLog.Error($"Clould not close the background video: {e.Message}");
     }
 }
Beispiel #16
0
        public static CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop = true)
        {
            Debug.Assert(!String.IsNullOrEmpty(videoName));
            CVideoStream video = CurrentThemes[partyModeID].CurrentSkin.GetVideo(videoName, loop);

            if (video == null)
            {
                _LogMissingElement(partyModeID, "video", videoName);
            }
            return(video);
        }
Beispiel #17
0
        public static float GetLength(CVideoStream stream)
        {
            if (stream == null)
            {
                throw new ArgumentException("stream is null");
            }
            if (_VideoDecoder == null)
            {
                throw new NotSupportedException("_VideoDecoder is null (already closed?)");
            }

            return(_VideoDecoder.GetLength(stream));
        }
Beispiel #18
0
        public static void Resume(CVideoStream stream)
        {
            if (stream == null)
            {
                throw new ArgumentException("stream is null");
            }
            if (_VideoDecoder == null)
            {
                throw new NotSupportedException("_VideoDecoder is null (already closed?)");
            }

            _VideoDecoder.Resume(stream);
        }
Beispiel #19
0
        public static void SetLoop(CVideoStream stream, bool loop)
        {
            if (stream == null)
            {
                throw new ArgumentException("stream is null");
            }
            if (_VideoDecoder == null)
            {
                throw new NotSupportedException("_VideoDecoder is null (already closed?)");
            }

            _VideoDecoder.SetLoop(stream, loop);
        }
Beispiel #20
0
        public static bool Skip(CVideoStream stream, float start, float gap)
        {
            if (stream == null)
            {
                throw new ArgumentException("stream is null");
            }
            if (_VideoDecoder == null)
            {
                throw new NotSupportedException("_VideoDecoder is null (already closed?)");
            }

            return(_VideoDecoder.Skip(stream, start, gap));
        }
Beispiel #21
0
        public static bool GetFrame(CVideoStream stream, float time)
        {
            if (stream == null)
            {
                throw new ArgumentException("stream is null");
            }
            if (_VideoDecoder == null)
            {
                throw new NotSupportedException("_VideoDecoder is null (already closed?)");
            }

            return(_VideoDecoder.GetFrame(stream, time));
        }
Beispiel #22
0
        public static bool Finished(CVideoStream stream)
        {
            if (stream == null)
            {
                throw new ArgumentException("stream is null");
            }
            if (_VideoDecoder == null)
            {
                throw new NotSupportedException("_VideoDecoder is null (already closed?)");
            }

            return(_VideoDecoder.Finished(stream));
        }
Beispiel #23
0
        public void Close(ref CVideoStream stream)
        {
            if (stream == null)
            {
                return;
            }
            CDecoder decoder;

            if (_TryGetDecoder(stream, out decoder))
            {
                decoder.Close();
                _Decoder.Remove(stream.ID);
            }
            stream.SetClosed();
            stream = null;
        }
Beispiel #24
0
        public void LoadSkin()
        {
            if (!ThemeLoaded)
            {
                return;
            }
            _Theme.Color.Get(_PartyModeID, out Color);

            if (_Theme.Type == EBackgroundTypes.SlideShow)
            {
                foreach (string s in _Theme.SlideShowTextures)
                {
                    _SlideShowTextures.Add(CBase.Themes.GetSkinTexture(s, _PartyModeID));
                }
            }

            if (_Theme.Type == EBackgroundTypes.Video)
            {
                _VideoStream = CBase.Themes.GetSkinVideo(_Theme.VideoName, _PartyModeID, true);
            }
        }
Beispiel #25
0
 public static void SetLoop(CVideoStream stream, bool loop)
 {
     _VideoDecoder.SetLoop(stream, loop);
 }
Beispiel #26
0
 public static bool Finished(CVideoStream stream)
 {
     return(_VideoDecoder.Finished(stream));
 }
Beispiel #27
0
 public static float GetLength(CVideoStream stream)
 {
     return(_VideoDecoder.GetLength(stream));
 }
Beispiel #28
0
 public static bool GetFrame(CVideoStream stream, float time)
 {
     return(_VideoDecoder.GetFrame(stream, time));
 }
Beispiel #29
0
 public static bool Skip(CVideoStream stream, float start, float gap)
 {
     return(_VideoDecoder.Skip(stream, start, gap));
 }
Beispiel #30
0
 public static void Pause(CVideoStream stream)
 {
     _VideoDecoder.Pause(stream);
 }