Esempio n. 1
0
        private void Ship_MouseRightButtonDown(object sender, MouseButtonEventArgs e) //no
        {
            int x = Grid.GetColumn(Images[0]);
            int y = Grid.GetRow(Images[0]);

            for (int i = 0; i < Length; i++)
            {
                PlayField.DeleteCell(Grid.GetColumn(Images[i]), Grid.GetRow(Images[i]), playField);
            }
            ChangeOrientation();
            Place(x, y, playField);
        }
Esempio n. 2
0
 public Ship4(PlayField field) //изображения задавать здесь
 {
     // ShipStackPanel = stackPanel;
     playField    = field;
     IsPlaced     = false;
     IsHorizontal = true;
     Length       = 4;
     Images       = new Image[4];
     Images[0]    = new Image
     {
         Stretch = Stretch.Fill,
         Source  = new BitmapImage(new Uri("/Resources/1.png", UriKind.Relative))
         {
             CreateOptions = BitmapCreateOptions.IgnoreImageCache
         },
     };
     Images[1] = new Image
     {
         Stretch = Stretch.Fill,
         Source  = new BitmapImage(new Uri("/Resources/2.png", UriKind.Relative))
         {
             CreateOptions = BitmapCreateOptions.IgnoreImageCache
         },
     };
     Images[2] = new Image
     {
         Stretch = Stretch.Fill,
         Source  = new BitmapImage(new Uri("/Resources/3.png", UriKind.Relative))
         {
             CreateOptions = BitmapCreateOptions.IgnoreImageCache
         },
     };
     Images[3] = new Image
     {
         Stretch = Stretch.Fill,
         Source  = new BitmapImage(new Uri("/Resources/4.png", UriKind.Relative))
         {
             CreateOptions = BitmapCreateOptions.IgnoreImageCache
         },
     };
     for (int i = 0; i < Length; i++)
     {
         Images[i].MouseLeftButtonDown += Ship_MouseLeftButtonDown;
     }
 }