Example #1
0
 private void buttonUpgradeInfrastructure_Click(object sender, EventArgs e)
 {
     if (Buildings.LevelOfRockMine < Buildings.LevelOfTownHall)
     {
         //Wywołanie funkcji sprawdzającej, czy posiadamy wystrczającą ilość zasobów do ulepszenia budynku
         if (EnoughtResources(labelInfrastructureCostGold, labelInfrastructureCostWood, labelInfrastructureCostRock, labelInfrastructureCostIron, labelInfrastructureCostFood) == true)
         {
             // zwiekszenie poziomu budynku
             Buildings.LevelOfInfrastructure += 1;
             // wyswietlenie aktualnego poziomu budynku
             labelLevelOfInfrastructure.Text = Buildings.LevelOfInfrastructure.ToString();
             //pobranie kosztow kolejnego poziomu ulepszenia budynku
             cost = Buildings.InfrastructureUpgradeCost();
             // wywolanie funkcji, ktora wyswietli koszty rozbudowy na kolejny poziom budynku
             FillCostLabels(cost, labelInfrastructureCostGold, labelInfrastructureCostWood, labelInfrastructureCostRock, labelInfrastructureCostIron, labelInfrastructureCostFood);
         }
         else
         {
             // wyswietlenie wiadomosci
             MessageBox.Show("Niewystarczająca ilość zasobów!");
         }
     }
     else
     {
         MessageBox.Show("Zbyt niski poziom ratusza!");
     }
 }
Example #2
0
 private void FormBuildings_Load(object sender, EventArgs e)
 {
     // pobranie kosztów ulepszenia kopalni złota z klasy Buildings
     cost = Buildings.GoldMineUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach kopalni złota, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelGoldMineCostGold, labelGoldMineCostWood, labelGoldMineCostRock, labelGoldMineCostIron, labelGoldMineCostFood);
     // pobranie kosztów ulepszenia tartaku z klasy Buildings
     cost = Buildings.SawmillUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach tartaku, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelSawmillCostGold, labelSawmillCostWood, labelSawmillCostRock, labelSawmillCostIron, labelSawmillCostFood);
     // pobranie kosztów ulepszenia kamieniołomu z klasy Buildings
     cost = Buildings.RockMineUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach kamieniołomu, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelRockMineCostGold, labelRockMineCostWood, labelRockMineCostRock, labelRockMineCostIron, labelRockMineCostFood);
     // pobranie kosztów ulepszenia chary myśliwskiej z klasy Buildings
     cost = Buildings.HuntingBuildingUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach chaty myśliwskiej, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelHuntingBuildingCostGold, labelHuntingBuildingCostWood, labelHuntingBuildingCostRock, labelHuntingBuildingCostIron, labelHuntingBuildingCostFood);
     // pobranie kosztów ulepszenia kopalni żelaza z klasy Buildings
     cost = Buildings.IronMineUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach kopalni żelaza, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelIronMineCostGold, labelIronMineCostWood, labelIronMineCostRock, labelIronMineCostIron, labelIronMineCostFood);
     // pobranie kosztów ulepszenia magazynu złota z klasy Buildings
     cost = Buildings.WareHouseUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach magazynu, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelWareHouseCostGold, labelWareHouseCostWood, labelWareHouseCostRock, labelWareHouseCostIron, labelWareHouseCostFood);
     // pobranie kosztów ulepszenia ratuszu z klasy Buildings
     cost = Buildings.TownHallUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach ratuszu, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelTownHallCostGold, labelTownHallCostWood, labelTownHallCostRock, labelTownHallCostIron, labelTownHallCostFood);
     // pobranie kosztów ulepszenia infrastruktury z klasy Buildings
     cost = Buildings.InfrastructureUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach infrastruktury, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelInfrastructureCostGold, labelInfrastructureCostWood, labelInfrastructureCostRock, labelInfrastructureCostIron, labelInfrastructureCostFood);
     // pobranie kosztów ulepszenia wieży strażniczej z klasy Buildings
     cost = Buildings.WatchtowerUpgradeCost();
     // wyswietlenie aktualnej ceny w labelach wieży strażniczej złota, ktore sa argumentami wywolywanej funkcji
     FillCostLabels(cost, labelWatchtowerCostGold, labelWatchtowerCostWood, labelWatchtowerCostRock, labelWatchtowerCostIron, labelWatchtowerCostFood);
 }