13,097
社区成员




public class Map {
public int startX=0;//开始x位子
public int endX=0;//结束x位子
public int startY=0;
public int endY=0;
public int value=0;
}
public int getSelectMapValue(int screenX,int screenY)
{
int tempSelectValue=-1;
Map tempMap=new Map();
int tempStartX=0;
int tempStartY=0;
int tempEndX=0;
int tempEndY=0;
boolean tempState=true;
if(mapVector.isEmpty()!=true)
{
tempState=true;
for(int i=0;i<mapVector.size()&&tempState==true;i++)
{
tempMap=(Map)mapVector.elementAt(i);
tempStartX=tempMap.startX;
tempStartY=tempMap.startY;
tempEndX=tempMap.endX;
tempEndY=tempMap.endY;
if(screenX>=tempStartX&&screenX<=tempEndX
&&screenY>=tempStartY&&screenY<=tempEndY)
{
tempSelectValue=i;
tempState=false;
}
}
}
return tempSelectValue;//没有找到返回-1,找到就返回你设置的值
}