예제 #1
0
        public void MergeAllData(DefaultDataCollection defaultDataCollection, GameDataCollection gameDataCollection)
        {
            // Merge data from default do game

            // Add all buildings do Game Collection
            gameDataCollection.AllBuildings = defaultDataCollection.Buildings;
            gameDataCollection.Countrys     = new StaticDictionary <GameCountry>();

            foreach (var country in defaultDataCollection.Countries.Values)
            {
                gameDataCollection.Countrys.Add(country.TagName, new GameCountry(country));
            }

            foreach (var country in gameDataCollection.Countrys.Values)
            {
                country.Regions = new StaticDictionary <GameRegion>();
                foreach (var region in defaultDataCollection.Regions.Values.Where(x => x.CountryTag == country.TagName))
                {
                    var gameRegion = new GameRegion(region);

                    gameRegion.City = new GameCity(defaultDataCollection.Citys[region.CityTag]);
                    MergeBuildings(defaultDataCollection, gameRegion.City, RequiredEnum.City);

                    gameRegion.Farm = new GameFarm(defaultDataCollection.Farms[region.FarmTag]);
                    MergeBuildings(defaultDataCollection, gameRegion.Farm, RequiredEnum.Farm);

                    gameRegion.Port = new GamePort(defaultDataCollection.Ports[region.PortTag]);
                    MergeBuildings(defaultDataCollection, gameRegion.Port, RequiredEnum.Port);

                    gameRegion.Industry = new GameIndustry(defaultDataCollection.Industries[region.IndustryTag]);
                    MergeBuildings(defaultDataCollection, gameRegion.Industry, RequiredEnum.Industry);

                    gameRegion.Infrastructure = new GameInfrastructure(defaultDataCollection.Infrastructures[region.InfrastructureTag]);
                    MergeBuildings(defaultDataCollection, gameRegion.Infrastructure, RequiredEnum.Infrastructure);

                    country.Regions.Add(gameRegion.TagName, gameRegion);
                }

                foreach (var provinceTag in defaultDataCollection.Regions.Values.Select(x => x.ProvinceTag).Distinct())
                {
                    foreach (var province in defaultDataCollection.Provinces.Values.Where(x => x.TagName == provinceTag))
                    {
                        country.Provinces.Add(province.TagName, new GameProvince(province));
                    }
                }
            }


            gameDataCollection.AllBuildings = defaultDataCollection.Buildings;


            //MergeRegionData(defaultDataCollection);

            //MergeBuildings(defaultDataCollection.Infrastructures, defaultDataCollection.Buildings);
            //MergeBuildings(defaultDataCollection.Farms, defaultDataCollection.Buildings);
        }
예제 #2
0
 public SelectManager(DefaultDataCollection defaultDataCollection, GameDataCollection gameDataCollection)
 {
     DefaultCollection = defaultDataCollection;
     GameCollection    = gameDataCollection;
 }