правки

This commit is contained in:
Казначеева Елизавета 2023-12-23 14:30:48 +04:00
parent b2a673367b
commit b5b8a7fdbe
4 changed files with 82 additions and 43 deletions

View File

@ -4,25 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="29352b25-08d8-425d-8ed8-8d142cfadb63" name="Changes" comment="Laba1">
<change afterPath="$PROJECT_DIR$/src/AbstractStrategy.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/DrawningObjectShip.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/DrawningRoundBlocks.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/DrawningShip.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/EntityShip.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/IDrawBlocks.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/IMoveableObject.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/MoveToBorder.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/MoveToCenter.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/ObjectParameters.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/Status.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_21_12_2023_16_01__Changes_.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_21_12_2023_16_01__Changes_1.xml" beforeDir="false" />
<list default="true" id="29352b25-08d8-425d-8ed8-8d142cfadb63" name="Changes" comment="Laba2 done">
<change afterPath="$PROJECT_DIR$/src/DrawningTriangularBlocks.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/DrawingBattleship.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/DrawingBattleship.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/DrawingBlocks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/DrawingBlocks.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/EntityBattleship.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/EntityBattleship.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/FrameBattleship.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/FrameBattleship.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/DrawningRoundBlocks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/DrawningRoundBlocks.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/DrawningShip.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/DrawningShip.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -53,15 +39,15 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;project.structure.last.edited&quot;: &quot;Modules&quot;,
&quot;project.structure.proportion&quot;: &quot;0.15&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.2&quot;
}
}]]></component>
}</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
@ -85,7 +71,14 @@
<option name="project" value="LOCAL" />
<updated>1703160484223</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="Laba2 done">
<created>1703323929322</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1703323929322</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -101,6 +94,7 @@
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Laba1" />
<option name="LAST_COMMIT_MESSAGE" value="Laba1" />
<MESSAGE value="Laba2 done" />
<option name="LAST_COMMIT_MESSAGE" value="Laba2 done" />
</component>
</project>

View File

@ -13,15 +13,15 @@ public class DrawningRoundBlocks implements IDrawBlocks {
}
@Override
public void drawBlocks(Graphics2D graphics2D, int _startX, int _startY) {
graphics2D.fillOval(_startX + 50, _startY + 11, 8, 8);
graphics2D.fillOval(_startX + 50, _startY + 31, 8, 8);
if (number == BlocksNumber.FOUR || number == BlocksNumber.SIX) {
graphics2D.fillOval(_startX + 60, _startY + 11, 8, 8);
graphics2D.fillOval(_startX + 60, _startY + 31, 8, 8);
if (number == BlocksNumber.SIX) {
graphics2D.fillOval(_startX + 40, _startY + 11, 8, 8);
graphics2D.fillOval(_startX + 40, _startY + 31, 8, 8);
public void drawBlocks(Graphics2D graphics2D, int _startX, int _startY){
graphics2D.fillOval(_startX+45, _startY+15, 8, 8);
graphics2D.fillOval(_startX+45, _startY+50, 8, 8);
if (number == BlocksNumber.FOUR || number == BlocksNumber.SIX){
graphics2D.fillOval(_startX+55, _startY+15, 8, 8);
graphics2D.fillOval(_startX+55, _startY+50, 8, 8);
if (number == BlocksNumber.SIX){
graphics2D.fillOval(_startX+35, _startY+15, 8, 8);
graphics2D.fillOval(_startX+35, _startY+50, 8, 8);
}
}
}

View File

@ -65,12 +65,12 @@ public class DrawningShip {
case 0:
drawingBlocks = new DrawingBlocks();
break;
// case 1:
// drawingBlocks = new DrawingCrossBlocks();
// break;
// case 2:
// drawingBlocks = new DrawingRoundBlocks();
// break;
case 1:
drawingBlocks = new DrawningRoundBlocks();
break;
case 2:
drawingBlocks = new DrawningTriangularBlocks();
break;
default:
drawingBlocks = new DrawingBlocks();
break;

View File

@ -0,0 +1,45 @@
import java.awt.*;
public class DrawningTriangularBlocks implements IDrawBlocks{
private BlocksNumber number;
public void setNumber(int x) {
if (x <= 2)
number = BlocksNumber.TWO;
if (x == 4)
number = BlocksNumber.FOUR;
if (x >= 6)
number = BlocksNumber.SIX;
}
public void drawBlocks(Graphics2D graphics2D, int _startX, int _startY){
int[] xPoints = {_startX+45, _startX+50, _startX+40};
int[] yPoints = {_startY+15, _startY+20, _startY+20};
int[] xPoints1 = {_startX+45, _startX+50, _startX+40};
int[] yPoints1 = {_startY+50, _startY+55, _startY+55};
graphics2D.fillPolygon(xPoints, yPoints, 3);
graphics2D.fillPolygon(xPoints, yPoints, 3);
graphics2D.fillPolygon(xPoints1, yPoints1, 3);
graphics2D.fillPolygon(xPoints1, yPoints1, 3);
if (number == BlocksNumber.FOUR || number == BlocksNumber.SIX){
xPoints = new int[]{_startX+55, _startX+60, _startX+50};
yPoints = new int[]{_startY+15, _startY+20, _startY+20};
xPoints1 = new int[]{_startX+55, _startX+60, _startX+50};
yPoints1 = new int[]{_startY+50, _startY+55, _startY+55};
graphics2D.fillPolygon(xPoints, yPoints, 3);
graphics2D.fillPolygon(xPoints, yPoints, 3);
graphics2D.fillPolygon(xPoints1, yPoints1, 3);
graphics2D.fillPolygon(xPoints1, yPoints1, 3);
if (number == BlocksNumber.SIX){
xPoints = new int[]{_startX+35, _startX+40, _startX+30};
yPoints = new int[]{_startY+15, _startY+20, _startY+20};
xPoints1 = new int[]{_startX+35, _startX+40, _startX+30};
yPoints1 = new int[]{_startY+50, _startY+55, _startY+55};
graphics2D.fillPolygon(xPoints, yPoints, 3);
graphics2D.fillPolygon(xPoints, yPoints, 3);
graphics2D.fillPolygon(xPoints1, yPoints1, 3);
graphics2D.fillPolygon(xPoints1, yPoints1, 3);
}
}
}
}