2023-09-26 19:51:49 +04:00
|
|
|
import java.awt.*;
|
2023-10-18 12:33:39 +04:00
|
|
|
import java.util.Random;
|
2023-09-26 19:51:49 +04:00
|
|
|
|
2023-10-18 12:33:39 +04:00
|
|
|
public class DrawWheelCircle implements IWheelDraw {
|
2023-09-26 19:51:49 +04:00
|
|
|
private WheelCounter wheelCounter;
|
|
|
|
public WheelCounter getWheelCounter()
|
|
|
|
{
|
|
|
|
return wheelCounter;
|
|
|
|
}
|
|
|
|
public void setWheelCount(int count)
|
|
|
|
{
|
|
|
|
if (count % 3 == 0)
|
|
|
|
wheelCounter = WheelCounter.THREE;
|
|
|
|
else if (count % 3 == 1)
|
|
|
|
wheelCounter = WheelCounter.FOUR;
|
|
|
|
else if (count % 3 == 2)
|
|
|
|
wheelCounter = WheelCounter.TWO;
|
|
|
|
}
|
|
|
|
|
2023-11-28 17:44:07 +04:00
|
|
|
public int getWheelCount()
|
|
|
|
{
|
|
|
|
switch (wheelCounter)
|
|
|
|
{
|
|
|
|
case TWO -> {return 2;}
|
|
|
|
case THREE -> {return 3;}
|
|
|
|
case FOUR -> {return 4;}
|
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
2023-09-26 19:51:49 +04:00
|
|
|
public void DrawWheels(int _startPosX, int _startPosY, Color bodyColor, Graphics2D g2d)
|
|
|
|
{
|
|
|
|
g2d.setColor(bodyColor);
|
2023-11-28 17:44:07 +04:00
|
|
|
Random rnd = new Random();
|
2023-09-26 19:51:49 +04:00
|
|
|
g2d.fillOval(10 + _startPosX, 60 + _startPosY, 20, 20);
|
|
|
|
g2d.fillOval(80 + _startPosX, 60 + _startPosY, 20, 20);
|
2023-11-28 17:44:07 +04:00
|
|
|
Color stringColor = new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256));
|
|
|
|
g2d.setColor(stringColor);
|
|
|
|
g2d.drawString("S",15 + _startPosX, 75 + _startPosY);
|
|
|
|
g2d.drawString("S",85 + _startPosX, 75 + _startPosY);
|
|
|
|
if (wheelCounter == null)
|
|
|
|
return;
|
2023-11-28 18:05:14 +04:00
|
|
|
g2d.setColor(bodyColor);
|
2023-09-26 19:51:49 +04:00
|
|
|
switch (wheelCounter)
|
|
|
|
{
|
|
|
|
case THREE -> {g2d.fillOval(45 + _startPosX, 60 + _startPosY ,20, 20);}
|
|
|
|
case FOUR -> {g2d.fillOval(30 + _startPosX, 60 + _startPosY ,20, 20); g2d.fillOval(60 + _startPosX, 60 + _startPosY ,20, 20);}
|
|
|
|
}
|
2023-11-28 18:05:14 +04:00
|
|
|
g2d.setColor(stringColor);
|
2023-10-18 12:33:39 +04:00
|
|
|
switch (wheelCounter)
|
|
|
|
{
|
|
|
|
case THREE -> {g2d.drawString("S",50 + _startPosX, 75 + _startPosY);}
|
|
|
|
case FOUR -> {g2d.drawString("S",35 + _startPosX, 75 + _startPosY); g2d.drawString("S",65 + _startPosX, 75 + _startPosY);}
|
|
|
|
}
|
2023-09-26 19:51:49 +04:00
|
|
|
}
|
|
|
|
}
|