Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b39ddffcf8 | |||
|
|
7e9ba348b2 | ||
| a96de93b13 | |||
| 4cf4bc3cb9 | |||
| 55214ce652 | |||
|
|
19134408a8 | ||
|
|
77e43f0fd2 | ||
| 69a4f121c5 | |||
|
|
1d970b201c | ||
|
|
fd921053d3 | ||
|
|
283e51c375 | ||
|
|
db0d8ec2db | ||
|
|
45d6d794f9 | ||
| dc28fb504d | |||
| 5a43adf7ad | |||
| 290dce81db | |||
|
|
6e43912b2e | ||
|
|
3ac1087741 | ||
|
|
c008a68166 | ||
|
|
85b2043ebf | ||
|
|
61f88c0a86 | ||
|
|
5caca9c9e3 | ||
| 24cb7ea70e | |||
| 0f56a515c1 | |||
|
|
4d8265ea79 | ||
|
|
0d548442d4 | ||
| f0b1d42892 | |||
| bf53113834 | |||
|
|
ffc2000c70 | ||
|
|
016b765e3a | ||
| 384a874e09 | |||
| d82ac891f1 | |||
|
|
f379278dc8 | ||
|
|
39b494ff88 | ||
|
|
799704ad5c | ||
|
|
2fb5d2fb1a | ||
|
|
bf21232510 | ||
| 68431ccad8 | |||
| b889ccd2bd | |||
|
|
31c72b3a1c | ||
| 566cc9dfb2 | |||
|
|
68f2c345d9 | ||
|
|
f27ee3d1d5 | ||
| 9012da0b3d | |||
| b8ed9bdb87 | |||
|
|
3b38c2475b | ||
|
|
ddc8cd4a06 | ||
|
|
55b3dbe0b6 | ||
| 519ddec330 | |||
| cf287833f6 | |||
|
|
d15e0fd7d7 | ||
|
|
7ec7f00983 | ||
| 0024e7a5ab | |||
| 30cd4805d9 | |||
| 9d113a656f | |||
| 3bdd7fb55b | |||
| e6e1f02ea9 | |||
| 0bedf3e182 | |||
| 55ff34ef9b | |||
|
|
60cb7b3069 | ||
|
|
7ed267a6a0 | ||
|
|
55c603716c | ||
|
|
7b9796f92c | ||
|
|
a33273035a | ||
|
|
2bc96e5d07 | ||
|
|
0f9ef34f54 | ||
|
|
db4a06e652 |
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -9,7 +9,7 @@
|
||||
<component name="ProjectKey">
|
||||
<option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8.0_201" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
|
||||
554
.idea/workspace.xml
generated
554
.idea/workspace.xml
generated
@@ -1,7 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="" />
|
||||
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Completed ShipWarfareGUI">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/saves/playerSave.txt" beforeDir="false" afterPath="$PROJECT_DIR$/src/saves/playerSave.txt" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<ignored path="C:\Users\Harkamal Randhawa\IdeaProjects\TaipanClone\.idea\shelf/" />
|
||||
<ignored path="$PROJECT_DIR$/.idea/shelf/" />
|
||||
@@ -13,20 +16,11 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="651">
|
||||
<caret line="38" column="39" selection-start-line="38" selection-start-column="39" selection-end-line="38" selection-end-column="39" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="308">
|
||||
<caret line="214" column="38" selection-start-line="214" selection-start-column="38" selection-end-line="214" selection-end-column="38" />
|
||||
<state relative-caret-position="-1380">
|
||||
<caret line="341" column="35" lean-forward="true" selection-start-line="341" selection-start-column="35" selection-end-line="341" selection-end-column="35" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
@@ -34,34 +28,26 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/Player.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1764">
|
||||
<caret line="84" column="44" selection-start-line="84" selection-start-column="44" selection-end-line="84" selection-end-column="44" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="9114">
|
||||
<caret line="453" column="33" selection-start-line="453" selection-start-column="33" selection-end-line="453" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="95" column="42" lean-forward="true" selection-start-line="95" selection-start-column="42" selection-end-line="95" selection-end-column="42" />
|
||||
<state relative-caret-position="291">
|
||||
<caret line="277" column="43" selection-start-line="277" selection-start-column="43" selection-end-line="277" selection-end-column="43" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#23606#23607#0" expanded="true" />
|
||||
<element signature="e#23651#23652#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="356">
|
||||
<caret line="28" selection-start-line="18" selection-start-column="4" selection-end-line="28" />
|
||||
<folding>
|
||||
<element signature="e#551#552#0" expanded="true" />
|
||||
<element signature="e#579#580#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@@ -70,29 +56,17 @@
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="42">
|
||||
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
|
||||
<state relative-caret-position="750">
|
||||
<caret line="56" column="24" selection-start-line="56" selection-start-column="24" selection-end-line="56" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="5901">
|
||||
<caret line="300" column="9" selection-start-line="300" selection-start-column="9" selection-end-line="300" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/LoanSharkGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="525">
|
||||
<caret line="35" column="7" selection-start-line="35" selection-start-column="7" selection-end-line="35" selection-end-column="7" />
|
||||
<state relative-caret-position="313">
|
||||
<caret line="188" column="11" selection-start-line="188" selection-start-column="11" selection-end-line="188" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -103,41 +77,42 @@
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
<option value="JavaFXApplication" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>destr</find>
|
||||
<find>destro</find>
|
||||
<find>hitco</find>
|
||||
<find>game</find>
|
||||
<find>numOf</find>
|
||||
<find>mis</find>
|
||||
<find>exitValue</find>
|
||||
<find>getGuns</find>
|
||||
<find>frustRat</find>
|
||||
<find>counter++</find>
|
||||
<find>setMone</find>
|
||||
<find>setNum</find>
|
||||
<find>We survive</find>
|
||||
<find>total of</find>
|
||||
<find>int numOfShips</find>
|
||||
<find>runFromShips()</find>
|
||||
<find>dang it!</find>
|
||||
<find>dang it</find>
|
||||
<find>destroy</find>
|
||||
<find>destroyPeas</find>
|
||||
<find>cash</find>
|
||||
<find>op</find>
|
||||
<find>.setvis</find>
|
||||
<find>durati</find>
|
||||
<find>setText</find>
|
||||
<find>setVisi</find>
|
||||
<find>continue</find>
|
||||
<find>cashTex</find>
|
||||
<find>cashTe</find>
|
||||
<find>userSh</find>
|
||||
<find>continueButton</find>
|
||||
<find>continueButton.setV</find>
|
||||
<find>.setText</find>
|
||||
<find>.setVisi</find>
|
||||
<find>taipanSH</find>
|
||||
<find>runButton.setOn</find>
|
||||
<find>runButton.se</find>
|
||||
<find>setVis</find>
|
||||
<find>counter</find>
|
||||
<find>stage</find>
|
||||
<find>run</find>
|
||||
<find>loan</find>
|
||||
<find>get loa</find>
|
||||
<find>warehouse</find>
|
||||
<find>warehouse\n</find>
|
||||
<find>flee</find>
|
||||
<find>runFrom</find>
|
||||
<find>report</find>
|
||||
<find>report.setVisible</find>
|
||||
<find>playerSh</find>
|
||||
<find>fightButton</find>
|
||||
<find>PlayerSh</find>
|
||||
<find>andT</find>
|
||||
<find>dest</find>
|
||||
<find>playerShoots</find>
|
||||
<find>shotsFired</find>
|
||||
<find>duration</find>
|
||||
<find>shop()</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>HP</replace>
|
||||
@@ -146,6 +121,15 @@
|
||||
<replace>shipWarfare.getHowMuchRun()</replace>
|
||||
<replace>shipWarfare.isUserAttacks()</replace>
|
||||
<replace>shipWarfare.getNumOfPeasantShips()</replace>
|
||||
<replace>attackImage</replace>
|
||||
<replace>shipsAttacking</replace>
|
||||
<replace>shipsApproachingGIF</replace>
|
||||
<replace>centeringLittyShipPane</replace>
|
||||
<replace>numOfLittyShips</replace>
|
||||
<replace>startingLitty</replace>
|
||||
<replace>littyShip</replace>
|
||||
<replace>whenfinished</replace>
|
||||
<replace>whenFinished</replace>
|
||||
</replaceStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
@@ -162,17 +146,17 @@
|
||||
<option value="$PROJECT_DIR$/src/main.java" />
|
||||
<option value="$PROJECT_DIR$/src/Travel.java" />
|
||||
<option value="$PROJECT_DIR$/src/ShipWarfare.java" />
|
||||
<option value="$PROJECT_DIR$/src/TravelGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/Player.java" />
|
||||
<option value="$PROJECT_DIR$/src/TaipanShopGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/StartGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/Player.java" />
|
||||
<option value="$PROJECT_DIR$/src/AnimationTesting.java" />
|
||||
<option value="$PROJECT_DIR$/src/TravelGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/TaipanShopGUI.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="6" />
|
||||
<option name="y" value="26" />
|
||||
<option name="y" value="23" />
|
||||
<option name="width" value="1189" />
|
||||
<option name="height" value="652" />
|
||||
</component>
|
||||
@@ -182,7 +166,6 @@
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
@@ -195,10 +178,17 @@
|
||||
<item name="TaipanClone" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="TaipanClone" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="TaipanClone" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="images" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
@@ -206,14 +196,20 @@
|
||||
<property name="ChangesTree.GroupingKeys" value="" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1552351596289" />
|
||||
<property name="extract.method.default.visibility" value="private" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1553533565975" />
|
||||
<property name="extract.method.default.visibility" value="public" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
<property name="settings.editor.selected.configurable" value="editing.templates" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/images" />
|
||||
<recent name="$PROJECT_DIR$/src" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
@@ -227,15 +223,15 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.MainGUI">
|
||||
<configuration name="Game" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="Game" />
|
||||
<configuration name="MainGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="MainGUI" />
|
||||
<module name="TaipanClone" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="MainGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="MainGUI" />
|
||||
<configuration name="ShipWarfareGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="ShipWarfareGUI" />
|
||||
<module name="TaipanClone" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
@@ -264,18 +260,18 @@
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Application.TaipanShop" />
|
||||
<item itemvalue="Application.Game" />
|
||||
<item itemvalue="Application.main" />
|
||||
<item itemvalue="Application.ShipWarfareGUI" />
|
||||
<item itemvalue="Application.MainGUI" />
|
||||
<item itemvalue="Application.ShipWarfareGUI" />
|
||||
</list>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.MainGUI" />
|
||||
<item itemvalue="Application.ShipWarfareGUI" />
|
||||
<item itemvalue="Application.ShipWarfareGUI" />
|
||||
<item itemvalue="Application.main" />
|
||||
<item itemvalue="Application.TaipanShop" />
|
||||
<item itemvalue="Application.Game" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
@@ -321,63 +317,26 @@
|
||||
<workItem from="1552240770629" duration="40000" />
|
||||
<workItem from="1552241394045" duration="178000" />
|
||||
<workItem from="1552254283748" duration="9473000" />
|
||||
<workItem from="1552277298937" duration="10904000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="This should fix the ShipWarfare file and bring it up to date with the rest of the file.">
|
||||
<created>1550458470138</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550458470138</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00002" summary="Created Core class">
|
||||
<created>1550540282400</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550540282400</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="Created Player class">
|
||||
<created>1550540820542</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550540820542</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00004" summary="Created Player class">
|
||||
<created>1550541406597</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550541406597</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00005" summary="Fixed the setters to be greater than 0">
|
||||
<created>1550541751914</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550541751914</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00006" summary="Created Player class">
|
||||
<created>1550543764970</created>
|
||||
<option name="number" value="00006" />
|
||||
<option name="presentableId" value="LOCAL-00006" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550543764971</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00007" summary="Added some stuff for the Travel Class">
|
||||
<created>1550575512841</created>
|
||||
<option name="number" value="00007" />
|
||||
<option name="presentableId" value="LOCAL-00007" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550575512841</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00008" summary="Added disasters as well as removing a bug from the flee method in Haris's code">
|
||||
<created>1550623749854</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1550623749854</updated>
|
||||
<workItem from="1552277298937" duration="11151000" />
|
||||
<workItem from="1552353291496" duration="1918000" />
|
||||
<workItem from="1552359156805" duration="98000" />
|
||||
<workItem from="1552533765176" duration="1016000" />
|
||||
<workItem from="1552622234355" duration="130000" />
|
||||
<workItem from="1553037480176" duration="499000" />
|
||||
<workItem from="1553047073421" duration="2245000" />
|
||||
<workItem from="1553050110780" duration="21000" />
|
||||
<workItem from="1553051761247" duration="104000" />
|
||||
<workItem from="1553051882218" duration="12177000" />
|
||||
<workItem from="1553369996499" duration="3948000" />
|
||||
<workItem from="1553376520648" duration="32000" />
|
||||
<workItem from="1553383476219" duration="1349000" />
|
||||
<workItem from="1553386923955" duration="4000" />
|
||||
<workItem from="1553387088425" duration="330000" />
|
||||
<workItem from="1553387443301" duration="11000" />
|
||||
<workItem from="1553387530005" duration="22322000" />
|
||||
<workItem from="1553444493182" duration="159000" />
|
||||
<workItem from="1553444769737" duration="82000" />
|
||||
<workItem from="1553444880371" duration="34292000" />
|
||||
</task>
|
||||
<task id="LOCAL-00009" summary="Fixed a bunch of stuff inside of Travel, but also discovered a MASSIVE problem with our code">
|
||||
<created>1550628232136</created>
|
||||
@@ -596,17 +555,143 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1552339973224</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="40" />
|
||||
<task id="LOCAL-00040" summary="wrote javadocs for authorname">
|
||||
<created>1552351619924</created>
|
||||
<option name="number" value="00040" />
|
||||
<option name="presentableId" value="LOCAL-00040" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1552351619924</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00041" summary="Added fight Button gif. Might not work on your computers yet though... I inputed my own local documents folder as the library temporarily.">
|
||||
<created>1553060094595</created>
|
||||
<option name="number" value="00041" />
|
||||
<option name="presentableId" value="LOCAL-00041" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553060094595</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00042" summary="Made the fight gif runnable by everyone hopefully">
|
||||
<created>1553060976358</created>
|
||||
<option name="number" value="00042" />
|
||||
<option name="presentableId" value="LOCAL-00042" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553060976358</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00043" summary="Made the fight gif runnable by everyone hopefully">
|
||||
<created>1553061205759</created>
|
||||
<option name="number" value="00043" />
|
||||
<option name="presentableId" value="LOCAL-00043" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553061205759</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00044" summary="Ayy added all the gifs needed.">
|
||||
<created>1553124112040</created>
|
||||
<option name="number" value="00044" />
|
||||
<option name="presentableId" value="LOCAL-00044" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553124112040</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00045" summary="Maybe this is whack idk">
|
||||
<created>1553193939606</created>
|
||||
<option name="number" value="00045" />
|
||||
<option name="presentableId" value="LOCAL-00045" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553193939606</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00046" summary="Litty Animation Practice">
|
||||
<created>1553387960582</created>
|
||||
<option name="number" value="00046" />
|
||||
<option name="presentableId" value="LOCAL-00046" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553387960582</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00047" summary="Added gifs back">
|
||||
<created>1553389067767</created>
|
||||
<option name="number" value="00047" />
|
||||
<option name="presentableId" value="LOCAL-00047" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553389067767</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00048" summary="Added method for animation">
|
||||
<created>1553390319733</created>
|
||||
<option name="number" value="00048" />
|
||||
<option name="presentableId" value="LOCAL-00048" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553390319734</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00049" summary="Litty Animation Practice littier">
|
||||
<created>1553390384762</created>
|
||||
<option name="number" value="00049" />
|
||||
<option name="presentableId" value="LOCAL-00049" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553390384762</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00050" summary="Sep up the scene which will be used for animation">
|
||||
<created>1553400771267</created>
|
||||
<option name="number" value="00050" />
|
||||
<option name="presentableId" value="LOCAL-00050" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553400771272</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00051" summary="Made fight button basically functional for AnimationTesting">
|
||||
<created>1553476072174</created>
|
||||
<option name="number" value="00051" />
|
||||
<option name="presentableId" value="LOCAL-00051" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553476072175</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00052" summary="changed some stuff related to the fight button animation">
|
||||
<created>1553478643204</created>
|
||||
<option name="number" value="00052" />
|
||||
<option name="presentableId" value="LOCAL-00052" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553478643204</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00053" summary="Small error in animation whcih shoots even if no guns must fix that">
|
||||
<created>1553482933744</created>
|
||||
<option name="number" value="00053" />
|
||||
<option name="presentableId" value="LOCAL-00053" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553482933744</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00054" summary="Fixed the issue where the ship shot with no guns">
|
||||
<created>1553484357669</created>
|
||||
<option name="number" value="00054" />
|
||||
<option name="presentableId" value="LOCAL-00054" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553484357670</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00055" summary="ShipWarfare javaDocs completed">
|
||||
<created>1553485725159</created>
|
||||
<option name="number" value="00055" />
|
||||
<option name="presentableId" value="LOCAL-00055" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553485725159</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00056" summary="Completed ShipWarfareGUI">
|
||||
<created>1553486334208</created>
|
||||
<option name="number" value="00056" />
|
||||
<option name="presentableId" value="LOCAL-00056" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553486334209</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00057" summary="Fixed silk issue">
|
||||
<created>1553533396273</created>
|
||||
<option name="number" value="00057" />
|
||||
<option name="presentableId" value="LOCAL-00057" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1553533396273</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="58" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="84236000" />
|
||||
<option name="totallyTimeSpent" value="164961000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
||||
<frame x="0" y="23" width="1189" height="652" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18123667" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2205754" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Image Layers" order="2" />
|
||||
<window_info id="Designer" order="3" />
|
||||
@@ -615,7 +700,7 @@
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32922733" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.9357143" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.22678572" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
@@ -626,7 +711,7 @@
|
||||
<window_info anchor="bottom" id="Terminal" order="10" weight="0.32922733" />
|
||||
<window_info anchor="bottom" id="Event Log" order="11" sideWeight="0.50061125" side_tool="true" weight="0.32922733" />
|
||||
<window_info anchor="bottom" id="Messages" order="12" sideWeight="0.49938875" weight="0.32857144" />
|
||||
<window_info anchor="bottom" id="Duplicate detector" order="13" weight="0.32922733" />
|
||||
<window_info anchor="bottom" id="Duplicate detector" order="13" weight="0.32857144" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
@@ -703,24 +788,7 @@
|
||||
<ignored-roots>
|
||||
<path value="$PROJECT_DIR$" />
|
||||
</ignored-roots>
|
||||
<MESSAGE value="Missed one statement that I needed to encapsulate" />
|
||||
<MESSAGE value="Messed up player by setting money to 1000" />
|
||||
<MESSAGE value="Please find error" />
|
||||
<MESSAGE value="Super broken but fight button is in progress for shipwarfare" />
|
||||
<MESSAGE value="Forces you to fight in ShipWarfareGUI unfortunately" />
|
||||
<MESSAGE value="ShipWarfare fight button coming along nicely" />
|
||||
<MESSAGE value="Shipwarfare fight button GUI almost complete" />
|
||||
<MESSAGE value="Fixed numOfShips method for ShipWarfareGUI" />
|
||||
<MESSAGE value="Fixed the loot system a bit" />
|
||||
<MESSAGE value="Completely ruined shipWarfare with a previous edit, fixed it and added a better loot feature for peasant ships" />
|
||||
<MESSAGE value="Basic functionality of buttons completed, think all I have to do now is to find a way to break the code when the user wins, loses or runs away." />
|
||||
<MESSAGE value="Fixed probability of ships running away" />
|
||||
<MESSAGE value="Fined minor bugs in shipwarfareGUI" />
|
||||
<MESSAGE value="Fined minor bugs in shipwarfareGUI including the "gun frustration" variable" />
|
||||
<MESSAGE value="Just checking" />
|
||||
<MESSAGE value="A lot of errors but easily fixable SHipwarfareGUI" />
|
||||
<MESSAGE value="Completed SHipWarfareGUI" />
|
||||
<MESSAGE value="Completed ShipWarfareGUI" />
|
||||
<MESSAGE value="Probably should upload" />
|
||||
<MESSAGE value="Fixed ShipWarfare bug about one-shotting." />
|
||||
<MESSAGE value="Completed javadocs for shipwarfare GUI" />
|
||||
@@ -728,7 +796,24 @@
|
||||
<MESSAGE value="Changed one line of text in shipwarfare GUI" />
|
||||
<MESSAGE value="Fixed output for start and TaipanShop GUI" />
|
||||
<MESSAGE value="Added JavaDocs for ShipWarfare" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Added JavaDocs for ShipWarfare" />
|
||||
<MESSAGE value="wrote javadocs for authorname" />
|
||||
<MESSAGE value="Added fight Button gif. Might not work on your computers yet though... I inputed my own local documents folder as the library temporarily." />
|
||||
<MESSAGE value="Made the fight gif runnable by everyone hopefully" />
|
||||
<MESSAGE value="Ayy added all the gifs needed." />
|
||||
<MESSAGE value="Maybe this is whack idk" />
|
||||
<MESSAGE value="Litty Animation Practice" />
|
||||
<MESSAGE value="Added gifs back" />
|
||||
<MESSAGE value="Added method for animation" />
|
||||
<MESSAGE value="Litty Animation Practice littier" />
|
||||
<MESSAGE value="Sep up the scene which will be used for animation" />
|
||||
<MESSAGE value="Made fight button basically functional for AnimationTesting" />
|
||||
<MESSAGE value="changed some stuff related to the fight button animation" />
|
||||
<MESSAGE value="Small error in animation whcih shoots even if no guns must fix that" />
|
||||
<MESSAGE value="Fixed the issue where the ship shot with no guns" />
|
||||
<MESSAGE value="ShipWarfare javaDocs completed" />
|
||||
<MESSAGE value="Completed ShipWarfareGUI" />
|
||||
<MESSAGE value="Fixed silk issue" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Fixed silk issue" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="uml://JAVA/ShipWarfare">
|
||||
@@ -774,25 +859,17 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/Bank.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShop.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/Travel.java" />
|
||||
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/com/sun/glass/ui/InvokeLaterDispatcher.java" />
|
||||
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/com/sun/glass/ui/InvokeLaterDispatcher.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="140">
|
||||
<caret line="110" column="19" selection-start-line="110" selection-start-column="19" selection-end-line="110" selection-end-column="19" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ShopGUI" />
|
||||
<entry file="file://$PROJECT_DIR$/src/Start.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/main.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfare.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="9114">
|
||||
<caret line="453" column="33" selection-start-line="453" selection-start-column="33" selection-end-line="453" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Player.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1764">
|
||||
<caret line="84" column="44" selection-start-line="84" selection-start-column="44" selection-end-line="84" selection-end-column="44" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/WarehouseGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1968">
|
||||
@@ -800,47 +877,106 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="42">
|
||||
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
|
||||
<state relative-caret-position="30">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="15" selection-end-column="2" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/LoanSharkGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="95" column="42" lean-forward="true" selection-start-line="95" selection-start-column="42" selection-end-line="95" selection-end-column="42" />
|
||||
<state relative-caret-position="30">
|
||||
<caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/BankGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="240">
|
||||
<caret line="26" column="51" lean-forward="true" selection-start-line="26" selection-start-column="51" selection-end-line="26" selection-end-column="51" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Ships Approaching.gif" />
|
||||
<entry file="file://$PROJECT_DIR$/src/Player.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="300">
|
||||
<caret line="20" column="25" lean-forward="true" selection-start-line="20" selection-start-column="25" selection-end-line="20" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipsRunning.gif" />
|
||||
<entry file="file://$PROJECT_DIR$/src/images/ShipsRunning.gif">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/images/ShipsAttacking.gif">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/FinalShipWarfareGUI.java" />
|
||||
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/javafx/application/Application.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="842">
|
||||
<caret line="145" column="7" lean-forward="true" selection-start-line="145" selection-start-column="7" selection-end-line="145" selection-end-column="7" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/javafx/event/EventHandler.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="298">
|
||||
<caret line="44" column="9" selection-start-line="44" selection-start-column="9" selection-end-line="44" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="750">
|
||||
<caret line="56" column="24" selection-start-line="56" selection-start-column="24" selection-end-line="56" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="356">
|
||||
<caret line="28" selection-start-line="18" selection-start-column="4" selection-end-line="28" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#23606#23607#0" expanded="true" />
|
||||
<element signature="e#23651#23652#0" expanded="true" />
|
||||
<element signature="e#551#552#0" expanded="true" />
|
||||
<element signature="e#579#580#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="5901">
|
||||
<caret line="300" column="9" selection-start-line="300" selection-start-column="9" selection-end-line="300" selection-end-column="9" />
|
||||
<state relative-caret-position="104">
|
||||
<caret line="156" column="7" lean-forward="true" selection-start-line="152" selection-start-column="4" selection-end-line="156" selection-end-column="7" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="651">
|
||||
<caret line="38" column="39" selection-start-line="38" selection-start-column="39" selection-end-line="38" selection-end-column="39" />
|
||||
<state relative-caret-position="313">
|
||||
<caret line="188" column="11" selection-start-line="188" selection-start-column="11" selection-end-line="188" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/StartGUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="308">
|
||||
<caret line="214" column="38" selection-start-line="214" selection-start-column="38" selection-end-line="214" selection-end-column="38" />
|
||||
<state relative-caret-position="291">
|
||||
<caret line="277" column="43" selection-start-line="277" selection-start-column="43" selection-end-line="277" selection-end-column="43" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1380">
|
||||
<caret line="341" column="35" lean-forward="true" selection-start-line="341" selection-start-column="35" selection-end-line="341" selection-end-column="35" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
||||
11
README.md
11
README.md
@@ -2,9 +2,16 @@
|
||||
Computer Science 233 project, Winter 2019
|
||||
|
||||
How to run:
|
||||
If you are using intellij, extract "TaipanClone-master.zip", and open the "TaipanClone-master" folder in intellij. Also set up the SDK. Then, run MainGUI.java.
|
||||
If you are using intellij, extract "TaipanClone-master.zip", and open the "TaipanClone-master" folder in intellij. Also set up the SDK.
|
||||
|
||||
If you are using the command line, extract "TaipanClone-master.zip", and open the "TaipanClone-master" folder. Open your terminal and change its directory to the "src" folder within "TaipanClone-master" folder. Then, type in "javac *.java", this compiles all the necessary files. Now, run MainGUI.java using "java MainGUI".
|
||||
Place jfxt.jar, hamcrest-core-1.3.jar and junit-4.12.jar into the src folder
|
||||
Then, run MainGUI.java.
|
||||
|
||||
If you are using the command line, extract "TaipanClone-master.zip", and open the "TaipanClone-master" folder. Open your terminal and change its directory to the "src" folder within "TaipanClone-master" folder.
|
||||
|
||||
Then, type in "javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar *.java", this compiles all the necessary files. Now, run MainGUI.java using "java MainGUI".
|
||||
|
||||
To run the test file PlayerTest.java, type in "javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar *.java", this compiles all the necessary files. Now, run PlayerTest.java using "java PlayerTest".
|
||||
|
||||
Additional information:
|
||||
|
||||
|
||||
@@ -7,5 +7,16 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="JUnit4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="hamcrest-core-1.3" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,5 +1,6 @@
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
@@ -10,37 +11,21 @@ import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class BankGUI {
|
||||
private Player player;
|
||||
|
||||
public class BankGUI extends Player{
|
||||
/**
|
||||
* setter method that takes in a Player object as an argument.
|
||||
*
|
||||
* @param player object of the class Player
|
||||
* 2019-03-10
|
||||
* Authors: Siddhant Dewani
|
||||
* BankGUI allows the user to store cash and gain interest off of the cash
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method for obtaining a player object.
|
||||
*
|
||||
* @return returns player object
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Constructor that takes in a type player as a parameter
|
||||
* <p>
|
||||
* //* @param player object of the class Player
|
||||
*
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public BankGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,10 +46,10 @@ public class BankGUI {
|
||||
HBox hbx2 = new HBox(30);
|
||||
VBox vbx1 = new VBox(30);
|
||||
|
||||
Label l1 = new Label("Player: " + player.getName());
|
||||
Label l2 = new Label("Current Balance: " + player.getBank());
|
||||
Label l1 = new Label("Player: " + getName());
|
||||
Label l2 = new Label("Balance: " + getBank());
|
||||
Label l3 = new Label("Enter Amount: ");
|
||||
Label l4 = new Label("Current cash: " + player.getMoney());
|
||||
Label l4 = new Label("Cash: " + getMoney());
|
||||
Label l5 = new Label(" ");
|
||||
|
||||
Button b1 = new Button("Withdraw");
|
||||
@@ -81,7 +66,7 @@ public class BankGUI {
|
||||
hbx1.getChildren().add(b1);
|
||||
hbx1.getChildren().add(b2);
|
||||
hbx1.getChildren().add(b3);
|
||||
|
||||
hbx1.setPadding(new Insets(0,0,20,0));
|
||||
brdr1.setBottom(hbx1);
|
||||
|
||||
/**
|
||||
@@ -102,6 +87,7 @@ public class BankGUI {
|
||||
vbx1.getChildren().add(l2);
|
||||
vbx1.getChildren().add(l4);
|
||||
vbx1.getChildren().add(l5);
|
||||
vbx1.setPadding(new Insets(20,0,0,0));
|
||||
brdr1.setTop(vbx1);
|
||||
|
||||
/**
|
||||
@@ -114,20 +100,20 @@ public class BankGUI {
|
||||
try {
|
||||
int withdraw = Integer.parseInt(txtField1.getText());
|
||||
if(withdraw < 0){
|
||||
l5.setText("Come on " + player.getName() + " are you trying to fool me??? \n No negative Numbers Please");
|
||||
l5.setText("Come on " + getName() + ", are you trying to fool me?\nNo negative numbers please!");
|
||||
}
|
||||
else if (withdraw <= player.getBank()) {
|
||||
player.setMoney(withdraw + player.getMoney());
|
||||
player.setBank(player.getBank() - withdraw);
|
||||
else if (withdraw <= getBank()) {
|
||||
setMoney(withdraw + getMoney());
|
||||
setBank(getBank() - withdraw);
|
||||
}
|
||||
else {
|
||||
l5.setText("Sorry you cannot withdraw that much");
|
||||
l5.setText("Sorry, you can not withdraw that much.");
|
||||
}
|
||||
l2.setText("Current Balance: " + player.getBank());
|
||||
l4.setText("Current cash: " + player.getMoney());
|
||||
l2.setText("Balance: " + getBank());
|
||||
l4.setText("Cash: " + getMoney());
|
||||
}
|
||||
catch (Exception e) {
|
||||
l5.setText("Please enter a valid value");
|
||||
l5.setText("Please enter a valid response.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,20 +130,20 @@ public class BankGUI {
|
||||
try {
|
||||
int deposit = Integer.parseInt(txtField1.getText());
|
||||
if(deposit < 0){
|
||||
l5.setText("Nice Try!!! No negative Numbers Please");
|
||||
l5.setText("Nice try! You can not enter negative numbers.");
|
||||
}
|
||||
else if (deposit <= player.getMoney()) {
|
||||
player.setBank(deposit + player.getBank());
|
||||
player.setMoney(player.getMoney() - deposit);
|
||||
else if (deposit <= getMoney()) {
|
||||
setBank(deposit + getBank());
|
||||
setMoney(getMoney() - deposit);
|
||||
} else {
|
||||
l5.setText("Sorry you cannot deposit that much.$");
|
||||
l5.setText("Sorry, you can not deposit that much.");
|
||||
}
|
||||
l2.setText("Current Balance: " + player.getBank());
|
||||
l4.setText("Current cash: " + player.getMoney());
|
||||
l2.setText("Balance: " + getBank());
|
||||
l4.setText("Cash: " + getMoney());
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
l5.setText("Please enter a valid value");
|
||||
l5.setText("Please enter a valid response.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +156,7 @@ public class BankGUI {
|
||||
b3.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
TaipanShopGUI shopGUI = new TaipanShopGUI(player);
|
||||
TaipanShopGUI shopGUI = new TaipanShopGUI(getPlayer());
|
||||
shopGUI.initializeShop(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
@@ -183,6 +169,7 @@ public class BankGUI {
|
||||
*
|
||||
*/
|
||||
Scene scene = new Scene(brdr1, 600, 480);
|
||||
scene.getStylesheets().add("styleguide.css");
|
||||
primaryStage.setScene(scene);
|
||||
return primaryStage;
|
||||
}
|
||||
@@ -193,7 +180,7 @@ public class BankGUI {
|
||||
* @param primaryStage the stage in which the scene may be run and switched to
|
||||
*/
|
||||
public void start(Stage primaryStage) {
|
||||
BankGUI bank = new BankGUI(player);
|
||||
BankGUI bank = new BankGUI(getPlayer());
|
||||
bank.initializeBank(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
69
src/FileSaving.java
Normal file
69
src/FileSaving.java
Normal file
@@ -0,0 +1,69 @@
|
||||
import java.io.*;
|
||||
/**
|
||||
* 2019-03-10 (Edited on 2019-03-19)
|
||||
* Authors:
|
||||
* FileSaving Class allows the user to save the current status of the game and to continue from where they left off.
|
||||
*/
|
||||
|
||||
public class FileSaving extends Player implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
*loads the file of type player which contains all the player instances
|
||||
* @return player
|
||||
*/
|
||||
public Player loadFile() {
|
||||
|
||||
try {
|
||||
InputStream in = new FileInputStream(new File("src/saves/playerSave.txt"));
|
||||
ObjectInputStream inObject = new ObjectInputStream(in);
|
||||
Player player = (Player) inObject.readObject();
|
||||
in.close();
|
||||
inObject.close();
|
||||
return player;
|
||||
}
|
||||
catch (Exception e) {
|
||||
try {
|
||||
InputStream in = new FileInputStream(new File("saves/playerSave.txt"));
|
||||
ObjectInputStream inObject = new ObjectInputStream(in);
|
||||
Player player = (Player) inObject.readObject();
|
||||
in.close();
|
||||
inObject.close();
|
||||
return player;
|
||||
}
|
||||
catch(Exception e2){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean saveFile(Player player){
|
||||
try{
|
||||
FileOutputStream out = new FileOutputStream(new File("src/saves/playerSave.txt"));
|
||||
ObjectOutputStream outObject = new ObjectOutputStream(out);
|
||||
outObject.writeObject(player);
|
||||
|
||||
out.close();
|
||||
outObject.close();
|
||||
|
||||
//returns true if program can save file
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(new File("saves/playerSave.txt"));
|
||||
ObjectOutputStream outObject = new ObjectOutputStream(out);
|
||||
outObject.writeObject(player);
|
||||
|
||||
out.close();
|
||||
outObject.close();
|
||||
return true;
|
||||
}
|
||||
catch(Exception e2){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import javafx.stage.Stage;
|
||||
* GameEndGUI class, Initializes and displays the graphical interface for when you lose
|
||||
*
|
||||
*/
|
||||
public class GameEndGUI {
|
||||
public class GameEndGUI extends Player{
|
||||
|
||||
private Label title;
|
||||
private VBox vBox;
|
||||
@@ -20,11 +20,10 @@ public class GameEndGUI {
|
||||
private Label gunsHeld;
|
||||
private Label netWorth;
|
||||
private BorderPane borderPane;
|
||||
private Player player;
|
||||
|
||||
public GameEndGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +78,7 @@ public class GameEndGUI {
|
||||
/**
|
||||
* If health is below or equal to 0 then the game will either show the gameOver screen or the win screen
|
||||
* */
|
||||
if (player.getHP() <= 0) {
|
||||
if (getHP() <= 0) {
|
||||
title.setText("Game Over!");
|
||||
} else {
|
||||
title.setText("Congratulations!");
|
||||
@@ -88,17 +87,18 @@ public class GameEndGUI {
|
||||
/**
|
||||
* Calculates the networth of the player by the end of the game
|
||||
* */
|
||||
netWorthInt = player.getMoney() + (player.getOpiumHeld() * 16000) + (player.getSilkHeld() * 160) + (player.getArmsHeld() * 160) + (player.getGeneralHeld() * 8);
|
||||
netWorthInt += (player.getwOpium() * 16000) + (player.getwSilk() * 160) + (player.getwArms() * 160) + (player.getwGeneral() * 8);
|
||||
netWorthInt -= player.getDebt();
|
||||
netWorthInt = getMoney() + (getOpiumHeld() * 16000) + (getSilkHeld() * 160) + (getArmsHeld() * 160) + (getGeneralHeld() * 8);
|
||||
netWorthInt += (getwOpium() * 16000) + (getwSilk() * 160) + (getwArms() * 160) + (getwGeneral() * 8);
|
||||
netWorthInt -= getDebt();
|
||||
|
||||
|
||||
//Updating the endgame stats of the player
|
||||
firmName.setText("Firm Name: " + player.getName());
|
||||
gunsHeld.setText("Guns Held: " + player.getGuns());
|
||||
firmName.setText("Firm Name: " + getName());
|
||||
gunsHeld.setText("Guns Held: " + getGuns());
|
||||
netWorth.setText("Net Worth: " + netWorthInt);
|
||||
|
||||
Scene root = new Scene(borderPane, 600, 480);
|
||||
root.getStylesheets().add("styleguide.css");
|
||||
|
||||
stage.setTitle("End Game Stats");
|
||||
stage.setResizable(false);
|
||||
@@ -113,7 +113,7 @@ public class GameEndGUI {
|
||||
* @param primaryStage the stage in which the scene may be run and switched to
|
||||
*/
|
||||
public void start(Stage primaryStage) {
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(player);
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
|
||||
gameEndGUI.initializeGameEndGUI(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
@@ -10,39 +11,34 @@ import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class LoanSharkGUI {
|
||||
private Player player;
|
||||
/**
|
||||
* 2019-03-10
|
||||
* Authors: Siddhant Dewani
|
||||
* LoanShark GUI Class allows the user to get a loan from the loan shark
|
||||
*/
|
||||
|
||||
/**
|
||||
* setter method that takes in a Player object as an argument.
|
||||
*
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method for obtaining a player object.
|
||||
*
|
||||
* @return returns player object
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
public class LoanSharkGUI extends Player {
|
||||
|
||||
/**
|
||||
* Class Constructor that takes in a type player as a parameter
|
||||
* <p>
|
||||
* //* @param player object of the class Player
|
||||
*
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public LoanSharkGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* This methods purpose is to loan the player the funds it wants
|
||||
* or pay its outstanding debts. The method prompts the user if they
|
||||
* would like to borrow money or repay. depending on what the player chooses
|
||||
* the corresponding loop is evoked. The player can only be loaned 2 times the
|
||||
* money they have minus the debt if their debt exceeds the cash balance, the loan
|
||||
* cannot be given.
|
||||
*
|
||||
* @param primaryStage the stage upon which the GUI will be imposed
|
||||
*/
|
||||
public Stage initializeLoanShark(Stage primaryStage) {
|
||||
primaryStage.setTitle("Loan Shark");
|
||||
|
||||
@@ -53,9 +49,9 @@ public class LoanSharkGUI {
|
||||
VBox vbx1 = new VBox(10);
|
||||
|
||||
//Declaring all Variables
|
||||
Label l1 = new Label("Player: " + player.getName());
|
||||
Label l2 = new Label("Current Debt " + player.getDebt());
|
||||
Label l4 = new Label("Current cash: " + player.getMoney());
|
||||
Label l1 = new Label("Player: " + getName());
|
||||
Label l2 = new Label("Debt " + getDebt());
|
||||
Label l4 = new Label("Cash: " + getMoney());
|
||||
Label l3 = new Label("Enter Amount: ");
|
||||
Label l5 = new Label(" ");
|
||||
|
||||
@@ -72,9 +68,11 @@ public class LoanSharkGUI {
|
||||
hbx1.getChildren().add(b1);
|
||||
hbx1.getChildren().add(b2);
|
||||
hbx1.getChildren().add(b3);
|
||||
hbx1.setPadding(new Insets(0,0,20,0));
|
||||
|
||||
brdr1.setBottom(hbx1);
|
||||
|
||||
|
||||
//Creating the TextField at the center of the screen
|
||||
hbx2.setAlignment(Pos.CENTER);
|
||||
hbx2.getChildren().add(l3);
|
||||
@@ -87,6 +85,7 @@ public class LoanSharkGUI {
|
||||
vbx1.getChildren().add(l2);
|
||||
vbx1.getChildren().add(l4);
|
||||
vbx1.getChildren().add(l5);
|
||||
vbx1.setPadding(new Insets(20,0,0,0));
|
||||
brdr1.setTop(vbx1);
|
||||
|
||||
// Set the event handler when the deposit button is clicked
|
||||
@@ -96,10 +95,10 @@ public class LoanSharkGUI {
|
||||
try {
|
||||
|
||||
int loanAsk = Integer.parseInt(txtField1.getText());
|
||||
if (loanAsk <= 2 * (player.getMoney() - player.getDebt()) && loanAsk >= 0) {
|
||||
player.setDebt(player.getDebt() + loanAsk);
|
||||
player.setMoney(player.getMoney() + loanAsk);
|
||||
l4.setText("Current cash: " + player.getMoney());
|
||||
if (loanAsk <= 2 * (getMoney() - getDebt()) && loanAsk >= 0) {
|
||||
setDebt(getDebt() + loanAsk);
|
||||
setMoney(getMoney() + loanAsk);
|
||||
l4.setText("Cash: " + getMoney());
|
||||
} else if (loanAsk < 0) {
|
||||
l5.setText("Sorry you cannot enter negative numbers");
|
||||
}
|
||||
@@ -108,7 +107,7 @@ public class LoanSharkGUI {
|
||||
}
|
||||
|
||||
|
||||
l2.setText("Debt: " + player.getDebt());
|
||||
l2.setText("Debt: " + getDebt());
|
||||
} catch (Exception e) {
|
||||
l5.setText("Please enter a valid value");
|
||||
}
|
||||
@@ -121,26 +120,26 @@ public class LoanSharkGUI {
|
||||
// Set the event handler when the withdraw button is clicked
|
||||
b2.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
public void handle(ActionEvent event) {
|
||||
try {
|
||||
|
||||
|
||||
int returnAsk = Integer.parseInt(txtField1.getText());
|
||||
if (returnAsk > player.getDebt()) {
|
||||
l5.setText("You dont need to return that much");
|
||||
if (returnAsk > getDebt()) {
|
||||
l5.setText("You do not need to return that much.");
|
||||
}
|
||||
else if (returnAsk <= player.getDebt() && returnAsk >= 0 && player.getMoney() >= returnAsk) {
|
||||
player.setDebt(player.getDebt() - returnAsk);
|
||||
player.setMoney(player.getMoney() - returnAsk);
|
||||
l4.setText("Current cash: " + player.getMoney());
|
||||
else if (returnAsk <= getDebt() && returnAsk >= 0 && getMoney() >= returnAsk) {
|
||||
setDebt(getDebt() - returnAsk);
|
||||
setMoney(getMoney() - returnAsk);
|
||||
l4.setText("Cash: " + getMoney());
|
||||
}
|
||||
else if(player.getMoney() < returnAsk) {
|
||||
l5.setText("Look " + player.getName() + ", you are being cheap!");
|
||||
else if(getMoney() < returnAsk) {
|
||||
l5.setText("Look " + getName() + ", you are being cheap!");
|
||||
}
|
||||
else {
|
||||
l5.setText("Sorry you cannot return a negative amount");
|
||||
l5.setText("Sorry, you can not return a negative amount!");
|
||||
}
|
||||
l2.setText("Debt: " + player.getDebt());
|
||||
l2.setText("Debt: " + getDebt());
|
||||
}
|
||||
catch (Exception e) {
|
||||
l5.setText("Please enter a valid value");
|
||||
@@ -152,7 +151,7 @@ public class LoanSharkGUI {
|
||||
b3.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
TaipanShopGUI shopGUI = new TaipanShopGUI(player);
|
||||
TaipanShopGUI shopGUI = new TaipanShopGUI(getPlayer());
|
||||
shopGUI.initializeShop(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
@@ -162,6 +161,7 @@ public class LoanSharkGUI {
|
||||
|
||||
//Setting the Scene and displaying it
|
||||
Scene scene = new Scene(brdr1, 600, 480);
|
||||
scene.getStylesheets().add("styleguide.css");
|
||||
primaryStage.setScene(scene);
|
||||
//primaryStage.show();
|
||||
return primaryStage;
|
||||
@@ -169,20 +169,10 @@ public class LoanSharkGUI {
|
||||
|
||||
|
||||
public void start(Stage primaryStage) {
|
||||
LoanSharkGUI loan = new LoanSharkGUI(player);
|
||||
LoanSharkGUI loan = new LoanSharkGUI(getPlayer());
|
||||
loan.initializeLoanShark(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This methods purpose is to loan the player the funds it wants
|
||||
* or pay its outstanding debts. The method prompts the user if they
|
||||
* would like to borrow money or repay. depending on what the player chooses
|
||||
* the corresponding loop is evoked. The player can only be loaned 2 times the
|
||||
* money they have minus the debt id their debt exceeds the cash balance, the loan
|
||||
* cannot be given.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,30 +9,6 @@ import javafx.stage.Stage;
|
||||
*/
|
||||
|
||||
public class MainGUI extends Application {
|
||||
private Player player = new Player();
|
||||
|
||||
/**
|
||||
* getter method for the Player object player.
|
||||
*
|
||||
* @return returns a copy of the object player
|
||||
*/
|
||||
|
||||
public Player getPlayer() {
|
||||
Player copy = new Player(player);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the Taipan shop with the players stats after the player finishes shopping, it updates the player object and returns it.
|
||||
*
|
||||
* @param shop player object from the main class used to update the shop class
|
||||
*/
|
||||
|
||||
public void shop(TaipanShopGUI shop) {
|
||||
shop.setPlayer(player);
|
||||
shop.shop();
|
||||
player = shop.getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates main class with player data and starts the game.
|
||||
@@ -45,7 +21,7 @@ public class MainGUI extends Application {
|
||||
}
|
||||
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
StartGUI start = new StartGUI(player);
|
||||
StartGUI start = new StartGUI(new Player());
|
||||
start.initializeStart(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 2019-03-10
|
||||
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
||||
@@ -5,9 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Player {
|
||||
public class Player implements Serializable {
|
||||
|
||||
private String name = "Taipan";
|
||||
private int bank = 0;
|
||||
@@ -31,30 +31,12 @@ public class Player {
|
||||
private int armsPrice = 160;
|
||||
private int generalPrice = 8;
|
||||
private int isPriceChanged = 0;
|
||||
private boolean attackingShips = true;
|
||||
|
||||
public Player() {
|
||||
this.name = "Taipan";
|
||||
this.bank = 0;
|
||||
this.money = 0;
|
||||
this.opiumHeld = 0;
|
||||
this.silkHeld = 0;
|
||||
this.generalHeld = 0;
|
||||
this.armsHeld = 0;
|
||||
this.location = 1;
|
||||
this.guns = 0;
|
||||
this.HP = 100;
|
||||
this.debt = 0;
|
||||
this.wOpium = 0;
|
||||
this.wSilk = 0;
|
||||
this.wGeneral = 0;
|
||||
this.wArms = 0;
|
||||
this.retire = false;
|
||||
this.opiumPrice = 1600;
|
||||
this.silkPrice = 1600;
|
||||
this.armsPrice = 160;
|
||||
this.generalPrice = 8;
|
||||
this.cargoSpace = 60;
|
||||
this.isPriceChanged = 0;
|
||||
/**
|
||||
* default constructor for player
|
||||
*/
|
||||
public Player(){
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,6 +45,24 @@ public class Player {
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public Player(Player player) {
|
||||
setPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for this player object
|
||||
*
|
||||
* @return a copy of this player object
|
||||
*/
|
||||
public Player getPlayer(){
|
||||
return new Player(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* copies the provided player's properties into the instance variable of this object
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void setPlayer(Player player){
|
||||
this.name = player.name;
|
||||
this.bank = player.bank;
|
||||
this.money = player.money;
|
||||
@@ -78,12 +78,14 @@ public class Player {
|
||||
this.wSilk = player.wSilk;
|
||||
this.wGeneral = player.wGeneral;
|
||||
this.wArms = player.wArms;
|
||||
this.retire = player.retire;
|
||||
this.cargoSpace = player.cargoSpace;
|
||||
this.opiumPrice = player.opiumPrice;
|
||||
this.silkPrice = player.silkPrice;
|
||||
this.armsPrice = player.armsPrice;
|
||||
this.generalPrice = player.generalPrice;
|
||||
this.cargoSpace = player.cargoSpace;
|
||||
this.isPriceChanged = player.isPriceChanged;
|
||||
this.attackingShips = player.attackingShips;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,13 +103,30 @@ public class Player {
|
||||
*
|
||||
* @param cargoSpace takes an int that is greater than 0 as an argument
|
||||
*/
|
||||
|
||||
public void setCargoSpace(int cargoSpace) {
|
||||
if (cargoSpace > 0) {
|
||||
this.cargoSpace = cargoSpace;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method for the instance variable attackingShips.
|
||||
*
|
||||
* @return returns the instance variable attackingShips
|
||||
*/
|
||||
public boolean getAttackingShips() {
|
||||
return attackingShips;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method for the instance variable attackingShips.
|
||||
*
|
||||
* @param attackingShips takes an int that is greater than 0 as an argument
|
||||
*/
|
||||
public void setAttackingShips(boolean attackingShips) {
|
||||
this.attackingShips = attackingShips;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method for the instance variable retire.
|
||||
*
|
||||
|
||||
454
src/PlayerTest.java
Normal file
454
src/PlayerTest.java
Normal file
@@ -0,0 +1,454 @@
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.io.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* 2019-03-10
|
||||
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
||||
* Player test, checks all the info about the player such as inventory, health, etc
|
||||
*
|
||||
*/
|
||||
|
||||
public class PlayerTest {
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getCargoSpace() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 60, player.getCargoSpace());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setCargoSpace() {
|
||||
Player player = new Player();
|
||||
player.setCargoSpace(10);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 10, player.getCargoSpace());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getAttackingShips() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getAttackingShips());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setAttackingShips() {
|
||||
Player player = new Player();
|
||||
player.setAttackingShips(false);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getAttackingShips());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getRetire() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getRetire());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setRetire() {
|
||||
Player player = new Player();
|
||||
player.setRetire(true);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getRetire());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getName() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", "Taipan", player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setName() {
|
||||
Player player = new Player();
|
||||
player.setName("a");
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", "a", player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getHP() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 100, player.getHP());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setHP() {
|
||||
Player player = new Player();
|
||||
player.setHP(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getHP());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getBank() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getBank());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setBank() {
|
||||
Player player = new Player();
|
||||
player.setBank(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getBank());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getMoney() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getMoney());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setMoney() {
|
||||
Player player = new Player();
|
||||
player.setMoney(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getMoney());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getOpiumHeld() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getOpiumHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setOpiumHeld() {
|
||||
Player player = new Player();
|
||||
player.setOpiumHeld(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getSilkHeld() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getSilkHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setSilkHeld() {
|
||||
Player player = new Player();
|
||||
player.setSilkHeld(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getGeneralHeld() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getGeneralHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setGeneralHeld() {
|
||||
Player player = new Player();
|
||||
player.setGeneralHeld(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getArmsHeld() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getArmsHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setArmsHeld() {
|
||||
Player player = new Player();
|
||||
player.setArmsHeld(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsHeld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getLocation() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getLocation());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setLocation() {
|
||||
Player player = new Player();
|
||||
player.setLocation(2);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 2, player.getLocation());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getGuns() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 5, player.getGuns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setGuns() {
|
||||
Player player = new Player();
|
||||
player.setGuns(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGuns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getDebt() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getDebt());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setDebt() {
|
||||
Player player = new Player();
|
||||
player.setDebt(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getDebt());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getwOpium() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwOpium());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setwOpium() {
|
||||
Player player = new Player();
|
||||
player.setwOpium(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwOpium());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getwSilk() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwSilk());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setwSilk() {
|
||||
Player player = new Player();
|
||||
player.setwSilk(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwSilk());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getwGeneral() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwGeneral());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setwGeneral() {
|
||||
Player player = new Player();
|
||||
player.setwGeneral(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwGeneral());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getwArms() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwArms());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setwArms() {
|
||||
Player player = new Player();
|
||||
player.setwArms(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwArms());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getOpiumPrice() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 16000, player.getOpiumPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setOpiumPrice() {
|
||||
Player player = new Player();
|
||||
player.setOpiumPrice(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getSilkPrice() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1600, player.getSilkPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setSilkPrice() {
|
||||
Player player = new Player();
|
||||
player.setSilkPrice(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getArmsPrice() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 160, player.getArmsPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setArmsPrice() {
|
||||
Player player = new Player();
|
||||
player.setArmsPrice(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getGeneralPrice() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 8, player.getGeneralPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setGeneralPrice() {
|
||||
Player player = new Player();
|
||||
player.setGeneralPrice(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this getter method to see if it returns the default values if called.
|
||||
*/
|
||||
@Test
|
||||
public void getIsPriceChanged() {
|
||||
Player player = new Player();
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getIsPriceChanged());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value
|
||||
*/
|
||||
@Test
|
||||
public void setIsPriceChanged() {
|
||||
Player player = new Player();
|
||||
player.setIsPriceChanged(1);
|
||||
assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getIsPriceChanged());
|
||||
}
|
||||
}
|
||||
229
src/RandomEventGUI.java
Normal file
229
src/RandomEventGUI.java
Normal file
@@ -0,0 +1,229 @@
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 2019-03-19
|
||||
* Authors: Harkamal Randhawa
|
||||
* Random Event GUI class generates random events that occur during travel, such as fixing your ship,
|
||||
* liu yen asking for money and to purchase a gun.
|
||||
*/
|
||||
|
||||
public class RandomEventGUI extends Player{
|
||||
|
||||
private HBox hBox;
|
||||
private Button yesButton;
|
||||
private Button noButton;
|
||||
private VBox vBox;
|
||||
private Label paymentLabel;
|
||||
private Label sellingItemLabel;
|
||||
private Label cannotAffordLabel;
|
||||
private VBox vBox0;
|
||||
private Label shipHPLabel;
|
||||
private Label gunsShipLabel;
|
||||
private Label moneyPlayerLabel;
|
||||
private Label moneyBankLabel;
|
||||
private Label cargoShipLabel;
|
||||
private Label cargoWarehouseLabel;
|
||||
private BorderPane borderPane;
|
||||
private int eventNumber = 0;
|
||||
private int itemPrice = 10;
|
||||
|
||||
/**
|
||||
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
|
||||
*
|
||||
* @param player is a Player object that will be copied and the player instance variable is set to the copy.
|
||||
*/
|
||||
public RandomEventGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes randomEvent on the given stage as a parameter.
|
||||
*
|
||||
* @param stage
|
||||
*/
|
||||
public Stage initializeRandomEventGUI(Stage stage) {
|
||||
//Creating the nodes within the event screen
|
||||
hBox = new HBox();
|
||||
yesButton = new Button();
|
||||
noButton = new Button();
|
||||
vBox = new VBox();
|
||||
paymentLabel = new Label();
|
||||
sellingItemLabel = new Label();
|
||||
cannotAffordLabel = new Label();
|
||||
vBox0 = new VBox();
|
||||
shipHPLabel = new Label();
|
||||
gunsShipLabel = new Label();
|
||||
moneyPlayerLabel = new Label();
|
||||
moneyBankLabel = new Label();
|
||||
cargoShipLabel = new Label();
|
||||
borderPane = new BorderPane();
|
||||
|
||||
//Messing with the alignments of the buttons and their text
|
||||
borderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
hBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox.setPrefHeight(100.0);
|
||||
hBox.setPrefWidth(200.0);
|
||||
hBox.setSpacing(10.0);
|
||||
yesButton.setMnemonicParsing(false);
|
||||
yesButton.setText("Yes");
|
||||
yesButton.setDefaultButton(true);
|
||||
noButton.setMnemonicParsing(false);
|
||||
noButton.setText("No");
|
||||
borderPane.setBottom(hBox);
|
||||
|
||||
//Making the vbox to put all Labels for the events
|
||||
borderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER);
|
||||
vBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
vBox.setPrefHeight(200.0);
|
||||
vBox.setPrefWidth(100.0);
|
||||
paymentLabel.setText("Would you like to pay?");
|
||||
sellingItemLabel.setText("for a Gun?");
|
||||
cannotAffordLabel.setText("You can't afford that!");
|
||||
cannotAffordLabel.setFocusTraversable(false);
|
||||
borderPane.setCenter(vBox);
|
||||
borderPane.setAlignment(vBox0, javafx.geometry.Pos.CENTER);
|
||||
vBox0.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
vBox0.setPrefHeight(200.0);
|
||||
vBox0.setPrefWidth(100.0);
|
||||
|
||||
//Update the labels to fit the player's stats
|
||||
shipHPLabel.setText("Ship Health: " + getPlayer().getHP());
|
||||
gunsShipLabel.setText("Number of Guns Remaining: " + getPlayer().getGuns());
|
||||
moneyPlayerLabel.setText("Money on Player: " + getPlayer().getMoney());
|
||||
moneyBankLabel.setText("Money in Bank: " + getPlayer().getBank());
|
||||
cargoShipLabel.setText("Ship Cargo Space: " + getPlayer().getCargoSpace());
|
||||
|
||||
|
||||
//Adding all the buttons and labels to the elements in the scene
|
||||
hBox.getChildren().add(yesButton);
|
||||
hBox.getChildren().add(noButton);
|
||||
vBox.getChildren().add(sellingItemLabel);
|
||||
vBox.getChildren().add(paymentLabel);
|
||||
vBox.getChildren().add(cannotAffordLabel);
|
||||
vBox0.getChildren().add(shipHPLabel);
|
||||
vBox0.getChildren().add(gunsShipLabel);
|
||||
vBox0.getChildren().add(moneyPlayerLabel);
|
||||
vBox0.getChildren().add(moneyBankLabel);
|
||||
vBox0.getChildren().add(cargoShipLabel);
|
||||
|
||||
//Adding all the elements to the scene
|
||||
borderPane.setTop(vBox0);
|
||||
borderPane.setTop(vBox0);
|
||||
borderPane.setCenter(vBox);
|
||||
borderPane.setBottom(hBox);
|
||||
|
||||
//Make it so that the player can't see the can't afford label until after they actually can't understand
|
||||
cannotAffordLabel.setVisible(false);
|
||||
|
||||
/*Pick a random number dictating the events that could happen.
|
||||
* 1: New gun for player
|
||||
* 2: Paying Liu Yuen
|
||||
* 3: Repairing the Ship
|
||||
*/
|
||||
Random rand = new Random();
|
||||
int randGenNum = rand.nextInt(3) + 1;
|
||||
while(true){
|
||||
//Buy Guns
|
||||
if (randGenNum == 1) {
|
||||
itemPrice = (int) ((getPlayer().getMoney() * 0.1) + 10);
|
||||
sellingItemLabel.setText("A vender is selling a gun for $" + itemPrice + " for a gun?");
|
||||
break;
|
||||
}
|
||||
//Liu Yuen
|
||||
if (randGenNum == 2) {
|
||||
itemPrice = (int) ((getPlayer().getMoney() * 0.1) + 10);
|
||||
sellingItemLabel.setText("Liu Yuen asks $" + itemPrice + " in donation to the temple of Tin Hau, the Sea Goddess");
|
||||
setAttackingShips(true);
|
||||
break;
|
||||
}
|
||||
//Ship Repair
|
||||
if (randGenNum == 3 && getHP() < 100) {
|
||||
itemPrice = (int) ((100 - getPlayer().getHP()) * 10 + 10);
|
||||
sellingItemLabel.setText("Mc Henry from the Hong Kong shipyard has arrived,\n would be willing to repair your ship for $" + itemPrice);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
randGenNum = 2;
|
||||
}
|
||||
}
|
||||
eventNumber = randGenNum;
|
||||
|
||||
if((eventNumber == 1 && getCargoSpace() < 10)){
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
if((eventNumber == 3 && getPlayer().getHP() >= 100)){
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if yes button is clicked, executes the code depending on the type of event
|
||||
yesButton.setOnAction(event -> {
|
||||
if(getPlayer().getMoney() > itemPrice) {
|
||||
//Buy Guns
|
||||
if (eventNumber == 1 && (getCargoSpace() >= 10)) {
|
||||
setGuns(getPlayer().getGuns() + 1);
|
||||
setMoney(getPlayer().getMoney() - itemPrice);
|
||||
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
//Liu Yuen
|
||||
if (eventNumber == 2) {
|
||||
setAttackingShips(false);
|
||||
setMoney(getPlayer().getMoney() - itemPrice);
|
||||
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
//Ship Repair
|
||||
if (eventNumber == 3 && getPlayer().getHP() != 100) {
|
||||
setHP(100);
|
||||
setMoney(getPlayer().getMoney() - itemPrice);
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
cannotAffordLabel.setVisible(true);
|
||||
yesButton.setVisible(false);
|
||||
noButton.setDefaultButton(true);
|
||||
noButton.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
//If the no button is clicked then it skips to the location screen you wanted to go to.
|
||||
noButton.setOnAction(event -> {
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
});
|
||||
|
||||
//Creates the scene and window
|
||||
Scene root = new Scene(borderPane, 600, 480);
|
||||
root.getStylesheets().add("styleguide.css");
|
||||
|
||||
stage.setTitle("Travel");
|
||||
stage.setResizable(false);
|
||||
stage.setScene(root);
|
||||
return stage;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +1,68 @@
|
||||
import javafx.animation.*;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Duration;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
* 2019-03-10
|
||||
* Authors: Haris Muhammad
|
||||
* 2019-03-10 (Edited on 2019-03-23)
|
||||
* Author: Haris Muhammad
|
||||
* ShipWarfareGUI class, Generates and utilizes ships which the user can attack or run from
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ShipWarfareGUI {
|
||||
public class ShipWarfareGUI extends Player {
|
||||
|
||||
|
||||
private Player player = new Player();
|
||||
private HBox hBox;
|
||||
private ShipWarfareGUI ship;
|
||||
private Circle cannon;
|
||||
private VBox buttonBox;
|
||||
private HBox fightRunBox;
|
||||
private Button fightButton;
|
||||
private Button runButton;
|
||||
private VBox vBox;
|
||||
private Button continueButton;
|
||||
private VBox labelBox;
|
||||
private Label title;
|
||||
private Label chooseFightOrRun;
|
||||
private Label report;
|
||||
private Label runAwayOrLeft;
|
||||
private Label shipsRemaining;
|
||||
private Label HPLeft;
|
||||
private Label gunsLeftOrTaken;
|
||||
private Label continueToFight;
|
||||
private int counter1;
|
||||
private Button continueButton;
|
||||
private Label runAwayOrLeft;
|
||||
private Label shipsRemaining;
|
||||
private Label report;
|
||||
|
||||
private boolean winOrLose= false;
|
||||
|
||||
|
||||
private int counter1;
|
||||
private int timeCounter;
|
||||
|
||||
private int numOfLittyShips = 0;
|
||||
private boolean userAttacks = true;
|
||||
private int startingLittyShips = 0;
|
||||
private int howMuchRun = 0;
|
||||
private int counter = 0;
|
||||
private String pirateName = "Liu Yen";
|
||||
|
||||
private int beginningX = 150;
|
||||
private int beginningY = 245;
|
||||
|
||||
private int endX = 350;
|
||||
private int endY = 90;
|
||||
|
||||
private TranslateTransition shotsFired = new TranslateTransition();
|
||||
private TranslateTransition enemyShots = new TranslateTransition();
|
||||
|
||||
/**
|
||||
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
|
||||
@@ -46,51 +71,7 @@ public class ShipWarfareGUI {
|
||||
*/
|
||||
public ShipWarfareGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
|
||||
private int numOfPeasantShips = 0;
|
||||
private int numOfLittyShips = 0;
|
||||
private boolean userAttacks = true;
|
||||
private int startingPeasantShips = 0;
|
||||
private int startingLittyShips = 0;
|
||||
private int howMuchRun = 0;
|
||||
private int counter = 0;
|
||||
private String pirateName = "Liu Yen";
|
||||
|
||||
/**
|
||||
* setter method for player
|
||||
*
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method for obtaining a player object.
|
||||
*
|
||||
* @return returns player object
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method that takes in an integer as an argument
|
||||
*
|
||||
* @param numOfPeasantShips the number of ships to be used in the peasant fleet attack
|
||||
*/
|
||||
public void setNumOfPeasantShips(int numOfPeasantShips) {
|
||||
counter1++;
|
||||
this.numOfPeasantShips = numOfPeasantShips;
|
||||
if (counter1 == 1) {
|
||||
startingPeasantShips = numOfPeasantShips;
|
||||
}
|
||||
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,16 +84,16 @@ public class ShipWarfareGUI {
|
||||
int numOfShipsAttacking = 0;
|
||||
Random randomValue = new Random();
|
||||
|
||||
if (player.getMoney() <= 100000) {
|
||||
if (getMoney() <= 100000) {
|
||||
//Minimum one ship will attack, maximum 20
|
||||
numOfShipsAttacking = randomValue.nextInt(20) + 1;
|
||||
} else if (player.getMoney() <= 200000) {
|
||||
} else if (getMoney() <= 200000) {
|
||||
//Minimum 30 Ships will attack, maximum 70
|
||||
numOfShipsAttacking = randomValue.nextInt(40) + 31;
|
||||
} else if (player.getMoney() <= 500000) {
|
||||
} else if (getMoney() <= 500000) {
|
||||
//Minimum 50 ships will attack, maximum 140
|
||||
numOfShipsAttacking = randomValue.nextInt(90) + 51;
|
||||
} else if (player.getMoney() >= 1000000) {
|
||||
} else if (getMoney() >= 1000000) {
|
||||
//Minimum 100 ships will attack, maximum 300 ships
|
||||
numOfShipsAttacking = randomValue.nextInt(200) + 101;
|
||||
}
|
||||
@@ -121,6 +102,20 @@ public class ShipWarfareGUI {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method that takes in an integer as an argument
|
||||
*
|
||||
* @param numOfLittyShips the number of ships to be used in the peasant fleet attack
|
||||
*/
|
||||
public void setNumOfLittyShips(int numOfLittyShips) {
|
||||
counter1++;
|
||||
this.numOfLittyShips = numOfLittyShips;
|
||||
if (counter1 == 1) {
|
||||
startingLittyShips = numOfLittyShips;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* One in two chance of running away
|
||||
*
|
||||
@@ -147,7 +142,6 @@ public class ShipWarfareGUI {
|
||||
shipsRemaining.setVisible(false);
|
||||
HPLeft.setVisible(false);
|
||||
gunsLeftOrTaken.setVisible(false);
|
||||
continueToFight.setVisible(false);
|
||||
|
||||
|
||||
}
|
||||
@@ -157,62 +151,61 @@ public class ShipWarfareGUI {
|
||||
*/
|
||||
public void completeWipe() {
|
||||
title.setVisible(false);
|
||||
chooseFightOrRun.setVisible(false);
|
||||
runAwayOrLeft.setVisible(false);
|
||||
shipsRemaining.setVisible(false);
|
||||
HPLeft.setVisible(false);
|
||||
gunsLeftOrTaken.setVisible(false);
|
||||
continueToFight.setVisible(false);
|
||||
report.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The user faces off against the peasant ships and either prevails, dies, or runs away
|
||||
* The user faces off against the litty ships and either prevails, dies, or runs away
|
||||
*
|
||||
* @return true if the user wins, loses, or flees, it returns false otherwise
|
||||
* @throws Exception in case of errors due to the delay
|
||||
*/
|
||||
public boolean destroyPeasantShipsOrEscape(Stage stage) throws Exception {
|
||||
public boolean destroyLittyShipsOrEscape(Stage stage) throws Exception {
|
||||
cannon.setLayoutX(beginningX);
|
||||
cannon.setLayoutY(beginningY);
|
||||
int calculateLoot = 0;
|
||||
int chanceOfEnemyRun = 0;
|
||||
int hitCounter = 0;
|
||||
int missCounter = 0;
|
||||
boolean gunFrustration = false;
|
||||
|
||||
title.setVisible(true);
|
||||
chooseFightOrRun.setVisible(true);
|
||||
report.setVisible(true);
|
||||
runAwayOrLeft.setVisible(true);
|
||||
shipsRemaining.setVisible(true);
|
||||
HPLeft.setVisible(true);
|
||||
gunsLeftOrTaken.setVisible(true);
|
||||
continueToFight.setVisible(true);
|
||||
continueButton.setVisible(false);
|
||||
|
||||
|
||||
runAwayOrLeft.setText("No ships ran away");
|
||||
|
||||
|
||||
|
||||
Random randomValue = new Random();
|
||||
int exitValue = 0;
|
||||
|
||||
//Player volley
|
||||
//while (exitValue == 0) {
|
||||
if (player.getGuns() > 0) {
|
||||
if (getGuns() > 0) {
|
||||
|
||||
for (int j = 0; j < player.getGuns(); j++) {
|
||||
for (int j = 0; j < getGuns(); j++) {
|
||||
if (userAttacks == true) {
|
||||
|
||||
int hitOrMiss = randomValue.nextInt(2) + 1;
|
||||
if (hitOrMiss == 2) {
|
||||
numOfPeasantShips--;
|
||||
if (numOfPeasantShips <= 0) {
|
||||
numOfLittyShips--;
|
||||
if (numOfLittyShips <= 0) {
|
||||
exitValue = 1;
|
||||
//break;
|
||||
}
|
||||
hitCounter++;
|
||||
|
||||
|
||||
} else {
|
||||
missCounter++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
//continue;
|
||||
}
|
||||
@@ -226,209 +219,327 @@ public class ShipWarfareGUI {
|
||||
}
|
||||
|
||||
|
||||
if (numOfPeasantShips <= 0) {
|
||||
if (numOfLittyShips <= 0) {
|
||||
exitValue = 1;
|
||||
//break;
|
||||
}
|
||||
if (player.getGuns() > 0) {
|
||||
if (getGuns() > 0) {
|
||||
chanceOfEnemyRun = randomValue.nextInt(2) + 1;
|
||||
if (chanceOfEnemyRun == 2) {
|
||||
howMuchRun = randomValue.nextInt(15) + 1;
|
||||
if (howMuchRun != 0 && howMuchRun < numOfPeasantShips) {
|
||||
if (howMuchRun != 0 && howMuchRun < numOfLittyShips) {
|
||||
|
||||
|
||||
setNumOfPeasantShips(numOfPeasantShips - howMuchRun);
|
||||
setNumOfLittyShips(numOfLittyShips - howMuchRun);
|
||||
if (userAttacks == true) {
|
||||
if (howMuchRun > 0) {
|
||||
runAwayOrLeft.setText(String.format("Cowards! %d ships ran away %s! ", howMuchRun, player.getName()));
|
||||
runAwayOrLeft.setText(String.format("Cowards! %d ships ran away %s! ", howMuchRun, getName()));
|
||||
|
||||
//runAwayOrLeft.setVisible(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
report.setText((String.format("Escaped %d of them %s!", howMuchRun, player.getName())));
|
||||
report.setText((String.format("Escaped %d of them %s!", howMuchRun, getName())));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shipsRemaining.setText(String.format("%d ships remaining and they look angry!", numOfPeasantShips));
|
||||
shipsRemaining.setText(String.format("%d ships remaining and they look angry!", numOfLittyShips));
|
||||
//Computer volley
|
||||
int takeGunChance = randomValue.nextInt(4) + 1;
|
||||
if (takeGunChance == 1 && player.getGuns() > 0) {
|
||||
player.setGuns(player.getGuns() - 1);
|
||||
if (takeGunChance == 1 && getGuns() > 0) {
|
||||
setGuns(getGuns() - 1);
|
||||
gunFrustration = true;
|
||||
} else {
|
||||
if (numOfPeasantShips > 0) {
|
||||
player.setHP(player.getHP() - (1 + randomValue.nextInt(10)));
|
||||
if (numOfLittyShips > 0) {
|
||||
int HPTaken = randomValue.nextInt(10);
|
||||
setHP(getHP() - (HPTaken));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (player.getHP() <= 0) {
|
||||
if (getHP() <= 0) {
|
||||
exitValue = 2;
|
||||
//break;
|
||||
}
|
||||
if (gunFrustration == true) {
|
||||
gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", player.getGuns()));
|
||||
gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", getGuns()));
|
||||
playerShoots(getGuns()+1);
|
||||
|
||||
} else {
|
||||
gunsLeftOrTaken.setText(String.format("We still have %d guns left", player.getGuns()));
|
||||
gunsLeftOrTaken.setText(String.format("We still have %d guns left", getGuns()));
|
||||
}
|
||||
|
||||
HPLeft.setText(String.format("EEK, our current ship status is %d%% ", player.getHP()));
|
||||
HPLeft.setText(String.format("EEK, our current ship status is %d%% ", getHP()));
|
||||
if (userAttacks == false) {
|
||||
userAttacks = true;
|
||||
}
|
||||
|
||||
continueToFight.setText(String.format("Captain, what are your orders? (Click the fight button or the run button)", player.getGuns()));
|
||||
|
||||
if (exitValue == 1) {
|
||||
wipe();
|
||||
chooseFightOrRun.setText(String.format("Ayy! We won and survived at %d%% ship status!", player.getHP()));
|
||||
calculateLoot = (startingPeasantShips * 100) + randomValue.nextInt(startingPeasantShips) * 200;
|
||||
player.setMoney(player.getMoney() + calculateLoot);
|
||||
calculateLoot = (startingLittyShips * 100) + randomValue.nextInt(startingLittyShips) * 200;
|
||||
setMoney(getMoney() + calculateLoot);
|
||||
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
|
||||
continueButton.setVisible(true);
|
||||
completeWipe();
|
||||
fightButton.setVisible(false);
|
||||
runButton.setVisible(false);
|
||||
continueButton.setDefaultButton(true);
|
||||
return true;
|
||||
} else if (exitValue == 2) {
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(player);
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
|
||||
gameEndGUI.initializeGameEndGUI(stage);
|
||||
stage.show();
|
||||
return true;
|
||||
} else if (exitValue == 3) {
|
||||
System.out.printf("We made it out at %d%% ship status!\n", player.getHP());
|
||||
report.setText(String.format("We made it out at %d%% ship status!", getHP()));
|
||||
|
||||
continueButton.setVisible(true);
|
||||
completeWipe();
|
||||
fightButton.setVisible(false);
|
||||
runButton.setVisible(false);
|
||||
continueButton.setDefaultButton(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the graphical part of ShipWarfare and includes all logic for the class
|
||||
*
|
||||
* @param stage sets the stage to which we will execute the scene of the ShipWarfare class
|
||||
* @return stage so that another class can switch to the stage
|
||||
* Player attacks enemy ships in an animation
|
||||
*/
|
||||
public void playerShoots(int amountOfShots) {
|
||||
userAttacks=true;
|
||||
shotsFired.setFromX(0);
|
||||
shotsFired.setFromY(0);
|
||||
shotsFired.setToX(endX);
|
||||
shotsFired.setToY(endY);
|
||||
shotsFired.setDuration(Duration.seconds(0.5));
|
||||
if(getGuns()>0) {
|
||||
shotsFired.setCycleCount(amountOfShots);
|
||||
}
|
||||
else{
|
||||
shotsFired.setCycleCount(0);
|
||||
shotsFired.stop();
|
||||
cannon.setVisible(false);
|
||||
}
|
||||
shotsFired.setNode(cannon);
|
||||
shotsFired.play();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ships attack player ship back in an animation
|
||||
*/
|
||||
|
||||
public Stage initializeShip(Stage stage) {
|
||||
setNumOfPeasantShips(numOfShips());
|
||||
public void shipsRetaliate(){
|
||||
cannon.setVisible(true);
|
||||
enemyShots.setFromX(270);
|
||||
enemyShots.setFromY(0);
|
||||
enemyShots.setToX(-30);
|
||||
enemyShots.setToY(90);
|
||||
enemyShots.setDuration(Duration.seconds(0.5));
|
||||
enemyShots.setCycleCount(1);
|
||||
enemyShots.setNode(cannon);
|
||||
enemyShots.play();
|
||||
}
|
||||
|
||||
BorderPane BorderPane = new BorderPane();
|
||||
/**
|
||||
* Sets most buttons to being invisble and switches to TaipanShop scene
|
||||
*
|
||||
* @param stage stage the user incorporates when they utilize the GUI
|
||||
*/
|
||||
public void setVisibilitiesAndTransition(Stage stage) {
|
||||
completeWipe();
|
||||
continueButton.setVisible(true);
|
||||
continueButton.setDefaultButton(true);
|
||||
fightButton.setVisible(false);
|
||||
runButton.setVisible(false);
|
||||
/**
|
||||
* Switches to Taipan Shop scene
|
||||
* @param event, once button is clicked, executes graphical information
|
||||
*/
|
||||
continueButton.setOnAction(event -> {
|
||||
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
});
|
||||
}
|
||||
|
||||
GridPane gridPane = new GridPane();
|
||||
gridPane.setPadding(new Insets(10.0, 10.0, 10.0, 10.0));
|
||||
gridPane.setVgap(5.0);
|
||||
|
||||
hBox = new HBox();
|
||||
/**
|
||||
* Generaties ships and deploys logic for the shipwarfare
|
||||
* @param primaryStage sets up the stage to whcih the GUI may be based around
|
||||
* @throws Exception in case of interruptions withing the graphical interface
|
||||
*/
|
||||
public void initializeShip(Stage primaryStage) throws Exception {
|
||||
setNumOfLittyShips(numOfShips());
|
||||
|
||||
Pane root = new Pane();
|
||||
HBox usAgainstEnemyDivisor;
|
||||
BorderPane centeringUserShipPane = new BorderPane();
|
||||
Circle cannon;
|
||||
BorderPane centeringLittyShipPane = new BorderPane();
|
||||
BorderPane encompassingPane = new BorderPane();
|
||||
usAgainstEnemyDivisor = new HBox();
|
||||
cannon = new Circle();
|
||||
this.cannon = cannon;
|
||||
|
||||
|
||||
|
||||
cannon.setVisible(false);
|
||||
|
||||
buttonBox = new VBox();
|
||||
fightRunBox = new HBox();
|
||||
fightButton = new Button();
|
||||
runButton = new Button();
|
||||
vBox = new VBox();
|
||||
continueButton = new Button();
|
||||
labelBox = new VBox();
|
||||
title = new Label();
|
||||
chooseFightOrRun = new Label();
|
||||
report = new Label();
|
||||
runAwayOrLeft = new Label();
|
||||
shipsRemaining = new Label();
|
||||
HPLeft = new Label();
|
||||
gunsLeftOrTaken = new Label();
|
||||
continueToFight = new Label();
|
||||
continueButton = new Button();
|
||||
runAwayOrLeft = new Label();
|
||||
shipsRemaining = new Label();
|
||||
report = new Label();
|
||||
|
||||
title.setText(String.format("%d ships from Liu Yuen's Fleet are attacking, Would you like to fight or run?", numOfLittyShips));
|
||||
|
||||
|
||||
fightButton.setText("Fight");
|
||||
runButton.setText("Run");
|
||||
continueButton.setText("Continue");
|
||||
|
||||
fightButton.setVisible(true);
|
||||
runButton.setVisible(true);
|
||||
continueButton.setVisible(false);
|
||||
|
||||
|
||||
BorderPane.setPrefHeight(400.0);
|
||||
BorderPane.setPrefWidth(600.0);
|
||||
hBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox.setPrefHeight(100.0);
|
||||
hBox.setPrefWidth(200.0);
|
||||
hBox.setSpacing(10.0);
|
||||
encompassingPane.setAlignment(labelBox, javafx.geometry.Pos.CENTER);
|
||||
labelBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
labelBox.setPrefHeight(41.0);
|
||||
labelBox.setPrefWidth(600.0);
|
||||
labelBox.setSpacing(20.0);
|
||||
|
||||
title.setAlignment(javafx.geometry.Pos.TOP_CENTER);
|
||||
title.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
title.setId("Label1");
|
||||
title.setText(String.format("%d ships attacking. Would you like to Fight or Run?", numOfPeasantShips));
|
||||
title.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
|
||||
labelBox.setPadding(new Insets(10.0, 0.0, 0.0, 0.0));
|
||||
|
||||
continueButton.setMnemonicParsing(false);
|
||||
continueButton.setText("Continue?");
|
||||
|
||||
fightButton.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
fightButton.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
fightButton.setId("Button1");
|
||||
fightButton.setMnemonicParsing(false);
|
||||
fightButton.setText("Fight");
|
||||
|
||||
runButton.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
runButton.setId("Button2");
|
||||
runButton.setMnemonicParsing(false);
|
||||
|
||||
BorderPane.setBottom(hBox);
|
||||
runButton.setText("Run");
|
||||
|
||||
javafx.scene.layout.BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER);
|
||||
vBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
|
||||
vBox.setPrefHeight(200.0);
|
||||
vBox.setPrefWidth(100.0);
|
||||
vBox.setSpacing(20.0);
|
||||
|
||||
report.setAlignment(javafx.geometry.Pos.TOP_CENTER);
|
||||
report.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
report.setId("Label1");
|
||||
report.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
|
||||
vBox.setPadding(new Insets(0.0, 0.0, 10.0, 0.0));
|
||||
BorderPane.setTop(vBox);
|
||||
BorderPane.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
|
||||
|
||||
hBox.getChildren().add(fightButton);
|
||||
hBox.getChildren().add(runButton);
|
||||
vBox.getChildren().add(title);
|
||||
vBox.getChildren().add(chooseFightOrRun);
|
||||
vBox.getChildren().add(report);
|
||||
vBox.getChildren().add(runAwayOrLeft);
|
||||
vBox.getChildren().add(shipsRemaining);
|
||||
vBox.getChildren().add(HPLeft);
|
||||
vBox.getChildren().add(gunsLeftOrTaken);
|
||||
vBox.getChildren().add(continueToFight);
|
||||
vBox.getChildren().add(continueButton);
|
||||
encompassingPane.setAlignment(buttonBox, javafx.geometry.Pos.CENTER);
|
||||
buttonBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
|
||||
|
||||
|
||||
//Fight
|
||||
fightButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
fightRunBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
fightRunBox.setPrefHeight(100.0);
|
||||
fightRunBox.setPrefWidth(200.0);
|
||||
fightRunBox.setSpacing(10.0);
|
||||
|
||||
VBox.setMargin(continueButton, new Insets(0.0, 0.0, 20.0, 0.0));
|
||||
|
||||
|
||||
root.getChildren().add(cannon);
|
||||
|
||||
encompassingPane.setPrefHeight(480);
|
||||
encompassingPane.setPrefWidth(600);
|
||||
|
||||
|
||||
usAgainstEnemyDivisor.setPrefHeight(0.0);
|
||||
usAgainstEnemyDivisor.setPrefWidth(600.0);
|
||||
|
||||
centeringUserShipPane.setPrefHeight(200.0);
|
||||
centeringUserShipPane.setPrefWidth(200.0);
|
||||
|
||||
Image ourShip;
|
||||
Image enemyShip;
|
||||
|
||||
try {
|
||||
ourShip = new Image(new FileInputStream("src/images/ourShip.png"));
|
||||
enemyShip = new Image(new FileInputStream("src/images/enemyShip.png"));
|
||||
|
||||
}catch(Exception e){
|
||||
ourShip = new Image(new FileInputStream("images/ourShip.png"));
|
||||
enemyShip = new Image(new FileInputStream("images/enemyShip.png"));
|
||||
}
|
||||
|
||||
|
||||
//Setting the image view
|
||||
ImageView userShip = new ImageView(ourShip);
|
||||
ImageView littyShip = new ImageView(enemyShip);
|
||||
|
||||
BorderPane.setAlignment(userShip, javafx.geometry.Pos.CENTER);
|
||||
userShip.setFitHeight(150.0);
|
||||
userShip.setFitWidth(248.0);
|
||||
userShip.setPickOnBounds(true);
|
||||
userShip.setPreserveRatio(true);
|
||||
centeringUserShipPane.setCenter(userShip);
|
||||
|
||||
BorderPane.setAlignment(buttonBox, javafx.geometry.Pos.CENTER);
|
||||
buttonBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
|
||||
|
||||
usAgainstEnemyDivisor.setTranslateY(-20.0);
|
||||
|
||||
cannon.setRadius(10.0);
|
||||
cannon.setStroke(javafx.scene.paint.Color.BLACK);
|
||||
cannon.setStrokeType(javafx.scene.shape.StrokeType.INSIDE);
|
||||
centeringUserShipPane.setRight(cannon);
|
||||
|
||||
centeringLittyShipPane.setPrefHeight(200.0);
|
||||
centeringLittyShipPane.setPrefWidth(200.0);
|
||||
centeringLittyShipPane.setOpaqueInsets(new Insets(0.0));
|
||||
HBox.setMargin(centeringLittyShipPane, new Insets(0.0, 0.0, 0.0, 200.0));
|
||||
|
||||
encompassingPane.setAlignment(littyShip, javafx.geometry.Pos.CENTER);
|
||||
littyShip.setFitHeight(165.0);
|
||||
littyShip.setFitWidth(180.0);
|
||||
littyShip.setPickOnBounds(true);
|
||||
littyShip.setPreserveRatio(true);
|
||||
encompassingPane.setMargin(littyShip, new Insets(0.0, 0.0, 20.0, 0.0));
|
||||
centeringLittyShipPane.setCenter(littyShip);
|
||||
|
||||
usAgainstEnemyDivisor.getChildren().add(centeringUserShipPane);
|
||||
usAgainstEnemyDivisor.getChildren().add(centeringLittyShipPane);
|
||||
fightRunBox.getChildren().add(fightButton);
|
||||
fightRunBox.getChildren().add(continueButton);
|
||||
fightRunBox.getChildren().add(runButton);
|
||||
buttonBox.getChildren().add(fightRunBox);
|
||||
labelBox.getChildren().add(title);
|
||||
labelBox.getChildren().add(HPLeft);
|
||||
labelBox.getChildren().add(gunsLeftOrTaken);
|
||||
labelBox.getChildren().add(runAwayOrLeft);
|
||||
labelBox.getChildren().add(shipsRemaining);
|
||||
labelBox.getChildren().add(report);
|
||||
|
||||
encompassingPane.setTop(labelBox);
|
||||
encompassingPane.setCenter(usAgainstEnemyDivisor);
|
||||
|
||||
encompassingPane.setBottom(buttonBox);
|
||||
|
||||
root.getChildren().addAll(encompassingPane, cannon);
|
||||
|
||||
Scene scene = new Scene(root, 600, 480);
|
||||
root.getStylesheets().add("styleguide.css");
|
||||
|
||||
primaryStage.setResizable(false);
|
||||
|
||||
primaryStage.setTitle("Ship Warfare");
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
continueButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
/**
|
||||
* Fight Button, engages in fight logic and graphical interface
|
||||
* Continue Button, engages in run logic and graphical interface
|
||||
* @param event, once button is clicked, executes graphical information
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
counter++;
|
||||
chooseFightOrRun.setText("Ohh, Fight ehh?");
|
||||
try {
|
||||
if (destroyPeasantShipsOrEscape(stage)) {
|
||||
completeWipe();
|
||||
continueButton.setVisible(true);
|
||||
fightButton.setVisible(false);
|
||||
runButton.setVisible(false);
|
||||
continueButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
/**
|
||||
* Switches to Taipan Shop scene
|
||||
* @param event, once button is clicked, executes graphical information
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
});
|
||||
shotsFired.stop();
|
||||
|
||||
/**
|
||||
* Switches to Taipan Shop scene
|
||||
*/
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||
shop.initializeShop(primaryStage);
|
||||
primaryStage.show();
|
||||
|
||||
if (counter >= 2) {
|
||||
title.setVisible(false);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -440,66 +551,131 @@ public class ShipWarfareGUI {
|
||||
* @param event, once button is clicked, executes graphical information
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
chooseFightOrRun.setText("Ayy captain we will try to run!");
|
||||
report.setVisible(true);
|
||||
title.setVisible(true);
|
||||
shipsRemaining.setVisible(true);
|
||||
gunsLeftOrTaken.setVisible(true);
|
||||
|
||||
title.setText("Ayy captain we will try to run!");
|
||||
report.setText("Epic");
|
||||
counter++;
|
||||
|
||||
if (runFromShips() == false) {
|
||||
title.setVisible(false);
|
||||
chooseFightOrRun.setVisible(false);
|
||||
report.setText(("Couldn't run away"));
|
||||
try {
|
||||
if (destroyPeasantShipsOrEscape(stage) == true) {
|
||||
completeWipe();
|
||||
continueButton.setVisible(true);
|
||||
fightButton.setVisible(false);
|
||||
runButton.setVisible(false);
|
||||
continueButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
/**
|
||||
* Switches to Taipan Shop scene
|
||||
* @param event, once button is clicked, executes graphical information
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
winOrLose= destroyLittyShipsOrEscape(primaryStage);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(winOrLose==true){
|
||||
report.setVisible(true);
|
||||
title.setVisible(true);
|
||||
shipsRemaining.setVisible(true);
|
||||
gunsLeftOrTaken.setVisible(true);
|
||||
|
||||
}
|
||||
} else {
|
||||
completeWipe();
|
||||
|
||||
report.setText("Phew! Got away safely");
|
||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
setVisibilitiesAndTransition(primaryStage);
|
||||
|
||||
|
||||
}
|
||||
if (counter >= 2) {
|
||||
title.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//Fight
|
||||
fightButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
|
||||
Scene root = new Scene(BorderPane, 600, 480);
|
||||
@Override
|
||||
/**
|
||||
* Fight Button, engages in fight logic and graphical interface
|
||||
* @param event, once button is clicked, executes graphical information
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
report.setVisible(false);
|
||||
runAwayOrLeft.setVisible(false);
|
||||
shipsRemaining.setVisible(false);
|
||||
HPLeft.setVisible(false);
|
||||
gunsLeftOrTaken.setVisible(false);
|
||||
fightButton.setVisible(false);
|
||||
runButton.setVisible(false);
|
||||
|
||||
stage.setTitle("Ship");
|
||||
stage.setResizable(false);
|
||||
stage.setScene(root);
|
||||
return stage;
|
||||
}
|
||||
try {
|
||||
winOrLose= destroyLittyShipsOrEscape(primaryStage);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
counter++;
|
||||
|
||||
cannon.setVisible(true);
|
||||
cannon.setLayoutX(beginningX);
|
||||
cannon.setLayoutY(beginningY);
|
||||
|
||||
if (counter >= 1) {
|
||||
title.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
playerShoots(getGuns());
|
||||
|
||||
shotsFired.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
/**
|
||||
* When the user is completed their volley this information will be accessed
|
||||
* @param event, once the shots fired transition is completed, execute graphical information
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
shotsFired.stop();
|
||||
if(!winOrLose) {
|
||||
shipsRetaliate();
|
||||
}
|
||||
else{
|
||||
report.setVisible(true);
|
||||
continueButton.setVisible(true);
|
||||
usAgainstEnemyDivisor.setVisible(false);
|
||||
cannon.setVisible(false);
|
||||
shotsFired.stop();
|
||||
|
||||
}
|
||||
enemyShots.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
/**
|
||||
* When the user is completed their volley, this information will be accessed
|
||||
* @param event, once the enemy shots transition is completed, execute graphical information
|
||||
*/
|
||||
public void handle(ActionEvent event) {
|
||||
fightButton.setVisible(true);
|
||||
runButton.setVisible(true);
|
||||
report.setVisible(true);
|
||||
cannon.setVisible(false);
|
||||
runAwayOrLeft.setVisible(true);
|
||||
gunsLeftOrTaken.setVisible(true);
|
||||
shipsRemaining.setVisible(true);
|
||||
HPLeft.setVisible(true);
|
||||
gunsLeftOrTaken.setVisible(true);
|
||||
|
||||
if(winOrLose==true){
|
||||
usAgainstEnemyDivisor.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* sets scene and runs stage
|
||||
*
|
||||
* @param primaryStage the stage in which the scene may be run and switched to
|
||||
*/
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage = initializeShip(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
@@ -9,20 +10,20 @@ import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* 2019-03-10
|
||||
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
||||
* StartGUI class, Initializes and displays the start menu for Taipan
|
||||
*
|
||||
*/
|
||||
* 2019-03-10
|
||||
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
||||
* StartGUI class, Initializes and displays the start menu for Taipan
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
public class StartGUI {
|
||||
public class StartGUI extends Player{
|
||||
|
||||
private Player player;
|
||||
private BorderPane borderPane = new BorderPane();
|
||||
private HBox hBox = new HBox();
|
||||
private TextField nameField = new TextField();
|
||||
private Button startButton = new Button();
|
||||
private Button continueButton = new Button();
|
||||
private VBox vBox = new VBox();
|
||||
private Label choiceLabel = new Label();
|
||||
private RadioButton gunChoice = new RadioButton();
|
||||
@@ -33,23 +34,12 @@ public class StartGUI {
|
||||
private Label authors = new Label();
|
||||
|
||||
/**
|
||||
* gets the player instance variable. The method returns a copy of the instance variable for encapsulation purposes.
|
||||
*
|
||||
* @return playerDummy -- playerDummy is a copy of the player instance variable.
|
||||
* Copy constructor.
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
public StartGUI(Player player) {
|
||||
Player playerTemp = new Player(player);
|
||||
return playerTemp;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the player instance variable equal to a copy of the parameter -- a copy is used for encapsulation purposes.
|
||||
*
|
||||
* @param player is a Player object that will replace the current instance of the player instance variable.
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
Player playerTemp = new Player(player);
|
||||
this.player = playerTemp;
|
||||
setPlayer(playerTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,22 +49,12 @@ public class StartGUI {
|
||||
*/
|
||||
public void setFirm(String name) {
|
||||
if (name.length() <= 22) {
|
||||
player.setName(name);
|
||||
super.setName(name);
|
||||
} else {
|
||||
player.setName("Taipan");
|
||||
super.setName("Taipan");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
* Copy constructor.
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public StartGUI(Player player) {
|
||||
Player playerTemp = new Player(player);
|
||||
this.player = playerTemp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the Start GUI the game.
|
||||
*
|
||||
@@ -112,7 +92,14 @@ public class StartGUI {
|
||||
*
|
||||
*/
|
||||
startButton.setMnemonicParsing(false);
|
||||
startButton.setText("Start");
|
||||
startButton.setText("New");
|
||||
|
||||
/**
|
||||
* Creates a button with text "Continue"
|
||||
*
|
||||
*/
|
||||
continueButton.setMnemonicParsing(false);
|
||||
continueButton.setText("Load");
|
||||
|
||||
/**
|
||||
* Creates a VBox at the left of center of the borderpane.
|
||||
@@ -167,7 +154,7 @@ public class StartGUI {
|
||||
*
|
||||
*/
|
||||
authors.setPrefHeight(80.0);
|
||||
authors.setPrefWidth(499.0);
|
||||
authors.setPrefWidth(480.0);
|
||||
authors.setText("By Vikram Bawa, Haris Muhammad, Siddhant Dewani, Nathan Lum \nand Harkamal Randhawa");
|
||||
|
||||
/**
|
||||
@@ -175,6 +162,8 @@ public class StartGUI {
|
||||
*
|
||||
*/
|
||||
authors.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
authors.setAlignment(Pos.CENTER);
|
||||
vBox0.setAlignment(Pos.CENTER);
|
||||
borderPane.setCenter(vBox0);
|
||||
|
||||
/**
|
||||
@@ -183,12 +172,14 @@ public class StartGUI {
|
||||
*/
|
||||
hBox.getChildren().add(nameField);
|
||||
hBox.getChildren().add(startButton);
|
||||
hBox.getChildren().add(continueButton);
|
||||
vBox.getChildren().add(choiceLabel);
|
||||
vBox.getChildren().add(gunChoice);
|
||||
vBox.getChildren().add(cashChoice);
|
||||
hBox.getChildren().add(vBox);
|
||||
vBox0.getChildren().add(title);
|
||||
vBox0.getChildren().add(authors);
|
||||
startButton.setDefaultButton(true);
|
||||
|
||||
/**
|
||||
* Adds function to the "Start" button, scenario 1 gives the player $400 and a $5000 debt at the start of the game;
|
||||
@@ -199,37 +190,54 @@ public class StartGUI {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
if (Start.getSelectedToggle() == cashChoice) {
|
||||
player.setMoney(400);
|
||||
player.setDebt(5000);
|
||||
|
||||
setMoney(400);
|
||||
setDebt(5000);
|
||||
setGuns(0);
|
||||
}
|
||||
if (Start.getSelectedToggle() == gunChoice) {
|
||||
player.setGuns(5);
|
||||
setGuns(5);
|
||||
}
|
||||
|
||||
String response = nameField.getText();
|
||||
// purely for testing purposes.
|
||||
if (response.equalsIgnoreCase("Vikram")) {
|
||||
player.setMoney(999999999);
|
||||
player.setBank(999999999);
|
||||
player.setGuns(999);
|
||||
player.setHP(99999999);
|
||||
player.setCargoSpace(Integer.MAX_VALUE);
|
||||
setMoney(999999999);
|
||||
setBank(999999999);
|
||||
setGuns(999);
|
||||
setHP(99999999);
|
||||
setCargoSpace(Integer.MAX_VALUE);
|
||||
}
|
||||
setFirm(response);
|
||||
|
||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
||||
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
//title.setText("SHOP PLACEHOLDER");
|
||||
}
|
||||
});
|
||||
|
||||
continueButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
FileSaving saving = new FileSaving();
|
||||
if(saving.loadFile() != null){
|
||||
TaipanShopGUI shop = new TaipanShopGUI(saving.loadFile());
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
else{
|
||||
authors.setText("There are no previous saves!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Scene root = new Scene(borderPane, 600, 480);
|
||||
root.getStylesheets().add("styleguide.css");
|
||||
|
||||
stage.setTitle("Start");
|
||||
stage.setResizable(false);
|
||||
stage.setScene(root);
|
||||
stage.setHeight(510);
|
||||
stage.setWidth(600);
|
||||
return stage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@ import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
import java.util.Random;
|
||||
|
||||
public class TaipanShopGUI {
|
||||
private Player player;
|
||||
public class TaipanShopGUI extends Player{
|
||||
private Label firm = new Label();
|
||||
private Label wItemsText = new Label();
|
||||
private Label wItemSpaceText = new Label();
|
||||
@@ -53,86 +52,64 @@ public class TaipanShopGUI {
|
||||
*/
|
||||
public TaipanShopGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is evoked if the user is eligible to win, and chooses to end the game (by winning).
|
||||
*/
|
||||
public void retire(Stage stage) {
|
||||
player.setRetire(true);
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(player);
|
||||
setRetire(true);
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
|
||||
gameEndGUI.initializeGameEndGUI(stage);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the player instance variable equal to a copy of the parameter -- a copy is used for encapsulation purposes.
|
||||
*
|
||||
* @param player is a Player object that will replace the current instance of the player instance variable.
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the player instance variable. The method returns a copy of the instance variable for encapsulation purposes.
|
||||
*
|
||||
* @return playerDummy -- playerDummy is a copy of the player instance variable.
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* this method is when the shop is accessed, randomizing the prices of all the items.
|
||||
*/
|
||||
public void updatePrices() {
|
||||
String s = "\t" + player.getName() + ", the price of ";
|
||||
String s = "\t" + getName() + ", the price of ";
|
||||
double value = 80 * Math.random();
|
||||
Random rand = new Random();
|
||||
player.setOpiumPrice((rand.nextInt(201) + 60) * 100);
|
||||
player.setSilkPrice((rand.nextInt(201) + 60) * 10);
|
||||
player.setArmsPrice((rand.nextInt(21) + 6) * 10);
|
||||
player.setGeneralPrice((rand.nextInt(17) + 4));
|
||||
setOpiumPrice((rand.nextInt(201) + 60) * 100);
|
||||
setSilkPrice((rand.nextInt(201) + 60) * 10);
|
||||
setArmsPrice((rand.nextInt(21) + 6) * 10);
|
||||
setGeneralPrice((rand.nextInt(17) + 4));
|
||||
|
||||
// there is a 10% chance that the price of an item is increased/decreased beyond its regular range.
|
||||
if (value < 8) {
|
||||
if (value < 2) {
|
||||
if (value < 1) {
|
||||
player.setOpiumPrice(player.getOpiumPrice() / 5);
|
||||
textOut.setText(s + "Opium has dropped to " + player.getOpiumPrice() + "!!!\n" + textOut.getText());
|
||||
setOpiumPrice(getOpiumPrice() / 5);
|
||||
textOut.setText(s + "Opium has dropped to " + getOpiumPrice() + "!!!\n" + textOut.getText());
|
||||
} else {
|
||||
player.setOpiumPrice(player.getOpiumPrice() * 5);
|
||||
textOut.setText(s + "Opium has risen to " + player.getOpiumPrice() + "!!!\n" + textOut.getText());
|
||||
setOpiumPrice(getOpiumPrice() * 5);
|
||||
textOut.setText(s + "Opium has risen to " + getOpiumPrice() + "!!!\n" + textOut.getText());
|
||||
}
|
||||
} else if (value < 4) {
|
||||
if (value < 3) {
|
||||
player.setSilkPrice(player.getSilkPrice() / 5);
|
||||
textOut.setText(s + "Silk has dropped to " + player.getSilkPrice() + "!!!\n" + textOut.getText());
|
||||
setSilkPrice(getSilkPrice() / 5);
|
||||
textOut.setText(s + "Silk has dropped to " + getSilkPrice() + "!!!\n" + textOut.getText());
|
||||
} else {
|
||||
player.setSilkPrice(player.getSilkPrice() * 5);
|
||||
textOut.setText(s + "Silk has risen to " + player.getSilkPrice() + "!!!\n" + textOut.getText());
|
||||
setSilkPrice(getSilkPrice() * 5);
|
||||
textOut.setText(s + "Silk has risen to " + getSilkPrice() + "!!!\n" + textOut.getText());
|
||||
}
|
||||
} else if (value < 6) {
|
||||
if (value < 3) {
|
||||
player.setArmsPrice(player.getArmsPrice() / 5);
|
||||
textOut.setText(s + "Arms has dropped to " + player.getArmsPrice() + "!!!\n" + textOut.getText());
|
||||
setArmsPrice(getArmsPrice() / 5);
|
||||
textOut.setText(s + "Arms has dropped to " + getArmsPrice() + "!!!\n" + textOut.getText());
|
||||
} else {
|
||||
player.setArmsPrice(player.getArmsPrice() * 5);
|
||||
textOut.setText(s + "Arms has risen to " + player.getArmsPrice() + "!!!\n" + textOut.getText());
|
||||
setArmsPrice(getArmsPrice() * 5);
|
||||
textOut.setText(s + "Arms has risen to " + getArmsPrice() + "!!!\n" + textOut.getText());
|
||||
}
|
||||
} else {
|
||||
if (value < 7) {
|
||||
player.setGeneralPrice(1);
|
||||
setGeneralPrice(1);
|
||||
textOut.setText(s + "General Cargo has dropped to 1!!!\n" + textOut.getText());
|
||||
} else {
|
||||
player.setGeneralPrice(player.getGeneralPrice() * 5);
|
||||
textOut.setText(s + "General Cargo has risen to " + player.getGeneralPrice() + "!!!\n" + textOut.getText());
|
||||
setGeneralPrice(getGeneralPrice() * 5);
|
||||
textOut.setText(s + "General Cargo has risen to " + getGeneralPrice() + "!!!\n" + textOut.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,7 +119,7 @@ public class TaipanShopGUI {
|
||||
* Sets the default dialogue of simply stating the prices of the items.
|
||||
*/
|
||||
public void defaultTextOut() {
|
||||
textOut.setText(String.format("\t%s, present prices per unit here are:\n\n\t\tOpium: %d\t\t\tSilk: %d\n\t\tArms: %d\t\t\tGeneral: %d", player.getName(), player.getOpiumPrice(), player.getSilkPrice(), player.getArmsPrice(), player.getGeneralPrice()));
|
||||
textOut.setText(String.format("\t%s, present prices per unit here are:\n\n\t\tOpium: %d\t\t\tSilk: %d\n\t\tArms: %d\t\t\tGeneral: %d", getName(), getOpiumPrice(), getSilkPrice(), getArmsPrice(), getGeneralPrice()));
|
||||
|
||||
}
|
||||
|
||||
@@ -176,7 +153,7 @@ public class TaipanShopGUI {
|
||||
silkButton.setText("Silk");
|
||||
armsButton.setText("Arms");
|
||||
generalButton.setText("General");
|
||||
if (player.getLocation() != 1) {
|
||||
if (getLocation() != 1) {
|
||||
buyButton.setVisible(true);
|
||||
sellButton.setVisible(true);
|
||||
bankButton.setVisible(false);
|
||||
@@ -184,33 +161,36 @@ public class TaipanShopGUI {
|
||||
loanButton.setVisible(false);
|
||||
armsButton.setVisible(false);
|
||||
quitButton.setVisible(true);
|
||||
//quitButton.setDefaultButton(true);
|
||||
opiumButton.setVisible(false);
|
||||
silkButton.setVisible(false);
|
||||
numberInput.setVisible(false);
|
||||
generalButton.setVisible(false);
|
||||
retireButton.setVisible(false);
|
||||
}
|
||||
if (player.getBank() + player.getMoney() - player.getDebt() < 1000000 && player.getLocation() == 1) {
|
||||
if (getBank() + getMoney() - getDebt() < 1000000 && getLocation() == 1) {
|
||||
buyButton.setVisible(true);
|
||||
sellButton.setVisible(true);
|
||||
bankButton.setVisible(true);
|
||||
cargoButton.setVisible(false);
|
||||
cargoButton.setVisible(true);
|
||||
loanButton.setVisible(true);
|
||||
quitButton.setVisible(true);
|
||||
//quitButton.setDefaultButton(true);
|
||||
opiumButton.setVisible(false);
|
||||
silkButton.setVisible(false);
|
||||
numberInput.setVisible(false);
|
||||
generalButton.setVisible(false);
|
||||
armsButton.setVisible(false);
|
||||
retireButton.setVisible(false);
|
||||
} else if (player.getLocation() == 1) {
|
||||
} else if (getLocation() == 1) {
|
||||
buyButton.setVisible(true);
|
||||
sellButton.setVisible(true);
|
||||
bankButton.setVisible(true);
|
||||
cargoButton.setVisible(false);
|
||||
cargoButton.setVisible(true);
|
||||
loanButton.setVisible(true);
|
||||
numberInput.setVisible(false);
|
||||
quitButton.setVisible(true);
|
||||
//quitButton.setDefaultButton(true);
|
||||
opiumButton.setVisible(false);
|
||||
silkButton.setVisible(false);
|
||||
generalButton.setVisible(false);
|
||||
@@ -240,64 +220,64 @@ public class TaipanShopGUI {
|
||||
String originalDialogue = textOut.getText();
|
||||
int num = Integer.parseInt(numberInput.getText().replace(" ", ""));
|
||||
if (buyButton.getText().contains(".")) {
|
||||
if (opiumButton.getText().contains(".") && num <= player.getMoney() / player.getOpiumPrice() && num >= 0) {
|
||||
player.setMoney(player.getMoney() - num * player.getOpiumPrice());
|
||||
player.setOpiumHeld(player.getOpiumHeld() + num);
|
||||
if (opiumButton.getText().contains(".") && num <= getMoney() / getOpiumPrice() && num >= 0) {
|
||||
setMoney(getMoney() - num * getOpiumPrice());
|
||||
setOpiumHeld(getOpiumHeld() + num);
|
||||
} else if (num >= 0 && opiumButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||
} else if (opiumButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " Opium?");
|
||||
} else if (silkButton.getText().contains(".") && num <= player.getMoney() / player.getOpiumPrice() && num >= 0) {
|
||||
player.setSilkHeld(player.getSilkHeld() + num);
|
||||
player.setMoney(player.getMoney() - num * player.getOpiumPrice());
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " Opium?");
|
||||
} else if (silkButton.getText().contains(".") && num <= getMoney() / getSilkPrice() && num >= 0) {
|
||||
setSilkHeld(getSilkHeld() + num);
|
||||
setMoney(getMoney() - num * getSilkPrice());
|
||||
} else if (num >= 0 && silkButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||
} else if (silkButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " Silk?");
|
||||
} else if (armsButton.getText().contains(".") && num <= player.getMoney() / player.getArmsPrice() && num >= 0) {
|
||||
player.setArmsHeld(player.getArmsHeld() + num);
|
||||
player.setMoney(player.getMoney() - num * player.getArmsPrice());
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " Silk?");
|
||||
} else if (armsButton.getText().contains(".") && num <= getMoney() / getArmsPrice() && num >= 0) {
|
||||
setArmsHeld(getArmsHeld() + num);
|
||||
setMoney(getMoney() - num * getArmsPrice());
|
||||
} else if (num >= 0 && armsButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||
} else if (armsButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " Arms?");
|
||||
} else if (generalButton.getText().contains(".") && num <= player.getMoney() / player.getGeneralPrice() && num >= 0) {
|
||||
player.setGeneralHeld(player.getGeneralHeld()+num);
|
||||
player.setMoney(player.getMoney() - num * player.getGeneralPrice());
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " Arms?");
|
||||
} else if (generalButton.getText().contains(".") && num <= getMoney() / getGeneralPrice() && num >= 0) {
|
||||
setGeneralHeld(getGeneralHeld()+num);
|
||||
setMoney(getMoney() - num * getGeneralPrice());
|
||||
} else if (num >= 0 && generalButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you can't afford that!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you can't afford that!");
|
||||
} else if (generalButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to buy " + "'" + num + "'" + " General Cargo?");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to buy " + "'" + num + "'" + " General Cargo?");
|
||||
}
|
||||
} else if (sellButton.getText().contains(".")) {
|
||||
if (opiumButton.getText().contains(".") && num <= player.getOpiumHeld() && num >= 0) {
|
||||
player.setOpiumHeld(player.getOpiumHeld() - num);
|
||||
player.setMoney(player.getMoney() + num * player.getOpiumPrice());
|
||||
if (opiumButton.getText().contains(".") && num <= getOpiumHeld() && num >= 0) {
|
||||
setOpiumHeld(getOpiumHeld() - num);
|
||||
setMoney(getMoney() + num * getOpiumPrice());
|
||||
} else if (num >= 0 && opiumButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||
} else if (opiumButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " Opium?");
|
||||
} else if (silkButton.getText().contains(".") && num <= player.getSilkHeld() && num >= 0) {
|
||||
player.setSilkHeld(player.getSilkHeld() - num);
|
||||
player.setMoney(player.getMoney() + num * player.getOpiumPrice());
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " Opium?");
|
||||
} else if (silkButton.getText().contains(".") && num <= getSilkHeld() && num >= 0) {
|
||||
setSilkHeld(getSilkHeld() - num);
|
||||
setMoney(getMoney() + num * getSilkPrice());
|
||||
} else if (num >= 0 && silkButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||
} else if (silkButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " Silk?");
|
||||
} else if (armsButton.getText().contains(".") && num <= player.getArmsHeld() && num >= 0) {
|
||||
player.setArmsHeld(player.getArmsHeld() - num);
|
||||
player.setMoney(player.getMoney() + num * player.getArmsPrice());
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " Silk?");
|
||||
} else if (armsButton.getText().contains(".") && num <= getArmsHeld() && num >= 0) {
|
||||
setArmsHeld(getArmsHeld() - num);
|
||||
setMoney(getMoney() + num * getArmsPrice());
|
||||
} else if (num >= 0 && armsButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||
} else if (armsButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " Arms?");
|
||||
} else if (generalButton.getText().contains(".") && num <= player.getGeneralHeld() && num >= 0) {
|
||||
player.setGeneralHeld(player.getGeneralHeld() - num);
|
||||
player.setMoney(player.getMoney() + num * player.getGeneralPrice());
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " Arms?");
|
||||
} else if (generalButton.getText().contains(".") && num <= getGeneralHeld() && num >= 0) {
|
||||
setGeneralHeld(getGeneralHeld() - num);
|
||||
setMoney(getMoney() + num * getGeneralPrice());
|
||||
} else if (num >= 0 && generalButton.getText().contains(".")) {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", you don't have that many to sell!");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", you don't have that many to sell!");
|
||||
} else {
|
||||
textOut.setText(originalDialogue + "\n\t" + player.getName() + ", how am I supposed to sell " + "'" + num + "'" + " General Cargo?");
|
||||
textOut.setText(originalDialogue + "\n\t" + getName() + ", how am I supposed to sell " + "'" + num + "'" + " General Cargo?");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,6 +288,9 @@ public class TaipanShopGUI {
|
||||
* @param stage
|
||||
*/
|
||||
public void initializeShop(Stage stage) {
|
||||
FileSaving saving = new FileSaving();
|
||||
saving.saveFile(getPlayer());
|
||||
|
||||
Font size14 = new Font(14.0);
|
||||
Rectangle dialogueRectangle = new Rectangle();
|
||||
dialogueRectangle.setFill(javafx.scene.paint.Color.WHITE);
|
||||
@@ -470,7 +453,7 @@ public class TaipanShopGUI {
|
||||
*/
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
WarehouseGUI warehouseGUI = new WarehouseGUI(player);
|
||||
WarehouseGUI warehouseGUI = new WarehouseGUI(getPlayer());
|
||||
warehouseGUI.initializeWarehouse(stage);
|
||||
stage.show();
|
||||
}
|
||||
@@ -509,11 +492,11 @@ public class TaipanShopGUI {
|
||||
*/
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
player.setIsPriceChanged(1);
|
||||
TravelGUI travelGUI = new TravelGUI(player);
|
||||
saving.saveFile(getPlayer());
|
||||
setIsPriceChanged(1);
|
||||
TravelGUI travelGUI = new TravelGUI(getPlayer());
|
||||
travelGUI.initializeTravel(stage);
|
||||
stage.show();
|
||||
//System.out.println("PLACEHOLDER FOR TRAVEL");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -554,9 +537,9 @@ public class TaipanShopGUI {
|
||||
defaultTextOut();
|
||||
String extraText;
|
||||
if (buyButton.getText().contains(".")) {
|
||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getOpiumPrice());
|
||||
extraText = String.format(" (You can afford %d)", getMoney() / getOpiumPrice());
|
||||
} else {
|
||||
extraText = String.format(" (You have %d)", player.getOpiumHeld());
|
||||
extraText = String.format(" (You have %d)", getOpiumHeld());
|
||||
}
|
||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of Opium?" + extraText);
|
||||
}
|
||||
@@ -581,9 +564,9 @@ public class TaipanShopGUI {
|
||||
defaultTextOut();
|
||||
String extraText;
|
||||
if (buyButton.getText().contains(".")) {
|
||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getSilkPrice());
|
||||
extraText = String.format(" (You can afford %d)", getMoney() / getSilkPrice());
|
||||
} else {
|
||||
extraText = String.format(" (You have %d)", player.getSilkHeld());
|
||||
extraText = String.format(" (You have %d)", getSilkHeld());
|
||||
}
|
||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of Silk?" + extraText);
|
||||
}
|
||||
@@ -606,9 +589,9 @@ public class TaipanShopGUI {
|
||||
defaultTextOut();
|
||||
String extraText;
|
||||
if (buyButton.getText().contains(".")) {
|
||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getArmsPrice());
|
||||
extraText = String.format(" (You can afford %d)", getMoney() / getArmsPrice());
|
||||
} else {
|
||||
extraText = String.format(" (You have %d)", player.getArmsHeld());
|
||||
extraText = String.format(" (You have %d)", getArmsHeld());
|
||||
}
|
||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of Arms?" + extraText);
|
||||
}
|
||||
@@ -635,9 +618,9 @@ public class TaipanShopGUI {
|
||||
defaultTextOut();
|
||||
String extraText;
|
||||
if (buyButton.getText().contains(".")) {
|
||||
extraText = String.format(" (You can afford %d)", player.getMoney() / player.getGeneralPrice());
|
||||
extraText = String.format(" (You can afford %d)", getMoney() / getGeneralPrice());
|
||||
} else {
|
||||
extraText = String.format(" (You have %d)", player.getGeneralHeld());
|
||||
extraText = String.format(" (You have %d)", getGeneralHeld());
|
||||
}
|
||||
textOut.setText(textOut.getText() + "\n\tWhat quantity of General Cargo?" + extraText);
|
||||
}
|
||||
@@ -698,16 +681,18 @@ public class TaipanShopGUI {
|
||||
wItemsText.setFont(size14);
|
||||
|
||||
wItemSpaceText.setPrefHeight(108.0);
|
||||
wItemSpaceText.setPrefWidth(215.0);
|
||||
wItemSpaceText.setPrefWidth(210.0);
|
||||
wItemSpaceText.setFont(size14);
|
||||
|
||||
locationText.setAlignment(Pos.BOTTOM_CENTER);
|
||||
locationText.setAlignment(Pos.BOTTOM_RIGHT);
|
||||
locationText.setPrefHeight(106.0);
|
||||
locationText.setPrefWidth(175.0);
|
||||
locationText.setPrefWidth(140.0);
|
||||
locationText.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
locationText.setFont(size14);
|
||||
|
||||
inventoryText.setAlignment(Pos.CENTER);
|
||||
inventoryText.setPrefWidth(110.0);
|
||||
inventoryText.setPrefHeight(108.0);
|
||||
inventoryText.setFont(size14);
|
||||
|
||||
inventoryHeldText.setAlignment(Pos.CENTER);
|
||||
@@ -723,7 +708,7 @@ public class TaipanShopGUI {
|
||||
shipStatusText.setAlignment(Pos.TOP_CENTER);
|
||||
shipStatusText.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
shipStatusText.setPrefHeight(110.0);
|
||||
shipStatusText.setPrefWidth(180.0);
|
||||
shipStatusText.setPrefWidth(200.0);
|
||||
shipStatusText.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
shipStatusText.setFont(size14);
|
||||
|
||||
@@ -763,13 +748,26 @@ public class TaipanShopGUI {
|
||||
|
||||
Scene root = new Scene(anchorPane, 600, 480);
|
||||
|
||||
root.getStylesheets().add("styleguide.css");
|
||||
stage.setTitle("Shop");
|
||||
stage.setResizable(false);
|
||||
stage.setScene(root);
|
||||
buyButton.setFocusTraversable(false);
|
||||
sellButton.setFocusTraversable(false);
|
||||
bankButton.setFocusTraversable(false);
|
||||
loanButton.setFocusTraversable(false);
|
||||
generalButton.setFocusTraversable(false);
|
||||
armsButton.setFocusTraversable(false);
|
||||
silkButton.setFocusTraversable(false);
|
||||
opiumButton.setFocusTraversable(false);
|
||||
sellButton.setFocusTraversable(false);
|
||||
retireButton.setFocusTraversable(false);
|
||||
cargoButton.setFocusTraversable(false);
|
||||
quitButton.setFocusTraversable(false);
|
||||
|
||||
// general updates to the buttons, user stats/inventory, and text.
|
||||
buttonSetup("reset");
|
||||
if(player.getIsPriceChanged() == 0 || player.getIsPriceChanged() == 2){
|
||||
if(getIsPriceChanged() == 0 || getIsPriceChanged() == 2){
|
||||
updatePrices();
|
||||
}
|
||||
defaultTextOut();
|
||||
@@ -783,7 +781,7 @@ public class TaipanShopGUI {
|
||||
*/
|
||||
public String getStringLocation() {
|
||||
String location;
|
||||
switch (player.getLocation()) {
|
||||
switch (getLocation()) {
|
||||
case 1:
|
||||
location = "Hong Kong";
|
||||
break;
|
||||
@@ -819,7 +817,7 @@ public class TaipanShopGUI {
|
||||
*/
|
||||
public String shipStatusString() {
|
||||
String shipStatus;
|
||||
switch (player.getHP() / 10) {
|
||||
switch (getHP() / 10) {
|
||||
case 10:
|
||||
shipStatus = "Mint Condition";
|
||||
break;
|
||||
@@ -864,22 +862,22 @@ public class TaipanShopGUI {
|
||||
* updates the text associated with the user's inventory.
|
||||
*/
|
||||
public void updateStage() {
|
||||
firm.setText(String.format("Firm: %s, %s", player.getName(), getStringLocation()));
|
||||
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", player.getwOpium(), player.getwSilk(), player.getwArms(), player.getwGeneral()));
|
||||
int itemsInWarehouse = player.getwOpium() + player.getwGeneral() + player.getwArms() + player.getwSilk();
|
||||
firm.setText(String.format("Firm: %s, %s", getName(), getStringLocation()));
|
||||
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", getwOpium(), getwSilk(), getwArms(), getwGeneral()));
|
||||
int itemsInWarehouse = getwOpium() + getwGeneral() + getwArms() + getwSilk();
|
||||
wItemSpaceText.setText(String.format("\n\t\tIn use:\n\t\t %d \n\t\tVacant:\n\t\t %d", itemsInWarehouse, (10000 - itemsInWarehouse)));
|
||||
locationText.setText(String.format("Location\n%s", getStringLocation()));
|
||||
int itemsInInventory = player.getCargoSpace() - player.getSilkHeld() - player.getOpiumHeld() - player.getGeneralHeld() - player.getArmsHeld() - 10 * player.getGuns();
|
||||
int itemsInInventory = getCargoSpace() - getSilkHeld() - getOpiumHeld() - getGeneralHeld() - getArmsHeld() - 10 * getGuns();
|
||||
if (itemsInInventory < 0) {
|
||||
inventoryText.setText(" Overloaded\n\t Opium\n\t Silk\n\t Arms\n\t General");
|
||||
} else {
|
||||
inventoryText.setText(String.format(" Hold %d\n\t Opium\n\t Silk\n\t Arms\n\t General", itemsInInventory));
|
||||
}
|
||||
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
|
||||
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
|
||||
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
|
||||
cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
|
||||
bankText.setText(String.format("Bank: $%,d", player.getBank()));
|
||||
gunsText.setText(String.format("Guns %d\n\n\n\n ", getGuns()));
|
||||
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", getOpiumHeld(), getSilkHeld(), getArmsHeld(), getGeneralHeld()));
|
||||
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", getDebt(), shipStatusString(), getHP()));
|
||||
cashText.setText(String.format(" Cash: $%,d", getMoney()));
|
||||
bankText.setText(String.format("Bank: $%,d", getBank()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* TravelGUI is the class in which takes the player from location to location
|
||||
*
|
||||
* Author: Harkamal Randhawa
|
||||
*/
|
||||
* TravelGUI is the class in which takes the player from location to location
|
||||
*
|
||||
* Author: Harkamal Randhawa
|
||||
*/
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
@@ -14,10 +14,12 @@ import javafx.geometry.Insets;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.scene.text.Font;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Random;
|
||||
|
||||
public class TravelGUI{
|
||||
private Player player;
|
||||
public class TravelGUI extends Player{
|
||||
private TaipanShopGUI shop;
|
||||
private Label firm = new Label();
|
||||
private Label wItemsText = new Label();
|
||||
@@ -41,7 +43,6 @@ public class TravelGUI{
|
||||
private Boolean stormScene = false;
|
||||
private Boolean sceneContinue = false;
|
||||
|
||||
|
||||
/**
|
||||
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
|
||||
*
|
||||
@@ -49,8 +50,7 @@ public class TravelGUI{
|
||||
*/
|
||||
public TravelGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.shop = new TaipanShopGUI(player);
|
||||
this.player = playerDummy;
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +59,7 @@ public class TravelGUI{
|
||||
* @param stage sets the stage to which we will execute the scene of the TravelGUI class
|
||||
* @return stage so that another class can switch to the stage
|
||||
*/
|
||||
public Stage initializeTravel(Stage stage){
|
||||
public Stage initializeTravel(Stage stage) {
|
||||
//Updates the stage for the first-time you read it
|
||||
updateStage();
|
||||
|
||||
@@ -166,28 +166,41 @@ public class TravelGUI{
|
||||
|
||||
//Goes back to shop
|
||||
quitButton.setOnAction(event -> {
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(player);
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
});
|
||||
|
||||
//Continues on to either shop or shipwarfare
|
||||
continueButton.setOnAction(event -> {
|
||||
if(peasantShipScene){
|
||||
ShipWarfareGUI ship = new ShipWarfareGUI(player);
|
||||
ship.initializeShip(stage);
|
||||
if(peasantShipScene && getAttackingShips()){
|
||||
ShipWarfareGUI ship = new ShipWarfareGUI(getPlayer());
|
||||
try {
|
||||
ship.initializeShip(stage);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
stage.show();
|
||||
}
|
||||
else if(shopScene){
|
||||
TaipanShopGUI shop = new TaipanShopGUI(player);
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
Random rand = new Random();
|
||||
int randGenNum = rand.nextInt(3) + 1;
|
||||
if(randGenNum >= 2) {
|
||||
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||
shop.initializeShop(stage);
|
||||
stage.show();
|
||||
}
|
||||
else {
|
||||
RandomEventGUI randomEventGUI = new RandomEventGUI(getPlayer());
|
||||
randomEventGUI.initializeRandomEventGUI(stage);
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Text input for where the player needs to go inside of the game world
|
||||
numberInput.setAlignment(javafx.geometry.Pos.CENTER_RIGHT);
|
||||
numberInput.setText("Enter preferred location.");
|
||||
//numberInput.setText("Enter preferred location.");
|
||||
numberInput.setOnKeyPressed(event -> {
|
||||
if(event.getCode().equals(KeyCode.ENTER)||event.getCode().equals(KeyCode.Z)) {
|
||||
int response;
|
||||
@@ -199,43 +212,44 @@ public class TravelGUI{
|
||||
}
|
||||
boolean hasTraveled = false;
|
||||
//Only lets the player leave the port if their inventory is greater than or equal to the sum of the items in the inventory.
|
||||
if(player.getCargoSpace() >= (player.getOpiumHeld()+ (player.getGuns()*10)+player.getSilkHeld() + player.getArmsHeld() + player.getGeneralHeld())){
|
||||
//Just in case the player types something that was not intended. It will refresh the question and ask it again
|
||||
try {
|
||||
//Makes sure you can't travel to your own location.
|
||||
if (response != player.getLocation() && response > 0 && 8 > response && event.getCode().equals(KeyCode.ENTER)||event.getCode().equals(KeyCode.Z)){
|
||||
hasTraveled = seaAtlas(response);
|
||||
randomEventSea(response,stage);
|
||||
player.setBank((int) (player.getBank() * 1.01));
|
||||
player.setDebt((int) (player.getDebt() * 1.01));
|
||||
player.setIsPriceChanged(2);
|
||||
//shopScene = false;
|
||||
//stormScene = false;
|
||||
if(getCargoSpace() >= (getOpiumHeld()+ (getGuns()*10)+getSilkHeld() + getArmsHeld() + getGeneralHeld())){
|
||||
//Just in case the player types something that was not intended. It will refresh the question and ask it again
|
||||
try {
|
||||
//Makes sure you can't travel to your own location.
|
||||
if (response != getLocation() && response > 0 && 8 > response && event.getCode().equals(KeyCode.ENTER)||event.getCode().equals(KeyCode.Z)){
|
||||
hasTraveled = seaAtlas(response);
|
||||
randomEventSea(response,stage);
|
||||
setBank((int) (getBank() * 1.01));
|
||||
setDebt((int) (getDebt() * 1.01));
|
||||
setIsPriceChanged(2);
|
||||
//shopScene = false;
|
||||
//stormScene = false;
|
||||
|
||||
} else{
|
||||
if(response == player.getLocation()){
|
||||
textOut.setText(" " + "You're already here " + player.getName() + "\n");
|
||||
}
|
||||
else{
|
||||
textOut.setText(" " + player.getName() + "; Sorry but could you say that again?");
|
||||
}
|
||||
|
||||
textOut.setText(textOut.getText() + "\n\n 1) Hong Kong, 2) Shanghai, 3) Nagasaki, 4) Saigon,\n 5) Manila, 6) Singapore, or 7) Batavia?");
|
||||
} else{
|
||||
if(response == getLocation()){
|
||||
textOut.setText(" " + "You're already here " + getName() + "\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
textOut.setText(" " + "Sorry, " + player.getName() + " could you say that again?");
|
||||
}
|
||||
if (hasTraveled) {
|
||||
continueButton.setVisible(true);
|
||||
quitButton.setVisible(false);
|
||||
numberInput.setVisible(false);
|
||||
shopScene = true;
|
||||
else{
|
||||
textOut.setText(" " + getName() + "; Sorry but could you say that again?");
|
||||
}
|
||||
|
||||
textOut.setText(textOut.getText() + "\n\n 1) Hong Kong, 2) Shanghai, 3) Nagasaki, 4) Saigon,\n 5) Manila, 6) Singapore, or 7) Batavia?");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
textOut.setText(" " + "Sorry, " + getName() + " could you say that again?");
|
||||
}
|
||||
if (hasTraveled) {
|
||||
continueButton.setVisible(true);
|
||||
continueButton.setDefaultButton(true);
|
||||
quitButton.setVisible(false);
|
||||
numberInput.setVisible(false);
|
||||
shopScene = true;
|
||||
}
|
||||
}
|
||||
else if (player.getCargoSpace() < (player.getOpiumHeld()+ (player.getGuns()*10)+player.getSilkHeld() + player.getArmsHeld() + player.getGeneralHeld())){
|
||||
textOut.setText(" "+player.getName() + " the cargo is too heavy! We can't set sail!");
|
||||
}
|
||||
}
|
||||
else if (getCargoSpace() < (getOpiumHeld()+ (getGuns()*10)+getSilkHeld() + getArmsHeld() + getGeneralHeld())){
|
||||
textOut.setText(" "+getName() + " the cargo is too heavy! We can't set sail!");
|
||||
}
|
||||
});
|
||||
|
||||
firm.setAlignment(Pos.CENTER);
|
||||
@@ -256,16 +270,18 @@ public class TravelGUI{
|
||||
wItemsText.setFont(size14);
|
||||
|
||||
wItemSpaceText.setPrefHeight(108.0);
|
||||
wItemSpaceText.setPrefWidth(215.0);
|
||||
wItemSpaceText.setPrefWidth(210.0);
|
||||
wItemSpaceText.setFont(size14);
|
||||
|
||||
locationText.setAlignment(Pos.BOTTOM_CENTER);
|
||||
locationText.setAlignment(Pos.BOTTOM_RIGHT);
|
||||
locationText.setPrefHeight(106.0);
|
||||
locationText.setPrefWidth(175.0);
|
||||
locationText.setPrefWidth(140.0);
|
||||
locationText.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
locationText.setFont(size14);
|
||||
|
||||
inventoryText.setAlignment(Pos.CENTER);
|
||||
inventoryText.setPrefWidth(110.0);
|
||||
inventoryText.setPrefHeight(108.0);
|
||||
inventoryText.setFont(size14);
|
||||
|
||||
inventoryHeldText.setAlignment(Pos.CENTER);
|
||||
@@ -281,7 +297,7 @@ public class TravelGUI{
|
||||
shipStatusText.setAlignment(Pos.TOP_CENTER);
|
||||
shipStatusText.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
shipStatusText.setPrefHeight(110.0);
|
||||
shipStatusText.setPrefWidth(180.0);
|
||||
shipStatusText.setPrefWidth(200.0);
|
||||
shipStatusText.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
shipStatusText.setFont(size14);
|
||||
|
||||
@@ -312,6 +328,7 @@ public class TravelGUI{
|
||||
|
||||
hBox0.getChildren().addAll(inventoryText, inventoryHeldText, gunsText, shipStatusText);
|
||||
|
||||
numberInput.requestFocus();
|
||||
flowPane.getChildren().addAll(numberInput, quitButton, continueButton);
|
||||
|
||||
gridPane.getColumnConstraints().add(columnConstraints);
|
||||
@@ -321,6 +338,7 @@ public class TravelGUI{
|
||||
anchorPane.getChildren().add(gridPane);
|
||||
|
||||
Scene root = new Scene(anchorPane, 600, 480);
|
||||
root.getStylesheets().add("styleguide.css");
|
||||
|
||||
stage.setTitle("Travel");
|
||||
stage.setResizable(false);
|
||||
@@ -338,34 +356,34 @@ public class TravelGUI{
|
||||
switch (locationOfTravel) {
|
||||
case 1:
|
||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Hong Kong");
|
||||
player.setLocation(1);
|
||||
setLocation(1);
|
||||
return true;
|
||||
case 2:
|
||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Shanghai");
|
||||
player.setLocation(2);
|
||||
setLocation(2);
|
||||
return true;
|
||||
case 3:
|
||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Nagasaki");
|
||||
player.setLocation(3);
|
||||
setLocation(3);
|
||||
return true;
|
||||
case 4:
|
||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Saigon");
|
||||
player.setLocation(4);
|
||||
setLocation(4);
|
||||
return true;
|
||||
case 5:
|
||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Manila");
|
||||
player.setLocation(5);
|
||||
setLocation(5);
|
||||
return true;
|
||||
case 6:
|
||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Singapore");
|
||||
player.setLocation(6);
|
||||
setLocation(6);
|
||||
return true;
|
||||
case 7:
|
||||
if(!peasantShipScene && !stormScene) textOut.setText( textOut.getText() + "\n " + "Arriving at Batavia");
|
||||
player.setLocation(7);
|
||||
setLocation(7);
|
||||
return true;
|
||||
default:
|
||||
textOut.setText(" " + "Sorry but could you say that again " + player.getName() + "?");
|
||||
textOut.setText(" " + "Sorry but could you say that again " + getName() + "?");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -381,9 +399,10 @@ public class TravelGUI{
|
||||
int randGenNum = rand.nextInt(3) + 1;
|
||||
if (randGenNum == 1) {
|
||||
continueButton.setVisible(true);
|
||||
continueButton.setDefaultButton(true);
|
||||
quitButton.setVisible(false);
|
||||
numberInput.setVisible(false);
|
||||
textOut.setText(" We see a ship on the horizon " + player.getName() + "; Prepare for combat!");
|
||||
textOut.setText(" We see a ship on the horizon " + getName() + "; Prepare for combat!");
|
||||
peasantShipScene = true;
|
||||
}else if (randGenNum == 2) {
|
||||
disaster(locationOfTravel);
|
||||
@@ -400,14 +419,14 @@ public class TravelGUI{
|
||||
**/
|
||||
private void disaster(int locationOfTravel) {
|
||||
//Tells player that there is a storm approaching.
|
||||
textOut.setText(" " + "Storm " + player.getName() + "! ");
|
||||
textOut.setText(" " + "Storm " + getName() + "! ");
|
||||
Random rand = new Random();
|
||||
int randGenNum = rand.nextInt(5) + 1;
|
||||
|
||||
//If the player lands within this range, nothing happens to them
|
||||
//Else they randomly get thrown into a location they weren't planning on going to(Anything but location of Travel).
|
||||
if (randGenNum <= 2) {
|
||||
textOut.setText(textOut.getText() + "\n " + "We got through the storm " + player.getName() + "!");
|
||||
textOut.setText(textOut.getText() + "\n " + "We got through the storm " + getName() + "!");
|
||||
}else {
|
||||
while (randGenNum == locationOfTravel) {
|
||||
randGenNum = rand.nextInt(7) + 1;
|
||||
@@ -426,7 +445,7 @@ public class TravelGUI{
|
||||
*/
|
||||
public String getStringLocation(){
|
||||
String location;
|
||||
switch(player.getLocation()){
|
||||
switch(getLocation()){
|
||||
case 1: location = "Hong Kong"; break;
|
||||
case 2: location = "Shanghai"; break;
|
||||
case 3: location = "Nagasaki"; break;
|
||||
@@ -446,7 +465,7 @@ public class TravelGUI{
|
||||
*/
|
||||
public String shipStatusString(){
|
||||
String shipStatus;
|
||||
switch(player.getHP()/10){
|
||||
switch(getHP()/10){
|
||||
case 10: shipStatus = "Mint Condition"; break;
|
||||
case 9: shipStatus = "Near Perfect"; break;
|
||||
case 8: shipStatus = "Great"; break;
|
||||
@@ -467,21 +486,21 @@ public class TravelGUI{
|
||||
* updates the text associated with the user's inventory.
|
||||
*/
|
||||
public void updateStage(){
|
||||
firm.setText(String.format("Firm: %s, %s", player.getName(), getStringLocation()));
|
||||
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", player.getwOpium(), player.getwSilk(), player.getwArms(), player.getwGeneral()));
|
||||
int itemsInWarehouse = player.getwOpium()+player.getwGeneral()+player.getwArms()+player.getwSilk();
|
||||
firm.setText(String.format("Firm: %s, %s", getName(), getStringLocation()));
|
||||
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", getwOpium(), getwSilk(), getwArms(), getwGeneral()));
|
||||
int itemsInWarehouse = getwOpium()+getwGeneral()+getwArms()+getwSilk();
|
||||
wItemSpaceText.setText(String.format("\n\t\tIn use:\n\t\t %d \n\t\tVacant:\n\t\t %d", itemsInWarehouse, (10000-itemsInWarehouse)));
|
||||
locationText.setText(String.format("Location\n%s", getStringLocation()));
|
||||
int itemsInInventory = player.getCargoSpace()-player.getSilkHeld()-player.getOpiumHeld()-player.getGeneralHeld()-player.getArmsHeld()-10*player.getGuns();
|
||||
int itemsInInventory = getCargoSpace()-getSilkHeld()-getOpiumHeld()-getGeneralHeld()-getArmsHeld()-10*getGuns();
|
||||
if(itemsInInventory < 0){
|
||||
inventoryText.setText(" Overloaded\n\t Opium\n\t Silk\n\t Arms\n\t General");
|
||||
}else{
|
||||
inventoryText.setText(String.format(" Hold %d\n\t Opium\n\t Silk\n\t Arms\n\t General", itemsInInventory));
|
||||
}
|
||||
gunsText.setText(String.format("Guns %d\n\n\n\n ", player.getGuns()));
|
||||
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", player.getOpiumHeld(), player.getSilkHeld(), player.getArmsHeld(), player.getGeneralHeld()));
|
||||
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", player.getDebt(), shipStatusString(), player.getHP()));
|
||||
cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
|
||||
bankText.setText(String.format("Bank: %d", player.getBank()));
|
||||
gunsText.setText(String.format("Guns %d\n\n\n\n ", getGuns()));
|
||||
inventoryHeldText.setText(String.format("\n %d\n %d\n %d\n %d", getOpiumHeld(), getSilkHeld(), getArmsHeld(), getGeneralHeld()));
|
||||
shipStatusText.setText(String.format("\tDebt\n\t%d\n\n\tShip status\n\t%s: %d", getDebt(), shipStatusString(), getHP()));
|
||||
cashText.setText(String.format(" Cash: $%,d", getMoney()));
|
||||
bankText.setText(String.format("Bank: $%,d", getBank()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,641 +1,336 @@
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* 2019-03-10
|
||||
* Authors: Harkamal, Vikram, Haris, Siddhant, Nathan
|
||||
* WarehouseGUI class, Initializes and displays the graphical interface for the warehouse in Taipan
|
||||
*
|
||||
*/
|
||||
public class WarehouseGUI {
|
||||
* 2019-03-19
|
||||
* Authors:Siddhant, Vikram, Harkamal, Haris, Nathan
|
||||
* WarehouseGUI allows the user to store goods in a warehouse in order to have more hold on the ship
|
||||
*/
|
||||
|
||||
private Player player;
|
||||
|
||||
private Text title;
|
||||
public class WarehouseGUI extends Player{
|
||||
//Create the labels, buttons and textfields required
|
||||
private HBox hBox;
|
||||
private Button withdraw;
|
||||
private Button deposit;
|
||||
private Button goBack;
|
||||
private VBox vBox;
|
||||
private Text playerName;
|
||||
private Text text;
|
||||
private Label opiumPlayer;
|
||||
private Label silkPlayer;
|
||||
private Label armsPlayer;
|
||||
private Label generalPlayer;
|
||||
private TextField textField;
|
||||
private RadioButton generalRadio;
|
||||
private ToggleGroup Goods;
|
||||
private RadioButton armsRadio;
|
||||
private RadioButton silkRadio;
|
||||
private RadioButton opiumRadio;
|
||||
private Button withdrawButton;
|
||||
private Button depositButton;
|
||||
private Button quitButton;
|
||||
private Label title;
|
||||
private HBox hBox0;
|
||||
private VBox vBox0;
|
||||
private Text text0;
|
||||
private Text text1;
|
||||
private Text opiumWarehouse;
|
||||
private Text silkWarehouse;
|
||||
private Text armsWarehouse;
|
||||
private Text generalWarehouse;
|
||||
private Label playerLabel;
|
||||
private Label playerGeneral;
|
||||
private Label playerArms;
|
||||
private Label playerSilk;
|
||||
private Label playerOpium;
|
||||
private VBox vBox1;
|
||||
private Text inUseWarehouse;
|
||||
private Text vacantWarehouse;
|
||||
private Label houseLabel;
|
||||
private Label houseGeneral;
|
||||
private Label houseArms;
|
||||
private Label houseSilk;
|
||||
private Label houseOpium;
|
||||
private BorderPane borderPane;
|
||||
private TextField textIn;
|
||||
private SplitMenuButton splitMenu;
|
||||
private CheckMenuItem general;
|
||||
private CheckMenuItem arms;
|
||||
private CheckMenuItem silk;
|
||||
private CheckMenuItem opium;
|
||||
|
||||
/**
|
||||
* A constructor that takes an object of type Player as an argument
|
||||
*
|
||||
* @param player object of the class Player
|
||||
* constructor that creates an object of type player
|
||||
* @param player
|
||||
*/
|
||||
public WarehouseGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
setPlayer(playerDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter method for the Player object, player
|
||||
*
|
||||
* @param player an object of type Player
|
||||
* @param stage
|
||||
* @return stage after creating buttons and layout
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
public Stage initializeWarehouse(Stage stage){
|
||||
|
||||
/**
|
||||
* Getter method for the Player object, player.
|
||||
*
|
||||
* @return returns a copy of the Player object, player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* initializes the GUI for the warehouse aspect of our game.
|
||||
*
|
||||
* @param stage an object of type Stage
|
||||
* @return returns the stage of the GUI
|
||||
*/
|
||||
public Stage initializeWarehouse(Stage stage) {
|
||||
|
||||
title = new Text();
|
||||
//Initializes the instances created above to a new type
|
||||
hBox = new HBox();
|
||||
withdraw = new Button();
|
||||
deposit = new Button();
|
||||
vBox = new VBox();
|
||||
playerName = new Text();
|
||||
text = new Text();
|
||||
opiumPlayer = new Label();
|
||||
silkPlayer = new Label();
|
||||
armsPlayer = new Label();
|
||||
generalPlayer = new Label();
|
||||
generalRadio = new RadioButton();
|
||||
Goods = new ToggleGroup();
|
||||
armsRadio = new RadioButton();
|
||||
silkRadio = new RadioButton();
|
||||
opiumRadio = new RadioButton();
|
||||
withdrawButton = new Button();
|
||||
depositButton = new Button();
|
||||
quitButton = new Button();
|
||||
title = new Label();
|
||||
hBox0 = new HBox();
|
||||
vBox0 = new VBox();
|
||||
text0 = new Text();
|
||||
text1 = new Text();
|
||||
opiumWarehouse = new Text();
|
||||
silkWarehouse = new Text();
|
||||
armsWarehouse = new Text();
|
||||
generalWarehouse = new Text();
|
||||
playerLabel = new Label();
|
||||
playerGeneral = new Label();
|
||||
playerArms = new Label();
|
||||
playerSilk = new Label();
|
||||
playerOpium = new Label();
|
||||
vBox1 = new VBox();
|
||||
inUseWarehouse = new Text();
|
||||
vacantWarehouse = new Text();
|
||||
houseLabel = new Label();
|
||||
houseGeneral = new Label();
|
||||
houseArms = new Label();
|
||||
houseSilk = new Label();
|
||||
houseOpium = new Label();
|
||||
borderPane = new BorderPane();
|
||||
textIn = new TextField();
|
||||
splitMenu = new SplitMenuButton();
|
||||
general = new CheckMenuItem();
|
||||
arms = new CheckMenuItem();
|
||||
silk = new CheckMenuItem();
|
||||
opium = new CheckMenuItem();
|
||||
textField = new TextField();
|
||||
|
||||
borderPane.setPrefHeight(480.0);
|
||||
borderPane.setPrefWidth(600.0);
|
||||
|
||||
/**
|
||||
* Sets the preferred width and height of the borderpane window to 600 by 480.
|
||||
*
|
||||
*/
|
||||
borderPane.setPrefHeight(480.0);
|
||||
borderPane.setPrefWidth(600.0);
|
||||
|
||||
/**
|
||||
* Creates a label "Hong Kong Warehouse: at the top of the borderpane.
|
||||
*
|
||||
*/
|
||||
BorderPane.setAlignment(title, javafx.geometry.Pos.CENTER);
|
||||
|
||||
title.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
title.setStrokeWidth(0.0);
|
||||
title.setText("Hong Kong Warehouse");
|
||||
title.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
title.setWrappingWidth(393.63671875);
|
||||
title.setFont(new Font(24.0));
|
||||
borderPane.setPrefHeight(480.0);
|
||||
borderPane.setPrefWidth(600.0);
|
||||
|
||||
BorderPane.setAlignment(title, javafx.geometry.Pos.CENTER);
|
||||
title.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
title.setStrokeWidth(0.0);
|
||||
title.setText("Hong Kong Warehouse");
|
||||
title.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
title.setWrappingWidth(393.63671875);
|
||||
title.setFont(new Font(24.0));
|
||||
borderPane.setTop(title);
|
||||
|
||||
|
||||
/**
|
||||
* creates an HBox at the center of the borderpane with a width of 200 and height of 100.
|
||||
*
|
||||
*/
|
||||
BorderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
//Creating the box for the warehouse GUI
|
||||
borderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
hBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox.setPrefHeight(100.0);
|
||||
hBox.setPrefWidth(200.0);
|
||||
hBox.setSpacing(10.0);
|
||||
|
||||
/**
|
||||
* Creates a button with text "Withdraw" which handles user events.
|
||||
*
|
||||
*/
|
||||
withdraw.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
withdraw.setMnemonicParsing(false);
|
||||
withdraw.setText("Withdraw");
|
||||
updateLabels();
|
||||
withdraw.setOnAction(new EventHandler<ActionEvent>() {
|
||||
/**
|
||||
* Creates a button with text "Deposit" which handles user events.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
vBox.setAlignment(javafx.geometry.Pos.CENTER_LEFT);
|
||||
vBox.setPrefHeight(200.0);
|
||||
vBox.setPrefWidth(100.0);
|
||||
|
||||
int withdraw = Integer.parseInt(textIn.getText());
|
||||
updateLabels();
|
||||
if (opium.isSelected()) {
|
||||
if (player.getwOpium() >= withdraw) {
|
||||
player.setwOpium(player.getwOpium() - withdraw);
|
||||
player.setOpiumHeld(player.getOpiumHeld() + withdraw);
|
||||
} else {
|
||||
title.setText("You don't have that much opium stored in the warehouse!");
|
||||
}
|
||||
}
|
||||
if (silk.isSelected()) {
|
||||
if (player.getwSilk() >= withdraw) {
|
||||
player.setwSilk(player.getwSilk() - withdraw);
|
||||
player.setSilkHeld(player.getSilkHeld() + withdraw);
|
||||
} else {
|
||||
title.setText("You don't have that much silk stored in the warehouse!");
|
||||
}
|
||||
}
|
||||
if (arms.isSelected()) {
|
||||
if (player.getwArms() >= withdraw) {
|
||||
player.setwArms(player.getwArms() - withdraw);
|
||||
player.setArmsHeld(player.getArmsHeld() + withdraw);
|
||||
} else {
|
||||
title.setText("You don't have that much arms stored in the warehouse!");
|
||||
}
|
||||
}
|
||||
if (general.isSelected()) {
|
||||
if (player.getwGeneral() >= withdraw) {
|
||||
player.setwGeneral(player.getwGeneral() - withdraw);
|
||||
player.setGeneralHeld(player.getGeneralHeld() + withdraw);
|
||||
} else {
|
||||
title.setText("You don't have that much general stored in the warehouse!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//Adding general button
|
||||
generalRadio.setMnemonicParsing(false);
|
||||
generalRadio.setSelected(true);
|
||||
generalRadio.setText("General");
|
||||
|
||||
deposit.setMnemonicParsing(false);
|
||||
deposit.setText("Deposit");
|
||||
deposit.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
generalRadio.setToggleGroup(Goods);
|
||||
|
||||
//Adding Arms Button
|
||||
armsRadio.setMnemonicParsing(false);
|
||||
armsRadio.setText("Arms");
|
||||
armsRadio.setToggleGroup(Goods);
|
||||
|
||||
//Adding Silk button
|
||||
silkRadio.setMnemonicParsing(false);
|
||||
silkRadio.setText("Silk");
|
||||
silkRadio.setToggleGroup(Goods);
|
||||
|
||||
// Adding opium button
|
||||
opiumRadio.setMnemonicParsing(false);
|
||||
opiumRadio.setText("Opium");
|
||||
opiumRadio.setToggleGroup(Goods);
|
||||
|
||||
// Remove materials button
|
||||
withdrawButton.setMnemonicParsing(false);
|
||||
withdrawButton.setText("Withdraw");
|
||||
|
||||
// Add materials button
|
||||
depositButton.setMnemonicParsing(false);
|
||||
depositButton.setText("Deposit");
|
||||
|
||||
//Go back to the previous screen button
|
||||
quitButton.setMnemonicParsing(false);
|
||||
quitButton.setText("Go back");
|
||||
borderPane.setBottom(hBox);
|
||||
|
||||
deposit.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
|
||||
//Takes you to the HK warehouse
|
||||
borderPane.setAlignment(title, javafx.geometry.Pos.CENTER);
|
||||
title.setText("Hong Kong Warehouse");
|
||||
title.setFont(new Font(24.0));
|
||||
title.setPadding(new Insets(10.0, 0.0, 0.0, 0.0));
|
||||
borderPane.setTop(title);
|
||||
|
||||
// Making the BOX again
|
||||
borderPane.setAlignment(hBox0, javafx.geometry.Pos.CENTER);
|
||||
hBox0.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox0.setPrefHeight(100.0);
|
||||
hBox0.setPrefWidth(200.0);
|
||||
hBox0.setSpacing(10.0);
|
||||
|
||||
vBox0.setAlignment(javafx.geometry.Pos.CENTER_LEFT);
|
||||
vBox0.setSpacing(10.0);
|
||||
|
||||
playerLabel.setText("Player:");
|
||||
playerLabel.setFont(new Font(18.0));
|
||||
|
||||
// displays the hold of general
|
||||
playerGeneral.setText("General:");
|
||||
|
||||
// displays the hold of Arms
|
||||
|
||||
playerArms.setText("Arms:");
|
||||
|
||||
// displays the hold of Silk
|
||||
|
||||
playerSilk.setText("Silk:");
|
||||
|
||||
// displays the hold of Opium
|
||||
|
||||
playerOpium.setText("Opium:");
|
||||
|
||||
vBox1.setAlignment(javafx.geometry.Pos.CENTER_LEFT);
|
||||
vBox1.setSpacing(10.0);
|
||||
|
||||
houseLabel.setAlignment(javafx.geometry.Pos.TOP_CENTER);
|
||||
houseLabel.setText("Warehouse:");
|
||||
houseLabel.setFont(new Font(18.0));
|
||||
|
||||
|
||||
houseGeneral.setText("General:");
|
||||
|
||||
houseArms.setText("Arms:");
|
||||
|
||||
houseSilk.setText("Silk:");
|
||||
|
||||
houseOpium.setText("Opium:");
|
||||
|
||||
//Shows the values of the goods that are in the warehouse
|
||||
borderPane.setMargin(hBox0, new Insets(0.0));
|
||||
hBox0.setPadding(new Insets(10.0, 0.0, 0.0, 0.0));
|
||||
vBox0.setPadding(new Insets(0, 0.0, 0.0, 0.0));
|
||||
borderPane.setCenter(hBox0);
|
||||
|
||||
//Add buttons for the goods
|
||||
vBox.getChildren().add(generalRadio);
|
||||
vBox.getChildren().add(armsRadio);
|
||||
vBox.getChildren().add(silkRadio);
|
||||
vBox.getChildren().add(opiumRadio);
|
||||
|
||||
//Adds the buttons for withdraw, deposit and quitting
|
||||
hBox.getChildren().add(vBox);
|
||||
hBox.getChildren().add(textField);
|
||||
hBox.getChildren().add(withdrawButton);
|
||||
hBox.getChildren().add(depositButton);
|
||||
hBox.getChildren().add(quitButton);
|
||||
|
||||
//Adds the buttons for the amount of the good the player has
|
||||
vBox0.getChildren().add(playerLabel);
|
||||
vBox0.getChildren().add(playerGeneral);
|
||||
vBox0.getChildren().add(playerArms);
|
||||
vBox0.getChildren().add(playerSilk);
|
||||
vBox0.getChildren().add(playerOpium);
|
||||
|
||||
//Amount of stock the warehouse has of the goods
|
||||
vBox1.getChildren().add(houseLabel);
|
||||
vBox1.getChildren().add(houseGeneral);
|
||||
vBox1.getChildren().add(houseArms);
|
||||
vBox1.getChildren().add(houseSilk);
|
||||
vBox1.getChildren().add(houseOpium);
|
||||
|
||||
hBox0.getChildren().add(vBox0);
|
||||
hBox0.getChildren().add(vBox1);
|
||||
|
||||
updateLabels();
|
||||
|
||||
//Goes back to shop
|
||||
quitButton.setOnAction(event -> {
|
||||
TaipanShopGUI taipanShopGUI = new TaipanShopGUI(getPlayer());
|
||||
taipanShopGUI.initializeShop(stage);
|
||||
stage.show();
|
||||
});
|
||||
//Runs when the withdraw button is selected. and removes the amount of the selected good
|
||||
withdrawButton.setOnAction(event -> {
|
||||
try {
|
||||
int withdraw = Integer.parseInt(textField.getText());
|
||||
|
||||
if(withdraw <= 0){
|
||||
title.setText("Please enter a valid value");
|
||||
}
|
||||
//Transfers general amount
|
||||
else if(Goods.getSelectedToggle() == generalRadio && withdraw <= getwGeneral()){
|
||||
setGeneralHeld(getPlayer().getGeneralHeld()+withdraw);
|
||||
setwGeneral(getPlayer().getwGeneral()-withdraw);
|
||||
}
|
||||
//Transfers Arms amount
|
||||
else if(Goods.getSelectedToggle() == armsRadio && withdraw <= getwArms()){
|
||||
setArmsHeld(getPlayer().getArmsHeld()+withdraw);
|
||||
setwArms(getPlayer().getwArms()-withdraw);
|
||||
}
|
||||
//Transfers Silk Amount
|
||||
else if(Goods.getSelectedToggle() == silkRadio && withdraw <= getwSilk()){
|
||||
setSilkHeld(getPlayer().getSilkHeld()+withdraw);
|
||||
setwSilk(getPlayer().getwSilk()-withdraw);
|
||||
}
|
||||
//Transfers Opium amount
|
||||
else if(Goods.getSelectedToggle() == opiumRadio && withdraw <= getwOpium()) {
|
||||
setOpiumHeld(getPlayer().getOpiumHeld() + withdraw);
|
||||
setwOpium(getPlayer().getwOpium() - withdraw);
|
||||
}
|
||||
// Ensures a valid value is entered
|
||||
else{
|
||||
title.setText("Please enter a valid value");
|
||||
}
|
||||
updateLabels();
|
||||
int deposit = Integer.parseInt(textIn.getText());
|
||||
if (opium.isSelected()) {
|
||||
if (player.getOpiumHeld() >= deposit) {
|
||||
player.setwOpium(player.getwOpium() + deposit);
|
||||
player.setOpiumHeld(player.getOpiumHeld() - deposit);
|
||||
} else {
|
||||
title.setText("You don't have that much opium stored in the ship!");
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
title.setText("Please enter a valid value");
|
||||
}
|
||||
});
|
||||
//Button to add a user entered amount to the warehouse
|
||||
depositButton.setOnAction(event -> {
|
||||
try {
|
||||
int deposit = Integer.parseInt(textField.getText());
|
||||
|
||||
if(deposit <= 0){
|
||||
title.setText("Please enter a valid value");
|
||||
}
|
||||
if (silk.isSelected()) {
|
||||
if (player.getwSilk() >= deposit) {
|
||||
player.setwSilk(player.getwSilk() + deposit);
|
||||
player.setSilkHeld(player.getSilkHeld() - deposit);
|
||||
} else {
|
||||
title.setText("You don't have that much silk stored in the ship!");
|
||||
}
|
||||
//Transfers general amount
|
||||
else if(Goods.getSelectedToggle() == generalRadio && deposit <= getGeneralHeld()){
|
||||
setGeneralHeld(getPlayer().getGeneralHeld()-deposit);
|
||||
setwGeneral(getPlayer().getwGeneral()+deposit);
|
||||
}
|
||||
if (arms.isSelected()) {
|
||||
if (player.getwArms() >= deposit) {
|
||||
player.setwArms(player.getwArms() + deposit);
|
||||
player.setArmsHeld(player.getArmsHeld() - deposit);
|
||||
} else {
|
||||
title.setText("You don't have that much arms stored in the ship!");
|
||||
}
|
||||
//Transfers Arms amount
|
||||
else if(Goods.getSelectedToggle() == armsRadio && deposit <= getArmsHeld()){
|
||||
setArmsHeld(getPlayer().getArmsHeld()-deposit);
|
||||
setwArms(getPlayer().getwArms()+deposit);
|
||||
}
|
||||
if (general.isSelected()) {
|
||||
if (player.getwGeneral() >= deposit) {
|
||||
player.setwGeneral(player.getwGeneral() + deposit);
|
||||
player.setGeneralHeld(player.getGeneralHeld() - deposit);
|
||||
} else {
|
||||
title.setText("You don't have that much general stored in the ship!");
|
||||
}
|
||||
//Transfers Silk amount
|
||||
else if(Goods.getSelectedToggle() == silkRadio && deposit <= getSilkHeld()){
|
||||
setSilkHeld(getPlayer().getSilkHeld()-deposit);
|
||||
setwSilk(getPlayer().getwSilk()+deposit);
|
||||
}
|
||||
//Transfers Opium amount
|
||||
else if(Goods.getSelectedToggle() == opiumRadio && deposit <= getOpiumHeld()){
|
||||
setOpiumHeld(getPlayer().getOpiumHeld()-deposit);
|
||||
setwOpium(getPlayer().getwOpium()+deposit);
|
||||
}
|
||||
//Checks if the correct value is entered
|
||||
else{
|
||||
title.setText("Please enter a valid value");
|
||||
}
|
||||
updateLabels();
|
||||
}
|
||||
catch (Exception e) {
|
||||
title.setText("Please enter a valid value");
|
||||
}
|
||||
});
|
||||
|
||||
splitMenu.setMnemonicParsing(false);
|
||||
splitMenu.setText("Item");
|
||||
|
||||
general.setMnemonicParsing(false);
|
||||
general.setText("General");
|
||||
|
||||
arms.setMnemonicParsing(false);
|
||||
arms.setText("Arms");
|
||||
|
||||
silk.setMnemonicParsing(false);
|
||||
silk.setText("Silk");
|
||||
|
||||
opium.setMnemonicParsing(false);
|
||||
opium.setText("Opium");
|
||||
borderPane.setBottom(hBox);
|
||||
|
||||
BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER_LEFT);
|
||||
vBox.setPrefHeight(156.0);
|
||||
vBox.setPrefWidth(106.0);
|
||||
|
||||
/**
|
||||
* Creates a label with text "Player" with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
playerName.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
playerName.setStrokeWidth(0.0);
|
||||
playerName.setText("Player");
|
||||
playerName.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
playerName.setWrappingWidth(103.47265625);
|
||||
playerName.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with no text for aesthetic spacing purposes.
|
||||
*
|
||||
*/
|
||||
text.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
text.setStrokeWidth(0.0);
|
||||
text.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
text.setWrappingWidth(103.47265625);
|
||||
text.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "Opium" under the "Player" label with size 18 font and default font style
|
||||
*
|
||||
*/
|
||||
opiumPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
opiumPlayer.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
opiumPlayer.setPrefWidth(100.0);
|
||||
opiumPlayer.setText("Opium");
|
||||
opiumPlayer.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
opiumPlayer.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "Silk" under the "Player" label with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
silkPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
silkPlayer.setPrefWidth(100.0);
|
||||
silkPlayer.setText("Silk");
|
||||
silkPlayer.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "Arms" under the "Player" label with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
armsPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
armsPlayer.setPrefWidth(100.0);
|
||||
armsPlayer.setText("Arms");
|
||||
armsPlayer.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "General" under the "Player" label with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
generalPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
generalPlayer.setPrefWidth(100.0);
|
||||
generalPlayer.setText("General");
|
||||
generalPlayer.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
generalPlayer.setFont(new Font(18.0));
|
||||
borderPane.setLeft(vBox);
|
||||
|
||||
/**
|
||||
* Creates a VBox at the center of the borderpane with a width of 261 and a height of 343.
|
||||
*
|
||||
*/
|
||||
BorderPane.setAlignment(vBox0, javafx.geometry.Pos.TOP_LEFT);
|
||||
vBox0.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
vBox0.setPrefHeight(343.0);
|
||||
vBox0.setPrefWidth(261.0);
|
||||
|
||||
text0.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
text0.setStrokeWidth(0.0);
|
||||
text0.setText("Warehouse");
|
||||
text0.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
text0.setWrappingWidth(103.47265625);
|
||||
text0.setFont(new Font(18.0));
|
||||
|
||||
text1.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
text1.setStrokeWidth(0.0);
|
||||
text1.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
text1.setWrappingWidth(103.47265625);
|
||||
text1.setFont(new Font(18.0));
|
||||
|
||||
opiumWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
opiumWarehouse.setStrokeWidth(0.0);
|
||||
opiumWarehouse.setText("Opium");
|
||||
opiumWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
opiumWarehouse.setWrappingWidth(103.47265625);
|
||||
opiumWarehouse.setFont(new Font(18.0));
|
||||
|
||||
silkWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
silkWarehouse.setStrokeWidth(0.0);
|
||||
silkWarehouse.setText("Silk");
|
||||
silkWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
silkWarehouse.setWrappingWidth(103.47265625);
|
||||
silkWarehouse.setFont(new Font(18.0));
|
||||
|
||||
armsWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
armsWarehouse.setStrokeWidth(0.0);
|
||||
armsWarehouse.setText("Arms");
|
||||
armsWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
armsWarehouse.setWrappingWidth(103.47265625);
|
||||
armsWarehouse.setFont(new Font(18.0));
|
||||
|
||||
generalWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
generalWarehouse.setStrokeWidth(0.0);
|
||||
generalWarehouse.setText("General");
|
||||
generalWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
generalWarehouse.setWrappingWidth(103.47265625);
|
||||
generalWarehouse.setFont(new Font(18.0));
|
||||
borderPane.setCenter(vBox0);
|
||||
|
||||
BorderPane.setAlignment(vBox1, javafx.geometry.Pos.CENTER);
|
||||
vBox1.setPrefHeight(48.0);
|
||||
vBox1.setPrefWidth(152.0);
|
||||
|
||||
inUseWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
inUseWarehouse.setStrokeWidth(0.0);
|
||||
inUseWarehouse.setText("In use:");
|
||||
inUseWarehouse.setFont(new Font(18.0));
|
||||
|
||||
vacantWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
vacantWarehouse.setStrokeWidth(0.0);
|
||||
vacantWarehouse.setText("Vacant:");
|
||||
vacantWarehouse.setFont(new Font(18.0));
|
||||
borderPane.setRight(vBox1);
|
||||
borderPane.setTop(title);
|
||||
|
||||
BorderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
hBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox.setPrefHeight(100.0);
|
||||
hBox.setPrefWidth(200.0);
|
||||
|
||||
withdraw.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
withdraw.setMnemonicParsing(false);
|
||||
withdraw.setText("Withdraw");
|
||||
|
||||
deposit.setMnemonicParsing(false);
|
||||
deposit.setText("Deposit");
|
||||
deposit.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
|
||||
splitMenu.setMnemonicParsing(false);
|
||||
splitMenu.setText("Item");
|
||||
|
||||
general.setMnemonicParsing(false);
|
||||
general.setText("General");
|
||||
|
||||
arms.setMnemonicParsing(false);
|
||||
arms.setText("Arms");
|
||||
|
||||
silk.setMnemonicParsing(false);
|
||||
silk.setText("Silk");
|
||||
|
||||
opium.setMnemonicParsing(false);
|
||||
opium.setText("Opium");
|
||||
borderPane.setBottom(hBox);
|
||||
|
||||
BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER_LEFT);
|
||||
vBox.setPrefHeight(156.0);
|
||||
vBox.setPrefWidth(106.0);
|
||||
|
||||
playerName.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
playerName.setStrokeWidth(0.0);
|
||||
playerName.setText("Player");
|
||||
playerName.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
playerName.setWrappingWidth(103.47265625);
|
||||
playerName.setFont(new Font(18.0));
|
||||
|
||||
text.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
text.setStrokeWidth(0.0);
|
||||
text.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
text.setWrappingWidth(103.47265625);
|
||||
text.setFont(new Font(18.0));
|
||||
|
||||
opiumPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
opiumPlayer.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
|
||||
opiumPlayer.setPrefWidth(100.0);
|
||||
opiumPlayer.setText("Opium");
|
||||
opiumPlayer.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
opiumPlayer.setFont(new Font(18.0));
|
||||
|
||||
silkPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
silkPlayer.setPrefWidth(100.0);
|
||||
silkPlayer.setText("Silk");
|
||||
silkPlayer.setFont(new Font(18.0));
|
||||
|
||||
armsPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
armsPlayer.setPrefWidth(100.0);
|
||||
armsPlayer.setText("Arms");
|
||||
armsPlayer.setFont(new Font(18.0));
|
||||
|
||||
generalPlayer.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
generalPlayer.setPrefWidth(100.0);
|
||||
generalPlayer.setText("General");
|
||||
generalPlayer.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
generalPlayer.setFont(new Font(18.0));
|
||||
borderPane.setLeft(vBox);
|
||||
|
||||
BorderPane.setAlignment(vBox0, javafx.geometry.Pos.TOP_LEFT);
|
||||
vBox0.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
vBox0.setPrefHeight(343.0);
|
||||
vBox0.setPrefWidth(261.0);
|
||||
|
||||
/**
|
||||
* Creates a label with text "Warehouse" with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
text0.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
text0.setStrokeWidth(0.0);
|
||||
text0.setText("Warehouse");
|
||||
text0.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
text0.setWrappingWidth(103.47265625);
|
||||
text0.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with no text for aesthetic spacing purposes.
|
||||
*
|
||||
*/
|
||||
text1.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
text1.setStrokeWidth(0.0);
|
||||
text1.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
text1.setWrappingWidth(103.47265625);
|
||||
text1.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "Opium" under the "Warehouse" label with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
opiumWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
opiumWarehouse.setStrokeWidth(0.0);
|
||||
opiumWarehouse.setText("Opium");
|
||||
opiumWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
opiumWarehouse.setWrappingWidth(103.47265625);
|
||||
opiumWarehouse.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "Silk" under the "Warehouse" label with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
silkWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
silkWarehouse.setStrokeWidth(0.0);
|
||||
silkWarehouse.setText("Silk");
|
||||
silkWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
silkWarehouse.setWrappingWidth(103.47265625);
|
||||
silkWarehouse.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "Arms" under the "Warehouse" label with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
armsWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
armsWarehouse.setStrokeWidth(0.0);
|
||||
armsWarehouse.setText("Arms");
|
||||
armsWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
armsWarehouse.setWrappingWidth(103.47265625);
|
||||
armsWarehouse.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with text "General" under the "Warehouse" label with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
generalWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
generalWarehouse.setStrokeWidth(0.0);
|
||||
generalWarehouse.setText("General");
|
||||
generalWarehouse.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
|
||||
generalWarehouse.setWrappingWidth(103.47265625);
|
||||
generalWarehouse.setFont(new Font(18.0));
|
||||
borderPane.setCenter(vBox0);
|
||||
|
||||
/**
|
||||
* Creates a VBox at the center of the borderpane with a width of 152 and a height of 48.
|
||||
*
|
||||
*/
|
||||
BorderPane.setAlignment(vBox1, javafx.geometry.Pos.CENTER);
|
||||
vBox1.setPrefHeight(48.0);
|
||||
vBox1.setPrefWidth(152.0);
|
||||
|
||||
/**
|
||||
* Creates a label with "In use:" text with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
inUseWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
inUseWarehouse.setStrokeWidth(0.0);
|
||||
inUseWarehouse.setText("In use:");
|
||||
inUseWarehouse.setFont(new Font(18.0));
|
||||
|
||||
/**
|
||||
* Creates a label with "Vacant:" text with size 18 font and default font style.
|
||||
*
|
||||
*/
|
||||
vacantWarehouse.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
vacantWarehouse.setStrokeWidth(0.0);
|
||||
vacantWarehouse.setText("Vacant:");
|
||||
vacantWarehouse.setFont(new Font(18.0));
|
||||
borderPane.setRight(vBox1);
|
||||
|
||||
/**
|
||||
* Adds all the labels and buttons to their respective boxes.
|
||||
*
|
||||
*/
|
||||
splitMenu.getItems().add(general);
|
||||
splitMenu.getItems().add(arms);
|
||||
splitMenu.getItems().add(silk);
|
||||
splitMenu.getItems().add(opium);
|
||||
hBox.getChildren().add(textIn);
|
||||
hBox.getChildren().add(withdraw);
|
||||
hBox.getChildren().add(deposit);
|
||||
hBox.getChildren().add(splitMenu);
|
||||
vBox.getChildren().add(playerName);
|
||||
vBox.getChildren().add(text);
|
||||
vBox.getChildren().add(opiumPlayer);
|
||||
vBox.getChildren().add(silkPlayer);
|
||||
vBox.getChildren().add(armsPlayer);
|
||||
vBox.getChildren().add(generalPlayer);
|
||||
vBox0.getChildren().add(text0);
|
||||
vBox0.getChildren().add(text1);
|
||||
vBox0.getChildren().add(opiumWarehouse);
|
||||
vBox0.getChildren().add(silkWarehouse);
|
||||
vBox0.getChildren().add(armsWarehouse);
|
||||
vBox0.getChildren().add(generalWarehouse);
|
||||
vBox1.getChildren().add(inUseWarehouse);
|
||||
vBox1.getChildren().add(vacantWarehouse);
|
||||
|
||||
//Create the sceene and box of the desired size
|
||||
Scene root = new Scene(borderPane, 600, 480);
|
||||
root.getStylesheets().add("styleguide.css");
|
||||
|
||||
stage.setTitle("Warehouse");
|
||||
stage.setResizable(false);
|
||||
stage.setScene(root);
|
||||
updateLabels();
|
||||
|
||||
return stage;
|
||||
}
|
||||
|
||||
/**
|
||||
* When run, shows the stage as a graphical interface through JavaFX.
|
||||
*
|
||||
* @param primaryStage object of type Stage
|
||||
* As soon as the transfer is made the table of the amount of goods is updated using this method
|
||||
*/
|
||||
public void start(Stage primaryStage) {
|
||||
WarehouseGUI warehouseGUI = new WarehouseGUI(player);
|
||||
warehouseGUI.initializeWarehouse(primaryStage);
|
||||
primaryStage.show();
|
||||
}
|
||||
public void updateLabels(){
|
||||
playerLabel.setText("Player: " + (getPlayer().getCargoSpace()-((getPlayer().getGuns()*10)+ getPlayer().getGeneralHeld() + getPlayer().getArmsHeld() + getPlayer().getSilkHeld() + getPlayer().getOpiumHeld())));
|
||||
houseLabel.setText("Warehouse: " + (10000 -(getPlayer().getwGeneral() + getPlayer().getwArms() + getPlayer().getwSilk() + getPlayer().getwOpium())));
|
||||
|
||||
/**
|
||||
* The purpose of this class is to create a warehouse where the goods
|
||||
* can be safely stored without holing space on the ship!
|
||||
*/
|
||||
public void updateLabels() {
|
||||
generalPlayer.setText("General: " + player.getGeneralHeld());
|
||||
armsPlayer.setText("Arms: " + player.getArmsHeld());
|
||||
silkPlayer.setText("Silk: " + player.getSilkHeld());
|
||||
opiumPlayer.setText("Opium: " + player.getOpiumHeld());
|
||||
playerGeneral.setText("General: " + getPlayer().getGeneralHeld());
|
||||
playerArms.setText("Arms: " + getPlayer().getArmsHeld());
|
||||
playerSilk.setText("Silk: " + getPlayer().getSilkHeld() );
|
||||
playerOpium.setText("Opium: " + getPlayer().getOpiumHeld());
|
||||
|
||||
generalWarehouse.setText("General: " + player.getwGeneral());
|
||||
armsWarehouse.setText("Arms: " + player.getwArms());
|
||||
silkWarehouse.setText("Silk: " + player.getwSilk());
|
||||
opiumWarehouse.setText("Opium: " + player.getwOpium());
|
||||
houseGeneral.setText("General: " + getPlayer().getwGeneral());
|
||||
houseArms.setText("Arms: " + getPlayer().getwArms());
|
||||
houseSilk.setText("Silk: " + getPlayer().getwSilk());
|
||||
houseOpium.setText("Opium: " + getPlayer().getwOpium());
|
||||
}
|
||||
}
|
||||
|
||||
BIN
src/hamcrest-core-1.3.jar
Normal file
BIN
src/hamcrest-core-1.3.jar
Normal file
Binary file not shown.
BIN
src/images/ShipsAttacking.gif
Normal file
BIN
src/images/ShipsAttacking.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 666 KiB |
BIN
src/images/ShipsRunning.gif
Normal file
BIN
src/images/ShipsRunning.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 666 KiB |
BIN
src/images/enemyShip.png
Normal file
BIN
src/images/enemyShip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
BIN
src/images/ourShip.png
Normal file
BIN
src/images/ourShip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
BIN
src/jfxrt.jar
Normal file
BIN
src/jfxrt.jar
Normal file
Binary file not shown.
BIN
src/junit-4.12.jar
Normal file
BIN
src/junit-4.12.jar
Normal file
Binary file not shown.
BIN
src/saves/playerSave.txt
Normal file
BIN
src/saves/playerSave.txt
Normal file
Binary file not shown.
8
src/styleguide.css
Normal file
8
src/styleguide.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.text-field:focused{
|
||||
-fx-faint-focus-color: transparent;
|
||||
-fx-focus-color:rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.button:default{
|
||||
-fx-default-button: #e5f8ff;
|
||||
}
|
||||
Reference in New Issue
Block a user