Ejemplo n.º 1
0
        /// <summary>
        /// 加载歌词文字
        /// </summary>
        /// <param name="d"></param>
        public void LoadNRCWord(List <NRCWordModel> d)
        {
            NRCWordList.Clear();
            StackPanel.Children.Clear();

            foreach (NRCWordModel w in d)
            {
                NRCWord nrcword = new NRCWord();
                nrcword.Word      = w.Word;
                nrcword.PlayTime  = w.PlayTime;
                nrcword.StartTime = w.StartTime;
                //将文字加入控件
                StackPanel.Children.Add(nrcword);
                //保存控件集合
                NRCWordList.Add(nrcword);
                Words += w.Word;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 正常播放更新进度时间(当进度到此句歌词时一直调用此方法保持更新文字描色
        /// </summary>
        /// <param name="PositionTime"></param>
        public void UpdatePlayPositionTime(double PositionTime)
        {
            if (LyricType == LyricType.LRC)
            {
                if (IsLRCColored == false)
                {
                    //给所有文字上色
                    foreach (NRCWord w in NRCWordList)
                    {
                        w.SetColor();
                    }
                    IsLRCColored = true;
                }
            }
            else
            {
                var w = NRCWordList.Where(m => m.animationState == NRCWord.AnimationState.Stop);
                //if (w.Count() > 0)
                //{
                foreach (NRCWord nw in NRCWordList)
                {
                    nw.Play(PositionTime);
                    //记录当前描色的字
                    NowPlayNRCWord = nw;
                }


                //}


                //var w = NRCWordList.Where(m => PositionTime >= m.StartTime && m.animationState== NRCWord.AnimationState.Stop);
                //if (w.Count() > 0)
                //{
                //    //取最后一个
                //    NRCWord nrcword = w.Last();
                //    //nrcword.Position = PositionTime;
                //    nrcword.Play(PositionTime);
                //    //记录当前描色的字
                //    NowPlayNRCWord = nrcword;

                //}
            }
        }