Пример #1
0
 private void CoolDownStart()
 {
     CountDownBar.Value      = 100;
     CountDownBar.Foreground = new SolidColorBrush(Colors.Turquoise);
     GameDescTextBlock.Text  = $"Round {++_roundNum} is coming...";
     CountDownAnimation.Begin();
     _gameStatus = true;
 }
Пример #2
0
        private async Task GameStarted()
        {
            ClearSongInfo();
            CountDownBar.Value      = 100;
            CountDownBar.Foreground = new SolidColorBrush(Colors.HotPink);
            GameDescTextBlock.Text  = $"Round {_roundNum} ";
            await PlaySong();

            CountDownAnimation.Begin();
            _gameStatus = false;
        }
Пример #3
0
        //private void StartButton_Click(object sender, RoutedEventArgs e)
        //{
        //    CoolDownStart();
        //}

        private async void AfterSongStoped(object sender, RoutedEventArgs e)
        {
            if (SongPlayer.CurrentState != MediaElementState.Stopped || _gameStatus == true)
            {
                return;
            }

            //  Show Song info
            SongNameText.Text = CurrentSong.Name;
            AlbumTest.Text    = CurrentSong.Album.Name;
            ArtistText.Text   = CurrentSong.Artist;
            ScoreText.Text    = _ttlScore.ToString();

            if (_roundNum > 4) //   wether go on game or not?
            {
                CountDownAnimation.Stop();
                CountDownBar.Value       = 100;
                GetSongButton.Visibility = Visibility.Visible;
                string result       = "correct songs: ";
                var    correctSongs = SongList.Where(song => song.GameMark == true);
                foreach (var song in correctSongs)
                {
                    result += $" [{song.Name}] ";
                    song.AfterPlayed();
                }
                GameDescTextBlock.Text = "Game finished!" + $"  You got {correctSongs.Count()} " + result;
                foreach (var song in SongList)
                {
                    song.ReInitialize();
                }
                await SongManager.SaveDataToXmlAsync(_correctSongs);

                return;
            }
            CoolDownStart();
        }