|
@@ -492,28 +492,28 @@ namespace GFGGame
|
|
|
}
|
|
|
private void OnClickEnd()
|
|
|
{
|
|
|
- touchSecond = Input.mousePosition;//记录拖动的位置
|
|
|
- if ((touchSecond.x - touchFirst.x) < -80 && Math.Abs(touchSecond.x - touchFirst.x) > Math.Abs(touchSecond.y - touchFirst.y))
|
|
|
- {
|
|
|
- //向左滑动
|
|
|
- Move(Map, Direction.left);
|
|
|
- }
|
|
|
- if ( (touchSecond.x - touchFirst.x) > 80 && Math.Abs(touchSecond.x - touchFirst.x) > Math.Abs(touchSecond.y - touchFirst.y))
|
|
|
- {
|
|
|
- //向右滑动
|
|
|
- Move(Map, Direction.right);
|
|
|
- }
|
|
|
- if ((touchSecond.y - touchFirst.y) < -80 && Math.Abs(touchSecond.y - touchFirst.y) > Math.Abs(touchSecond.x - touchFirst.x))
|
|
|
- {
|
|
|
- //向下滑动
|
|
|
- Move(Map, Direction.down);
|
|
|
- }
|
|
|
- if ((touchSecond.y - touchFirst.y) > 80 && Math.Abs(touchSecond.y - touchFirst.y) > Math.Abs(touchSecond.x - touchFirst.x))
|
|
|
- {
|
|
|
- //向上滑动
|
|
|
- Move(Map, Direction.up);
|
|
|
- }
|
|
|
- touchFirst = touchSecond;
|
|
|
+ touchSecond = Input.mousePosition;//记录拖动的位置
|
|
|
+ if (touchSecond.x < touchFirst.x && Math.Abs(touchSecond.x - touchFirst.x) > Math.Abs(touchSecond.y - touchFirst.y))
|
|
|
+ {
|
|
|
+ //向左滑动
|
|
|
+ Move(Map, Direction.left);
|
|
|
+ }
|
|
|
+ if (touchSecond.x > touchFirst.x && Math.Abs(touchSecond.x - touchFirst.x) > Math.Abs(touchSecond.y - touchFirst.y))
|
|
|
+ {
|
|
|
+ //向右滑动
|
|
|
+ Move(Map, Direction.right);
|
|
|
+ }
|
|
|
+ if (touchSecond.y < touchFirst.y && Math.Abs(touchSecond.y - touchFirst.y) > Math.Abs(touchSecond.x - touchFirst.x))
|
|
|
+ {
|
|
|
+ //向下滑动
|
|
|
+ Move(Map, Direction.down);
|
|
|
+ }
|
|
|
+ if (touchSecond.y > touchFirst.y && Math.Abs(touchSecond.y - touchFirst.y) > Math.Abs(touchSecond.x - touchFirst.x))
|
|
|
+ {
|
|
|
+ //向上滑动
|
|
|
+ Move(Map, Direction.up);
|
|
|
+ }
|
|
|
+ touchFirst = touchSecond;
|
|
|
}
|
|
|
|
|
|
private void OnClickMergeTips()
|