示例#1
0
        public bool TryGetVideo(MappedCustomSong song, out VideoData video)
        {
            if (song == null || !videos.TryGetValue(song, out video))
            {
                video = null;
            }

            return(video != null);
        }
        private void SetVideo(string songName)
        {
            try
            {
                CurrentSong = SongLoader.Instance.GetMappedSong(songName);

                if (VideoLoader.Instance.TryGetVideo(CurrentSong, out CurrentVideo))
                {
                    Logger.Instance.Log($"Found video for {songName}: \n{CurrentVideo}", Logger.LogSeverity.DEBUG);
                    VideoPlayerManager.Instance.PrepareVideo(CurrentVideo);
                }
                else
                {
                    Logger.Instance.Log($"Video could not be found for {songName}", Logger.LogSeverity.DEBUG);
                }
            }
            catch (Exception e)
            {
                Logger.Instance.Log($"Got {e} on {songName}", Logger.LogSeverity.DEBUG);
            }
        }
示例#3
0
        private VideoData LoadVideo(string videoJsonPath, MappedCustomSong customSong)
        {
            var       json  = File.ReadAllText(videoJsonPath);
            VideoData video = null;

            try
            {
                video      = JsonUtility.FromJson <VideoData>(json);
                video.Song = customSong;

                if (File.Exists(GetVideoPath(video)))
                {
                    video.DownloadState = DownloadState.Downloaded;
                }
            }
            catch
            {
                Logger.Instance.Log($"Failed to parse video json at {videoJsonPath}", Logger.LogSeverity.ERROR);
            }

            return(video);
        }