Exemplo n.º 1
0
        /// <summary>
        /// Scans the GameMode folder for compatible GameModes and loads them.
        /// </summary>
        public void LoadGameModes()
        {
            //Unload and clear all old GameModes first:
            foreach (GameMode oldGameMode in _gameModes)
            {
                oldGameMode.FreeResources();
            }
            _gameModes.Clear();

            string gameModeFilePath = "";
            string[] folders = System.IO.Directory.GetDirectories(GameModeFileProvider.GameModeFolder, "*.*", System.IO.SearchOption.TopDirectoryOnly);

            foreach (string folder in folders)
            {
                //Check if the GameMode.dat file exists inside the selected folder:
                gameModeFilePath = GameModeFileProvider.GetGameModeFile(folder);

                if (System.IO.File.Exists(gameModeFilePath))
                {
                    var newGameMode = new GameMode(gameModeFilePath);
                    if (newGameMode.IsValid)
                        _gameModes.Add(newGameMode);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets a new active GameMode.
 /// </summary>
 public void SetActiveGameMode(GameMode gameMode)
 {
     _activeGameMode = _gameModes.IndexOf(gameMode);
 }