Esempio n. 1
0
        /// <summary>
        /// 更新歌曲播放时的进度
        /// </summary>
        internal static void UpdateSongPlayingTime()
        {
            if (ModelManager.Instance.GetLogicDatas.GameState != GameState.Playing)
            {
                return;
            }
            ScenesDatas scenesDatas = ModelManager.Instance.GetScenesDatas;

            scenesDatas.SongPlayingTime.text = SongTimeTools.SongTimeToStringTime(scenesDatas.AudioSource.time);
            scenesDatas.SongTimeSlide.value  = scenesDatas.AudioSource.time / scenesDatas.AudioSource.clip.length;
        }
Esempio n. 2
0
        /// <summary>
        /// 播放加载完毕的歌曲
        /// </summary>
        internal static void PlayLoadFinishSong()
        {
            LogicDatas  logicDatas  = ModelManager.Instance.GetLogicDatas;
            ScenesDatas scenesDatas = ModelManager.Instance.GetScenesDatas;

            UILyricControl.InitLyric(scenesDatas.LyricItems, logicDatas.LyricInfo);
            scenesDatas.SongName.text        = System.IO.Path.GetFileNameWithoutExtension(logicDatas.SongsName[logicDatas.CurrentSongIndex]);
            scenesDatas.SongPlayingTime.text = "00:00";
            scenesDatas.SongTotalTime.text   = SongTimeTools.SongTimeToStringTime(scenesDatas.AudioSource.clip.length);
            scenesDatas.SongTimeSlide.value  = 0.0f;
            scenesDatas.AudioSource.time     = 0.0f;
            scenesDatas.AudioSource.Play();
            logicDatas.GameState = GameState.Playing;
        }
Esempio n. 3
0
        /// <summary>
        /// 监听歌曲是否播放完毕
        /// </summary>
        internal static void ListeningSongOver()
        {
            ScenesDatas scenesDatas = ModelManager.Instance.GetScenesDatas;

            if (scenesDatas.AudioSource.clip == null)
            {
                return;
            }

            if (SongTimeTools.IsSongOver(AudioSourceData.GetCurrentSongTime(scenesDatas.AudioSource), AudioSourceData.GetCurrentSongLength(scenesDatas.AudioSource)))
            {
                switch (ModelManager.Instance.GetLogicDatas.CycleType)
                {
                case CycleType.SingleCycle:
                    SongControl.OnSingleCycle();
                    break;

                case CycleType.PlayInOrder:
                    SongControl.OnPlayInOrder();
                    break;

                case CycleType.LoopPlayback:
                    SongControl.OnLoopPlayback();
                    break;

                case CycleType.RandomPlay:
                    SongControl.OnRandomPlay();
                    break;

                case CycleType.SinglePlay:
                    SongControl.OnSinglePlay();
                    break;

                default:
                    break;
                }
            }
        }