public shi(player.colour a) { this.type = game.type.shi; this.color = a; switch (color) { case player.colour.black: this.pic = Image.FromFile("./pic/4.png"); return; case player.colour.red: this.pic = Image.FromFile("./pic/41.png"); return; } }
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; } }
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; } } }
public virtual void clicked(Point p, player.colour color) { }