예제 #1
0
        protected override void OnStartRunning()
        {
            Debug.Log("CACHE READ START!");

            _blobAssetReferences = new List <IDisposable>();

            var definitions = new DefinitionsLoad();

            definitions.ReadCache(CacheFolder);

            var areas = new AreasLoad();

            areas.ReadCache(CacheFolder);

            var regions = new RegionsLoad();

            regions.ReadCache(CacheFolder);

            var supers = new SuperRegionsLoad();

            supers.ReadCache(CacheFolder);

            var countries = new CountryColorsLoad();

            countries.ReadCache(CacheFolder);

            var provinces = new ProvinceHistoryLoad();

            provinces.ReadCache(CacheFolder);

            GenerateCountryEntities(in countries, out var countryList);
            GenerateProvinceEntities(in provinces, countryList, out var provList);

            CreateProvinceAreaLookups(in areas, provList, out var provinceToArea);
            CreateAreaRegionLookups(in regions, out var areaToRegion);
            CreateRegionSuperLookups(in supers, out var regionToSuper);

            CreateUpwardsSingleton(provinceToArea, areaToRegion, regionToSuper);

            CreateColorBlob(definitions.Colors, areas.AreaColors, regions.RegionColors, supers.Colors);

            Debug.Log("STARTUP ENTITIES CREATED!");
        }
예제 #2
0
        public void DebugGenerateColorMapBasedOffOfAreas()
        {
            var areas = new AreasLoad();

            areas.ReadCache(CacheFolder);

            var colorMap = new Texture2D(areas.ProvinceToAreas.Length, 1, TextureFormat.RGB24, false)
            {
                filterMode = FilterMode.Point
            };

            for (var index = 0; index < areas.ProvinceToAreas.Length; index++)
            {
                colorMap.SetPixel(index, 0, areas.AreaColors[areas.ProvinceToAreas[index]]);
            }

            colorMap.Apply();

            File.WriteAllBytes(Path.Combine(Application.dataPath, "Materials", "Maps", "DebugColorMap.png"),
                               colorMap.EncodeToPNG());

            Debug.Log("Debug Color Map generated.");
        }