|
public override void MoveTo(int i, int j)
{
if (CanMoveTo(i, j))
{
this.Location = AppHelper.Axis[i, j];
if (i == 0 && j < 9)
{
Direction = ChinaChess.Controls.Direction.Up;//qian;
}
else if (i <= 8 && j == 0)
{
this.Direction = Direction.UpRight;//you;
}
else if (i==0 && j >0)
{
this.Direction=Direction.
}
else
{
this.Direction = Direction.UpLeftRight;
}
this.ArrayIndex = new KeyValuePair<int, int>(i, j);
}
}
public override bool CanMoveTo(int i, int j)
{
if (Direction == Direction.Up)
{
if ((this.ArrayIndex.Key - i == 1) && (this.ArrayIndex.Value - j == 0))
{
return true;
}
}
else if (Direction == Direction.Right)
{
if ((this.ArrayIndex.Key - i == 0) && (this.ArrayIndex.Value + j == 1))
{
return true;
}
else if ((this.ArrayIndex.Key - i == 1) && (this.ArrayIndex.Value - j == 0))
{
return true;
}
}
return false;
}
|
|