Esempio n. 1
0
 /// <summary>
 /// Plays the specified track.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="repeating"></param>
 public static void PlayTrack(byte id, bool repeating)
 {
     if (TMBAW_Game.IsMusicMuted)
     {
         return;
     }
     if (id != CurrentId)
     {
         MediaPlayer.Stop();
         CurrentId    = id;
         _currentSong = SoundtrackDb.GetSong(CurrentId);
         MediaPlayer.Play(_currentSong);
         MediaPlayer.IsRepeating = repeating;
     }
 }
        public void TransferDataToWorldData()
        {
            GameWorld.WorldData.TileIDs = (TileType[])(object)TileIDs;
            GameWorld.WorldData.WallIDs = (TileType[])(object)WallIDs;

            GameWorld.WorldData.LevelWidth  = LevelWidth;
            GameWorld.WorldData.LevelHeight = LevelHeight;

            GameWorld.WorldData.BackgroundId = BackgroundId;
            GameWorld.WorldData.SoundtrackId = SoundtrackId;

            // Need to convert metadata xml string array to dict.
            GameWorld.WorldData.MetaData.Clear();
            if (MetaData != null)
            {
                foreach (var keyVal in MetaData)
                {
                    if (keyVal == null)
                    {
                        continue;
                    }
                    string[] keyValSeparated = keyVal.Split(' ');
                    int.TryParse(keyValSeparated[0], out int key);
                    GameWorld.WorldData.MetaData.Add(key, keyValSeparated[1]);
                }
            }

            GameWorld.WorldData.IsTopDown     = IsTopDown;
            GameWorld.WorldData.LevelName     = LevelName;
            GameWorld.WorldData.HasClouds     = HasClouds;
            GameWorld.WorldData.HasSun        = HasSun;
            GameWorld.WorldData.IsRaining     = IsRaining;
            GameWorld.WorldData.IsSnowing     = IsSnowing;
            GameWorld.WorldData.IsDarkOutline = IsDarkOutline;
            GameWorld.WorldData.SunLightColor = SunLightColor;

            GameWorld.WorldData.Song = SoundtrackDb.GetSong(1);
        }