コード例 #1
0
 public che(player.colour a)
 {
     this.type = game.type.che;
     this.color = a;
     switch (color)
     {
         case player.colour.black:
             this.pic = Image.FromFile("./pic/1.png");
             return;
         case player.colour.red:
             this.pic = Image.FromFile("./pic/11.png");
             return;
     }
 }
コード例 #2
0
        public xiang(player.colour a)
        {
            this.type = game.type.xiang;
            this.color = a;
            switch (color)
            {
                case player.colour.black:
                    this.pic = Image.FromFile("./pic/5.png");
                    return;
                case player.colour.red:
                    this.pic = Image.FromFile("./pic/51.png");
                    return;
            }

        }
コード例 #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;
            }

        }
コード例 #4
0
        public override void clicked(Point point, player.colour color)
        {
            foreach (var piece1 in game.qipan.qz)
            {
                if (piece1.position == point && piece1.color == color)
                {
                    foreach (var piece2 in game.qipan.qz)
                    {
                        if (piece2.selected && piece2.position == piece1.position)//if it's select, and clicked on it again, then dis-select it.
                        {
                            piece2.selected = false;
                            return;
                        }
                        else if (piece2.selected && piece2.color == piece1.color) //if the one clicked and the one selected are in the same color, then select the one clicked.
                        {
                            piece2.selected = false;
                            piece1.selected = true;
                            return;
                        }
                        else if (piece2.selected && piece2.color != piece1.color) //吃子
                        {
                            game.move(piece2.position, piece1.position);
                            //p.position = point;
                            //p.selected = false;
                            return;
                        }
                    }
                    piece1.selected = true;
                    return;
                }
            }
            foreach (var piece1 in game.qipan.qz) 
            {
                if (piece1.selected)
                {
                    game.move(piece1.position, point);
                    return;
                }
            }

        }
コード例 #5
0
 public virtual void clicked(Point p, player.colour color) { }