dsfdsf
This commit is contained in:
parent
344f5b926d
commit
72a1bae2fe
73
ChasseTresor/build.xml
Normal file
73
ChasseTresor/build.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ChasseTresor" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ChasseTresor.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="ChasseTresor-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
3
ChasseTresor/manifest.mf
Normal file
3
ChasseTresor/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
1771
ChasseTresor/nbproject/build-impl.xml
Normal file
1771
ChasseTresor/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
8
ChasseTresor/nbproject/genfiles.properties
Normal file
8
ChasseTresor/nbproject/genfiles.properties
Normal file
@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=2eac148f
|
||||
build.xml.script.CRC32=ccffb208
|
||||
build.xml.stylesheet.CRC32=f85dc8f2@1.111.0.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=2eac148f
|
||||
nbproject/build-impl.xml.script.CRC32=b42136f3
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.111.0.48
|
102
ChasseTresor/nbproject/project.properties
Normal file
102
ChasseTresor/nbproject/project.properties
Normal file
@ -0,0 +1,102 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
application.title=ChasseTresor
|
||||
application.vendor=emile.lalorcey
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.modulepath=\
|
||||
${run.modulepath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
debug.test.modulepath=\
|
||||
${run.test.modulepath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/ChasseTresor.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
dist.jlink.dir=${dist.dir}/jlink
|
||||
dist.jlink.output=${dist.jlink.dir}/ChasseTresor
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${libs.junit_4.classpath}:\
|
||||
${libs.junit_5.classpath}:\
|
||||
${libs.hamcrest.classpath}:\
|
||||
${libs.absolutelayout.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=21
|
||||
javac.target=21
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit_5.classpath}
|
||||
javac.test.modulepath=\
|
||||
${javac.modulepath}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.html5=false
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
# The jlink additional root modules to resolve
|
||||
jlink.additionalmodules=
|
||||
# The jlink additional command line parameters
|
||||
jlink.additionalparam=
|
||||
jlink.launcher=true
|
||||
jlink.launcher.name=ChasseTresor
|
||||
main.class=chasseAuTresor.Interface
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.modulepath=\
|
||||
${javac.modulepath}
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
run.test.modulepath=\
|
||||
${javac.test.modulepath}
|
||||
source.encoding=ISO-8859-1
|
||||
src.dir=src
|
||||
test.src.dir=test
|
15
ChasseTresor/nbproject/project.xml
Normal file
15
ChasseTresor/nbproject/project.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>ChasseTresor</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
335
ChasseTresor/src/chasseAuTresor/Interface.form
Normal file
335
ChasseTresor/src/chasseAuTresor/Interface.form
Normal file
@ -0,0 +1,335 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
<Property name="title" type="java.lang.String" value="Chasse au trésor"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[500, 700]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-46,0,0,1,-13"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="false"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPZoneJeu">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="cc" green="cc" red="cc" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[400, 400]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="40" y="160" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPJoueur">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="0" red="0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="0" y="0" width="20" height="20"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="20" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="20" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPTresor">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="ff" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="160" y="80" width="20" height="20"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="20" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="20" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPUtilisateur">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="99" green="99" red="99" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="30" y="40" width="160" height="110"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jTFPseudo" pref="80" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jBGo" min="-2" pref="46" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jTFPseudo" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jBGo" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="36" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Pseudo :"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTFPseudo">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBGo">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Go"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBGoActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPHud">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="99" green="99" red="99" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="270" y="40" width="190" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLANbVies" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="58" max="-2" attributes="0"/>
|
||||
<Component id="jLNbVies" pref="42" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLADeplacements" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLNbDeplacement" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLADeplacements" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLNbDeplacement" alignment="3" min="-2" pref="16" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jLANbVies" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLNbVies" min="-2" pref="16" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="33" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLADeplacements">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Nombre Déplacement : "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLANbVies">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Nombre Vies :"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLNbDeplacement">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Segoe UI Black" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLNbVies">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Segoe UI Black" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLUtilisateur">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Utilisateur :"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="30" y="20" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLHud">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="HUD :"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="300" y="20" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBDroite">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Droite"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBDroiteActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="250" y="600" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBBas">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Bas"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBBasActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="200" y="630" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBGauche">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Gauche"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBGaucheActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="150" y="600" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBHaut">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Haut"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBHautActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="200" y="570" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
382
ChasseTresor/src/chasseAuTresor/Interface.java
Normal file
382
ChasseTresor/src/chasseAuTresor/Interface.java
Normal file
@ -0,0 +1,382 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package chasseAuTresor;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import metier.Jeu;
|
||||
import metier.Joueur;
|
||||
import metier.Position;
|
||||
import metier.Recif;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class Interface extends javax.swing.JFrame {
|
||||
private Jeu leJeu;
|
||||
boolean gagner;
|
||||
/**
|
||||
* Creates new form Interface
|
||||
*/
|
||||
public Interface() {
|
||||
leJeu = new Jeu();
|
||||
initComponents();
|
||||
jLHud.setVisible(false);
|
||||
jPHud.setVisible(false);
|
||||
jPZoneJeu.setVisible(false);
|
||||
jBBas.setVisible(false);
|
||||
jBHaut.setVisible(false);
|
||||
jBDroite.setVisible(false);
|
||||
jBGauche.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jPZoneJeu = new javax.swing.JPanel();
|
||||
jPJoueur = new javax.swing.JPanel();
|
||||
jPTresor = new javax.swing.JPanel();
|
||||
jPUtilisateur = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jTFPseudo = new javax.swing.JTextField();
|
||||
jBGo = new javax.swing.JButton();
|
||||
jPHud = new javax.swing.JPanel();
|
||||
jLADeplacements = new javax.swing.JLabel();
|
||||
jLANbVies = new javax.swing.JLabel();
|
||||
jLNbDeplacement = new javax.swing.JLabel();
|
||||
jLNbVies = new javax.swing.JLabel();
|
||||
jLUtilisateur = new javax.swing.JLabel();
|
||||
jLHud = new javax.swing.JLabel();
|
||||
jBDroite = new javax.swing.JButton();
|
||||
jBBas = new javax.swing.JButton();
|
||||
jBGauche = new javax.swing.JButton();
|
||||
jBHaut = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setTitle("Chasse au trésor");
|
||||
setPreferredSize(new java.awt.Dimension(500, 700));
|
||||
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
|
||||
|
||||
jPZoneJeu.setBackground(new java.awt.Color(204, 204, 204));
|
||||
jPZoneJeu.setPreferredSize(new java.awt.Dimension(400, 400));
|
||||
jPZoneJeu.setLayout(null);
|
||||
|
||||
jPJoueur.setBackground(new java.awt.Color(0, 0, 0));
|
||||
jPJoueur.setPreferredSize(new java.awt.Dimension(20, 20));
|
||||
|
||||
javax.swing.GroupLayout jPJoueurLayout = new javax.swing.GroupLayout(jPJoueur);
|
||||
jPJoueur.setLayout(jPJoueurLayout);
|
||||
jPJoueurLayout.setHorizontalGroup(
|
||||
jPJoueurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 20, Short.MAX_VALUE)
|
||||
);
|
||||
jPJoueurLayout.setVerticalGroup(
|
||||
jPJoueurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 20, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jPZoneJeu.add(jPJoueur);
|
||||
jPJoueur.setBounds(0, 0, 20, 20);
|
||||
|
||||
jPTresor.setBackground(new java.awt.Color(255, 255, 0));
|
||||
jPTresor.setPreferredSize(new java.awt.Dimension(20, 20));
|
||||
|
||||
javax.swing.GroupLayout jPTresorLayout = new javax.swing.GroupLayout(jPTresor);
|
||||
jPTresor.setLayout(jPTresorLayout);
|
||||
jPTresorLayout.setHorizontalGroup(
|
||||
jPTresorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 20, Short.MAX_VALUE)
|
||||
);
|
||||
jPTresorLayout.setVerticalGroup(
|
||||
jPTresorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 20, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jPZoneJeu.add(jPTresor);
|
||||
jPTresor.setBounds(160, 80, 20, 20);
|
||||
|
||||
getContentPane().add(jPZoneJeu, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 160, -1, -1));
|
||||
|
||||
jPUtilisateur.setBackground(new java.awt.Color(153, 153, 153));
|
||||
jPUtilisateur.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
|
||||
jLabel1.setText("Pseudo :");
|
||||
|
||||
jBGo.setText("Go");
|
||||
jBGo.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBGoActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPUtilisateurLayout = new javax.swing.GroupLayout(jPUtilisateur);
|
||||
jPUtilisateur.setLayout(jPUtilisateurLayout);
|
||||
jPUtilisateurLayout.setHorizontalGroup(
|
||||
jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPUtilisateurLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPUtilisateurLayout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPUtilisateurLayout.createSequentialGroup()
|
||||
.addComponent(jTFPseudo, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jBGo, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPUtilisateurLayout.setVerticalGroup(
|
||||
jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPUtilisateurLayout.createSequentialGroup()
|
||||
.addGap(19, 19, 19)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jTFPseudo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jBGo))
|
||||
.addContainerGap(36, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
getContentPane().add(jPUtilisateur, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 40, 160, 110));
|
||||
|
||||
jPHud.setBackground(new java.awt.Color(153, 153, 153));
|
||||
jPHud.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
|
||||
jLADeplacements.setText("Nombre Déplacement : ");
|
||||
|
||||
jLANbVies.setText("Nombre Vies :");
|
||||
|
||||
jLNbDeplacement.setFont(new java.awt.Font("Segoe UI Black", 0, 12)); // NOI18N
|
||||
|
||||
jLNbVies.setFont(new java.awt.Font("Segoe UI Black", 0, 12)); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPHudLayout = new javax.swing.GroupLayout(jPHud);
|
||||
jPHud.setLayout(jPHudLayout);
|
||||
jPHudLayout.setHorizontalGroup(
|
||||
jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPHudLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPHudLayout.createSequentialGroup()
|
||||
.addComponent(jLANbVies)
|
||||
.addGap(58, 58, 58)
|
||||
.addComponent(jLNbVies, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
|
||||
.addGroup(jPHudLayout.createSequentialGroup()
|
||||
.addComponent(jLADeplacements)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLNbDeplacement, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPHudLayout.setVerticalGroup(
|
||||
jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPHudLayout.createSequentialGroup()
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLADeplacements)
|
||||
.addComponent(jLNbDeplacement, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(27, 27, 27)
|
||||
.addGroup(jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLANbVies)
|
||||
.addComponent(jLNbVies, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(33, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
getContentPane().add(jPHud, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 40, 190, -1));
|
||||
|
||||
jLUtilisateur.setText("Utilisateur :");
|
||||
getContentPane().add(jLUtilisateur, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 20, -1, -1));
|
||||
|
||||
jLHud.setText("HUD :");
|
||||
getContentPane().add(jLHud, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 20, -1, -1));
|
||||
|
||||
jBDroite.setText("Droite");
|
||||
jBDroite.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBDroiteActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
getContentPane().add(jBDroite, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 600, -1, -1));
|
||||
|
||||
jBBas.setText("Bas");
|
||||
jBBas.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBBasActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
getContentPane().add(jBBas, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 630, -1, -1));
|
||||
|
||||
jBGauche.setText("Gauche");
|
||||
jBGauche.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBGaucheActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
getContentPane().add(jBGauche, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 600, -1, -1));
|
||||
|
||||
jBHaut.setText("Haut");
|
||||
jBHaut.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBHautActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
getContentPane().add(jBHaut, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 570, -1, -1));
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jBHautActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBHautActionPerformed
|
||||
Joueur personne = leJeu.getLeJoueur();
|
||||
leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1);
|
||||
jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement()));
|
||||
|
||||
personne.setPosition(personne.deplacer('n', leJeu.getNB_COL(), leJeu.getNB_LIGNES()));
|
||||
jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(),
|
||||
personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE());
|
||||
|
||||
gagner = leJeu.gagner(leJeu.getLeTresor(), personne);
|
||||
if(gagner){
|
||||
String message = "Bravo !!!! \nTu as gagner cette chasse";
|
||||
JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE);
|
||||
System.exit(0);
|
||||
}
|
||||
}//GEN-LAST:event_jBHautActionPerformed
|
||||
|
||||
private void jBDroiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBDroiteActionPerformed
|
||||
Joueur personne = leJeu.getLeJoueur();
|
||||
leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1);
|
||||
jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement()));
|
||||
|
||||
personne.setPosition(personne.deplacer('e', leJeu.getNB_COL(), leJeu.getNB_LIGNES()));
|
||||
jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(),
|
||||
personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE());
|
||||
|
||||
gagner = leJeu.gagner(leJeu.getLeTresor(), personne);
|
||||
if(gagner){
|
||||
String message = "Bravo !!!! \nTu as gagner cette chasse";
|
||||
JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE);
|
||||
System.exit(0);
|
||||
}
|
||||
}//GEN-LAST:event_jBDroiteActionPerformed
|
||||
|
||||
private void jBGaucheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGaucheActionPerformed
|
||||
Joueur personne = leJeu.getLeJoueur();
|
||||
leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1);
|
||||
jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement()));
|
||||
|
||||
personne.setPosition(personne.deplacer('o', leJeu.getNB_COL(), leJeu.getNB_LIGNES()));
|
||||
jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(),
|
||||
personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE());
|
||||
|
||||
gagner = leJeu.gagner(leJeu.getLeTresor(), personne);
|
||||
if(gagner){
|
||||
String message = "Bravo !!!! \nTu as gagner cette chasse";
|
||||
JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE);
|
||||
System.exit(0);
|
||||
}
|
||||
}//GEN-LAST:event_jBGaucheActionPerformed
|
||||
|
||||
private void jBBasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBBasActionPerformed
|
||||
Joueur personne = leJeu.getLeJoueur();
|
||||
leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1);
|
||||
jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement()));
|
||||
|
||||
personne.setPosition(personne.deplacer('s', leJeu.getNB_COL(), leJeu.getNB_LIGNES()));
|
||||
jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(),
|
||||
personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE());
|
||||
|
||||
gagner = leJeu.gagner(leJeu.getLeTresor(), personne);
|
||||
if(gagner){
|
||||
String message = "Bravo !!!! \nTu as gagner cette chasse";
|
||||
JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE);
|
||||
System.exit(0);
|
||||
}
|
||||
}//GEN-LAST:event_jBBasActionPerformed
|
||||
|
||||
private void jBGoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGoActionPerformed
|
||||
//Initialistaion du Joueur
|
||||
Position pos = new Position(0, 0);
|
||||
Joueur jean = new Joueur(jTFPseudo.getText(), 15, pos);
|
||||
leJeu.setLeJoueur(jean);
|
||||
System.out.println(jTFPseudo.getText());
|
||||
jLHud.setVisible(true);
|
||||
jPHud.setVisible(true);
|
||||
jPZoneJeu.setVisible(true);
|
||||
jBBas.setVisible(true);
|
||||
jBHaut.setVisible(true);
|
||||
jBDroite.setVisible(true);
|
||||
jBGauche.setVisible(true);
|
||||
|
||||
jLNbDeplacement.setText(toString().valueOf(leJeu.getLeJoueur().getNbDeplacement()));
|
||||
jLNbVies.setText(toString().valueOf(leJeu.getLeJoueur().getNbVie()));
|
||||
|
||||
jPJoueur.setLocation(leJeu.getLeJoueur().getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(),
|
||||
leJeu.getLeJoueur().getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE());
|
||||
|
||||
jPTresor.setLocation(leJeu.getLeTresor().getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(),
|
||||
leJeu.getLeTresor().getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE());
|
||||
}//GEN-LAST:event_jBGoActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new Interface().setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jBBas;
|
||||
private javax.swing.JButton jBDroite;
|
||||
private javax.swing.JButton jBGauche;
|
||||
private javax.swing.JButton jBGo;
|
||||
private javax.swing.JButton jBHaut;
|
||||
private javax.swing.JLabel jLADeplacements;
|
||||
private javax.swing.JLabel jLANbVies;
|
||||
private javax.swing.JLabel jLHud;
|
||||
private javax.swing.JLabel jLNbDeplacement;
|
||||
private javax.swing.JLabel jLNbVies;
|
||||
private javax.swing.JLabel jLUtilisateur;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JPanel jPHud;
|
||||
private javax.swing.JPanel jPJoueur;
|
||||
private javax.swing.JPanel jPTresor;
|
||||
private javax.swing.JPanel jPUtilisateur;
|
||||
private javax.swing.JPanel jPZoneJeu;
|
||||
private javax.swing.JTextField jTFPseudo;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
140
ChasseTresor/src/metier/Jeu.java
Normal file
140
ChasseTresor/src/metier/Jeu.java
Normal file
@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import metier.Joueur;
|
||||
import metier.Position;
|
||||
import metier.Recif;
|
||||
import metier.Tresor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class Jeu {
|
||||
private static final int TAILLE_CELLULE = 20;
|
||||
private static final int X_MAX = 400 - TAILLE_CELLULE;
|
||||
private static final int X_MIN = 0;
|
||||
private static final int Y_MAX = 400 - TAILLE_CELLULE;
|
||||
private static final int Y_MIN = 0;
|
||||
private final int NB_LIGNES = (X_MAX+TAILLE_CELLULE)/TAILLE_CELLULE;
|
||||
private final int NB_COL = (Y_MAX+TAILLE_CELLULE)/TAILLE_CELLULE;
|
||||
private final int NB_RECIF = 10;
|
||||
private Joueur leJoueur;
|
||||
private Tresor leTresor;
|
||||
private ArrayList<Recif> lesRecif;
|
||||
|
||||
// Constructeur
|
||||
public Jeu() {
|
||||
this.initJeu();
|
||||
}
|
||||
|
||||
// Guetteur
|
||||
public Joueur getLeJoueur() {
|
||||
return leJoueur;
|
||||
}
|
||||
|
||||
public Tresor getLeTresor() {
|
||||
return leTresor;
|
||||
}
|
||||
|
||||
public ArrayList<Recif> getLesRecif() {
|
||||
return lesRecif;
|
||||
}
|
||||
|
||||
public int getTAILLE_CELLULE() {
|
||||
return TAILLE_CELLULE;
|
||||
}
|
||||
|
||||
public static int getX_MAX() {
|
||||
return X_MAX;
|
||||
}
|
||||
|
||||
public static int getX_MIN() {
|
||||
return X_MIN;
|
||||
}
|
||||
|
||||
public static int getY_MAX() {
|
||||
return Y_MAX;
|
||||
}
|
||||
|
||||
public static int getY_MIN() {
|
||||
return Y_MIN;
|
||||
}
|
||||
|
||||
public int getNB_LIGNES() {
|
||||
return NB_LIGNES;
|
||||
}
|
||||
|
||||
public int getNB_COL() {
|
||||
return NB_COL;
|
||||
}
|
||||
|
||||
public int getNB_RECIF() {
|
||||
return NB_RECIF;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Setteur
|
||||
public void setLesRecif(ArrayList<Recif> lesRecif) {
|
||||
this.lesRecif = lesRecif;
|
||||
}
|
||||
|
||||
public void setLeJoueur(Joueur leJoueur){
|
||||
|
||||
this.leJoueur = leJoueur;
|
||||
}
|
||||
|
||||
public void setLeTresor(Tresor leTresor) {
|
||||
this.leTresor = leTresor;
|
||||
}
|
||||
|
||||
// Methodes
|
||||
private void initJeu() {
|
||||
//Initialisation du Trésor
|
||||
int y = this.genererNbAlea(0, NB_LIGNES);
|
||||
int x = this.genererNbAlea(0, NB_COL);
|
||||
Tresor chest = new Tresor("Coffre",y ,x);
|
||||
this.leTresor = chest;
|
||||
|
||||
//Initialisation des Récifs
|
||||
ArrayList<Recif> recifs = new ArrayList<Recif>();
|
||||
for(int i =0; i<NB_RECIF; i++){
|
||||
int dangereux = this.genererNbAlea(1, 3);
|
||||
boolean nouveau = true;
|
||||
Position pos1 = new Position();
|
||||
do{
|
||||
y = this.genererNbAlea(0, NB_LIGNES);
|
||||
x = this.genererNbAlea(0, NB_COL);
|
||||
pos1.setX(x);
|
||||
pos1.setY(y);
|
||||
for(Recif recif: recifs){
|
||||
if(recif.getLaPosition().equals(pos1)){
|
||||
nouveau = false;
|
||||
}
|
||||
}
|
||||
}while(!nouveau);
|
||||
Recif plan = new Recif(dangereux, pos1);
|
||||
recifs.add(plan);
|
||||
}
|
||||
}
|
||||
|
||||
public int genererNbAlea(int min, int max){
|
||||
int nbAlea = min + (int)(Math.random() * max);
|
||||
return nbAlea;
|
||||
}
|
||||
|
||||
public boolean gagner(Tresor tresor, Joueur joueur){
|
||||
boolean gagner = false;
|
||||
if(tresor.getLaPosition().getPosX() == joueur.getLaPosition().getPosX() &&
|
||||
tresor.getLaPosition().getPosY() == joueur.getLaPosition().getPosY()){
|
||||
gagner = true;
|
||||
}
|
||||
return gagner;
|
||||
}
|
||||
|
||||
}
|
137
ChasseTresor/src/metier/Joueur.java
Normal file
137
ChasseTresor/src/metier/Joueur.java
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class Joueur {
|
||||
private String nom;
|
||||
private int nbVie;
|
||||
private Position laPosition;
|
||||
private int nbDeplacement;
|
||||
private boolean aGagne;
|
||||
private boolean mort;
|
||||
|
||||
// Constructeur
|
||||
|
||||
public Joueur(){
|
||||
}
|
||||
public Joueur(String nom,int vie,Position pos){
|
||||
this.nom = nom;
|
||||
this.nbVie = vie;
|
||||
this.laPosition = pos;
|
||||
}
|
||||
|
||||
// Guetteur
|
||||
public Position getLaPosition(){
|
||||
return this.laPosition;
|
||||
}
|
||||
|
||||
public boolean isaGagne(){
|
||||
return this.aGagne;
|
||||
}
|
||||
|
||||
public boolean isMort(){
|
||||
return this.mort;
|
||||
}
|
||||
|
||||
public int getNbDeplacement(){
|
||||
return this.nbDeplacement;
|
||||
}
|
||||
|
||||
public int getNbVie(){
|
||||
return this.nbVie;
|
||||
}
|
||||
|
||||
public String getNom(){
|
||||
return this.nom;
|
||||
}
|
||||
|
||||
// Setteur
|
||||
|
||||
public void setPosition(Position pos){
|
||||
this.laPosition = pos;
|
||||
}
|
||||
|
||||
public void setaGagne(boolean gagne){
|
||||
this.aGagne = gagne;
|
||||
}
|
||||
|
||||
public void setNbDeplacement(int deplacement){
|
||||
this.nbDeplacement = deplacement;
|
||||
}
|
||||
|
||||
public boolean mourir(){
|
||||
this.mort = true;
|
||||
return this.mort;
|
||||
}
|
||||
|
||||
// Methodes
|
||||
|
||||
public void faireVarierVie (int varier){
|
||||
if((this.nbVie+varier)>0){
|
||||
this.nbVie += varier;
|
||||
}else{
|
||||
this.nbVie = 0;
|
||||
this.mourir();
|
||||
}
|
||||
}
|
||||
|
||||
public Position deplacer(char direction, int nbCol, int nbLignes){
|
||||
int y = this.getLaPosition().getPosY();
|
||||
int x = this.getLaPosition().getPosX();
|
||||
switch(direction){
|
||||
case 'n':
|
||||
if((y-1)>=0){
|
||||
y--;
|
||||
}else{
|
||||
System.out.println("Limite de map atteinte!! Demi-tour");
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if((y+1)<= nbLignes-1){
|
||||
y++;
|
||||
|
||||
}else{
|
||||
System.out.println("Limite de map atteinte!! Demi-tour");
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
if((x-1)>=0){
|
||||
x--;
|
||||
}else{
|
||||
System.out.println("Limite de map atteinte!! Demi-tour");
|
||||
}
|
||||
break;
|
||||
case 'e':
|
||||
if((x+1)<= nbCol-1){
|
||||
x++;
|
||||
}else{
|
||||
System.out.println("Limite de map atteinte!! Demi-tour");
|
||||
}
|
||||
break;
|
||||
}
|
||||
return new Position(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
String infos = "La classe est " + this.getClass()+"\nSon nom est "+this.getNom()+"\n"
|
||||
+ "Son nombre de vie vaut "+this.getNbVie()+"\nSa position est à "+this.getLaPosition()+"\n"
|
||||
+ "Il s'est déjà deplacer "+this.getNbDeplacement()+"Il est mort :"+ this.isMort();
|
||||
return infos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
52
ChasseTresor/src/metier/Position.java
Normal file
52
ChasseTresor/src/metier/Position.java
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class Position {
|
||||
private int posX;
|
||||
private int posY;
|
||||
|
||||
// Constructeur
|
||||
public Position(){
|
||||
}
|
||||
|
||||
public Position(int x, int y){
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
}
|
||||
|
||||
//Guetteur
|
||||
|
||||
public int getPosX(){
|
||||
return this.posX;
|
||||
}
|
||||
|
||||
public int getPosY(){
|
||||
return this.posY;
|
||||
}
|
||||
|
||||
// Setteur
|
||||
public void setX(int x){
|
||||
this.posX = x;
|
||||
}
|
||||
|
||||
public void setY(int y){
|
||||
this.posY = y;
|
||||
}
|
||||
|
||||
// MEthodes
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "La position vaut "+this.getPosX()+" et "+this.getPosY();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
95
ChasseTresor/src/metier/Recif.java
Normal file
95
ChasseTresor/src/metier/Recif.java
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class Recif {
|
||||
private int dangerosite;
|
||||
private Position laPosition;
|
||||
|
||||
// COnstructeur
|
||||
|
||||
public Recif() {
|
||||
}
|
||||
|
||||
public Recif(int dangerosite, Position laPosition) {
|
||||
this.dangerosite = dangerosite;
|
||||
this.laPosition = laPosition;
|
||||
}
|
||||
|
||||
// Guetteur
|
||||
|
||||
public int getDangerosite() {
|
||||
return dangerosite;
|
||||
}
|
||||
|
||||
public Position getLaPosition() {
|
||||
return laPosition;
|
||||
}
|
||||
|
||||
// Setteur
|
||||
|
||||
public void setDangerosite(int dangerosite) {
|
||||
this.dangerosite = dangerosite;
|
||||
}
|
||||
|
||||
public void setLaPosition(Position laPosition) {
|
||||
this.laPosition = laPosition;
|
||||
}
|
||||
|
||||
// Methodes
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Recif{" + "dangerosite=" + dangerosite + ", laPosition=" + laPosition + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 19 * hash + this.dangerosite;
|
||||
hash = 19 * hash + Objects.hashCode(this.laPosition);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Recif other = (Recif) obj;
|
||||
if (this.dangerosite != other.dangerosite) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.laPosition, other.laPosition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
64
ChasseTresor/src/metier/Tresor.java
Normal file
64
ChasseTresor/src/metier/Tresor.java
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class Tresor {
|
||||
String type;
|
||||
Position laPosition = new Position();
|
||||
boolean decouvert;
|
||||
|
||||
// Constructeur
|
||||
public Tresor(){
|
||||
}
|
||||
|
||||
public Tresor(String type, int y, int x){
|
||||
this.type = type;
|
||||
this.laPosition.setX(x);
|
||||
this.laPosition.setY(y);
|
||||
}
|
||||
|
||||
// Guetteur
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Position getLaPosition() {
|
||||
return laPosition;
|
||||
}
|
||||
|
||||
public boolean isDecouvert() {
|
||||
return decouvert;
|
||||
}
|
||||
|
||||
|
||||
// Setteur
|
||||
|
||||
public void setLaPosition(Position laPosition) {
|
||||
this.laPosition = laPosition;
|
||||
}
|
||||
|
||||
public void setDecouvert(boolean decouvert) {
|
||||
this.decouvert = decouvert;
|
||||
}
|
||||
|
||||
|
||||
// Methodes
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Tresor{" + "type=" + type + ", laPosition=" + laPosition + ", decouvert=" + decouvert + '}';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
125
ChasseTresor/test/metier/JoueurTest.java
Normal file
125
ChasseTresor/test/metier/JoueurTest.java
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit5TestClass.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class JoueurTest {
|
||||
|
||||
public JoueurTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test of faireVarierVie method, of class Joueur.
|
||||
*/
|
||||
@Test
|
||||
public void testFaireVarierVie() {
|
||||
System.out.println("--------------------------------faireVarierVie--------------------");
|
||||
Position pos = new Position();
|
||||
Joueur instance = new Joueur("Didier", 5, pos); // À compléter, joueur créé avec 5 vies
|
||||
System.out.println ("\t 1er cas : moins 1 vie/5 au départ");
|
||||
int nb = -1;
|
||||
instance.faireVarierVie(nb);
|
||||
int expResult = 4; // Résultat attendu
|
||||
int result = instance.getNbVie(); // Résultat réel
|
||||
assertEquals("Pb maj Vie",expResult, result );
|
||||
boolean expResultB = false;
|
||||
boolean resultB = instance.isMort();
|
||||
assertEquals("Pb maj isMort",expResultB, resultB );
|
||||
System.out.println ("\t 2nd cas : moins 6 vies/ 4");
|
||||
Joueur instan = new Joueur("Did", 4, pos);
|
||||
nb = -6;
|
||||
instan.faireVarierVie(nb);
|
||||
expResult = 0;
|
||||
result = instan.getNbVie();
|
||||
assertEquals("Pb maj Vie",expResult, result );
|
||||
expResultB = false;
|
||||
resultB = instance.isMort();
|
||||
assertEquals("Pb maj isMort",expResultB, resultB );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of deplacer method, of class Joueur.
|
||||
*/
|
||||
@Test
|
||||
public void testDeplacer() {
|
||||
System.out.println("--------------------deplacer----------------------");
|
||||
Joueur instance = new Joueur();
|
||||
Position pos1 = new Position(2, 2);
|
||||
instance.setPosition(pos1);
|
||||
|
||||
System.out.println ("\t 1er cas : monter de 1");
|
||||
//Test d'un déplacement neutre vers le nord
|
||||
Position a = instance.deplacer('n', 3, 3);
|
||||
int expResult = 1;
|
||||
int result = a.getPosY();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
instance.setPosition(a);
|
||||
System.out.println ("\t 2er cas : hors limite vers le nord");
|
||||
a = instance.deplacer('n', 3, 3);
|
||||
instance.setPosition(a);
|
||||
a = instance.deplacer('n', 3, 3);
|
||||
expResult = 0;
|
||||
result = a.getPosY();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
|
||||
System.out.println ("\t 3er cas : Est de 1");
|
||||
a = instance.deplacer('e', 3, 3);
|
||||
expResult = 2;
|
||||
result = a.getPosX();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
instance.setPosition(a);
|
||||
System.out.println ("\t 4er cas : hors limite vers l'Est");
|
||||
a = instance.deplacer('e', 3, 3);
|
||||
instance.setPosition(a);
|
||||
expResult = 2;
|
||||
result = a.getPosX();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
|
||||
System.out.println ("\t 5er cas : Sud de 1");
|
||||
a = instance.deplacer('s', 3, 3);
|
||||
expResult = 1;
|
||||
result = a.getPosY();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
instance.setPosition(a);
|
||||
System.out.println ("\t 6er cas : hors limite vers le Sud");
|
||||
a = instance.deplacer('s', 3, 3);
|
||||
instance.setPosition(a);
|
||||
a = instance.deplacer('s', 3, 3);
|
||||
instance.setPosition(a);
|
||||
expResult = 2;
|
||||
result = a.getPosY();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
|
||||
System.out.println ("\t 7eme cas : Ouest de 1");
|
||||
a = instance.deplacer('o', 3, 3);
|
||||
expResult = 1;
|
||||
result = a.getPosX();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
instance.setPosition(a);
|
||||
System.out.println ("\t 8eme cas : hors limite vers le Sud");
|
||||
a = instance.deplacer('o', 3, 3);
|
||||
instance.setPosition(a);
|
||||
a = instance.deplacer('o', 3, 3);
|
||||
instance.setPosition(a);
|
||||
expResult = 0;
|
||||
result = a.getPosX();
|
||||
assertEquals("Pb déplacement",expResult, result );
|
||||
//instance.deplacer(direction, nbCol, nbLignes);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
}
|
||||
|
||||
}
|
92
ChasseTresor/test/metier/PositionTest.java
Normal file
92
ChasseTresor/test/metier/PositionTest.java
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit5TestClass.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class PositionTest {
|
||||
|
||||
public PositionTest() {
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPosX method, of class Position.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPosX() {
|
||||
System.out.println("getPosX");
|
||||
Position instance = new Position();
|
||||
int expResult = 0;
|
||||
int result = instance.getPosX();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPosY method, of class Position.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPosY() {
|
||||
System.out.println("getPosY");
|
||||
Position instance = new Position();
|
||||
int expResult = 0;
|
||||
int result = instance.getPosY();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of setX method, of class Position.
|
||||
*/
|
||||
@Test
|
||||
public void testSetX() {
|
||||
System.out.println("setX");
|
||||
int x = 0;
|
||||
Position instance = new Position();
|
||||
instance.setX(x);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of setY method, of class Position.
|
||||
*/
|
||||
@Test
|
||||
public void testSetY() {
|
||||
System.out.println("setY");
|
||||
int y = 0;
|
||||
Position instance = new Position();
|
||||
instance.setY(y);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of toString method, of class Position.
|
||||
*/
|
||||
@Test
|
||||
public void testToString() {
|
||||
System.out.println("toString");
|
||||
Position instance = new Position();
|
||||
String expResult = "";
|
||||
String result = instance.toString();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
121
ChasseTresor/test/metier/RecifTest.java
Normal file
121
ChasseTresor/test/metier/RecifTest.java
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit4TestClass.java to edit this template
|
||||
*/
|
||||
package metier;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.lalorcey
|
||||
*/
|
||||
public class RecifTest {
|
||||
|
||||
public RecifTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getDangerosite method, of class Recif.
|
||||
*/
|
||||
@Test
|
||||
public void testGetDangerosite() {
|
||||
System.out.println("getDangerosite");
|
||||
Recif instance = new Recif();
|
||||
int expResult = 0;
|
||||
int result = instance.getDangerosite();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getLaPosition method, of class Recif.
|
||||
*/
|
||||
@Test
|
||||
public void testGetLaPosition() {
|
||||
System.out.println("getLaPosition");
|
||||
Recif instance = new Recif();
|
||||
Position expResult = null;
|
||||
Position result = instance.getLaPosition();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of setDangerosite method, of class Recif.
|
||||
*/
|
||||
@Test
|
||||
public void testSetDangerosite() {
|
||||
System.out.println("setDangerosite");
|
||||
int dangerosite = 0;
|
||||
Recif instance = new Recif();
|
||||
instance.setDangerosite(dangerosite);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of setLaPosition method, of class Recif.
|
||||
*/
|
||||
@Test
|
||||
public void testSetLaPosition() {
|
||||
System.out.println("setLaPosition");
|
||||
Position laPosition = null;
|
||||
Recif instance = new Recif();
|
||||
instance.setLaPosition(laPosition);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of toString method, of class Recif.
|
||||
*/
|
||||
@Test
|
||||
public void testToString() {
|
||||
System.out.println("toString");
|
||||
Recif instance = new Recif();
|
||||
String expResult = "";
|
||||
String result = instance.toString();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of hashCode method, of class Recif.
|
||||
*/
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
System.out.println("hashCode");
|
||||
Recif instance = new Recif();
|
||||
int expResult = 0;
|
||||
int result = instance.hashCode();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of equals method, of class Recif.
|
||||
*/
|
||||
@Test
|
||||
public void testEquals() {
|
||||
System.out.println("equals");
|
||||
Object obj = null;
|
||||
Recif instance = new Recif();
|
||||
boolean expResult = false;
|
||||
boolean result = instance.equals(obj);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
22
ChasseTresor/test/metier/sqdd.java
Normal file
22
ChasseTresor/test/metier/sqdd.java
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
package metier;
|
||||
|
||||
/**
|
||||
* @author emile malcuit
|
||||
* @version 1
|
||||
*/
|
||||
public class sqdd {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO code application logic here
|
||||
Jeu ju = new Jeu();
|
||||
Position pos = new Position(10, 10);
|
||||
Joueur j = new Joueur("j", 12, pos);
|
||||
Tresor t = new Tresor("coffre", 11, 10);
|
||||
System.out.println(ju.gagner(t, j));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user