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)); }
internal static ProvincesSettings getInstance() { if (_instance == null) { _instance = new ProvincesSettings(); string path = "Assets/Independencia/ProvincesSettings.json"; StreamReader reader = new StreamReader(path); String provinceReader = reader.ReadToEnd(); reader.Close(); _instance = JsonUtility.FromJson <ProvincesSettings>(provinceReader); } return(_instance); }