public void SaveDefinitions() { Provinces = Provinces.OrderBy(p => p.ID).ToList(); int n = 0; // File.Mutate(filename, filename); using (System.IO.StreamWriter file = new System.IO.StreamWriter(Globals.MapOutputTotalDir + "map\\definition.csv", false, Encoding.GetEncoding(1252))) { file.Write("province;red;green;blue;x;x" + Environment.NewLine); foreach (var def in Provinces) { file.Write(def.ID + ";" + def.Color.R + ";" + def.Color.G + ";" + def.Color.B + ";x;x" + Environment.NewLine); } file.Close(); } }
public Form1() { InitializeComponent(); PlayerInventory.Clear(); foreach (string s in ProductName) { PlayerInventory.Add(s, 5); } if (!Countries.Any()) { Country Gaia = new Country(); Gaia.Name = "None"; Countries.Add(Gaia); Gaia.Color = Color.Gray; } if (!Provinces.Any()) { foreach (Label ctrl in Map.Controls) { MakeHex(ctrl); Province prv = new Province(ctrl); Provinces.Add(prv); ctrl.Click += new EventHandler(ProvinceClick); prv.Terrain = "water"; prv.Development = 1; prv.Fortifications = 0; ctrl.Text = "#"; GetByObject(ctrl).Owner = GetByName("None"); GetByName("None").Land.Add(prv); prv.Occ = null; } } TerrainBox.TextChanged += new EventHandler(TerrainChange); IEnumerable <Province> query = Provinces.OrderBy(n => n.ctrl.Name); Provinces = query.ToList(); PlayerCurrent = Provinces[150]; Provinces[150].Terrain = "grassland"; Tabs.SelectedIndexChanged += Tabs_TabIndexChanged; foreach (Province pr in GetSurrounding(Provinces[150])) { pr.Terrain = "grassland"; } Prices.Add("wood", 50); Prices.Add("bricks", 75); Prices.Add("wheat", 40); Prices.Add("metals", 200); Prices.Add("tools", 350); Prices.Add("weapons", 500); Prices.Add("wool", 100); Prices.Add("cloth", 400); Prices.Add("furs", 300); Prices.Add("ale", 175); Prices.Add("wine", 300); Prices.Add("spices", 700); Prices.Add("salt", 150); Prices.Add("meat", 150); Prices.Add("hemps", 100); }