public void OnConfigure()
 {
     if (_producers.Count == 0)
     {
         try
         {
             //_producers
             XmlDataInfo prodInfo = Utils.LoadXmlAssetFile("data/idle_producers", "idle_producers");
             if (prodInfo != null)
             {
                 foreach (XElement element in prodInfo.MainNodeElements)
                 {
                     BaseDataAddon newProd = new BaseDataAddon();
                     newProd.LoadData(prodInfo, element);
                     _producers.Add(newProd.Type, newProd);
                 }
             }
             //_storages
             XmlDataInfo storInfo = Utils.LoadXmlAssetFile("data/idle_res_storages", "idle_res_storages");
             if (storInfo != null)
             {
                 foreach (XElement element in storInfo.MainNodeElements)
                 {
                     BaseDataAddon newStor = new BaseDataAddon();
                     newStor.LoadData(storInfo, element);
                     _storages.Add(newStor.Type, newStor);
                 }
             }
             //_resStacks
             XmlDataInfo resInfo = Utils.LoadXmlAssetFile("data/idle_res_stacks", "idle_res_stacks");
             if (resInfo != null)
             {
                 foreach (XElement element in resInfo.MainNodeElements)
                 {
                     BaseDataAddon newRes = new BaseDataAddon();
                     newRes.LoadData(resInfo, element);
                     _resStacks.Add(newRes.Type, newRes);
                 }
             }
             //_stubs
             XmlDataInfo stubInfo = Utils.LoadXmlAssetFile("data/idle_stubs", "idle_stubs");
             if (stubInfo != null)
             {
                 foreach (XElement element in stubInfo.MainNodeElements)
                 {
                     BaseDataAddon newStub = new BaseDataAddon();
                     newStub.LoadData(stubInfo, element);
                     _stubs.Add(newStub.Type, newStub);
                 }
             }
         }
         catch (System.Exception wyjatek)
         {
             Debug.LogError("Ogólny wyjątek: " + wyjatek.Message);
         }
         _buildingsBuilt.Clear();
     }
 }
Exemplo n.º 2
0
 public void OnConfigure()
 {
     if (_basicItemTemplates.Count == 0)
     {
         //przedmioty ogolnie
         XmlDataInfo itemsInfo = Utils.LoadXmlAssetFile("data/items", "items");
         if (itemsInfo != null)
         {
             foreach (XElement element in itemsInfo.MainNodeElements)
             {
                 ItemDataAddon newItem = new ItemDataAddon();
                 newItem.LoadData(itemsInfo, element);
                 _basicItemTemplates.Add(newItem.Type, newItem);
             }
         }
     }
     if (_weaponTemplates.Count == 0)
     {
         //bronie
         XmlDataInfo weaponsInfo = Utils.LoadXmlAssetFile("data/weapons", "weapons");
         if (weaponsInfo != null)
         {
             foreach (XElement element in weaponsInfo.MainNodeElements)
             {
                 WeaponDataAddon newItem = new WeaponDataAddon();
                 newItem.LoadData(weaponsInfo, element);
                 _weaponTemplates.Add(newItem.Type, newItem);
             }
         }
         //desctructibles
         XmlDataInfo destrInfo = Utils.LoadXmlAssetFile("data/destructibles", "destructibles");
         if (destrInfo != null)
         {
             foreach (XElement element in destrInfo.MainNodeElements)
             {
                 BaseDataAddon newItem = new BaseDataAddon();
                 newItem.LoadData(destrInfo, element);
                 _destructibles.Add(newItem.Type, newItem);
             }
         }
     }
     if (_enemyTemplates.Count == 0)
     {
         //wrogowie
         XmlDataInfo enemyInfo = Utils.LoadXmlAssetFile("data/enemies", "enemies");
         if (enemyInfo != null)
         {
             foreach (XElement element in enemyInfo.MainNodeElements)
             {
                 BaseDataAddon nowyEnemyInfo = new BaseDataAddon();
                 nowyEnemyInfo.LoadData(enemyInfo, element);
                 _enemyTemplates.Add(nowyEnemyInfo.Type, nowyEnemyInfo);
             }
         }
     }
 }
 public void OnConfigure()
 {
     if (_characterTemplates.Count == 0)
     {
         //postacie
         XmlDataInfo charInfo = Utils.LoadXmlAssetFile("data/characters", "characters");
         if (charInfo != null)
         {
             foreach (XElement element in charInfo.MainNodeElements)
             {
                 BaseDataAddon nowyCharData = new BaseDataAddon();
                 nowyCharData.LoadData(charInfo, element);
                 _characterTemplates.Add(nowyCharData.Type, nowyCharData);
             }
         }
     }
     ThePlayer = new PlayerCharacter(FindCharacterData("Player"));
 }
 public void OnConfigure()
 {
     if (_medicalEventTemplates.Count == 0)
     {
         //zdarzenia
         XmlDataInfo eventsInfo = Utils.LoadXmlAssetFile("data/medical_events", "medical_events");
         if (eventsInfo != null)
         {
             foreach (XElement element in eventsInfo.MainNodeElements)
             {
                 MedicalEvent noweZdarzenie = new MedicalEvent();
                 noweZdarzenie.LoadData(eventsInfo, element);
                 _medicalEventTemplates.Add(noweZdarzenie.Type, noweZdarzenie);
             }
         }
         //substancje
         XmlDataInfo substancesInfo = Utils.LoadXmlAssetFile("data/medical_substances", "substances");
         if (substancesInfo != null)
         {
             foreach (XElement element in substancesInfo.MainNodeElements)
             {
                 Substance nowaSubstancja = new Substance();
                 nowaSubstancja.LoadData(substancesInfo, element);
                 _substancesTemplates.Add(nowaSubstancja);
             }
         }
         //przedmioty lecznicze (ladowanie substancji musi tu byc skonczone poniewaz sa one uzywane do tworzenia klonow substancji aktywnych w przedmiotach)
         XmlDataInfo medicalItemsInfo = Utils.LoadXmlAssetFile("data/medical_items", "medical_items");
         if (medicalItemsInfo != null)
         {
             foreach (XElement element in medicalItemsInfo.MainNodeElements)
             {
                 MedicalItemDataAddon nowyPrzedmiot = new MedicalItemDataAddon();
                 nowyPrzedmiot.LoadData(medicalItemsInfo, element, _substancesTemplates);
                 _medicalItemTemplates.Add(nowyPrzedmiot.Type, nowyPrzedmiot);
             }
         }
     }
     if (_primalDiseasesTemplates.Count == 0)
     {
         try
         {
             //szanse
             XmlDataInfo chancesInfo = Utils.LoadXmlAssetFile("data/medical_chances", "chances");
             if (chancesInfo != null)
             {
                 foreach (XElement element in chancesInfo.MainNodeElements)
                 {
                     BaseDataAddon nowaSzansaNaZdarzenie = new BaseDataAddon();
                     nowaSzansaNaZdarzenie.LoadData(chancesInfo, element);
                     if ((string)nowaSzansaNaZdarzenie["last"] == "")
                     {
                         _primalDiseasesTemplates.Add(nowaSzansaNaZdarzenie);
                     }
                     else
                     {
                         _derivedDiseasesTemplates.Add(nowaSzansaNaZdarzenie);
                     }
                 }
             }
         }
         catch (System.Exception wyjatek)
         {
             Debug.LogError("Ogólny wyjątek: " + wyjatek.Message);
         }
     }
 }