NGUI : OnClick execution issue

Hello,

I have a script that I use to construct buildings in my game each time I click on the Build button in NGUI.
The problem is that with the current script format, it doesn’t construct one building as it should, but constructs all the buildings for all the available resources in one click.
How to make it execute only the certain condition and then wait for new OnClick input ?

The code :

void OnClick()
	{
		if(MenuControllerTower.isPaused==false & MenuControllerTower.isBuild==true){
		if (MenuControllerTower.goblinBarracks == 1) {
			//BUY GOBLIN BARRACKS LEVEL1
		if(MenuControllerTower.goldTower>=500){
							MenuControllerTower.goldTower=MenuControllerTower.goldTower-500;
				MenuControllerTower.population+=24;
				MenuControllerTower.goblinBarracks = 2;
					MenuControllerTower.highScore += 500;
			}
		}
		
		if (MenuControllerTower.goblinBarracks == 2) {
			//BUY GOBLIN BARRACKS LEVEL2
		if(MenuControllerTower.goldTower>=2000){
							MenuControllerTower.goldTower=MenuControllerTower.goldTower-2000;
				MenuControllerTower.population+=60;
				MenuControllerTower.goblinBarracks = 3;
				MenuControllerTower.assassinGoblin = 1;
				MenuControllerTower.maxAssassins = 2;
				MenuControllerTower.maxGrunts = 6;
				MenuControllerTower.highScore += 2000;
			}
		}
		
		if (MenuControllerTower.goblinBarracks == 3) {
			//BUY GOBLIN BARRACKS LEVEL3
		if(MenuControllerTower.goldTower>=5000){
							MenuControllerTower.goldTower=MenuControllerTower.goldTower-5000;
				MenuControllerTower.population+=150;
				MenuControllerTower.goblinBarracks = 4;
				MenuControllerTower.goblin = 2;
				MenuControllerTower.highScore += 5000;
			}
		}
		
		if (MenuControllerTower.goblinBarracks == 4) {
			//BUY GOBLIN BARRACKS LEVEL4
		if(MenuControllerTower.goldTower>=7000){
							MenuControllerTower.goldTower=MenuControllerTower.goldTower-7000;
				MenuControllerTower.population+=320;
				MenuControllerTower.goblinBarracks = 5;
				MenuControllerTower.assassinGoblin = 2;
				MenuControllerTower.maxGrunts = 9;
				MenuControllerTower.maxAssassins = 4;
				MenuControllerTower.highScore += 7000;
			}
		}
		
		if (MenuControllerTower.goblinBarracks == 5) {
			//BUY GOBLIN BARRACKS LEVEL4
		if(MenuControllerTower.goldTower>=10000){
							MenuControllerTower.goldTower=MenuControllerTower.goldTower-10000;
				MenuControllerTower.population+=320;
				MenuControllerTower.goblinBarracks = 6;
				MenuControllerTower.goblin = 3;
				MenuControllerTower.maxGrunts = 10;
				MenuControllerTower.maxAssassins = 5;
				MenuControllerTower.highScore += 10000;
			}
		}
			
		if (MenuControllerTower.goblinBarracks == 6) {
			//BUY GOBLIN BARRACKS LEVEL4
		if(MenuControllerTower.goldTower>=14000){
							MenuControllerTower.goldTower=MenuControllerTower.goldTower-14000;
				MenuControllerTower.population+=320;
				MenuControllerTower.goblinBarracks = 7;
				MenuControllerTower.assassinGoblin = 3;
				MenuControllerTower.maxAssassins = 7;
				MenuControllerTower.highScore += 14000;
				}
			}
		}
	}

Add an ‘else’ before each of the

if (MenuControllerTower.goblinBarracks == some number)

statements (after the first). This will ensure that only one of these if statements is ever entered:

void OnClick()
    {
       if(MenuControllerTower.isPaused==false & MenuControllerTower.isBuild==true){
       if (MenuControllerTower.goblinBarracks == 1) {
         //BUY GOBLIN BARRACKS LEVEL1
       if(MenuControllerTower.goldTower>=500){
                   MenuControllerTower.goldTower=MenuControllerTower.goldTower-500;
          MenuControllerTower.population+=24;
          MenuControllerTower.goblinBarracks = 2;
              MenuControllerTower.highScore += 500;
         }
       }
 
       else if (MenuControllerTower.goblinBarracks == 2) {
         //BUY GOBLIN BARRACKS LEVEL2
       if(MenuControllerTower.goldTower>=2000){
                   MenuControllerTower.goldTower=MenuControllerTower.goldTower-2000;
          MenuControllerTower.population+=60;
          MenuControllerTower.goblinBarracks = 3;
          MenuControllerTower.assassinGoblin = 1;
          MenuControllerTower.maxAssassins = 2;
          MenuControllerTower.maxGrunts = 6;
          MenuControllerTower.highScore += 2000;
         }
       }
 
       else if (MenuControllerTower.goblinBarracks == 3) {
         //BUY GOBLIN BARRACKS LEVEL3
       if(MenuControllerTower.goldTower>=5000){
                   MenuControllerTower.goldTower=MenuControllerTower.goldTower-5000;
          MenuControllerTower.population+=150;
          MenuControllerTower.goblinBarracks = 4;
          MenuControllerTower.goblin = 2;
          MenuControllerTower.highScore += 5000;
         }
       }
 
       else if (MenuControllerTower.goblinBarracks == 4) {
         //BUY GOBLIN BARRACKS LEVEL4
       if(MenuControllerTower.goldTower>=7000){
                   MenuControllerTower.goldTower=MenuControllerTower.goldTower-7000;
          MenuControllerTower.population+=320;
          MenuControllerTower.goblinBarracks = 5;
          MenuControllerTower.assassinGoblin = 2;
          MenuControllerTower.maxGrunts = 9;
          MenuControllerTower.maxAssassins = 4;
          MenuControllerTower.highScore += 7000;
         }
       }
 
       else if (MenuControllerTower.goblinBarracks == 5) {
         //BUY GOBLIN BARRACKS LEVEL4
       if(MenuControllerTower.goldTower>=10000){
                   MenuControllerTower.goldTower=MenuControllerTower.goldTower-10000;
          MenuControllerTower.population+=320;
          MenuControllerTower.goblinBarracks = 6;
          MenuControllerTower.goblin = 3;
          MenuControllerTower.maxGrunts = 10;
          MenuControllerTower.maxAssassins = 5;
          MenuControllerTower.highScore += 10000;
         }
       }
 
       else if (MenuControllerTower.goblinBarracks == 6) {
         //BUY GOBLIN BARRACKS LEVEL4
       if(MenuControllerTower.goldTower>=14000){
                   MenuControllerTower.goldTower=MenuControllerTower.goldTower-14000;
          MenuControllerTower.population+=320;
          MenuControllerTower.goblinBarracks = 7;
          MenuControllerTower.assassinGoblin = 3;
          MenuControllerTower.maxAssassins = 7;
          MenuControllerTower.highScore += 14000;
          }
         }
       }
    }