private void changeType() { this.Controls.Clear(); this.Controls.Add(picBox); // this.Controls.Add( this.cmdCouncil ); // this.Controls.Add( this.cmdSpies ); // this.Controls.Add( this.cmdGeneral ); // cmdCouncil.BringToFront(); // cmdSpies.BringToFront(); // cmdGeneral.BringToFront(); g.Clear(Color.Wheat); Font pnFont = new Font("Tahoma", 12, FontStyle.Regular), pFont = new Font("Tahoma", 10, FontStyle.Regular); Brush blackBrush = new SolidBrush(Color.Black); // int spyWidth = 100; #region once switch (currentType) { case (byte)types.general: yo = 62; //yo = 4; contact = new Button[players.Length - posAtTop > maxPlayersOnScreen ? maxPlayersOnScreen : players.Length - posAtTop]; g.DrawLine(new Pen(Color.Black), 0, yo - 10, this.Width, yo - 10); break; case (byte)types.council: yo = 62; g.DrawLine(new Pen(Color.Black), 0, yo - 10, this.Width, yo - 10); break; case (byte)types.spies: spyDetail = new Button[players.Length - posAtTop > maxPlayersOnScreen ? maxPlayersOnScreen : players.Length - posAtTop]; spyAdd = new Button[players.Length - posAtTop > maxPlayersOnScreen ? maxPlayersOnScreen : players.Length - posAtTop]; yo = 62; SizeF ciSize = g.MeasureString(language.getAString(language.order.counterIntelligence), new Font("Tahoma", 9, FontStyle.Regular)); g.DrawString(language.getAString(language.order.counterIntelligence), new Font("Tahoma", 9, FontStyle.Regular), new SolidBrush(Color.Black), 4, 4); g.DrawLine(new Pen(Color.Black), 0, yo - 10, this.Width, yo - 10); int counterSpy = Form1.game.playerList[player].counterIntNbr; int cis = 0; if (sbCounterInt != null) { cis = sbCounterInt.selected; } sbCounterInt = new SpyBar(4, 4 + (int)ciSize.Height, this.Width - 8); sbCounterInt.picBox.Parent = this; sbCounterInt.picBox.BringToFront(); sbCounterInt.enabled = true; sbCounterInt.spyNbr = counterSpy; sbCounterInt.backColor = Color.Wheat; sbCounterInt.selected = cis; sbCounterInt.drawSpies(); sbCounterInt.drawAff(); sbCounterInt.picBox.MouseDown += new MouseEventHandler(picBoxCI_MouseDown); sbCounterInt.picBox.MouseUp += new MouseEventHandler(picBoxCI_MouseDown); spyAddCi = new Button(); spyAddCi.Top = sbCounterInt.Height; // +sbCounterInt.y; spyAddCi.Text = "+"; spyAddCi.Height = 16; spyAddCi.Width = spyAddCi.Height; spyAddCi.Left = this.Width - spyAddCi.Width - 8; spyAddCi.Parent = this; // spyAddCi.Enabled = false; spyAddCi.BringToFront(); spyAddCi.Click += new EventHandler(cmdAddCi_Click); #if !CF spyAddCi.FlatStyle = FlatStyle.System; #endif break; } #endregion once #region loop for (int p = posAtTop, pos = 0; p < players.Length && pos < maxPlayersOnScreen; p++, pos++) { g.FillRectangle( new SolidBrush(Statistics.civilizations[Form1.game.playerList[players[p]].civType].color), 0, yo + (yDiff * pos), xo - 2, yDiff ); g.DrawRectangle( new Pen(Color.Black), -1, yo + (yDiff * pos), xo - 1, yDiff ); g.DrawString( Statistics.civilizations[Form1.game.playerList[players[p]].civType].name, pnFont, blackBrush, xo, yo + (yDiff * pos) ); g.DrawString( Form1.relationPol[Form1.game.playerList[players[p]].foreignRelation[player].politic], pFont, blackBrush, xo, yo + (yDiff * pos) + g.MeasureString(Statistics.civilizations[Form1.game.playerList[players[p]].civType].name, pnFont).Height ); switch (currentType) { case (byte)types.general: contact[pos] = new Button(); contact[pos].Text = language.getAString(language.order.contactNation); //"Contact"; contact[pos].Left = this.Width - contact[pos].Width - xo; contact[pos].Top = pos * yDiff + yo; this.Controls.Add(contact[pos]); platformSpec.resolution.setOne(contact[pos]); contact[pos].BringToFront(); contact[pos].Click += new EventHandler(contact_Click); #if !CF contact[pos].FlatStyle = FlatStyle.System; #endif break; case (byte)types.council: break; case (byte)types.spies: 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].x = this.Width - 8 - spyWidth; sbNation[p].y = pos * yDiff + yo; sbNation[p].picBox.Parent = this; platformSpec.resolution.setOne(sbNation[p].picBox); sbNation[p].picBox.BringToFront(); sbNation[p].enabled = true; sbNation[p].spyNbr = spyInNation; sbNation[p].drawSpies(); sbNation[p].drawAff(); sbNation[p].picBox.MouseDown += new MouseEventHandler(sbNation_Click); sbNation[p].picBox.MouseUp += new MouseEventHandler(sbNation_Click); spyDetail[pos] = new Button(); spyDetail[pos].Top = pos * yDiff + yo + sbNation[pos].Height; spyDetail[pos].Text = language.getAString(language.order.Details); //"Details"; spyDetail[pos].Height = 16; spyDetail[pos].Left = this.Width - spyDetail[pos].Width - 4; spyDetail[pos].Parent = this; platformSpec.resolution.setOne(spyDetail[pos]); spyDetail[pos].BringToFront(); spyDetail[pos].Click += new EventHandler(spyDetail_Click); #if !CF spyDetail[pos].FlatStyle = FlatStyle.System; #endif spyAdd[pos] = new Button(); spyAdd[pos].Top = spyDetail[pos].Top; // p * yDiff + yo + 120; spyAdd[pos].Text = "+"; spyAdd[pos].Height = 16; spyAdd[pos].Width = spyAdd[pos].Height; spyAdd[pos].Left = this.Width - spyDetail[pos].Width - spyAdd[pos].Width - 8; spyAdd[pos].Parent = this; platformSpec.resolution.setOne(spyAdd[pos]); spyAdd[pos].Enabled = false; spyAdd[pos].BringToFront(); spyAdd[pos].Click += new EventHandler(spyAdd_Click); #if !CF spyAdd[pos].FlatStyle = FlatStyle.System; #endif break; } } #endregion loop if (currentType == (byte)types.spies) { spyEnableWHTB(); } if (posAtTop > 0) { g.FillRectangle(new SolidBrush(Statistics.civilizations[Form1.game.playerList[players[posAtTop - 1]].civType].color), 0, yo + (yDiff * 0) - 10, xo - 2, 10); g.DrawRectangle(new Pen(Color.Black), -1, yo + (yDiff * 0) - 10, xo - 1, 10); } if (players.Length - maxPlayersOnScreen > posAtTop) { g.FillRectangle(new SolidBrush(Statistics.civilizations[Form1.game.playerList[players[posAtTop + maxPlayersOnScreen]].civType].color), 0, yo + (yDiff * maxPlayersOnScreen), xo - 2, 11); g.DrawRectangle(new Pen(Color.Black), -1, yo + (yDiff * maxPlayersOnScreen), xo - 1, 11); } picBox.Image = back; }
private void spyEnableWHTB() // byte sender) { if (spySelected == 100) { if (sbCounterInt.selected > 0) { for (int i = 0; i < sbNation.Length; i++) { if (sbNation[i].selected != 0) { sbNation[i].selected = 0; sbNation[i].drawAff(); } } for (int i = 0; i < spyAdd.Length; i++) { spyAdd[i].Enabled = true; } } else { for (int i = 0; i < spyAdd.Length; i++) { spyAdd[i].Enabled = false; } } spyAddCi.Enabled = false; } else { if (sbNation[spySelected].selected > 0) { for (int i = 0; i < sbNation.Length; i++) { if (i != spySelected) { if (sbNation[i].selected != 0) { sbNation[i].selected = 0; sbNation[i].drawAff(); } } } for (int i = 0; i < spyAdd.Length; i++) { if (i + posAtTop != spySelected) { spyAdd[i].Enabled = true; } else { spyAdd[i].Enabled = false; } } //sbCounterInt.selected = 0; spyAddCi.Enabled = true; } else { spyAddCi.Enabled = false; for (int i = 0; i < spyAdd.Length; i++) { spyAdd[i].Enabled = false; } } sbCounterInt.selected = 0; sbCounterInt.drawSpies(); sbCounterInt.drawAff(); } }
private void changeType() { this.Controls.Clear(); this.Controls.Add( picBox ); // this.Controls.Add( this.cmdCouncil ); // this.Controls.Add( this.cmdSpies ); // this.Controls.Add( this.cmdGeneral ); // cmdCouncil.BringToFront(); // cmdSpies.BringToFront(); // cmdGeneral.BringToFront(); g.Clear( Color.Wheat ); Font pnFont = new Font( "Tahoma", 12, FontStyle.Regular ), pFont = new Font( "Tahoma", 10, FontStyle.Regular ); Brush blackBrush = new SolidBrush( Color.Black ); // int spyWidth = 100; #region once switch ( currentType ) { case (byte)types.general : yo = 62; //yo = 4; contact = new Button[ players.Length - posAtTop > maxPlayersOnScreen ? maxPlayersOnScreen : players.Length - posAtTop ]; g.DrawLine( new Pen( Color.Black ), 0, yo - 10, this.Width, yo - 10 ); break; case (byte)types.council : yo = 62; g.DrawLine( new Pen( Color.Black ), 0, yo - 10, this.Width, yo - 10 ); break; case (byte)types.spies : spyDetail = new Button[ players.Length - posAtTop > maxPlayersOnScreen ? maxPlayersOnScreen : players.Length - posAtTop ]; spyAdd = new Button[ players.Length - posAtTop > maxPlayersOnScreen ? maxPlayersOnScreen : players.Length - posAtTop ]; yo = 62; SizeF ciSize = g.MeasureString( language.getAString( language.order.counterIntelligence ), new Font( "Tahoma", 9, FontStyle.Regular ) ); g.DrawString( language.getAString( language.order.counterIntelligence ), new Font( "Tahoma", 9, FontStyle.Regular ), new SolidBrush( Color.Black ), 4, 4 ); g.DrawLine( new Pen( Color.Black ), 0, yo - 10, this.Width, yo - 10 ); int counterSpy = Form1.game.playerList[ player ].counterIntNbr; int cis = 0; if ( sbCounterInt != null ) cis = sbCounterInt.selected; sbCounterInt = new SpyBar( 4, 4 + (int)ciSize.Height, this.Width - 8 ); sbCounterInt.picBox.Parent = this; sbCounterInt.picBox.BringToFront(); sbCounterInt.enabled = true; sbCounterInt.spyNbr = counterSpy; sbCounterInt.backColor = Color.Wheat; sbCounterInt.selected = cis; sbCounterInt.drawSpies(); sbCounterInt.drawAff(); sbCounterInt.picBox.MouseDown += new MouseEventHandler( picBoxCI_MouseDown ); sbCounterInt.picBox.MouseUp += new MouseEventHandler( picBoxCI_MouseDown ); spyAddCi = new Button(); spyAddCi.Top = sbCounterInt.Height; // +sbCounterInt.y; spyAddCi.Text = "+"; spyAddCi.Height = 16; spyAddCi.Width = spyAddCi.Height; spyAddCi.Left = this.Width - spyAddCi.Width - 8; spyAddCi.Parent = this; // spyAddCi.Enabled = false; spyAddCi.BringToFront(); spyAddCi.Click += new EventHandler( cmdAddCi_Click ); #if !CF spyAddCi.FlatStyle = FlatStyle.System; #endif break; } #endregion once #region loop for ( int p = posAtTop, pos = 0; p < players.Length && pos < maxPlayersOnScreen; p++, pos++ ) { g.FillRectangle( new SolidBrush( Statistics.civilizations[ Form1.game.playerList[ players[ p ] ].civType ].color ), 0, yo + ( yDiff * pos ), xo - 2, yDiff ); g.DrawRectangle( new Pen( Color.Black ), -1, yo + ( yDiff * pos ), xo - 1, yDiff ); g.DrawString( Statistics.civilizations[ Form1.game.playerList[ players[ p ] ].civType ].name, pnFont, blackBrush, xo, yo + ( yDiff * pos ) ); g.DrawString( Form1.relationPol[ Form1.game.playerList[ players[ p ] ].foreignRelation[ player ].politic ], pFont, blackBrush, xo, yo + ( yDiff * pos ) + g.MeasureString( Statistics.civilizations[ Form1.game.playerList[ players[ p ] ].civType ].name, pnFont ).Height ); switch ( currentType ) { case (byte)types.general : contact[ pos ] = new Button(); contact[ pos ].Text = language.getAString( language.order.contactNation );//"Contact"; contact[ pos ].Left = this.Width - contact[ pos ].Width - xo; contact[ pos ].Top = pos * yDiff + yo; this.Controls.Add( contact[ pos ] ); platformSpec.resolution.setOne( contact[ pos ] ); contact[ pos ].BringToFront(); contact[ pos ].Click += new EventHandler( contact_Click ); #if !CF contact[ pos ].FlatStyle = FlatStyle.System; #endif break; case (byte)types.council : break; case (byte)types.spies : 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 ].x = this.Width - 8 - spyWidth; sbNation[ p ].y = pos * yDiff + yo; sbNation[ p ].picBox.Parent = this; platformSpec.resolution.setOne( sbNation[ p ].picBox ); sbNation[ p ].picBox.BringToFront(); sbNation[ p ].enabled = true; sbNation[ p ].spyNbr = spyInNation; sbNation[ p ].drawSpies(); sbNation[ p ].drawAff(); sbNation[ p ].picBox.MouseDown += new MouseEventHandler( sbNation_Click ); sbNation[ p ].picBox.MouseUp += new MouseEventHandler( sbNation_Click ); spyDetail[ pos ] = new Button(); spyDetail[ pos ].Top = pos * yDiff + yo + sbNation[ pos ].Height; spyDetail[ pos ].Text = language.getAString( language.order.Details );//"Details"; spyDetail[ pos ].Height = 16; spyDetail[ pos ].Left = this.Width - spyDetail[ pos ].Width - 4; spyDetail[ pos ].Parent = this; platformSpec.resolution.setOne( spyDetail[ pos ] ); spyDetail[ pos ].BringToFront(); spyDetail[ pos ].Click += new EventHandler( spyDetail_Click ); #if !CF spyDetail[ pos ].FlatStyle = FlatStyle.System; #endif spyAdd[ pos ] = new Button(); spyAdd[ pos ].Top = spyDetail[ pos ].Top; // p * yDiff + yo + 120; spyAdd[ pos ].Text = "+"; spyAdd[ pos ].Height = 16; spyAdd[ pos ].Width = spyAdd[ pos ].Height; spyAdd[ pos ].Left = this.Width - spyDetail[ pos ].Width - spyAdd[ pos ].Width - 8; spyAdd[ pos ].Parent = this; platformSpec.resolution.setOne( spyAdd[ pos ] ); spyAdd[ pos ].Enabled = false; spyAdd[ pos ].BringToFront(); spyAdd[ pos ].Click += new EventHandler( spyAdd_Click ); #if !CF spyAdd[ pos ].FlatStyle = FlatStyle.System; #endif break; } } #endregion loop if ( currentType == (byte)types.spies ) spyEnableWHTB(); if ( posAtTop > 0 ) { g.FillRectangle( new SolidBrush( Statistics.civilizations[ Form1.game.playerList[ players[ posAtTop - 1 ] ].civType ].color ), 0, yo + ( yDiff * 0 ) - 10, xo - 2, 10 ); g.DrawRectangle( new Pen( Color.Black ), -1, yo + ( yDiff * 0 ) - 10, xo - 1, 10 ); } if ( players.Length - maxPlayersOnScreen > posAtTop ) { g.FillRectangle( new SolidBrush( Statistics.civilizations[ Form1.game.playerList[ players[ posAtTop + maxPlayersOnScreen ] ].civType ].color ), 0, yo + ( yDiff * maxPlayersOnScreen ), xo - 2, 11 ); g.DrawRectangle( new Pen( Color.Black ), -1, yo + ( yDiff * maxPlayersOnScreen ), xo - 1, 11 ); } picBox.Image = back; }