Esempio n. 1
0
        public void BdfarmersObjectTest()
        {
            NationNameFactory name   = new NationNameFactory("Bangladeshi Farmers");
            INation           nation = name.NationNameFactoryMethod();

            Assert.IsType <BdFarmers>(nation);
        }
Esempio n. 2
0
 private void newVillage_Click(object sender, EventArgs e)
 {
     nation        = nation2;
     tree.Checked  = false;
     House.Checked = false;
     Water.Checked = false;
 }
Esempio n. 3
0
        public void InuitHuntersObjectTest()
        {
            NationNameFactory name   = new NationNameFactory("Inuit Hunters");
            INation           nation = name.NationNameFactoryMethod();

            Assert.IsType <InuitHunters>(nation);
        }
 private void nation_selector_SelectedIndexChanged(object sender, EventArgs e)
 {
     selected_nation = nation_selector.Text;
     if (selected_nation == "Arab Bedouins")
     {
         nation = new Arab();
     }
     else if (selected_nation == "Bangladeshi Farmers")
     {
         nation = new Bangladesh();
     }
     else if (selected_nation == "Egyptian Kings")
     {
         nation = new Egypt();
     }
     else if (selected_nation == "Inuit Hunters")
     {
         nation = new Inuit();
     }
     else
     {
         nation = null;
     }
     g.Clear(nation.getBackgroundColor());
     vill = new Village();
 }
Esempio n. 5
0
        public void EgyptianKingsObjectTest()
        {
            NationNameFactory name   = new NationNameFactory("Egyptian Kings");
            INation           nation = name.NationNameFactoryMethod();

            Assert.IsType <EgyptianKings>(nation);
        }
Esempio n. 6
0
        public void ArabBedouinObjectTest()
        {
            NationNameFactory name   = new NationNameFactory("Arab Bedouin");
            INation           nation = name.NationNameFactoryMethod();

            Assert.IsType <ArabBedouin>(nation);
        }
Esempio n. 7
0
 public Village(INation nation, string villagename)
 {
     this.nation      = nation;
     this.villagename = villagename;
     trees            = new List <VillageItem>();
     houses           = new List <VillageItem>();
     watersources     = new List <VillageItem>();
 }
Esempio n. 8
0
        /// <summary> Creates a new nation. </summary>
        /// <param name="dataRepository"> A data repository to persist the object with. </param>
        /// <param name="id"> The branch's ID. </param>
        /// <param name="gaijinId"> The branch's Gaijin ID. </param>
        /// <param name="nation"> The branch's nation. </param>
        public Branch(IDataRepository dataRepository, long id, string gaijinId, INation nation)
            : base(dataRepository, id, gaijinId)
        {
            AsEnumerationItem = EReference.BranchesFromString[GaijinId.Split(ECharacter.Underscore).Last()];
            Nation            = nation;

            LogCreation();
        }
		public void SetUp()
		{
			this.Player = new Mock<UnitTests.TestPlayer>();
			this.Player.SetupAllProperties();

			this.Description1 = new UnitDescription("Unit1", 100, 1f, 5f, 5f);
			this.Description2 = new UnitDescription("Unit2", 100, 1f, 5f, 5f);

			this.Nation = new Nation("TestNation", "NonExisting", new IUnitDescription[] { this.Description1, this.Description2 });
		}
 private void btndone_Click(object sender, EventArgs e)
 {
     if (txtvillagename.TextLength != 0)
     {
         INationFactory factory = (INationFactory)cboxnation.SelectedItem;
         INation        nation  = factory.GetNation();
         villagewindow.village         = new Village(nation, txtvillagename.Text);
         villagewindow.lblnation.Text  = nation.GetNationName();
         villagewindow.lblvillage.Text = txtvillagename.Text;
         villagewindow.village.initiate(villagewindow.g, villagewindow.p);
         this.Dispose();
     }
 }
Esempio n. 11
0
        public void setSavedVill(Village vill)
        {
            selected_nation = vill.nation;
            if (selected_nation == "Arab Bedouins")
            {
                nation = new Arab();
            }
            else if (selected_nation == "Bangladeshi Farmers")
            {
                nation = new Bangladesh();
            }
            else if (selected_nation == "Egyptian Kings")
            {
                nation = new Egypt();
            }
            else if (selected_nation == "Inuit Hunters")
            {
                nation = new Inuit();
            }
            else
            {
                nation = null;
            }
            if (nation != null)
            {
                g.Clear(nation.getBackgroundColor());
            }

            Label_villName.Text = vill.village_name;
            foreach (Point p in vill.trees_drawn.ToList())
            {
                selected_component = "tree";
                drawInPanel(p);
            }
            foreach (Point p in vill.houses_drawn.ToList())
            {
                selected_component = "house";
                drawInPanel(p);
            }
            foreach (Point p in vill.rivers_drawn.ToList())
            {
                selected_component = "water_source";
                drawInPanel(p);
            }
            nation_selector.SelectedIndex = nation_selector.Items.IndexOf(vill.nation);
        }
 private void btnopen_Click(object sender, EventArgs e)
 {
     if (txtvillagepath.Text != "")
     {
         INationFactory factory    = (INationFactory)cboxnation.SelectedItem;
         INation        nation     = factory.GetNation();
         var            dataString = System.IO.File.ReadAllText(txtvillagepath.Text);
         var            settings   = new JsonSerializerSettings()
         {
             TypeNameHandling = TypeNameHandling.All
         };
         IState state = JsonConvert.DeserializeObject <IState>(dataString, settings);
         villagewindow.village         = new Village(nation, "");
         villagewindow.lblnation.Text  = nation.GetNationName();
         villagewindow.lblvillage.Text = state.GetVillageName();
         villagewindow.village.SetState(state);
         villagewindow.village.initiate(villagewindow.g, villagewindow.p);
         this.Dispose();
     }
 }
Esempio n. 13
0
 public INation NationNameFactoryMethod()
 {
     if (nationName == "Bangladeshi Farmers")
     {
         obj = new BdFarmers();
     }
     else if (nationName == "Arab Bedouin")
     {
         obj = new ArabBedouin();
     }
     else if (nationName == "Egyptian Kings")
     {
         obj = new EgyptianKings();
     }
     else if (nationName == "Inuit Hunters")
     {
         obj = new InuitHunters();
     }
     return(obj);
 }
Esempio n. 14
0
        private void mouse_click(object sender, MouseEventArgs e)
        {
            int x, y;

            //String nationName;
            x = e.X;
            y = e.Y;
            Graphics g = panel1.CreateGraphics();
            //nationName = comboBoxNationName.Text;
            Pen p = new Pen(new SolidBrush(Color.Black), 2);
            NationNameFactory nationName1 = new NationNameFactory(comboBoxNationName.Text);

            INation nation = nationName1.NationNameFactoryMethod();

            if (radioButtonHouse.Checked)
            {
                nation.paint_house(e, g, p);
            }
            else if (radioButtonTree.Checked)
            {
                nation.paint_tree(e, g, p);
            }
            else if (radioButtonWaterSource.Checked)
            {
                nation.paint_waterSource(e, g, p);
            }

            /*else if (nationName == "Egyptian Kings")
             * {
             *  if (radioButtonHouse.Checked)
             *  {
             *      egyptianKings.paint_house(e, g, p);
             *  }
             *  else if (radioButtonTree.Checked)
             *  {
             *      egyptianKings.paint_tree(e, g, p);
             *  }
             *  else if (radioButtonWaterSource.Checked)
             *  {
             *      egyptianKings.paint_waterSource(e, g, p);
             *  }
             * }
             * else if (nationName == "Arab Bedouin")
             * {
             *
             *  if (radioButtonHouse.Checked)
             *  {
             *      arabBedouin.paint_house(e, g, p);
             *  }
             *  else if (radioButtonTree.Checked)
             *  {
             *      arabBedouin.paint_tree(e, g, p);
             *  }
             *  else if (radioButtonWaterSource.Checked)
             *  {
             *      //arabBedouin.paint_waterSource(e, g, p);
             *  }
             * }
             * else if (nationName == "Inuit Hunters")
             * {
             *  if (radioButtonHouse.Checked)
             *  {
             *      inuitHunters.paint_house(e, g, p);
             *  }
             *  else if (radioButtonTree.Checked)
             *  {
             *      //inuitHunters.paint_tree(e, g, p);
             *  }
             *  else if (radioButtonWaterSource.Checked)
             *  {
             *      //inuitHunters.paint_waterSource(e, g, p);
             *  }
             * }*/
        }
Esempio n. 15
0
 /// <summary> Creates a new nation. </summary>
 /// <param name="dataRepository"> A data repository to persist the object with. </param>
 /// <param name="gaijinId"> The branch's Gaijin ID. </param>
 /// <param name="nation"> The branch's nation. </param>
 public Branch(IDataRepository dataRepository, string gaijinId, INation nation)
     : this(dataRepository, -1L, gaijinId, nation)
 {
 }
Esempio n. 16
0
 public AllianceDetailsModel(INation nation)
 {
     this.nation = nation;
 }
Esempio n. 17
0
 private void NationChoose_SelectedIndexChanged(object sender, EventArgs e)
 {
     nation           = checker.GetNation(NationChoose.Text);
     canvas.BackColor = nation.TerrainColor();
 }
Esempio n. 18
0
 public NationCheckListModel(INation nation)
 {
     this.Mynation = nation;
 }
		/// <summary>
		/// Inicjalizuje.
		/// </summary>
		/// <param name="id">Nazwa gracza</param>
		/// <param name="name">Nazwa.</param>
		/// <param name="nation">Jego nacja.</param>
		public Player(string name, INation nation, uint maxHealth)
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				throw new ArgumentNullException("name");
			}
			if (nation == null)
			{
				throw new ArgumentNullException("nation");
			}

			this.Units = new List<IUnit>();
			this.Resources = new Resources.ResourcesCollection();

			this.Name = name;
			this.Nation = nation;
			this.MaxHealth = maxHealth;
		}