/// <summary>
 /// Drawing
 /// </summary>
 /// <param name="g"></param>
 /// <param name="qipan"></param>
 public drawing(Graphics g, chessboard qipan)
 {
     qp          = qipan;
     qppic       = Image.FromFile("./pic/qp.jpg");
     bitmap      = new Bitmap(qppic.Width + 110, qppic.Height + 110);//Properties.Resources.qp.Width, Properties.Resources.qp.Height);
     graphicbuff = Graphics.FromImage(bitmap);
 }
 /// <summary>
 /// Drawing
 /// </summary>
 /// <param name="g"></param>
 /// <param name="qipan"></param>
 public drawing(Graphics g,chessboard qipan) 
 {
     qp = qipan;
     qppic=Image.FromFile("./pic/qp.jpg");
     bitmap = new Bitmap(qppic.Width+110, qppic.Height+110);//Properties.Resources.qp.Width, Properties.Resources.qp.Height);
     graphicbuff = Graphics.FromImage(bitmap);
          
 }
Exemplo n.º 3
0
        /// <summary>
        /// initialize the the board
        /// put chess on board
        /// </summary>
        /// <param name="g"></param>
        public void init(Graphics g)
        {
            qipan   = new chessboard();
            drawing = new drawing(g, qipan);

            switch (gamemode)
            {
            case mode.free_local:
                playerA              = new player(this);
                playerA.seat         = player.set.top;
                playerA.playersource = player.source.local;
                playerA.color        = player.colour.black;
                playerA.ini();

                playerB              = new player(this);
                playerB.seat         = player.set.bottom;
                playerB.playersource = player.source.local;
                playerB.color        = player.colour.red;
                playerB.ini();


                break;

            case mode.turn_local:
                playerA              = new player(this);
                playerA.seat         = player.set.top;
                playerA.playersource = player.source.local;
                playerA.color        = player.colour.black;
                playerA.ini();

                playerB              = new player(this);
                playerB.seat         = player.set.bottom;
                playerB.playersource = player.source.local;
                playerB.color        = player.colour.red;
                playerB.ini();

                playerB.turn = true;
                this.turn    = turnm.playerB;

                break;

            case mode.networking:
                break;

            case mode.AI:
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// initialize the the board
        /// put chess on board
        /// </summary>
        /// <param name="g"></param>
        public void init(Graphics g)
        {
            qipan = new chessboard();
            drawing = new drawing(g, qipan);

            switch (gamemode)
            {
                case mode.free_local:
                    playerA = new player(this);
                    playerA.seat = player.set.top;
                    playerA.playersource = player.source.local;
                    playerA.color = player.colour.black;
                    playerA.ini();

                    playerB = new player(this);
                    playerB.seat = player.set.bottom;
                    playerB.playersource = player.source.local;
                    playerB.color = player.colour.red;
                    playerB.ini();


                    break;
                case mode.turn_local:
                    playerA = new player(this);
                    playerA.seat = player.set.top;
                    playerA.playersource = player.source.local;
                    playerA.color = player.colour.black;
                    playerA.ini();

                    playerB = new player(this);
                    playerB.seat = player.set.bottom;
                    playerB.playersource = player.source.local;
                    playerB.color = player.colour.red;
                    playerB.ini();

                    playerB.turn = true;
                    this.turn = turnm.playerB;

                    break;
                case mode.networking:
                    break;

                case mode.AI:
                    break;
            }

        }
Exemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="b">chessboard</param>
 /// <param name="point">point that clicked</param>
 private void freeGoMode(chessboard b, Point point)
 {
     foreach (var r in b.qz)                                 //r is the piece that clicked on.
     {
         if (r.position == point)                            //按键处有子
         {
             foreach (var p in this.qipan.qz)                // p is selected
             {
                 if (p.selected && p.position == r.position) //if it's select, and clicked on it again, then dis-select it.
                 {
                     p.selected = false;
                     return;
                 }
                 else if (p.selected && p.color == r.color) //if the one clicked and the one selected are in the same color, then select the one clicked.
                 {
                     p.selected = false;
                     r.selected = true;
                     return;
                 }
                 else if (p.selected && p.color != r.color) //吃子
                 {
                     move(p.position, r.position);
                     //p.position = point;
                     //p.selected = false;
                     return;
                 }
             }
             r.selected = true;  //no piece is selected, select the one that clicked on.
             return;
         }
     }
     if (true) //no piece is on the point that clicked.
     {
         foreach (var p in b.qz)
         {
             if (p.selected == true)
             {
                 move(p.position, point);
                 return;
             }
         }
     }
 }
 public player(game g)
 {
     //control control = new chessclient.control();
     qipan = g.qipan;
     game = g;
 }
Exemplo n.º 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="b">chessboard</param>
        /// <param name="point">point that clicked</param>
        private void freeGoMode(chessboard b, Point point)
        {
            foreach (var r in b.qz) //r is the piece that clicked on.
            {
                if (r.position == point) //按键处有子
                {
                    foreach (var p in this.qipan.qz) // p is selected
                    {
                        if (p.selected && p.position == r.position)//if it's select, and clicked on it again, then dis-select it.
                        {
                            p.selected = false;
                            return;
                        }
                        else if (p.selected && p.color == r.color) //if the one clicked and the one selected are in the same color, then select the one clicked.
                        {
                            p.selected = false;
                            r.selected = true;
                            return;
                        }
                        else if (p.selected && p.color != r.color) //吃子
                        {
                            move(p.position, r.position);
                            //p.position = point;
                            //p.selected = false;
                            return;
                        }
                    }
                    r.selected = true;  //no piece is selected, select the one that clicked on.
                    return;

                }
            }
            if (true) //no piece is on the point that clicked.
            {
                foreach (var p in b.qz)
                {
                    if (p.selected == true)
                    {
                        move(p.position,point);
                        return;
                    }
                }
            }


        }
Exemplo n.º 8
0
 public player(game g)
 {
     //control control = new chessclient.control();
     qipan = g.qipan;
     game  = g;
 }