示例#1
0
 public static void DrawDataBoard(int rw, int cl, bool record, bool type)
 {
     if (type == true)
     {
         if (currPlayer == Player.Human)
         {
             UserControl co;
             co        = new Image.Chess.Chess_O();
             co.Height = length;
             co.Width  = length;
             co.HorizontalAlignment = 0;
             co.VerticalAlignment   = 0;
             co.Margin = new Thickness(cl * length, rw * length, 0, 0);
             grdBanCo.Children.Add(co);
             //Ghi lại cờ vừa đánh
             ddau.Opacity = 100;
             ddau.Margin  = new Thickness(cl * length - 10, rw * length - 10, 0, 0);
         }
         else if (currPlayer == Player.Com || currPlayer == Player.Online)
         {
             UserControl co;
             co        = new Image.Chess.Chess_X();
             co.Height = length;
             co.Width  = length;
             co.HorizontalAlignment = 0;
             co.VerticalAlignment   = 0;
             co.Margin = new Thickness(cl * length, rw * length, 0, 0);
             grdBanCo.Children.Add(co);
             ddau.Opacity = 100;
             ddau.Margin  = new Thickness(cl * length - 10, rw * length - 10, 0, 0);
         }
     }
     else
     {
         System.Windows.Controls.Image co1 = new System.Windows.Controls.Image();
         if (currPlayer == Player.Human)
         {
             co1.Source = new BitmapImage(new Uri("pack://application:,,,/Image/Chess/ok-icon (1).png"));
             co1.Width  = co1.Height = length;
             co1.HorizontalAlignment = 0;
             co1.VerticalAlignment   = 0;
             co1.Margin  = new Thickness(cl * length, rw * length, 0, 0);
             co1.Opacity = 100;
             grdBanCo.Children.Add(co1);
         }
         else if (currPlayer == Player.Com || currPlayer == Player.Online)
         {
             System.Windows.Controls.Image co2 = new System.Windows.Controls.Image();
             co2.Source = new BitmapImage(new Uri("pack://application:,,,/Image/Chess/Cute-Ball-Stop-icon.png"));
             co2.Width  = co2.Height = length;
             co2.HorizontalAlignment = 0;
             co2.VerticalAlignment   = 0;
             co2.Margin  = new Thickness(cl * length, rw * length, 0, 0);
             co2.Opacity = 100;
             grdBanCo.Children.Add(co2);
         }
     }
 }
示例#2
0
        public static void DrawDataBoard(int rw, int cl, bool record, bool type)
        {
            if (type == true)
            {
                if (currPlayer == Player.Human)
                {
                    UserControl co;
                    co = new Image.Chess.Chess_O();
                    co.Height = length;
                    co.Width = length;
                    co.HorizontalAlignment = 0;
                    co.VerticalAlignment = 0;
                    co.Margin = new Thickness(cl * length, rw * length, 0, 0);
                    grdBanCo.Children.Add(co);
                    //Ghi lại cờ vừa đánh
                    ddau.Opacity = 100;
                    ddau.Margin = new Thickness(cl * length - 10, rw * length - 10, 0, 0);
                }
                else if (currPlayer == Player.Com || currPlayer == Player.Online)
                {
                    UserControl co;
                    co = new Image.Chess.Chess_X();
                    co.Height = length;
                    co.Width = length;
                    co.HorizontalAlignment = 0;
                    co.VerticalAlignment = 0;
                    co.Margin = new Thickness(cl * length, rw * length, 0, 0);
                    grdBanCo.Children.Add(co);
                    ddau.Opacity = 100;
                    ddau.Margin = new Thickness(cl * length - 10, rw * length - 10, 0, 0);
                }

            }
            else
            {
                System.Windows.Controls.Image co1 = new System.Windows.Controls.Image();
                if (currPlayer == Player.Human)
                {
                    co1.Source = new BitmapImage(new Uri("pack://application:,,,/Image/Chess/ok-icon (1).png"));
                    co1.Width = co1.Height = length;
                    co1.HorizontalAlignment = 0;
                    co1.VerticalAlignment = 0;
                    co1.Margin = new Thickness(cl * length, rw * length, 0, 0);
                    co1.Opacity = 100;
                    grdBanCo.Children.Add(co1);
                }
                else if (currPlayer == Player.Com || currPlayer == Player.Online)
                {
                    System.Windows.Controls.Image co2 = new System.Windows.Controls.Image();
                    co2.Source = new BitmapImage(new Uri("pack://application:,,,/Image/Chess/Cute-Ball-Stop-icon.png"));
                    co2.Width = co2.Height = length;
                    co2.HorizontalAlignment = 0;
                    co2.VerticalAlignment = 0;
                    co2.Margin = new Thickness(cl * length, rw * length, 0, 0);
                    co2.Opacity = 100;
                    grdBanCo.Children.Add(co2);
                }
            }
        }