Exemple #1
0
 public void AddMusic()
 {
     add.Dispose();
     add = new AddMusic();
     if (!add.Visible)
         add.Show();
 }
Exemple #2
0
 public void AddMusic()
 {
     add.Dispose();
     add = new AddMusic();
     if (!add.Visible)
     {
         add.Show();
     }
 }
Exemple #3
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     this.IsFixedTimeStep     = false;
     this.IsMouseVisible      = true;
     Window.AllowUserResizing = false;
     Window.Title             = "Best Rubik's Cube Game";
     this.IsFixedTimeStep     = false;
     loading       = new LoadingScreen(Content);
     loadingThread = new Thread(Load);
     loadingThread.Start();
     add = new AddMusic();
     base.Initialize();
 }
Exemple #4
0
 public Music(GraphicsDeviceManager graphics, GraphicsDevice graphicsDevice, ContentManager content)
 {
     WhichGenre = "default";
     add = new AddMusic();
     defaultSong = content.Load<Song>("music/bg-music");
     if (Directory.Exists("c:/users/" + Environment.UserName + "/Documents/RubikCube/Songs"))
     {
         string[] files = Directory.GetFiles("c:/users/" + Environment.UserName + "/Documents/RubikCube/Songs",
             "*", SearchOption.TopDirectoryOnly);
         int fCount = files.Length;
         if (fCount > 0)
         {
             string name = files[0].Substring(36 + Environment.UserName.Length,
                 files[0].Length - (36 + Environment.UserName.Length));
             var ctor = typeof(Song).GetConstructor(
                      BindingFlags.NonPublic | BindingFlags.Instance, null,
                      new[] { typeof(string), typeof(string), typeof(int) }, null);
             Song currSong1 =
                 (Song)
                     ctor.Invoke(new object[]
                         {
                             add.currentSong,
                             @"c:/users/" + Environment.UserName + "/Documents/RubikCube/Songs/" +
                             name,
                             0
                         });
             MediaPlayer.Play(currSong1);
         }
         else
         {
             currSong = defaultSong;
         }
     }
     else
     {
         currSong = defaultSong;
     }
     //MediaPlayer.Play(currSong);
 }
Exemple #5
0
 public Music(GraphicsDeviceManager graphics, GraphicsDevice graphicsDevice, ContentManager content)
 {
     WhichGenre  = "default";
     add         = new AddMusic();
     defaultSong = content.Load <Song>("music/bg-music");
     if (Directory.Exists("c:/users/" + Environment.UserName + "/Documents/RubikCube/Songs"))
     {
         string[] files = Directory.GetFiles("c:/users/" + Environment.UserName + "/Documents/RubikCube/Songs",
                                             "*", SearchOption.TopDirectoryOnly);
         int fCount = files.Length;
         if (fCount > 0)
         {
             string name = files[0].Substring(36 + Environment.UserName.Length,
                                              files[0].Length - (36 + Environment.UserName.Length));
             var ctor = typeof(Song).GetConstructor(
                 BindingFlags.NonPublic | BindingFlags.Instance, null,
                 new[] { typeof(string), typeof(string), typeof(int) }, null);
             Song currSong1 =
                 (Song)
                 ctor.Invoke(new object[]
             {
                 add.currentSong,
                 @"c:/users/" + Environment.UserName + "/Documents/RubikCube/Songs/" +
                 name,
                 0
             });
             MediaPlayer.Play(currSong1);
         }
         else
         {
             currSong = defaultSong;
         }
     }
     else
     {
         currSong = defaultSong;
     }
     //MediaPlayer.Play(currSong);
 }
Exemple #6
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     this.IsFixedTimeStep = false;
     this.IsMouseVisible = true;
     Window.AllowUserResizing = false;
     Window.Title = "Best Rubik's Cube Game";
     this.IsFixedTimeStep = false;
     loading = new LoadingScreen(Content);
     loadingThread = new Thread(Load);
     loadingThread.Start();
     add = new AddMusic();
     base.Initialize();
 }