コード例 #1
0
ファイル: CityList.cs プロジェクト: jithuin/infogeezer
		public void buildConstruction( Form1 form1 ) // Building( Stat.Building building )
		{
			bool keepGoing = true;
			if ( 
				population == 1 && 
				construction.list[ 0 ] == Statistics.units[ (byte)Form1.unitType.colon ]
				)
			{
				if ( player.player == player.game.curPlayerInd )
				{
					Stat.Construction[] ib = ai.whatCanBeBuilt(
						player.player, 
						city 
						);
					string[] choices = uiWrap.buildingListStrings( player.player, city, ib ); 
											
					form1.zoomOnCity( player.player, city );

					userChoice ui = new userChoice(
						language.getAString( language.order.uiNewConstrution ),
						String.Format( language.getAString( language.order.uiNewConstrution ), name ),
						choices,
						0,
						language.getAString( language.order.ok ),
						language.getAString( language.order.uiGoToCity )
						);
					ui.ShowDialog();
					int res = ui.result;

					if ( res == -1 )
					{
						form1.openCityFrm( player.player, city );
						keepGoing = false;
					}
					else if ( res == 0 )
					{
						keepGoing = true;
						/*		construction.points -= Statistics.units[ construction.list[ 0 ].ind ].cost;
								Form1.game.curPlayer.createUnit ( X, Y, (byte)construction.list[ 0 ].ind );
								Form1.game.curPlayerInd.cityList[ i ].kill();
								continue;*/
					}
					else
					{ // si non
						construction.list[0] = ib[res];
						keepGoing = false;
						/*		Form1.construction.list[ 0 ].ind = ib[ res ].info;
								Form1.construction.list[ 0 ].type = ib[ res ].type;*/
					}
				}
				else
					ai.chooseConstruction( player.player, city );
			}
		//	else

			if ( keepGoing )
			{
				construction.points -= construction.list[ 0 ].cost; //Statistics.units[ construction.list[ 0 ].ind ].cost;
												
				if ( construction.list[ 0 ] is Stat.Unit ) // construction.list[ 0 ].type == 1 )
				{ // units
					player.createUnit( X, Y, (byte)construction.list[ 0 ].type );
												
					if ( construction.list[ 0 ] == Statistics.units[ (byte)Form1.unitType.colon ] ) //construction.list[ 0 ].ind == (byte)Form1.unitType.colon )
					{
						if ( population > 1 )
						{
							labor.autoRemoveLabor( player.player, city, true );
							population --;
						}
						else
						{
							kill();
						}
					}
				}
				else if ( construction.list[ 0 ] is Stat.Building )
				{ // buildings
					buildingList[ construction.list[ 0 ].type ] = true;
					aiPref.setBuildingUpkeep( player.player );

					#region special buildings
					#endregion
				}
				else if ( construction.list[ 0 ] is Stat.SmallWonder )
				{ // buildings
				//	buildingList[ construction.list[ 0 ].type ] = true;
				///	aiPref.setBuildingUpkeep( player.player );
				
					player.smallWonderList.buildWonder( construction.list[ 0 ] );

					#region special
					#endregion
				}
				else if ( construction.list[ 0 ] is Stat.Wonder )
				{ // buildings
				//	buildingList[ construction.list[ 0 ].type ] = true;
				//	aiPref.setBuildingUpkeep( player.player );
					
					player.game.wonderList.buildWonder( construction.list[ 0 ] );

					#region special
					switch ( construction.list[ 0 ].type )
					{
						case (int)Stat.Wonder.list.chinaWall:
							break;
					}
					#endregion
				}

				if ( !dead )
				{
					if ( player.isCurPlayer )
					{
						if ( construction.list[ 1 ] != null )
						{
							construction.removeFirst();
						}
						else
						{
							form1.zoomOnCity( player.player, city );
							uiWrap.choseConstruction( player.player, city, false ); 
						}
					}
					else
					{
						ai.chooseConstruction( player.player, city );
					}
				}
			}
		}