Example #1
0
        /// <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();
        }
Example #2
0
        /// <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);
        }
Example #3
0
        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;
        }
Example #4
0
        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;
        }
Example #5
0
 public void SaveInfoPlayerIntoXML(InfoPlayer infoPlayer)
 {
     _infoPlayerXMLManager.CreateInfoPlayerXML(infoPlayer, ControlManager.Instance.PathToSaveGame);
 }