/// <summary> /// This event function is called by the country dropdown script. It has been linked on the UI directly. /// </summary> public void ProvinceSelected(int index) { string provinceName = provincesDropdown.options [index].text; string countryName = countriesDropdown.options[countriesDropdown.value].text; int provinceIndex = map.GetProvinceIndex(countryName, provinceName); map.BlinkProvince(provinceIndex, Color.blue, Color.white, 2f, 0.1f); }
IEnumerator TransferProvinces() { // Reset map map.ReloadData(); map.Redraw(); // Transfer some German provinces to Poland int countryIndex = map.GetCountryIndex("Poland"); // Step 1: Focus on area of provinces map.showProvinces = true; map.drawAllProvinces = true; map.FlyToProvince("Germany", "Brandenburg", 1f, 0.04f); yield return(new WaitForSeconds(1f)); // Step 2: Mark provinces string[] provincesToTransfer = new string[] { "Brandenburg", "Mecklenburg-Vorpommern", "Sachsen-Anhalt", "Sachsen", "Thüringen" }; foreach (string provinceName in provincesToTransfer) { int provinceIndex = map.GetProvinceIndex("Germany", provinceName); map.BlinkProvince(provinceIndex, Color.white, Color.red, 2f, 0.15f); LineMarkerAnimator lma = map.AddLine(new Vector2[] { map.provinces [provinceIndex].center, map.countries [countryIndex].center }, Color.yellow, 1f, 0.15f); lma.dashInterval = 0.0001f; lma.dashAnimationDuration = 0.3f; lma.drawingDuration = 2.5f; lma.autoFadeAfter = 0.5f; lma.fadeOutDuration = 0f; } yield return(new WaitForSeconds(3f)); // Step 3: transfer some German provinces to Poland foreach (string provinceName in provincesToTransfer) { Province province = map.GetProvince(provinceName, "Germany"); if (!map.CountryTransferProvinceRegion(countryIndex, province.mainRegion, false)) { Debug.LogError("Could not transfer province " + provinceName + " to Poland."); } } map.Redraw(); // End map.FlyToCountry("Poland", 1f, 0.04f); map.BlinkCountry("Poland", Color.white, Color.green, 2f, 0.15f); Debug.Log("Done."); }