commit1
This commit is contained in:
parent
c815fc49e8
commit
4874beae78
@ -6,7 +6,6 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="91fba623-49d8-4a60-90d5-98344ab7724a" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Hydroplane/src/main/java/org/example/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/Hydroplane/src/main/java/org/example/Main.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
80
Hydroplane/src/main/java/org/example/AbstractStrategy.java
Normal file
80
Hydroplane/src/main/java/org/example/AbstractStrategy.java
Normal file
@ -0,0 +1,80 @@
|
||||
package org.example;
|
||||
|
||||
public abstract class AbstractStrategy {
|
||||
|
||||
private IMoveableObject _moveableObject;
|
||||
|
||||
private Status _state = Status.NotInit;
|
||||
|
||||
protected int FieldWidth;
|
||||
|
||||
protected int FieldHeight;
|
||||
|
||||
public Status GetStatus() { return _state; }
|
||||
|
||||
public void SetData(IMoveableObject moveableObject, int width, int
|
||||
height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = Status.NotInit;
|
||||
return;
|
||||
}
|
||||
_state = Status.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (IsTargetDestinaion())
|
||||
{
|
||||
_state = Status.Finish;
|
||||
return;
|
||||
}
|
||||
MoveToTarget();
|
||||
}
|
||||
|
||||
protected boolean MoveLeft() { return MoveTo(Direction.Left);}
|
||||
|
||||
protected boolean MoveRight() { return MoveTo(Direction.Right);}
|
||||
|
||||
protected boolean MoveUp() { return MoveTo(Direction.Up);}
|
||||
|
||||
protected boolean MoveDown() { return MoveTo(Direction.Down);}
|
||||
|
||||
protected ObjectParameters GetObjectParameters() { return _moveableObject.GetObjectPosition(); }
|
||||
|
||||
protected int GetStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return _moveableObject.GetStep();
|
||||
}
|
||||
|
||||
protected abstract void MoveToTarget();
|
||||
|
||||
protected abstract boolean IsTargetDestinaion();
|
||||
|
||||
private boolean MoveTo(Direction Direction)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_moveableObject.CheckCanMove(Direction))
|
||||
{
|
||||
_moveableObject.MoveObject(Direction);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -6,37 +6,14 @@ import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class DrawingHydroplane{
|
||||
public class DrawingHydroplane extends DrawingPlane{
|
||||
|
||||
private WindowDrawing windowDrawing;
|
||||
|
||||
public EntityHydroplane _EntityHydroplane;
|
||||
|
||||
private int _pictureWidth;
|
||||
|
||||
private int _pictureHeight;
|
||||
|
||||
private int _startPosX;
|
||||
|
||||
private int _startPosY;
|
||||
|
||||
private int _planeWidth = 190;
|
||||
|
||||
private int _planeHeight = 80;
|
||||
|
||||
public boolean Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, boolean boat, boolean bobber, int numWindow, int width, int height)
|
||||
public DrawingHydroplane(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, boolean boat, boolean bobber, int _numWindow, int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_pictureHeight < _planeHeight || _pictureWidth < _planeWidth)
|
||||
return false;
|
||||
_EntityHydroplane = new EntityHydroplane();
|
||||
_EntityHydroplane.Init(speed, weight, bodyColor, additionalColor,boat, bobber, numWindow);
|
||||
super(speed, weight, bodyColor, _numWindow, width, height);
|
||||
_EntityPlane = new EntityHydroplane(speed, weight, bodyColor, additionalColor, boat, bobber, _numWindow);
|
||||
|
||||
windowDrawing = new WindowDrawing();
|
||||
windowDrawing.setNumWindow(numWindow);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
@ -45,58 +22,17 @@ public class DrawingHydroplane{
|
||||
_startPosY = Math.min(y, _pictureHeight-_planeHeight);
|
||||
}
|
||||
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (_EntityHydroplane == null){
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
case Left:
|
||||
if (_startPosX - _EntityHydroplane.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)_EntityHydroplane.Step;
|
||||
}
|
||||
break;
|
||||
case Up:
|
||||
if (_startPosY - _EntityHydroplane.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)_EntityHydroplane.Step;
|
||||
}
|
||||
break;
|
||||
case Right:
|
||||
if (_startPosX + _planeWidth + _EntityHydroplane.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)_EntityHydroplane.Step;
|
||||
}
|
||||
break;
|
||||
case Down:
|
||||
if (_startPosY + _planeHeight + _EntityHydroplane.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)_EntityHydroplane.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawTransport(Graphics2D g)
|
||||
{
|
||||
|
||||
if (_EntityHydroplane == null)
|
||||
if (_EntityPlane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g.setColor(_EntityHydroplane.BodyColor);
|
||||
g.fillPolygon(
|
||||
new int[]{ _startPosX + 5, _startPosX + 5, _startPosX + 130, _startPosX + 160, _startPosX + 130, _startPosX + 130, _startPosX + 55 },
|
||||
new int[]{ _startPosY, _startPosY + 55, _startPosY + 55, _startPosY + 40, _startPosY + 40, _startPosY + 25, _startPosY + 25 },
|
||||
7);
|
||||
super.DrawTransport(g);
|
||||
|
||||
g.fillRect(_startPosX + 65, _startPosY + 55, 5, 15);
|
||||
g.fillRect(_startPosX + 125, _startPosY + 55, 5, 15);
|
||||
|
||||
g.setColor(_EntityHydroplane.AdditionalColor);
|
||||
g.setColor(((EntityHydroplane)_EntityPlane).AdditionalColor);
|
||||
|
||||
g.fillPolygon(
|
||||
new int[]{ _startPosX + 160, _startPosX + 130, _startPosX + 130 },
|
||||
@ -104,22 +40,9 @@ public class DrawingHydroplane{
|
||||
3
|
||||
);
|
||||
|
||||
g.drawRect(_startPosX + 5, _startPosY + 25, 125, 30);
|
||||
//windowDrawing.Draw(_startPosX, _startPosY, _EntityHydroplane.AdditionalColor, g);
|
||||
|
||||
g.drawLine(_startPosX + 130, _startPosY + 25, _startPosX + 160, _startPosY + 40);
|
||||
g.drawLine(_startPosX + 130, _startPosY + 55, _startPosX + 160, _startPosY + 40);
|
||||
g.drawLine(_startPosX + 130, _startPosY + 40, _startPosX + 160, _startPosY + 40);
|
||||
|
||||
g.drawOval(_startPosX + 35, _startPosY + 43, 80, 7);
|
||||
|
||||
g.drawLine(_startPosX + 65, _startPosY + 55, _startPosX + 65, _startPosY + 70);
|
||||
g.drawLine(_startPosX + 70, _startPosY + 55, _startPosX + 70, _startPosY + 70);
|
||||
g.drawLine(_startPosX + 125, _startPosY + 55, _startPosX + 125, _startPosY + 70);
|
||||
g.drawLine(_startPosX + 130, _startPosY + 55, _startPosX + 130, _startPosY + 70);
|
||||
|
||||
windowDrawing.Draw(_startPosX, _startPosY, _EntityHydroplane.AdditionalColor, g);
|
||||
|
||||
if (_EntityHydroplane.Bobber) {
|
||||
if (((EntityHydroplane)_EntityPlane).Bobber) {
|
||||
g.fillPolygon(
|
||||
new int[]{ _startPosX + 55, _startPosX + 55, _startPosX + 155, _startPosX + 175 },
|
||||
new int[]{ _startPosY + 70, _startPosY + 80, _startPosY + 80, _startPosY + 70 },
|
||||
@ -139,7 +62,7 @@ public class DrawingHydroplane{
|
||||
g.drawOval(_startPosX + 120, _startPosY + 70, 15, 15);
|
||||
}
|
||||
|
||||
if (_EntityHydroplane.Boat){
|
||||
if (((EntityHydroplane)_EntityPlane).Boat){
|
||||
g.fillOval(_startPosX, _startPosY + 21, 32, 8);
|
||||
g.drawOval(_startPosX, _startPosY + 21, 32, 8);
|
||||
}
|
||||
|
147
Hydroplane/src/main/java/org/example/DrawingPlane.java
Normal file
147
Hydroplane/src/main/java/org/example/DrawingPlane.java
Normal file
@ -0,0 +1,147 @@
|
||||
package org.example;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class DrawingPlane{
|
||||
|
||||
//protected IWheelDrawing wheelDrawing;
|
||||
|
||||
public EntityPlane _EntityPlane;
|
||||
|
||||
protected int _pictureWidth;
|
||||
|
||||
protected int _pictureHeight;
|
||||
|
||||
protected int _startPosX;
|
||||
|
||||
protected int _startPosY;
|
||||
|
||||
protected int _planeWidth = 190;
|
||||
|
||||
protected int _planeHeight = 80;
|
||||
|
||||
public DrawingPlane(int speed, double weight, Color bodyColor, int _numWindow, int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_pictureHeight < _planeHeight || _pictureWidth < _planeWidth)
|
||||
return;
|
||||
_EntityPlane = new EntityPlane(speed, weight, bodyColor, _numWindow);
|
||||
/*
|
||||
Random random = new Random();
|
||||
switch(random.nextInt(0, 3)){
|
||||
case 0:
|
||||
wheelDrawing = new WheelDrawingSimple();
|
||||
break;
|
||||
case 1:
|
||||
wheelDrawing = new WheelDrawingBalls();
|
||||
break;
|
||||
case 2:
|
||||
wheelDrawing = new WheelDrawingDavidStar();
|
||||
break;
|
||||
default:
|
||||
wheelDrawing = new WheelDrawingSimple();
|
||||
break;
|
||||
}
|
||||
wheelDrawing.setNumWheel(_numWheel);
|
||||
*/
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
_startPosX = Math.min(x, _pictureWidth-_planeWidth);
|
||||
_startPosY = Math.min(y, _pictureHeight-_planeHeight);
|
||||
}
|
||||
|
||||
public int GetPosX (){return _startPosX;}
|
||||
|
||||
public int GetPosY (){return _startPosY;}
|
||||
|
||||
public int GetWidth (){return _planeWidth;}
|
||||
|
||||
public int GetHeight (){return _planeHeight;}
|
||||
|
||||
public boolean CanMove(Direction direction)
|
||||
{
|
||||
if (_EntityPlane == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
case Left:
|
||||
return _startPosX - _EntityPlane.Step > 0;
|
||||
case Right:
|
||||
return _startPosX + _planeWidth + _EntityPlane.Step < _pictureWidth;
|
||||
case Up:
|
||||
return _startPosY - _EntityPlane.Step > 0;
|
||||
case Down:
|
||||
return _startPosY + _planeHeight + _EntityPlane.Step < _pictureHeight;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (!CanMove(direction) || _EntityPlane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
case Left:
|
||||
_startPosX -= (int)_EntityPlane.Step;
|
||||
break;
|
||||
case Up:
|
||||
_startPosY -= (int)_EntityPlane.Step;
|
||||
break;
|
||||
case Right:
|
||||
_startPosX += (int)_EntityPlane.Step;
|
||||
break;
|
||||
case Down:
|
||||
_startPosY += (int)_EntityPlane.Step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawTransport(Graphics2D g)
|
||||
{
|
||||
|
||||
if (_EntityPlane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g.setColor(_EntityPlane.BodyColor);
|
||||
g.fillPolygon(
|
||||
new int[]{ _startPosX + 5, _startPosX + 5, _startPosX + 130, _startPosX + 160, _startPosX + 130, _startPosX + 130, _startPosX + 55 },
|
||||
new int[]{ _startPosY, _startPosY + 55, _startPosY + 55, _startPosY + 40, _startPosY + 40, _startPosY + 25, _startPosY + 25 },
|
||||
7);
|
||||
|
||||
g.fillRect(_startPosX + 65, _startPosY + 55, 5, 15);
|
||||
g.fillRect(_startPosX + 125, _startPosY + 55, 5, 15);
|
||||
|
||||
g.setColor(Color.black);
|
||||
|
||||
g.drawRect(_startPosX + 5, _startPosY + 25, 125, 30);
|
||||
|
||||
g.drawLine(_startPosX + 130, _startPosY + 25, _startPosX + 160, _startPosY + 40);
|
||||
g.drawLine(_startPosX + 130, _startPosY + 55, _startPosX + 160, _startPosY + 40);
|
||||
g.drawLine(_startPosX + 130, _startPosY + 40, _startPosX + 160, _startPosY + 40);
|
||||
|
||||
g.drawOval(_startPosX + 35, _startPosY + 43, 80, 7);
|
||||
|
||||
g.drawLine(_startPosX + 65, _startPosY + 55, _startPosX + 65, _startPosY + 70);
|
||||
g.drawLine(_startPosX + 70, _startPosY + 55, _startPosX + 70, _startPosY + 70);
|
||||
g.drawLine(_startPosX + 125, _startPosY + 55, _startPosX + 125, _startPosY + 70);
|
||||
g.drawLine(_startPosX + 130, _startPosY + 55, _startPosX + 130, _startPosY + 70);
|
||||
|
||||
//windowDrawing.Draw(_startPosX, _startPosY, _EntityHydroplane.AdditionalColor, g);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.example;
|
||||
|
||||
public class DrawningObjectPlane implements IMoveableObject {
|
||||
private DrawingPlane _drawingPlane = null;
|
||||
public DrawningObjectPlane(DrawingPlane drawingPlane)
|
||||
{
|
||||
_drawingPlane = drawingPlane;
|
||||
}
|
||||
public ObjectParameters GetObjectPosition(){
|
||||
if (_drawingPlane == null || _drawingPlane._EntityPlane ==
|
||||
null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawingPlane.GetPosX(),
|
||||
_drawingPlane.GetPosY(), _drawingPlane.GetWidth(), _drawingPlane.GetHeight());
|
||||
}
|
||||
public int GetStep(){ return (int)_drawingPlane._EntityPlane.Step; }
|
||||
public boolean CheckCanMove(Direction direction) { return _drawingPlane.CanMove(direction);}
|
||||
public void MoveObject(Direction direction) { _drawingPlane.MoveTransport(direction); }
|
||||
|
||||
}
|
@ -6,13 +6,7 @@ import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class EntityHydroplane{
|
||||
|
||||
public int Speed;
|
||||
|
||||
public double Weight;
|
||||
|
||||
public Color BodyColor;
|
||||
public class EntityHydroplane extends EntityPlane{
|
||||
|
||||
public Color AdditionalColor;
|
||||
|
||||
@ -20,20 +14,12 @@ public class EntityHydroplane{
|
||||
|
||||
public boolean Bobber;
|
||||
|
||||
public double Step;
|
||||
|
||||
public int numWindow;
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
public EntityHydroplane(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, boolean boat, boolean bobber, int _numWindow)
|
||||
{
|
||||
numWindow = _numWindow;
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
super(speed, weight, bodyColor, _numWindow);
|
||||
AdditionalColor = additionalColor;
|
||||
Boat = boat;
|
||||
Bobber = bobber;
|
||||
Step = (double)Speed * 100 / Weight;
|
||||
}
|
||||
}
|
||||
|
29
Hydroplane/src/main/java/org/example/EntityPlane.java
Normal file
29
Hydroplane/src/main/java/org/example/EntityPlane.java
Normal file
@ -0,0 +1,29 @@
|
||||
package org.example;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class EntityPlane{
|
||||
|
||||
public int Speed;
|
||||
|
||||
public double Weight;
|
||||
|
||||
public Color BodyColor;
|
||||
|
||||
public double Step;
|
||||
|
||||
public int numWindow;
|
||||
|
||||
public EntityPlane(int speed, double weight, Color bodyColor, int _numWindow)
|
||||
{
|
||||
numWindow = _numWindow;
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
Step = (double)Speed * 100 / Weight;
|
||||
}
|
||||
}
|
13
Hydroplane/src/main/java/org/example/IMoveableObject.java
Normal file
13
Hydroplane/src/main/java/org/example/IMoveableObject.java
Normal file
@ -0,0 +1,13 @@
|
||||
package org.example;
|
||||
|
||||
public interface IMoveableObject {
|
||||
|
||||
ObjectParameters GetObjectPosition();
|
||||
|
||||
int GetStep();
|
||||
|
||||
boolean CheckCanMove(Direction direction);
|
||||
|
||||
void MoveObject(Direction direction);
|
||||
}
|
||||
|
17
Hydroplane/src/main/java/org/example/IWindowDrawing.java
Normal file
17
Hydroplane/src/main/java/org/example/IWindowDrawing.java
Normal file
@ -0,0 +1,17 @@
|
||||
package org.example;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.event.*;
|
||||
|
||||
public interface IWindowDrawing{
|
||||
|
||||
public NumWindow getNumWindow();
|
||||
|
||||
public void setNumWindow(int kWindow);
|
||||
|
||||
public void Draw(int _startPosX, int _startPosY, Color color, Graphics2D g2d);
|
||||
|
||||
}
|
29
Hydroplane/src/main/java/org/example/ObjectParameters.java
Normal file
29
Hydroplane/src/main/java/org/example/ObjectParameters.java
Normal file
@ -0,0 +1,29 @@
|
||||
package org.example;
|
||||
|
||||
public class ObjectParameters {
|
||||
private int _x;
|
||||
private int _y;
|
||||
private int _width;
|
||||
private int _height;
|
||||
|
||||
public int LeftBorder() {return _x;}
|
||||
|
||||
public int TopBorder () {return _y;}
|
||||
|
||||
public int RightBorder () {return _x + _width;}
|
||||
|
||||
public int DownBorder () {return _y + _height;}
|
||||
|
||||
public int ObjectMiddleHorizontal () {return _x + _width / 2;}
|
||||
|
||||
public int ObjectMiddleVertical () {return _y + _height / 2;}
|
||||
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
|
8
Hydroplane/src/main/java/org/example/Status.java
Normal file
8
Hydroplane/src/main/java/org/example/Status.java
Normal file
@ -0,0 +1,8 @@
|
||||
package org.example;
|
||||
|
||||
public enum Status {
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package org.example;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class WindowDrawing{
|
||||
public class WindowDrawing implements IWindowDrawing{
|
||||
private NumWindow numWindow;
|
||||
|
||||
public NumWindow getSomeProperty() {
|
||||
public NumWindow getNumWindow() {
|
||||
return numWindow;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ public class WindowDrawing{
|
||||
}
|
||||
}
|
||||
|
||||
void Draw(int _startPosX, int _startPosY, Color color, Graphics2D g){
|
||||
public void Draw(int _startPosX, int _startPosY, Color color, Graphics2D g){
|
||||
g.setColor(color);
|
||||
switch (numWindow) {
|
||||
case tenWindows -> {
|
||||
|
60
Hydroplane/src/main/java/org/example/WindowDrawingRect.java
Normal file
60
Hydroplane/src/main/java/org/example/WindowDrawingRect.java
Normal file
@ -0,0 +1,60 @@
|
||||
package org.example;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class WindowDrawingRect implements IWindowDrawing{
|
||||
private NumWindow numWindow;
|
||||
|
||||
public NumWindow getNumWindow() {
|
||||
return numWindow;
|
||||
}
|
||||
|
||||
public void setNumWindow(int kWindow){
|
||||
switch(kWindow){
|
||||
case 10:
|
||||
numWindow = NumWindow.tenWindows;
|
||||
break;
|
||||
case 20:
|
||||
numWindow = NumWindow.twentyWindows;
|
||||
break;
|
||||
case 30:
|
||||
numWindow = NumWindow.thirtyWindows;
|
||||
break;
|
||||
default:
|
||||
numWindow = NumWindow.tenWindows;
|
||||
System.out.println("Произошел косяк с количеством, но давайте их будет 10, вообще было " + kWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(int _startPosX, int _startPosY, Color color, Graphics2D g){
|
||||
g.setColor(color);
|
||||
switch (numWindow) {
|
||||
case tenWindows -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
g.fillRect(_startPosX + 35 + i * 8, _startPosY + 30, 4, 4);
|
||||
}
|
||||
}
|
||||
case twentyWindows -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
g.fillRect(_startPosX + 35 + i * 8, _startPosY + 30, 4, 4);
|
||||
}
|
||||
for (int i = 0; i < 10; i++) {
|
||||
g.fillRect(_startPosX + 35 + i * 8, _startPosY + 30 + 4, 4, 4);
|
||||
}
|
||||
}
|
||||
case thirtyWindows -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
g.fillRect(_startPosX + 35 + i * 8, _startPosY + 30, 4, 4);
|
||||
}
|
||||
for (int i = 0; i < 10; i++) {
|
||||
g.fillRect(_startPosX + 35 + i * 8, _startPosY + 30 + 4, 4, 4);
|
||||
}
|
||||
for (int i = 0; i < 10; i++) {
|
||||
g.fillRect(_startPosX + 35 + i * 8, _startPosY + 30 + 8, 4, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user