void populate()
        {
            foreach (GameCountry country in GameCountry.GetStartingGameCountries())
            {
                if (country == null)
                {
                    Debug.Log("Country shouldn't be null here.");
                    continue;
                }
                bool countryHasBeenSpawned = mapUtils.DoesCountryExist(country.Name);

                foreach (ProvinceIdentifier identifier in country.GetProvinceIdentifiers())
                {
                    if (!countryHasBeenSpawned)
                    {
                        mapUtils.SpawnNewCountry(identifier, country);
                        countryHasBeenSpawned = true;
                    }
                    else
                    {
                        mapUtils.TransferControlOfProvince(identifier, country);
                    }
                }
                mapUtils.ToggleNationFlagsOnMap(true);
            }
        }
Esempio n. 2
0
        public void SpawnNewCountry(ProvinceIdentifier id, GameCountry newCountry)
        {
            Debug.Assert(id != null);
            Debug.Assert(newCountry != null);
            Debug.Log("Spawning new country " + newCountry.Name + " from province  : " + id.Province);
            var formerProvince = _map.GetProvince(id.Province, id.Nation);

            _map.ProvinceToCountry(formerProvince, newCountry.Name);
            var newCountryIndex = _map.GetCountryIndex(_map.GetCountry(newCountry.Name));
            //_map.ToggleCountryMainRegionSurface(newCountryIndex,true, _flagProvider.getFlag(newCountry.Flag));
        }
Esempio n. 3
0
        public void TransferControlOfProvince(ProvinceIdentifier id, GameCountry newCountry)
        {
            Debug.Assert(id != null);
            Debug.Assert(newCountry != null);
            Debug.Log("Transferring control of province  : " + id.Province);
            var province        = _map.GetProvince(id.Province, id.Nation);
            var newCountryIndex = _map.GetCountryIndex(_map.GetCountry(newCountry.Name));

            _map.CountryTransferProvinceRegion(newCountryIndex, province.mainRegion);
            //_map.ToggleCountryMainRegionSurface(newCountryIndex,true, _flagProvider.getFlag(newCountry.Flag));
            //TODO: This graphical effect appears to be buggy.
        }
Esempio n. 4
0
 public void ToggleNationFlagsOnMap(bool useFlags)
 {
     foreach (GameCountry country in GameCountry.GetStartingGameCountries())
     {
         if (!DoesCountryExist(country.Name))
         {
             continue;
         }
         var newCountryIndex = _map.GetCountryIndex(_map.GetCountry(country.Name));
         _map.ToggleCountryMainRegionSurface(newCountryIndex, useFlags, _flagProvider.getFlag(country.Flag));
     }
 }
Esempio n. 5
0
        private void PopulateBuildings(GameData data)
        {
            GameCountry country = GameManager.SystemManager.GameDataCollection.Countrys[data.TagCountry];
            GameCity city = country.Regions.Values.Where(x => x.City.TagName == data.TagName).Select(x=>x.City).SingleOrDefault();
            Texts["CityName"].GetComponent<Text>().text = city.Name;
            int count = 1;
            foreach (var chain in GameManager.SystemManager.GameDataCollection.AllBuildings.Values)
            {
                if (!Buildings.ContainsKey(chain.BuildingChain))
                {
                    Buildings.Add(chain.BuildingChain, CreateButton(_panel.transform, new Vector2(200, 20), new Vector2(0, -(30 * count)), chain.Name,
                    delegate { OnCancel(); }));
                    count++;
                }
            }

            foreach (var complete in city.ListOfCompleteBuilding.Values)
            {
                if (Buildings.ContainsKey(complete.BuildingChain))
                {
                    var go = Buildings[complete.BuildingChain];
                    go.GetComponentInChildren<Text>().text = city.ListOfPotentialBuilding[complete.UpgradesTo].Name;
                }
            }

            

            //int count = 1;
            //foreach (var value in city.ListOfPotentialBuilding.Values.Where(x=> string.IsNullOrEmpty(x.UpgradesFrom)))
            //{

            //    Buildings.Add(value.TagName, CreateButton(_panel.transform, new Vector2(200, 20), new Vector2(0, -(30 * count)), value.Name,
            //        delegate { OnCancel(); }));
            //    count++;
            //}


            //foreach (var value in city.ListOfCompleteBuilding.Values)
            //{
            //    // if Building is built and there is next level show that

                
                
            //    CreateButton(_panel.transform, new Vector2(200, 20), new Vector2(0, -(30 * count)), value.Name,
            //        delegate { OnCancel(); });
            //    count++;
            //}
        }