protected internal override void ProcessTouchPressed() { float x = MathUtils.BringToBounds(0, baseWidth, Touch.GetX() - GetScreenX()) / baseWidth - 0.5f; float y = MathUtils.BringToBounds(0, baseHeight, Touch.GetY() - GetScreenY()) / baseHeight - 0.5f; if (x == 0 && y == 0) { return; } if (MathUtils.Abs(x) > MathUtils.Abs(y)) { if (x > 0) { this.isRight = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 + dotWidth * 0.75f; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2; if (listener != null) { listener.right(); } } else if (x < 0) { this.isLeft = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 - dotWidth * 0.75f; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2; if (listener != null) { listener.left(); } } else if (x == 0) { FreeClick(); } } else { if (y > 0) { this.isDown = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 - 1; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2 + dotHeight * 0.75f; if (listener != null) { listener.down(); } } else if (y < 0) { this.isUp = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 - 1; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2 - dotHeight * 0.75f; if (listener != null) { listener.up(); } } else if (y == 0) { FreeClick(); } } }