#region Copyright
/*
--------------------------------------------------------------------------------
This source file is part of Xenocide
by Project Xenocide Team
For the latest info on Xenocide, see http://www.projectxenocide.com/
This work is licensed under the Creative Commons
Attribution-NonCommercial-ShareAlike 2.5 License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.
--------------------------------------------------------------------------------
*/
/*
* @file StaticTables.cs
* @date Created: 2007/03/24
* @author File creator: dteviot
* @author Credits: none
*/
#endregion
#region Using Statements
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Microsoft.Xna.Framework.Storage;
using ProjectXenocide.Model.StaticData;
using ProjectXenocide.Model.StaticData.Facilities;
using ProjectXenocide.Model.StaticData.Items;
using ProjectXenocide.Model.StaticData.Research;
using ProjectXenocide.Model.StaticData.Battlescape;
#endregion
namespace ProjectXenocide.Model
{
///
/// The root class that holds all "model" (as in model-view) data that is fixed, but loaded from XML files
///
/// That is, things like weapon and craft stats, facilities, etc.
public class StaticTables
{
///
/// Read the static data from the files it's stored in
///
public StaticTables()
{
xnetEntryList = new XNetEntryCollection(DataDirectory + "xnet.xml");
facilityList = new FacilityInfoCollection(DataDirectory + "facility.xml", xnetEntryList);
peopleNames = new PeopleNames(DataDirectory + "peopleNames.xml");
armorList = new ArmorCollection(DataDirectory + "combatant.xml");
}
///
/// Populate the tables
/// This function is needed because some items refer to Xenocide.StaticTables in their constructors
/// So we have to have created the StaticTables object before we create them
///
public void Populate()
{
itemList.Populate(DataDirectory + "item.xml", xnetEntryList);
startSettings.Populate(DataDirectory + "startsettings.xml");
researchGraph.Populate(DataDirectory + "research.xml");
combatantFactory.Populate(DataDirectory + "combatant.xml");
// additional validation checks
researchGraph.Validate(xnetEntryList, facilityList, itemList);
}
///
/// The X-Net entries
///
public XNetEntryCollection XNetEntryList { get { return xnetEntryList; } }
///
/// Stats for all the different types of Facilities
///
public FacilityInfoCollection FacilityList { get { return facilityList; } }
///
/// Stats for the different items
///
public ItemCollection ItemList { get { return itemList; } }
///
/// The directory holding all the XML data files.
///
public string DataDirectory { get { return StorageContainer.TitleLocation + "/Content/Schema/"; } }
///
/// Assorted configuration data for putting game into starting state
///
public StartSettings StartSettings { get { return startSettings; } }
///
/// Object holding lists of given and family names for all personnel
///
public PeopleNames PeopleNames { get { return peopleNames; } }
///
/// List of topics a player can (eventually) research
///
public ResearchGraph ResearchGraph { get { return researchGraph; } }
///
/// List of all the available armors that combatants can have
///
public ArmorCollection ArmorList { get { return armorList; } }
/// Builds combatants
public CombatantFactory CombatantFactory { get { return combatantFactory; } }
///
/// The X-Net entries
///
private XNetEntryCollection xnetEntryList;
///
/// Stats for all the different types of Facilities
///
private FacilityInfoCollection facilityList;
///
/// Stats for the different items
///
private ItemCollection itemList = new ItemCollection();
///
/// Assorted configuration data for putting game into starting state
///
private StartSettings startSettings = new StartSettings();
///
/// Object holding lists of given and family names for all personnel
///
private PeopleNames peopleNames;
///
/// List of topics a player can (eventually) research
///
private ResearchGraph researchGraph = new ResearchGraph();
///
/// List of all the available armors that combatants can have
///
private ArmorCollection armorList;
/// Builds combatants
private CombatantFactory combatantFactory = new CombatantFactory();
}
}