public void LoadGamesFromXml(string file)
{
// Load defined XML games
GamesXmlFactory xml_games;
xml_games = new GamesXmlFactory ();
xml_games.Read (file);
Type type = typeof (GameXml);
int cnt = 0;
foreach (GameXmlDefinition game in xml_games.Definitions)
{
// If the game has variants the game definition is used as reference
// but only the variants are playable. The first variant is used as game (IsGame = true)
available_games.Add (new GameLocator (type, cnt++, game.Type, true));
switch (game.Type) {
case GameTypes.LogicPuzzle:
cnt_logic++;
break;
case GameTypes.Calculation:
cnt_calculation++;
break;
default:
break;
}
for (int i = 1; i < game.Variants.Count; i++)
{
available_games.Add (new GameLocator (type, cnt++, game.Type, false));
}
}
}