Skip to content

Commit

Permalink
Modified the NetworkConnection to make the Client try for a maximum n…
Browse files Browse the repository at this point in the history
…umber of times before giving up the connection to the server.

Now both the Server and the Client can't play before a connection is made.
General improvements to the gameplay and GUI of GameBoard.

Closes #12
  • Loading branch information
Sokom141 committed Nov 13, 2020
1 parent 1ba7df1 commit 641e097
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 67 deletions.
122 changes: 83 additions & 39 deletions src/main/java/com/battleship/gui/GameBoard.form
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.battleship.gui.GameBoard">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="1034" height="704"/>
<xy x="20" y="20" width="1034" height="737"/>
</constraints>
<properties>
<foreground color="-4473925"/>
Expand All @@ -12,25 +12,10 @@
<size top="10" left="10" bottom="10" right="10"/>
</border>
<children>
<grid id="ea81d" binding="gameBoard1" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="400" height="400"/>
<preferred-size width="400" height="400"/>
<maximum-size width="400" height="400"/>
</grid>
</constraints>
<properties/>
<border type="empty">
<size top="10" left="10" bottom="10" right="20"/>
</border>
<children/>
</grid>
<grid id="56528" binding="chatPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="250" height="250"/>
<preferred-size width="250" height="500"/>
</grid>
Expand Down Expand Up @@ -68,35 +53,94 @@
</component>
</children>
</grid>
<grid id="cc029" binding="gameBoard2" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="794a7" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="400" height="400"/>
<preferred-size width="400" height="400"/>
<maximum-size width="400" height="400"/>
</grid>
<grid row="1" column="0" row-span="2" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="empty">
<size top="10" left="10" bottom="10" right="20"/>
</border>
<children/>
<border type="none"/>
<children>
<grid id="f0a9" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="ea81d" binding="gameBoard1" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="400" height="400"/>
<preferred-size width="400" height="400"/>
<maximum-size width="400" height="400"/>
</grid>
</constraints>
<properties/>
<border type="empty">
<size top="10" left="10" bottom="10" right="20"/>
</border>
<children/>
</grid>
<component id="cf5b6" class="javax.swing.JLabel" binding="playerFieldLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<horizontalAlignment value="10"/>
<horizontalTextPosition value="11"/>
<text value="Your Field"/>
</properties>
</component>
</children>
</grid>
<grid id="6cc72" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="cc029" binding="gameBoard2" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="400" height="400"/>
<preferred-size width="400" height="400"/>
<maximum-size width="400" height="400"/>
</grid>
</constraints>
<properties/>
<border type="empty">
<size top="10" left="10" bottom="10" right="20"/>
</border>
<children/>
</grid>
<component id="892c5" class="javax.swing.JLabel" binding="enemyFieldLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<horizontalAlignment value="10"/>
<horizontalTextPosition value="11"/>
<text value="Enemy field"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<component id="cf5b6" class="javax.swing.JLabel" binding="playerFieldLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Your Field"/>
</properties>
</component>
<component id="892c5" class="javax.swing.JLabel" binding="enemyFieldLabel">
<component id="1d7de" class="javax.swing.JLabel" binding="statusLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Enemy field"/>
<horizontalAlignment value="10"/>
<horizontalTextPosition value="11"/>
<text value="Status"/>
</properties>
</component>
</children>
Expand Down
Loading

0 comments on commit 641e097

Please sign in to comment.