Example #1
0
		public frmRelations( byte player )
		{
			this.player = player;
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		/*	picBox = new PictureBox();
			picBox.Width = this.Width;
			picBox.Height = this.Height;
			this.Controls.Add( picBox );*/

		/*	tabCouncil.Controls.Add( picBox );
			tabSpies.Controls.Add( picBox );*/

			MainMenu menu = new MainMenu();
			
			cmdGeneral = new MenuItem();
			cmdGeneral.Click += new System.EventHandler( this.cmdGeneral_Click );
			cmdGeneral.Text = language.getAString( language.order.rfGeneral );
			menu.MenuItems.Add( cmdGeneral );

			MenuItem mis0 = new MenuItem();
			mis0.Text = "|";
			mis0.Enabled = false;
			menu.MenuItems.Add( mis0 );

			cmdSpies = new MenuItem();
			cmdSpies.Click += new System.EventHandler( this.cmdSpies_Click );
			cmdSpies.Text = language.getAString( language.order.rfSpies );
			menu.MenuItems.Add( cmdSpies );

			MenuItem mis1 = new MenuItem();
			mis1.Text = "|";
			mis1.Enabled = false;
			menu.MenuItems.Add( mis1 );

			cmdCouncil = new MenuItem(); 
			cmdCouncil.Click += new System.EventHandler( this.cmdCouncil_Click );
			cmdCouncil.Text = language.getAString( language.order.rfCouncil );
			menu.MenuItems.Add( cmdCouncil );

			this.Text = language.getAString( language.order.relation );

			this.Menu = menu;
			picBox.Size = this.ClientSize;


			int pos = 0; 
			byte[] tempPlayers = new byte[ Form1.game.playerList.Length - 1 ]; 
			for ( int p = 0; p < Form1.game.playerList.Length; p ++ ) 
				if ( 
					p != player && 
					!Form1.game.playerList[ p ].dead && 
					Form1.game.playerList[ player ].foreignRelation[ p ].madeContact 
					) 
				{ 
					tempPlayers[ pos ] = (byte)p; 
					pos++; 
				} 

			players = new byte[ pos ]; 
			for ( int p = 0; p < pos; p++ ) 
				players[ p ] = tempPlayers[ p ]; 

			back = new Bitmap( picBox.Width, picBox.Height );
			g = Graphics.FromImage( back );

			sbNation = new SpyBar[ players.Length ]; // players.Length - posAtTop > maxPlayersOnScreen ? maxPlayersOnScreen : players.Length - posAtTop ];			
			for ( int p = 0; p < players.Length; p++ )
			{
				int spyInNation = Form1.game.playerList[ player ].foreignRelation[ players[ p ] ].spies[ (byte)enums.spyType.people ].nbr + Form1.game.playerList[ player ].foreignRelation[ players[ p ] ].spies[ (byte)enums.spyType.gov ].nbr + Form1.game.playerList[ player ].foreignRelation[ players[ p ] ].spies[ (byte)enums.spyType.military ].nbr + Form1.game.playerList[ player ].foreignRelation[ players[ p ] ].spies[ (byte)enums.spyType.science ].nbr;

				sbNation[ p ] = new SpyBar( this.Width - 8 - spyWidth, p * yDiff + yo, spyWidth );
				sbNation[ p ].backColor = Color.Wheat;
				sbNation[ p ].enabled = true;
				sbNation[ p ].spyNbr = spyInNation;
				sbNation[ p ].picBox.MouseDown += new MouseEventHandler( sbNation_Click );
			}

		//	keyIn = new keyInPut();
			tmr = new Timer();
			tmr.Interval = 5;
			tmr.Tick += new EventHandler( tmr_Tick );
			tmr.Enabled = true;

			platformSpec.resolution.set( this.Controls );

			posAtTop = 0;
			currentType = 0;
			changeType();
			enabledTypes();
		//	drawBack();
		}
Example #2
0
		private void dispSpyBars()
		{
			spyBars = new SpyBar[ 4 ];
			cmdAdd = new Button[ 4 ];
			comboBoxes = new ComboBox[ 4 ];
			for ( int i = 0; i < spyBars.Length; i ++ )
			{
				spyBars[ i ] = new SpyBar( left, label[ i ].Bottom + 4, width );
				spyBars[ i ].picBox.Parent = this;
				spyBars[ i ].picBox.BringToFront();
				spyBars[ i ].spyNbr = Form1.game.playerList[ Form1.game.curPlayerInd ].foreignRelation[ player ].spies[ i ].nbr;
				spyBars[ i ].enabled = true;
				spyBars[ i ].drawSpies();
				spyBars[ i ].drawAff();

				comboBoxes[ i ] = new ComboBox();
				comboBoxes[ i ].Top = label[ i ].Bottom - comboBoxes[ i ].Height + 3;
				comboBoxes[ i ].Left = this.Width - 8 - comboBoxes[ i ].Width;
				comboBoxes[ i ].Parent = this;
				comboBoxes[ i ].BringToFront();
				
				comboBoxes[ i ].Items.Add( "Passive" );
				comboBoxes[ i ].Items.Add( "Agressive" );
				comboBoxes[ i ].SelectedIndex = Form1.game.playerList[ Form1.game.curPlayerInd ].foreignRelation[ player ].spies[ i ].state;
				comboBoxes[ i ].SelectedIndexChanged += new EventHandler(frmSpyDetail_SelectedIndexChanged);

				cmdAdd[ i ] = new Button();
				cmdAdd[ i ].Text = "+";
				cmdAdd[ i ].Width = cmdAdd[ i ].Height;
				cmdAdd[ i ].Enabled = false;
				cmdAdd[ i ].Top = label[ i ].Bottom - cmdAdd[ i ].Height + 3;
				cmdAdd[ i ].Left = comboBoxes[ i ].Left - 8 - cmdAdd[ i ].Width;
				cmdAdd[ i ].Parent = this;
				cmdAdd[ i ].BringToFront();
#if !CF
				cmdAdd[ i ].FlatStyle = FlatStyle.System;
#endif
			}
			
			cmdAdd[ (byte)enums.spyType.gov ].Click += new EventHandler(addGov_Click);
			cmdAdd[ (byte)enums.spyType.military ].Click += new EventHandler(addMilitary_Click);
			cmdAdd[ (byte)enums.spyType.people ].Click += new EventHandler(addPeople_Click);
			cmdAdd[ (byte)enums.spyType.science ].Click += new EventHandler(addScience_Click);
			
			spyBars[ (byte)enums.spyType.gov ].picBox.MouseUp += new MouseEventHandler(addGov_MouseUp);
			spyBars[ (byte)enums.spyType.military ].picBox.MouseUp += new MouseEventHandler(addMilitary_MouseUp);
			spyBars[ (byte)enums.spyType.people ].picBox.MouseUp += new MouseEventHandler(addPeople_MouseUp);
			spyBars[ (byte)enums.spyType.science ].picBox.MouseUp += new MouseEventHandler(addScience_MouseUp);

			spyBars[ (byte)enums.spyType.gov ].picBox.MouseDown += new MouseEventHandler(addGov_MouseUp);
			spyBars[ (byte)enums.spyType.military ].picBox.MouseDown += new MouseEventHandler(addMilitary_MouseUp);
			spyBars[ (byte)enums.spyType.people ].picBox.MouseDown += new MouseEventHandler(addPeople_MouseUp);
			spyBars[ (byte)enums.spyType.science ].picBox.MouseDown += new MouseEventHandler(addScience_MouseUp);
			
			enableWHTB();
		}