private void updateUI() { if (titleText.text != GameVariables.batimentSelectionne.nomBatiment) { initUI(); } //Update Effectifs if Nessecary if (buildingPopulationManager.gameObject.activeSelf == true) { buildingPopulationManager.enableUpAction(); buildingPopulationManager.enableDownAction(); //Update Avaible Pop int avaiblePopCounter = GameVariables.listHabitant.Count; if (avaiblePopCounter == 0) { //On désac le bouton + (plus de pop dispo) buildingPopulationManager.disableUpAction(); } //Update Bat Pop int batPopCounter = GameVariables.batimentSelectionne.ListHabitants.Count; buildingPopulationManager.setPopCounter(batPopCounter); if (batPopCounter == 0) { //On désac le bouton - (pas de pop a retirer) buildingPopulationManager.disableDownAction(); } if (batPopCounter == GameVariables.batimentSelectionne.nbrMaxHab) { //On désac le bouton + (plus de place pour pop supp) buildingPopulationManager.disableUpAction(); } } //Update Prod if Nessecary if (buildingProdUI.gameObject.activeSelf == true) { buildingProdUI.updateProdIcon((GameVariables.batimentSelectionne as BatimentRessource).typeHabitant); buildingProdUI.updateCurrentProd((GameVariables.batimentSelectionne as BatimentRessource).getCurrentResourceProd()); buildingProdUI.updateProdUnit((GameVariables.batimentSelectionne as BatimentRessource).nbSecondBeforeGenerate, "sec"); } //Update Upgrade if Nessecary if (buildingUpgradeUI.gameObject.activeSelf == true) { //MAJ des couts d'upgrade buildingUpgradeUI.updateFoodCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMeat); buildingUpgradeUI.updateWoodCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceWood); buildingUpgradeUI.updateIronCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceIron); buildingUpgradeUI.updateGoldCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceGold); buildingUpgradeUI.updateManaCost(GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMana); buildingUpgradeUI.setUpgradeButtonActive(true); //De base upgrade possible if (GameVariables.nbMeat < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMeat || GameVariables.nbWood < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceWood || GameVariables.nbIron < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceIron || GameVariables.nbGold < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceGold || GameVariables.nbMana < GameVariables.batimentSelectionne.batUpgrade.GetComponent <Batiment>().priceMana) { //Si une ressource manquante buildingUpgradeUI.setUpgradeButtonActive(false); //Upgrade imposible } } }
void updateUI() { //Update Avaible Pop int avaiblePopCounter = getQtCurr_avaiblePop(); avaiblePop.setPopCounter(avaiblePopCounter); if (avaiblePopCounter == 0) { //On désac les boutons + (plus de pop dispo) avaiblePop.disableUpAction(); miliciaPop.disableUpAction(); foodPop.disableUpAction(); woodPop.disableUpAction(); ironPop.disableUpAction(); goldPop.disableUpAction(); manaPop.disableUpAction(); } //Update Food Pop int miliciaPopCounter = getQtCurr_miliciaPop(); miliciaPop.setPopCounter(miliciaPopCounter); if (miliciaPopCounter == 0) { //On désac le bouton - (pas de pop a retirer) miliciaPop.disableDownAction(); } if (miliciaPopCounter == getQtMax_miliciaPop()) { //On désac le bouton + (plus de place pour pop supp) miliciaPop.disableUpAction(); } //Update Food Pop int foodPopCounter = getQtCurr_foodPop(); foodPop.setPopCounter(foodPopCounter); if (foodPopCounter == 0) { //On désac le bouton - (pas de pop a retirer) foodPop.disableDownAction(); } if (foodPopCounter == getQtMax_foodPop()) { //On désac le bouton + (plus de place pour pop supp) foodPop.disableUpAction(); } //Update Wood Pop int woodPopCounter = getQtCurr_woodPop(); woodPop.setPopCounter(woodPopCounter); if (woodPopCounter == 0) { //On désac le bouton - (pas de pop a retirer) woodPop.disableDownAction(); } if (woodPopCounter == getQtMax_woodPop()) { //On désac le bouton + (plus de place pour pop supp) woodPop.disableUpAction(); } //Update Iron Pop int ironPopCounter = getQtCurr_ironPop(); ironPop.setPopCounter(ironPopCounter); if (ironPopCounter == 0) { //On désac le bouton - (pas de pop a retirer) ironPop.disableDownAction(); } if (ironPopCounter == getQtMax_ironPop()) { //On désac le bouton + (plus de place pour pop supp) ironPop.disableUpAction(); } //Update Gold Pop int goldPopCounter = getQtCurr_goldPop(); goldPop.setPopCounter(goldPopCounter); if (goldPopCounter == 0) { //On désac le bouton - (pas de pop a retirer) goldPop.disableDownAction(); } if (goldPopCounter == getQtMax_goldPop()) { //On désac le bouton + (plus de place pour pop supp) goldPop.disableUpAction(); } //Update Mana Pop int manaPopCounter = getQtCurr_manaPop(); manaPop.setPopCounter(manaPopCounter); if (manaPopCounter == 0) { //On désac le bouton - (pas de pop a retirer) manaPop.disableDownAction(); } if (manaPopCounter == getQtMax_manaPop()) { //On désac le bouton + (plus de place pour pop supp) manaPop.disableUpAction(); } }