【柯哀王道】左右两边的世界-作者:忧冷繁星
if(y_temp1<0 || x_temp1>this.width)
break;
if(this.arrMapShow[x_temp1][y_temp1]==arrvalue)
num++;
else
break;
}
//判断左下
x_temp1=x_temp;
y_temp1=y_temp;
for(int i=1;i<6;i++){
x_temp1-=1;
y_temp1+=1;
if(y_temp1>this.height || x_temp1<0)
break;
if(this.arrMapShow[x_temp1][y_temp1]==arrvalue)
num++;
else
break;
}
if(num==5)
return true;
return false;
}
//赢棋后的提示
public void showSuccess(JPanel jp){
JOptionPane.showMessageDialog(jp,"你赢了,好厉害!","win",
RMATION_MESSAGE);
}
//输棋后的提示
public void showDefeat(JPanel jp){
JOptionPane.showMessageDialog(jp,"你输了,请重新开始!","lost", RMATION_MESSAGE);
}
}
/*
*类MainPanel主要完成如下功能:
*1、构建一个面板,在该面板上画上棋盘;
*2、处理在该棋盘上的鼠标事件(如鼠标左键点击、鼠标右键点击、鼠标拖动等) **/
class MainPanel extends JPanel
implements MouseListener,MouseMotionListener{
private int width,height;//棋盘的宽度和高度