Exemplo n.º 1
0
        public static void chooseNextTechno(byte player, string text, string caption)
        {
            string technoName = Statistics.technologies[Form1.game.playerList[player].currentResearch].name;

            ai Ai = new ai();

            byte[] technos    = ai.returnDisponibleTechnologies(player);
            byte   nextTechno = ai.randomTechnology(player);

            string[] choices = technoListStrings(player, technos);

            userChoice uc = new userChoice(
                caption,
                text,
                choices,
                0,
                language.getAString(language.order.uiAccept),
                language.getAString(language.order.uiOpenTechnoTree)
                );

            uc.ShowDialog();
            int res = uc.result;

            if (res == -1)
            {             // science tree
                Form1.game.playerList[player].currentResearch = (byte)nextTechno;

                sciTree sciTree1 = new sciTree();
                sciTree1.ShowDialog();
            }
            else
            {             // accept
                Form1.game.playerList[player].currentResearch = (byte)technos[res];
            }
        }
Exemplo n.º 2
0
        public void aquireTechno(byte techno)
        {
            technos[techno].researched = true;
            //	Form1.game.playerList[ player ].technos[ Form1.game.playerList[ player ].currentResearch ].researched = true;

            if (currentResearch == techno)
            {
                //	ai Ai = new ai();
                byte[] possibleTechnos = ai.returnDisponibleTechnologies(player);

                if (player == Form1.game.curPlayerInd)
                {
                    string technoName = Statistics.technologies[currentResearch].name;

                    if (possibleTechnos.Length > 0)
                    {
                        byte     nextTechno = ai.randomTechnology(player);
                        string[] choices    = uiWrap.technoListStrings(player, possibleTechnos);

                        userChoice ui = new userChoice(
                            language.getAString(language.order.uiNewTechnology),
                            String.Format(language.getAString(language.order.uiYouJustDiscovered),
                                          technoName),
                            choices,
                            0,
                            language.getAString(language.order.ok),
                            language.getAString(language.order.uiOpenTechnoTree)
                            );

                        ui.ShowDialog();

                        int res = ui.result;

                        if (res == -1)
                        {                         // science tree
                            currentResearch = nextTechno;

                            sciTree sciTree1 = new sciTree();

                            sciTree1.ShowDialog();
                        }
                        else
                        {                         // accept
                            currentResearch = (byte)possibleTechnos[res];
                        }
                    }
                    else
                    {
                        if (currentResearch != 0)
                        {
                            System.Windows.Forms.MessageBox.Show(
                                String.Format(language.getAString(language.order.uiYouJustDiscoveredEverything), Statistics.technologies[Form1.game.playerList[player].currentResearch].name),
                                language.getAString(language.order.uiNewTechnology)
                                );
                        }

                        currentResearch = 0;
                        technos[currentResearch].pntDiscovered = 0;
                    }
                }
                else                 // cpu
                {
                    if (possibleTechnos.Length > 0)
                    {
                        byte nextTechnos = ai.randomTechnology(player);

                        currentResearch = nextTechnos;
                    }
                    else
                    {
                        currentResearch = 0;
                        technos[Form1.game.playerList[player].currentResearch].pntDiscovered = 0;
                    }
                }
            }

            /*	Form1.game.playerList[ player ].technos[ techno ].researched = true;
             *
             * if ( Form1.game.playerList[ player ].currentResearch == techno )
             * {
             *      if ( player == Form1.game.curPlayerInd )
             *      {
             *              uiWrap.chooseNextTechno(
             *                      player,
             *                      "You just aquired " + Statistics.technologies[ Form1.game.playerList[ player ].currentResearch ].name.ToLower() + ".  Please choose your next research.",
             *                      "Technology aquired"
             *                      );
             *      }
             *      else
             *      {
             *              ai Ai = new ai();
             *              Form1.game.playerList[ player ].currentResearch = Ai.randomTechnology( player );
             *      }
             *
             * }*/
        }
Exemplo n.º 3
0
		public static void chooseNextTechno( byte player, string text, string caption )
		{
			string technoName = Statistics.technologies[ Form1.game.playerList[ player ].currentResearch ].name;

			ai Ai = new ai();
			byte[] technos = ai.returnDisponibleTechnologies( player );
			byte nextTechno = ai.randomTechnology( player );

			string[] choices = technoListStrings( player, technos );

			userChoice uc = new userChoice(
				caption,
				text,	
				choices,
				0, 
				language.getAString( language.order.uiAccept ),
				language.getAString( language.order.uiOpenTechnoTree )
				);
			uc.ShowDialog();
			int res = uc.result;
						
			if ( res == -1 )
			{ // science tree
				Form1.game.playerList[ player ].currentResearch = (byte)nextTechno;

				sciTree sciTree1 = new sciTree();
				sciTree1.ShowDialog();
			}
			else
			{ // accept
				Form1.game.playerList[ player ].currentResearch = (byte)technos[ res ];
			}
		}
Exemplo n.º 4
0
		public void aquireTechno( byte techno )
		{
			technos[ techno ].researched = true;
			//	Form1.game.playerList[ player ].technos[ Form1.game.playerList[ player ].currentResearch ].researched = true;

			if ( currentResearch == techno )
			{
			//	ai Ai = new ai();
				byte[] possibleTechnos = ai.returnDisponibleTechnologies( player );

				if ( player == Form1.game.curPlayerInd )
				{
					string technoName = Statistics.technologies[ currentResearch ].name;

					if ( possibleTechnos.Length > 0 )
					{
						byte nextTechno = ai.randomTechnology( player );
						string[] choices = uiWrap.technoListStrings( player, possibleTechnos );

						userChoice ui = new userChoice(
							language.getAString( language.order.uiNewTechnology ), 
							String.Format( language.getAString( language.order.uiYouJustDiscovered ), 
							technoName ), 
							choices,
							0,
							language.getAString( language.order.ok ), 
							language.getAString( language.order.uiOpenTechnoTree ) 
							);

						ui.ShowDialog();

						int res = ui.result;

						if ( res == -1 )
						{ // science tree
							currentResearch = nextTechno;

							sciTree sciTree1 = new sciTree();

							sciTree1.ShowDialog();
						}
						else
						{ // accept
							currentResearch = (byte)possibleTechnos[ res ];
						}
					}
					else
					{
						if ( currentResearch != 0 )
							System.Windows.Forms.MessageBox.Show( 
								String.Format( language.getAString( language.order.uiYouJustDiscoveredEverything ), Statistics.technologies[ Form1.game.playerList[ player ].currentResearch ].name ), 
								language.getAString( language.order.uiNewTechnology ) 
								);

						currentResearch = 0;
						technos[ currentResearch ].pntDiscovered = 0;
					}
				}
				else // cpu
				{
					if ( possibleTechnos.Length > 0 )
					{
						byte nextTechnos = ai.randomTechnology( player );

						currentResearch = nextTechnos;
					}
					else
					{
						currentResearch = 0;
						technos[ Form1.game.playerList[ player ].currentResearch ].pntDiscovered = 0;
					}
				}
			}
			/*	Form1.game.playerList[ player ].technos[ techno ].researched = true;

			if ( Form1.game.playerList[ player ].currentResearch == techno )
			{
				if ( player == Form1.game.curPlayerInd )
				{
					uiWrap.chooseNextTechno( 
						player, 
						"You just aquired " + Statistics.technologies[ Form1.game.playerList[ player ].currentResearch ].name.ToLower() + ".  Please choose your next research.", 
						"Technology aquired" 
						);
				}
				else
				{
					ai Ai = new ai();
					Form1.game.playerList[ player ].currentResearch = Ai.randomTechnology( player );
				}

			}*/
		}