//该点是不在要移动到的区域之内,需置空
this.MyMap.Grid[this.currentCursor[1] + i][this.currentCursor[0] + j] = Images.BLANK;
}
}
}
//交换currentCursor和nextCursor
this.currentCursor[0]=nextCursor[0];
this.currentCursor[1]=nextCursor[1];
repaint();
}
private void Move() {
if ( this.currentCursor[0]==this.nextCursor[0] && this.currentCursor[1]==this.nextCursor[1] )
return; //不需要移动就返回.
//将要移动的区域移动到刚选中的区域
if (this.nextCursor[0] == -1 || this.nextCursor[1] == -1 ||
this.currentCursor[0] == -1 || this.currentCursor[1] == -1) {//没有选中区域
}
else {//已经选中了要移动的区域和要移动到的区域
byte[][] temp = new byte[this.currentCursor[3]][this.currentCursor[2]];
//复制要移动的区域,因为这块区域可能会被覆盖掉
for (int i = 0; i < this.currentCursor[2]; i++) {
for (int j = 0; j < this.currentCursor[3]; j++) {
temp[j][i] = this.MyMap.Grid[this.currentCursor[1] +j][this.currentCursor[0] + i];
}
}
// 调试信息
//将要移动的区域移动到刚选中的区域(即要移动到的区域)
for (int i = 0; i < this.currentCursor[2]; i++) {
for (int j = 0; j < this.currentCursor[3]; j++) {
this.MyMap.Grid[this.nextCursor[1] + j][this.nextCursor[0] + i] = temp[j][i];
}
}
//PrintGrid("2");// 调试信息
//将要移动的区域中无用内容置成空白
for (int i = 0; i < this.currentCursor[3]; i++) {
for (int j = 0; j < this.currentCursor[2]; j++) {
if (!isInRange2(this.currentCursor[0] + j,this.currentCursor[1] + i)) {
//该点是不在要移动到的区域之内,需置空
this.MyMap.Grid[this.currentCursor[1] + i][this.currentCursor[0] + j] = Images.BLANK;
}else {
}
}