/// <summary> /// Function to generate an XML (usefull to override an existing one). /// </summary> public void CreateInfoPlayerXML(InfoPlayer ip, string destinyFolder) { XmlSerializer serializer = new XmlSerializer(typeof(InfoPlayer)); FileStream stream = new FileStream(destinyFolder + nameXMLFile, FileMode.Create); serializer.Serialize(stream, ip); //we write on that file stream.Close(); }
/// <summary> /// Function to extract the database from the xml in the specified directory /// </summary> /// <returns>The infoplayer (not the database because there's only one) contained in the xml</returns> public InfoPlayer LoadInfoPlayerXML(string sourceFolder) { XmlSerializer serializer = new XmlSerializer(typeof(InfoPlayer)); FileStream stream = new FileStream(sourceFolder + nameXMLFile, FileMode.Open); InfoPlayer ip = serializer.Deserialize(stream) as InfoPlayer; stream.Close(); return(ip); }
public void LoadDefaultData() { string pathDSF = ControlManager.Instance.PathToDefaultSaveValue; InfoWeaponsDatabase iwd = _infoWeaponsXMLManager.LoadInfoWeaponsDatabaseXML(pathDSF); InventoryManager.Instance.SetInventoryWeapons(iwd.DataBase); InfoArmorDatabase iad = _infoArmorXMLManager.LoadInfoArmorDatabaseXML(pathDSF); InventoryManager.Instance.SetInventoryArmor(iad.Database); InfoPlayer ip = _infoPlayerXMLManager.LoadInfoPlayerXML(pathDSF); StatsManager.Instance.InfoPlayer = ip; }
public void LoadAllData() { string pathSG = ControlManager.Instance.PathToSaveGame; InfoWeaponsDatabase iwd = _infoWeaponsXMLManager.LoadInfoWeaponsDatabaseXML(pathSG); InventoryManager.Instance.SetInventoryWeapons(iwd.DataBase); InfoArmorDatabase iad = _infoArmorXMLManager.LoadInfoArmorDatabaseXML(pathSG); InventoryManager.Instance.SetInventoryArmor(iad.Database); InfoItemsDatabase iim = _infoItemsXMLManager.LoadInfoItemsDatabaseXML(pathSG); InventoryManager.Instance.SetInventoryItems(iim.DataBase); InfoPlayer ip = _infoPlayerXMLManager.LoadInfoPlayerXML(pathSG); StatsManager.Instance.InfoPlayer = ip; }
public void SaveInfoPlayerIntoXML(InfoPlayer infoPlayer) { _infoPlayerXMLManager.CreateInfoPlayerXML(infoPlayer, ControlManager.Instance.PathToSaveGame); }