public void DrawIt(LandTerritory passedTerritory) { passedTerritory.getStackPanel().Children.Clear(); passedTerritory.getStackPanel().Orientation = System.Windows.Controls.Orientation.Horizontal; string fileString = ""; foreach (Knight k in passedTerritory.getKnights()) { fileString = "C:\\Users\\User\\Desktop\\GameOfThronesProject\\GameOfThronesUnits\\" + passedTerritory.getHouseOccupied().getName() + "Knight.jpg"; System.Windows.Controls.Image image1 = new System.Windows.Controls.Image(); image1.Source = new BitmapImage(new Uri(fileString, UriKind.RelativeOrAbsolute)); passedTerritory.getStackPanel().Children.Add(image1); } foreach (Infantry i in passedTerritory.getInfantry()) { fileString = "C:\\Users\\User\\Desktop\\GameOfThronesProject\\GameOfThronesUnits\\" + passedTerritory.getHouseOccupied().getName() + "Footman.jpg"; System.Windows.Controls.Image image1 = new System.Windows.Controls.Image(); image1.Source = new BitmapImage(new Uri(fileString, UriKind.RelativeOrAbsolute)); passedTerritory.getStackPanel().Children.Add(image1); } }
private void MoveToNewTerritory(LandTerritory passedTerritory) { Infantry placeHolderInfantry; Knight placeHolderKnight; passedTerritory.setNumKnight(getAttackingKnights().Count); passedTerritory.setNumInfantry(getAttackingInfantry().Count); attacker.setNumKnight(attacker.getNumKnight() - getAttackingKnights().Count); attacker.setNumInfantry(attacker.getNumInfantry() - getAttackingInfantry().Count); passedTerritory.setHouseOccupied(attacker.getHouseOccupied()); passedTerritory.setOrderToken(new PlaceHolderOrderToken()); foreach(Knight k in getAttackingKnights()) { attacker.getKnights().Remove(k); passedTerritory.getKnights().Add(k); } foreach(Infantry i in getAttackingInfantry()) { attacker.getInfantry().Remove(i); passedTerritory.getInfantry().Add(i); } }
private void showMarchTroopPopup(LandTerritory passedTerritory) { main.PopupChooseMarchTroops.IsOpen = true; main.KnightListBox.Items.Clear(); main.FootmanListBox.Items.Clear(); int count = 0; main.KnightListBox.Items.Add(count); foreach (Knight k in passedTerritory.getKnights()) { count++; if (!k.getRouted()) { main.KnightListBox.Items.Add(count); } } count = 0; main.FootmanListBox.Items.Add(count); foreach (Infantry i in passedTerritory.getInfantry()) { count++; if (!i.getRouted()) { main.FootmanListBox.Items.Add(count); } } }