コード例 #1
0
ファイル: CScreenSing.cs プロジェクト: zhaozw/Vocaluxe
        private void DrawLyricHelper()
        {
            if (_FadeOut)
            {
                return;
            }

            if (!CSound.IsPlaying(_CurrentStream) && !CSound.IsPaused(_CurrentStream))
            {
                return;
            }

            CSong song = CGame.GetSong();

            if (song == null)
            {
                return;
            }

            float alpha = (float)((Math.Cos(_CurrentTime * Math.PI * 2) + 1) / 2.0) / 2f + 0.5f;

            if (_TimeToFirstNote > CSettings.LyricHelperMinTime && _RemainingTimeToFirstNote > 0f && _RemainingTimeToFirstNote < CSettings.LyricHelperEnableTime)
            {
                float time      = _RemainingTimeToFirstNote;
                float totaltime = CSettings.LyricHelperMoveTime;

                if (totaltime > _TimeToFirstNote)
                {
                    totaltime = _TimeToFirstNote;
                }

                if (time > totaltime)
                {
                    time = totaltime;
                }

                SRectF  Rect  = Statics[htStatics(StaticLyricHelper)].Rect;
                SColorF Color = new SColorF(
                    Statics[htStatics(StaticLyricHelper)].Color.R,
                    Statics[htStatics(StaticLyricHelper)].Color.G,
                    Statics[htStatics(StaticLyricHelper)].Color.B,
                    Statics[htStatics(StaticLyricHelper)].Color.A * Statics[htStatics(StaticLyricHelper)].Alpha * alpha);

                float distance = Lyrics[htLyrics(LyricMain)].GetCurrentLyricPosX() - Rect.X - Rect.W;
                CDraw.DrawTexture(Statics[htStatics(StaticLyricHelper)].Texture,
                                  new SRectF(Rect.X + distance * (1f - time / totaltime), Rect.Y, Rect.W, Rect.H, Rect.Z), Color);

                if (Statics[htStatics(StaticLyricsTop)].Visible)
                {
                    Rect  = Statics[htStatics(StaticLyricHelperTop)].Rect;
                    Color = new SColorF(
                        Statics[htStatics(StaticLyricHelperTop)].Color.R,
                        Statics[htStatics(StaticLyricHelperTop)].Color.G,
                        Statics[htStatics(StaticLyricHelperTop)].Color.B,
                        Statics[htStatics(StaticLyricHelperTop)].Color.A * Statics[htStatics(StaticLyricHelper)].Alpha * alpha);

                    distance = Lyrics[htLyrics(LyricMainTop)].GetCurrentLyricPosX() - Rect.X - Rect.W;
                    CDraw.DrawTexture(Statics[htStatics(StaticLyricHelperTop)].Texture,
                                      new SRectF(Rect.X + distance * (1f - time / totaltime), Rect.Y, Rect.W, Rect.H, Rect.Z), Color);
                }
            }

            if (song.IsDuet)
            {
                if (_TimeToFirstNoteDuet > CSettings.LyricHelperMinTime && _RemainingTimeToFirstNoteDuet > 0f && _RemainingTimeToFirstNoteDuet < CSettings.LyricHelperEnableTime)
                {
                    float time      = _RemainingTimeToFirstNoteDuet;
                    float totaltime = CSettings.LyricHelperMoveTime;

                    if (totaltime > _TimeToFirstNoteDuet)
                    {
                        totaltime = _TimeToFirstNoteDuet;
                    }

                    if (time > totaltime)
                    {
                        time = totaltime;
                    }

                    SRectF Rect = Statics[htStatics(StaticLyricHelperDuet)].Rect;

                    SColorF Color = new SColorF(
                        Statics[htStatics(StaticLyricHelperDuet)].Color.R,
                        Statics[htStatics(StaticLyricHelperDuet)].Color.G,
                        Statics[htStatics(StaticLyricHelperDuet)].Color.B,
                        Statics[htStatics(StaticLyricHelperDuet)].Color.A * Statics[htStatics(StaticLyricHelperDuet)].Alpha * alpha);

                    float distance = Lyrics[htLyrics(LyricMainDuet)].GetCurrentLyricPosX() - Rect.X - Rect.W;
                    CDraw.DrawTexture(Statics[htStatics(StaticLyricHelperDuet)].Texture,
                                      new SRectF(Rect.X + distance * (1f - time / totaltime), Rect.Y, Rect.W, Rect.H, Rect.Z),
                                      Color);
                }
            }
        }
コード例 #2
0
ファイル: CScreenSing.cs プロジェクト: zhaozw/Vocaluxe
        public override bool UpdateGame()
        {
            bool Finish = false;

            if (CSound.IsPlaying(_CurrentStream) || CSound.IsPaused(_CurrentStream))
            {
                _CurrentTime = CSound.GetPosition(_CurrentStream);

                if (_FinishTime != 0 && _CurrentTime >= _FinishTime)
                {
                    Finish = true;
                }
            }
            else
            {
                Finish = true;
            }

            if (Finish)
            {
                LoadNextSong();
            }

            UpdateSongText();

            if (_FadeOut)
            {
                return(true);
            }

            UpdateTimeLine();

            CGame.UpdatePoints(_CurrentTime);
            UpdateLyrics();

            float[] Alpha = CalcFadingAlpha();
            if (Alpha != null)
            {
                Lyrics[htLyrics(LyricMain)].Alpha = Alpha[0];
                Lyrics[htLyrics(LyricSub)].Alpha  = Alpha[1];

                Lyrics[htLyrics(LyricMainTop)].Alpha = Alpha[0];
                Lyrics[htLyrics(LyricSubTop)].Alpha  = Alpha[1];

                Statics[htStatics(StaticLyrics)].Alpha    = Alpha[0];
                Statics[htStatics(StaticLyricsTop)].Alpha = Alpha[0];

                Statics[htStatics(StaticLyricHelper)].Alpha    = Alpha[0];
                Statics[htStatics(StaticLyricHelperTop)].Alpha = Alpha[0];

                for (int p = 0; p < CGame.NumPlayer; p++)
                {
                    SingNotes[htSingNotes(SingBars)].SetAlpha(NoteLines[p], Alpha[CGame.Player[p].LineNr * 2]);
                }

                if (Alpha.Length > 2)
                {
                    Lyrics[htLyrics(LyricMainDuet)].Alpha = Alpha[0];
                    Lyrics[htLyrics(LyricSubDuet)].Alpha  = Alpha[1];

                    Statics[htStatics(StaticLyricsDuet)].Alpha      = Alpha[0];
                    Statics[htStatics(StaticLyricHelperDuet)].Alpha = Alpha[0];

                    Lyrics[htLyrics(LyricMain)].Alpha = Alpha[2];
                    Lyrics[htLyrics(LyricSub)].Alpha  = Alpha[3];

                    Statics[htStatics(StaticLyrics)].Alpha      = Alpha[2];
                    Statics[htStatics(StaticLyricHelper)].Alpha = Alpha[2];
                }
            }


            for (int p = 0; p < CGame.NumPlayer; p++)
            {
                Texts[htTexts(TextScores[p, CGame.NumPlayer - 1])].Text = CGame.Player[p].Points.ToString("00000");
            }

            if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON)
            {
                float vtime = 0f;
                CVideo.VdGetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, ref vtime);
            }

            return(true);
        }