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)); } }
void MakeClick(float x, float y) { if (enableClearFogOnClick) { // Smoothly clear fog at position map.FogOfWarIncrement(x, y, -0.25f, 0.075f); } else if (enableClearFogCountryOnClick) { // Get country index at position Vector2 position = new Vector2(x, y); int countryIndex = map.GetCountryIndex(position); if (countryIndex >= 0) { // Get fog alpha at position and toggle its state float alpha = map.FogOfWarGet(x, y); if (alpha > 0) { // Fog is visible, clear it on entire country map.FogOfWarSetCountry(countryIndex, 0); } else { // Fog is clear, show it on entire country map.FogOfWarSetCountry(countryIndex, 1); } } } }
void Start() { map = WMSK.instance; // Adjacent countries are not selectable foreach (string country in peripheralCountries) { int sourcePeripheralCountryIndex = map.GetCountryIndex(country); if (sourcePeripheralCountryIndex < 0) { Debug.Log("Countries not found " + country); } map.countries[sourcePeripheralCountryIndex].allowProvincesHighlight = false; map.countries[sourcePeripheralCountryIndex].allowHighlight = false; } // We want only to show names if they are Spanish provinces map.OnCountryEnter += Map_OnCountryEnter; // We init the game info from JSON file ProvincesSettings provincesSettings = JSONProvinceSettings.getInstance(); Action <ProvinceSettings> action = new Action <ProvinceSettings>(initProvince); Array.ForEach <ProvinceSettings>(provincesSettings.provinces, action); map.ToggleProvinceSurface(map.GetProvinceIndex("Spain", "Las Palmas"), true, new Color(231f / 255f, 182f / 255f, 207f / 255f)); map.ToggleProvinceSurface(map.GetProvinceIndex("Spain", "Murcia"), true, new Color(97f / 255f, 85f / 255f, 80f / 255f)); map.ToggleProvinceSurface(map.GetProvinceIndex("Spain", "País Vasco"), true, new Color(215f / 255f, 196f / 255f, 157f / 255f)); map.ToggleProvinceSurface(map.GetProvinceIndex("Spain", "Valencia"), true, new Color(164f / 255f, 231f / 255f, 223f / 255f)); }
/// <summary> /// Locates coastal points for a sample country and add custom sprites over that line /// </summary> void FindCoast() { int franceIndex = map.GetCountryIndex("France"); List <Vector2> points = map.GetCountryCoastalPoints(franceIndex); points.ForEach((point) => AddRandomSpriteAtPosition(point)); if (points.Count > 0) { map.FlyToLocation(points[0], 2, 0.2f); } }
private void Map_OnCountryEnter(int countryIndex, int regionIndex) { if (countryIndex == map.GetCountryIndex("Spain")) { map.showProvinceNames = true; } else { map.showProvinceNames = false; } }
void ChangeCountryOwnerShip(float x, float y) { int countryIndex = map.GetCountryIndex(new Vector2(x, y)); Country country = map.countries[countryIndex]; if (country.attrib["player"] == 1) { country.attrib["player"] = 2; } else { country.attrib["player"] = 1; } PaintCountries(); }
void FlyToCountry(string countryName) { int countryIndex = map.GetCountryIndex(countryName); FlyToCountry(countryIndex); }