public static void GuardarPartida() { string farmName = PartidaList[0].FarmName; string adjustedName = farmName + DateTime.Now.ToString(); Partida.Almacenar_Partida(PartidaList, adjustedName); Alimento.Almacenar_Alimentos(PartidaList[0].PlayerAnimalFood, adjustedName); Alimento.Almacenar_Alimentos(PartidaList[0].PlayerFertilizerList, adjustedName); Alimento.Almacenar_Alimentos(PartidaList[0].PlayerAnimalWater, adjustedName); Alimento.Almacenar_Alimentos(PartidaList[0].PlayerPlantWater, adjustedName); Cattle.Almacenar_Ganado(PartidaList[0].PlayerBoughtCattle, adjustedName); Map.Almacenar_Mapa(PartidaList[0].Map, adjustedName); Plantation.Almacenar_Plantacion(PartidaList[0].PlayerPlantation, adjustedName); Remedio.Almacenar_Remedios(PartidaList[0].PlayerVaccines, adjustedName); Remedio.Almacenar_Remedios(PartidaList[0].PlayerFungicides, adjustedName); Remedio.Almacenar_Remedios(PartidaList[0].PlayerPesticides, adjustedName); Remedio.Almacenar_Remedios(PartidaList[0].PlayerHerbicides, adjustedName); }
private void FoodPurchaseDoneButton_Click(object sender, EventArgs e) { string chosenFood = Convert.ToString(FoodPurchaseComboBox.SelectedItem); int foodQuantity = Convert.ToInt32(FoodQuantityNumericUpDown.Value); int price = 500 * foodQuantity; int type = 0; if (chosenFood == "Fertilizante") { type = 1; } else if (chosenFood == "Riego") { type = 2; } else if (chosenFood == "Alimento para animales") { type = 3; } else if (chosenFood == "Agua para animales") { type = 4; } int currentMoney = Juego.PartidaList[0].PlayerCash; if (currentMoney < price) { NotEnoughFoodMoneyLabel.Visible = true; System.Threading.Thread.Sleep(2000); NotEnoughFoodMoneyLabel.Visible = false; } else { Alimento a = new Alimento(500, foodQuantity, 1); currentMoney = currentMoney - price; string currentMoneyText = Convert.ToString(currentMoney); ConsMarketMoneyLabel.Text = "Dinero actual: $" + currentMoneyText; Juego.PartidaList[0].PlayerCash = currentMoney; if (chosenFood == "Fertilizante") { Juego.PartidaList[0].PlayerFertilizerList.Add(a); } else if (chosenFood == "Riego") { Juego.PartidaList[0].PlayerPlantWater.Add(a); } else if (chosenFood == "Alimento para animales") { Juego.PartidaList[0].PlayerAnimalFood.Add(a); } else if (chosenFood == "Agua para animales") { Juego.PartidaList[0].PlayerAnimalWater.Add(a); } FoodPurchaseLabel.Visible = false; FoodPurchaseComboBox.Visible = false; ConsumableDataGridView1.Visible = false; FoodPurchaseButton.Visible = false; } }