Ejemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent()
        {
            MusicPlayer mp = this._mainGame.GameManager.GetComponent <MusicPlayer>();
            StatusMaker sm = this._mainGame.GameManager.GetComponent <StatusMaker>();

            this._mainGame.Window.Title = mp.GetActiveSongName();

            //music minutes and seconds
            this._musicMinutes = mp.GetActiveSongDuration().Minutes;
            this._musicSeconds = mp.GetActiveSongDuration().Seconds;

            if (this._musicSeconds < 10)
            {
                this._musicTimeText = this._musicMinutes + ":0" + this._musicSeconds;
            }
            else
            {
                this._musicTimeText = this._musicMinutes + ":" + this._musicSeconds;
            }

            sm.GenerateStatus(-1, 0, 0, this._isSongFinished);

            this.NewGame();

            //game is paused when start
            this._mainGame.IsPaused = true;
        }
Ejemplo n.º 2
0
 private void Mp_BeforeSongArchiveClosed(object sender, EventArgs e)
 {
     if (sender != null && sender is MusicPlayer)
     {
         MusicPlayer mp = (MusicPlayer)sender;
         StatusMaker sm = this._mainGame.GameManager.GetComponent <StatusMaker>();
         if (mp.ActualSongId.HasValue)
         {
             if (this._actualSongScore > mp.SongArchive.GetHightScoreById(mp.ActualSongId.Value))
             {
                 mp.SongArchive.UpdateSongHightScore(mp.ActualSongId.Value, this._actualSongScore, sm.Status);
             }
         }
         //else
         //{
         //    mp.SongArchive.AddSongHightScore(mp.ActiveSong.Artist.Name, mp.ActiveSong.Name, score, sm.Status);
         //}
     }
 }
Ejemplo n.º 3
0
        private void Mp_SongChanged(object sender, EventArgs e)
        {
            if (sender != null && sender is MusicPlayer)
            {
                MusicPlayer mp = (MusicPlayer)sender;
                StatusMaker sm = this._mainGame.GameManager.GetComponent <StatusMaker>();
                //score metody
                sm.GenerateStatus(this._shieldHit, this._particleCatch, this._particlesPerGame, this._isSongFinished);
                Song prevSong = mp.PreviousSong;
                if (prevSong != null)
                {
                    Int32?searchForSong = mp.SongArchive.SearchByArtisName(prevSong.Artist.Name, prevSong.Name);
                    if (searchForSong.HasValue)
                    {
                        if (this._actualSongScore > mp.SongArchive.GetHightScoreById(searchForSong.Value))
                        {
                            mp.SongArchive.UpdateSongHightScore(searchForSong.Value, this._actualSongScore, sm.Status);
                        }
                    }
                    else
                    {
                        mp.SongArchive.AddSongHightScore(prevSong.Artist.Name, prevSong.Name, this._actualSongScore, sm.Status);
                    }
                }

                //reset score
                Int32?searchForSongActual = mp.SongArchive.SearchByArtisName(mp.ActiveSong.Artist.Name, mp.ActiveSong.Name);
                if (searchForSongActual.HasValue)
                {
                    this._actualSongHightScore = mp.SongArchive.GetHightScoreById(searchForSongActual.Value);
                    this._actualSongStatus     = mp.SongArchive.GetHightStatusById(searchForSongActual.Value);
                }
                else
                {
                    this._actualSongHightScore = 0;
                }

                this._mainGame.Window.Title = mp.GetActiveSongName();//MediaPlayer.Queue.ActiveSong.Artist.Name + "-" + MediaPlayer.Queue.ActiveSong.Name;

                this.NewGame();
            }
        }