public void touch(int x, int y) { if (x == active.getX() && y == active.getY()) { active.setX(-1); active.setY(-1); } else { active.setX(x); active.setY(y); } }
public bool OnTouch(View v, MotionEvent e) { if (e.Action == MotionEventActions.Down) { GameController controller = GameController.getInstance(); double widthStep = (double)v.MeasuredWidth / 9; double heightStep = (double)v.MeasuredHeight / 9; int x = (int)((e.GetX()) / widthStep); int y = (int)((e.GetY()) / heightStep); controller.touch(x, y); IntPoint pickerPoint = controller.getActive(); if (pickerPoint.getX() == -1) { container.picker.Set(0, 0, 0, 0); } else { container.picker.Set((int)(x * widthStep), (int)(y * heightStep), (int)(x * widthStep + widthStep), (int)(y * heightStep + heightStep)); } container.Invalidate(); } return(true); }