ACTION_DOWN:
if(1==isMenuLevel)//一级菜单
{
if(doorState==1)//当前为开仓状态,并且没有弹出对话框
{
if(hasInertia)//按下时,如果有惯性,那么直接停止
{
hasInertia=false;
curr_angle_speed=0;
}
//这里对滚轮菜单下的按下事件进行监听
if(x>MENU_BUTTON_AREA[0]&&x<MENU_BUTTON_AREA[1]&&y>MENU_BUTTON_AREA[2]&&y<MENU_BUTTON_AREA[3])
{
isPoint=true;//点击了相应的菜单按钮
}
}
}
ACTION_MOVE:
if(doorState==1)//当前为开仓状态,并且没有弹出对话框
{
//这里进行范围限制
if(missile_rotation+dy*TOUCH_SCALE_FACTOR>20)
{
missile_rotation=20;
}
else if(missile_rotation+dy*TOUCH_SCALE_FACTOR<-245)
{
missile_rotation=-245;
}
else
{
missile_rotation+=dy*TOUCH_SCALE_FACTOR;//当前导弹菜单旋转地角度
}
if(Math.abs(dy)>8)//设定一个阈值,如果大于这个阈值,松开手指后,添加惯性
{
isTouchMoved=true;//当前正在触摸 移动中
curr_angle_speed=ori_angle_speed*(dy/SCREEN_WIDTH);
}
if(isPoint&&Math.abs(dy)>10)//如果点击事件为true,但是又移动了,所以点击事件设为false
{
isPoint=false;
}
}
ACTION_UP:
if(doorState==1)//当前为开仓状态,并且没有弹出对话框
{
if(isTouchMoved)//如果当前滑动过
{
isTouchMoved=false;//false
hasInertia=true;//具有惯性true
//若当前角速度大于零则加速度置为负
curr_acceleratedSpeed=ori_acceleratedSpeed;
if(curr_angle_speed>0)
{
curr_acceleratedSpeed=-ori_acceleratedSpeed;
}
}
else//这里启动角度智能调整
{
auto_adjust=true;
}