Reset project
@@ -1 +0,0 @@
|
||||
AlienDefence
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="14" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="false" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="14" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/VL_AlienDefence.iml" filepath="$PROJECT_DIR$/VL_AlienDefence.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -7,7 +7,7 @@ Ihnen liegen eine funktionierende Angriffswelt, verschiedene Menüs und ein spie
|
||||
|
||||
In den Räumlichkeiten der Schick&Kannix gibt es einiges, was Ihnen bei der Entwicklung helfen kann. Zum einen finden Sie hier den Quellcode des Spiels.
|
||||
|
||||
Auch wurde ein Scrumboard zurückgelassen, das noch die aktuellen ToDos bei dem Projekt zeigt.
|
||||
Auch wurde ein Scrumboard zurückgelassen, das noch die aktuellen ToDos bei dem Projekt zeigt: https://trello.com/b/LorKrW1Z/ls03-alien-defence .
|
||||
Außerdem gibt es eine kleine Fachbibliothek mit Literatur, die für die Fertigstellung der Software wichtig ist, und die Sie in jedem Abschnitt in Moodle finden.
|
||||
|
||||
Also auf gehts ans Werk!
|
||||
@@ -2,7 +2,10 @@
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../.." />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,37 +0,0 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group 'de.oszimt.ls'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
/**
|
||||
* 1st approach: Setting encoding during compilation in Java and Test classes
|
||||
*/
|
||||
compileJava.options.encoding = "UTF-8"
|
||||
compileTestJava.options.encoding = "UTF-8"
|
||||
|
||||
/**
|
||||
* 2nd approach: Setting encoding during compilation in Java and Test classes
|
||||
*/
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks.withType(Test) {
|
||||
systemProperty "file.encoding", "UTF-8"
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
org.gradle.warning.mode=none
|
||||
org.gradle.jvmargs=-Dfile.encoding=UTF8
|
||||
@@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,185 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -1,89 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,2 +0,0 @@
|
||||
rootProject.name = 'AlienDefence'
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.0.9
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: 127.0.0.1
|
||||
-- Erstellungszeit: 11. Feb 2021 um 09:23
|
||||
-- Server Version: 5.6.14
|
||||
-- PHP-Version: 5.5.6
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- Datenbank: `alien_defence`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Tabellenstruktur für Tabelle `levels`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `levels` (
|
||||
`P_level_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`background` varchar(100) NOT NULL,
|
||||
`duration` int(11) NOT NULL,
|
||||
PRIMARY KEY (`P_level_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=4 ;
|
||||
|
||||
--
|
||||
-- Daten für Tabelle `levels`
|
||||
--
|
||||
|
||||
INSERT INTO `levels` (`P_level_id`, `name`, `background`, `duration`) VALUES
|
||||
(1, 'Level 1', 'background_1.jpg', 10000),
|
||||
(2, 'Level 2', 'background_2.jpg', 5000),
|
||||
(3, 'Level 3', 'background_10.jpg', 10000);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Tabellenstruktur für Tabelle `targets`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `targets` (
|
||||
`P_target_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`F_level_id` int(11) NOT NULL,
|
||||
`x_position` int(11) NOT NULL,
|
||||
`y_position` int(11) NOT NULL,
|
||||
`width` int(11) NOT NULL,
|
||||
`height` int(11) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`duration` int(11) NOT NULL,
|
||||
`image_address` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`P_target_id`),
|
||||
KEY `FK LEVELS ID` (`F_level_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=60 ;
|
||||
|
||||
--
|
||||
-- Daten für Tabelle `targets`
|
||||
--
|
||||
|
||||
INSERT INTO `targets` (`P_target_id`, `F_level_id`, `x_position`, `y_position`, `width`, `height`, `time`, `duration`, `image_address`) VALUES
|
||||
(40, 1, 100, 100, 150, 50, 1000, 2000, 'ufo_1.png'),
|
||||
(41, 1, 500, 100, 150, 50, 2000, 2000, 'ufo_2.png'),
|
||||
(44, 1, 800, 800, 150, 50, 3000, 2000, 'ufo_3.png'),
|
||||
(51, 1, 600, 400, 150, 50, 4000, 1000, 'ufo_4.png'),
|
||||
(52, 1, 200, 400, 150, 50, 5000, 1500, 'ufo_5.png'),
|
||||
(53, 1, 1000, 800, 150, 50, 6000, 1000, 'ufo_3.png'),
|
||||
(54, 1, 500, 500, 150, 50, 7000, 1000, 'ufo_1.png'),
|
||||
(55, 2, 600, 400, 150, 50, 1000, 2000, 'ufo_3.png'),
|
||||
(56, 2, 400, 600, 150, 50, 2000, 2000, 'ufo_2.png'),
|
||||
(57, 3, 600, 400, 150, 50, 1000, 1000, 'ufo_3.png'),
|
||||
(58, 3, 600, 400, 150, 50, 6000, 1000, 'ufo_3.png'),
|
||||
(59, 3, 100, 300, 400, 150, 4000, 1000, 'ufo_3.png');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Tabellenstruktur für Tabelle `attempts`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `attempts` (
|
||||
`P_attempt_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`F_user_id` int(11) NOT NULL,
|
||||
`F_level_id` int(11) NOT NULL,
|
||||
`shots` int(11) NOT NULL,
|
||||
`hits` int(11) NOT NULL,
|
||||
`reaction_time` int(11) NOT NULL,
|
||||
`date` date NOT NULL,
|
||||
`time` time NOT NULL,
|
||||
PRIMARY KEY (`P_attempt_id`),
|
||||
KEY `FK PARTICIPANTS ID` (`F_user_id`),
|
||||
KEY `FK LEVELS2 ID` (`F_level_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=333 ;
|
||||
|
||||
--
|
||||
-- Daten für Tabelle `attempt`
|
||||
--
|
||||
|
||||
INSERT INTO `attempts` (`P_attempt_id`, `F_user_id`, `F_level_id`, `shots`, `hits`, `reaction_time`, `date`, `time`) VALUES
|
||||
(278, 1, 3, 3, 2, 2214, '2020-08-15', '09:23:32'),
|
||||
(279, 1, 3, 3, 3, -942, '2020-08-15', '09:24:04'),
|
||||
(299, 1, 3, 3, 2, 3533, '2020-08-15', '10:16:46'),
|
||||
(300, 1, 3, 5, 2, 2451, '2020-08-15', '10:17:21'),
|
||||
(303, 1, 3, 5, 3, -979, '2020-08-15', '10:32:21'),
|
||||
(304, 1, 3, 9, 2, 878, '2020-08-15', '10:32:49'),
|
||||
(313, 1, 2, 2, 1, 571, '2020-08-15', '13:56:01'),
|
||||
(314, 1, 2, 4, 2, 1101, '2020-08-15', '14:21:01'),
|
||||
(315, 1, 1, 10, 4, 514, '2020-08-15', '14:21:30'),
|
||||
(316, 1, 2, 3, 2, 724, '2020-08-15', '14:23:59'),
|
||||
(317, 1, 2, 0, 0, 0, '2020-08-15', '16:03:36'),
|
||||
(318, 1, 2, 4, 2, 651, '2020-08-15', '16:23:43'),
|
||||
(319, 1, 2, 6, 2, 1262, '2020-08-15', '17:09:40'),
|
||||
(320, 1, 2, 6, 2, 784, '2020-08-15', '17:11:35'),
|
||||
(321, 1, 2, 3, 1, 1857, '2020-08-15', '17:11:51'),
|
||||
(322, 1, 1, 7, 6, 1021, '2021-02-09', '10:15:41'),
|
||||
(323, 1, 1, 6, 6, 664, '2021-02-09', '10:16:19'),
|
||||
(324, 1, 1, 5, 5, 1000, '2021-02-09', '15:14:03'),
|
||||
(325, 1, 1, 20, 7, 300, '2021-02-09', '15:14:45'),
|
||||
(326, 1, 1, 5, 5, 703, '2021-02-09', '15:57:42'),
|
||||
(327, 1, 1, 0, 0, 0, '2021-02-09', '16:20:42'),
|
||||
(328, 1, 1, 7, 7, 622, '2021-02-09', '17:37:38'),
|
||||
(329, 1, 3, 2, 2, -1772, '2021-02-09', '17:37:57'),
|
||||
(330, 1, 1, 27, 6, 935, '2021-02-10', '15:34:13'),
|
||||
(331, 1, 1, 7, 7, 660, '2021-02-10', '15:44:01'),
|
||||
(332, 1, 1, 3, 3, 1013, '2021-02-11', '08:39:39');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Tabellenstruktur für Tabelle `users`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `users` (
|
||||
`P_user_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`first_name` varchar(100) NOT NULL,
|
||||
`sur_name` varchar(100) NOT NULL,
|
||||
`birthday` date NOT NULL,
|
||||
`street` varchar(100) NOT NULL,
|
||||
`house_number` varchar(6) NOT NULL,
|
||||
`postal_code` char(5) NOT NULL,
|
||||
`city` varchar(100) NOT NULL,
|
||||
`login_name` varchar(100) NOT NULL,
|
||||
`password` varchar(100) NOT NULL,
|
||||
`salary_expectations` int(100) NOT NULL,
|
||||
`marital_status` varchar(100) NOT NULL,
|
||||
`final_grade` decimal(3,2) NOT NULL,
|
||||
PRIMARY KEY (`P_user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=6 ;
|
||||
|
||||
--
|
||||
-- Daten für Tabelle `users`
|
||||
--
|
||||
|
||||
INSERT INTO `users` (`P_user_id`, `first_name`, `sur_name`, `birthday`, `street`, `house_number`, `postal_code`, `city`, `login_name`, `password`, `salary_expectations`, `marital_status`, `final_grade`) VALUES
|
||||
(1, 'Mike', 'Leveltester', '2000-10-25', 'Testweg', '1', '10245', 'Berlin', 'test', 'pass', 36000, 'Roboter', '1.00'),
|
||||
(2, 'MC', 'A', '1998-02-03', 'Brooklynstreet', '2', '10113', 'NYC', 'user', 'pass', 100000, 'ledig', '2.40'),
|
||||
(3, 'Susanne', 'König', '2001-12-25', 'Hasenweg', '4', '08900', 'Bretnig-Hauswalde', 'susi', 'pass', 20000, 'verheirate', '2.90'),
|
||||
(4, 'Jan', 'Jonas', '2004-02-29', 'Galihag', '111C', '10317', 'Berlin', 'jan', 'pass', 44444, 'ledig', '1.00'),
|
||||
(5, 'Felix', 'DelSande', '1985-04-01', 'Lerchenweg', '23', '10245', 'Berlin', 'felix', 'pass', 36000, 'ledig', '3.70');
|
||||
|
||||
--
|
||||
-- Constraints der exportierten Tabellen
|
||||
--
|
||||
|
||||
--
|
||||
-- Constraints der Tabelle `targets`
|
||||
--
|
||||
ALTER TABLE `targets`
|
||||
ADD CONSTRAINT `FK LEVELS ID` FOREIGN KEY (`F_level_id`) REFERENCES `levels` (`P_level_id`);
|
||||
|
||||
ALTER TABLE `attempts`
|
||||
ADD CONSTRAINT `FK LEVEL ID` FOREIGN KEY (`F_level_id`) REFERENCES `levels` (`P_level_id`);
|
||||
|
||||
ALTER TABLE `attempts`
|
||||
ADD CONSTRAINT `FK USER ID` FOREIGN KEY (`F_user_id`) REFERENCES `users` (`P_user_id`);
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -1,8 +1,8 @@
|
||||
package controller;
|
||||
package de.oszimt.ls.aliendefence.controller;
|
||||
|
||||
import model.Level;
|
||||
import model.persistence.IPersistance;
|
||||
import toDo.User;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IPersistance;
|
||||
import de.oszimt.ls.aliendefence.toDo.User;
|
||||
|
||||
public class AlienDefenceController {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package controller;
|
||||
package de.oszimt.ls.aliendefence.controller;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import model.Level;
|
||||
import model.persistence.IAttemptPersistance;
|
||||
import model.persistence.IPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IAttemptPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IPersistance;
|
||||
|
||||
public class AttemptController {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package controller;
|
||||
package de.oszimt.ls.aliendefence.controller;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import model.Level;
|
||||
import model.Point;
|
||||
import model.Target;
|
||||
import toDo.User;
|
||||
import view.menue.Highscore;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.Point;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
import de.oszimt.ls.aliendefence.toDo.User;
|
||||
import de.oszimt.ls.aliendefence.view.menue.Highscore;
|
||||
|
||||
public class GameController {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package controller;
|
||||
package de.oszimt.ls.aliendefence.controller;
|
||||
|
||||
public class HitCounter {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package controller;
|
||||
package de.oszimt.ls.aliendefence.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import model.Level;
|
||||
import model.persistence.ILevelPersistance;
|
||||
import model.persistence.IPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ILevelPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IPersistance;
|
||||
|
||||
public class LevelController {
|
||||
|
||||
private ILevelPersistance levelPersistance;
|
||||
private final ILevelPersistance levelPersistance;
|
||||
public final String DEFAULT_LEVELNAME = "unnamed";
|
||||
public final String DEFAULT_BACKGROUND_PICTURE_URL = "background_1.jpg";
|
||||
public final long DEFAULT_DURATION = 90000L;
|
||||
@@ -1,12 +1,12 @@
|
||||
package controller;
|
||||
package de.oszimt.ls.aliendefence.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import model.Level;
|
||||
import model.Target;
|
||||
import model.persistence.IPersistance;
|
||||
import model.persistence.ITargetPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ITargetPersistance;
|
||||
|
||||
public class TargetController {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package model;
|
||||
package de.oszimt.ls.aliendefence.model;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Vector;
|
||||
|
||||
import toDo.User;
|
||||
import de.oszimt.ls.aliendefence.toDo.User;
|
||||
|
||||
public class Attempt {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package model;
|
||||
package de.oszimt.ls.aliendefence.model;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package model;
|
||||
package de.oszimt.ls.aliendefence.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package model;
|
||||
package de.oszimt.ls.aliendefence.model;
|
||||
|
||||
public class Point {
|
||||
private int x;
|
||||
@@ -1,4 +1,4 @@
|
||||
package model;
|
||||
package de.oszimt.ls.aliendefence.model;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package model.persistence;
|
||||
package de.oszimt.ls.aliendefence.model.persistence;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
|
||||
public interface IAttemptPersistance {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package model.persistence;
|
||||
package de.oszimt.ls.aliendefence.model.persistence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
|
||||
public interface ILevelPersistance {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package model.persistence;
|
||||
package de.oszimt.ls.aliendefence.model.persistence;
|
||||
|
||||
public interface IPersistance {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package model.persistence;
|
||||
package de.oszimt.ls.aliendefence.model.persistence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import model.Target;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
|
||||
public interface ITargetPersistance {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package de.oszimt.ls.aliendefence.model.persistence;
|
||||
|
||||
import de.oszimt.ls.aliendefence.toDo.User;
|
||||
|
||||
public interface IUserPersistance {
|
||||
|
||||
User readUser(String username);
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package model.persistenceDB;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDB;
|
||||
|
||||
public class AccessDB {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package model.persistenceDB;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDB;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
@@ -11,10 +11,10 @@ import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Vector;
|
||||
|
||||
import model.Attempt;
|
||||
import model.Level;
|
||||
import model.persistence.IAttemptPersistance;
|
||||
import toDo.User;
|
||||
import de.oszimt.ls.aliendefence.model.Attempt;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IAttemptPersistance;
|
||||
import de.oszimt.ls.aliendefence.toDo.User;
|
||||
|
||||
public class AttemptDB implements IAttemptPersistance {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package model.persistenceDB;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDB;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
@@ -9,9 +9,9 @@ import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import model.Level;
|
||||
import model.persistence.ILevelPersistance;
|
||||
import model.persistence.ITargetPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ILevelPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ITargetPersistance;
|
||||
|
||||
public class LevelDB implements ILevelPersistance {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package model.persistenceDB;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDB;
|
||||
|
||||
import model.persistence.IAttemptPersistance;
|
||||
import model.persistence.ILevelPersistance;
|
||||
import model.persistence.IPersistance;
|
||||
import model.persistence.ITargetPersistance;
|
||||
import model.persistence.IUserPersistance;
|
||||
import toDo.UserDB;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IAttemptPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ILevelPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ITargetPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IUserPersistance;
|
||||
import de.oszimt.ls.aliendefence.toDo.UserDB;
|
||||
|
||||
public class PersistanceDB implements IPersistance{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package model.persistenceDB;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDB;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
@@ -9,9 +9,9 @@ import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import model.Hitbox;
|
||||
import model.Target;
|
||||
import model.persistence.ITargetPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Hitbox;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ITargetPersistance;
|
||||
|
||||
public class TargetDB implements ITargetPersistance {
|
||||
private AccessDB dbAccess;
|
||||
@@ -1,9 +1,9 @@
|
||||
package model.persistenceDummy;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDummy;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import model.Level;
|
||||
import model.persistence.IAttemptPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IAttemptPersistance;
|
||||
|
||||
/**
|
||||
* Klasse mit Dummywerten zum Testen der View und des Controllers
|
||||
@@ -1,11 +1,11 @@
|
||||
package model.persistenceDummy;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDummy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import model.Level;
|
||||
import model.Target;
|
||||
import model.persistence.ILevelPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ILevelPersistance;
|
||||
|
||||
public class LevelDummy implements ILevelPersistance {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package model.persistenceDummy;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDummy;
|
||||
|
||||
import model.persistence.IAttemptPersistance;
|
||||
import model.persistence.ILevelPersistance;
|
||||
import model.persistence.IPersistance;
|
||||
import model.persistence.ITargetPersistance;
|
||||
import model.persistence.IUserPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IAttemptPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ILevelPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ITargetPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IUserPersistance;
|
||||
|
||||
public class PersistanceDummy implements IPersistance{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package model.persistenceDummy;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDummy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import model.Target;
|
||||
import model.persistence.ITargetPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.ITargetPersistance;
|
||||
|
||||
public class TargetDummy implements ITargetPersistance {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package model.persistenceDummy;
|
||||
package de.oszimt.ls.aliendefence.model.persistenceDummy;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import model.persistence.IUserPersistance;
|
||||
import toDo.User;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IUserPersistance;
|
||||
import de.oszimt.ls.aliendefence.toDo.User;
|
||||
|
||||
/**
|
||||
* Dummyklasse zum Testen
|
||||
@@ -1,4 +1,4 @@
|
||||
package toDo;
|
||||
package de.oszimt.ls.aliendefence.toDo;
|
||||
|
||||
//TODO create a usermanagement
|
||||
public class CreateUserWindow {
|
||||
@@ -1,4 +1,4 @@
|
||||
package toDo;
|
||||
package de.oszimt.ls.aliendefence.toDo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package toDo;
|
||||
package de.oszimt.ls.aliendefence.toDo;
|
||||
|
||||
import model.persistence.IUserPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IUserPersistance;
|
||||
|
||||
/**
|
||||
* controller for users
|
||||
* de.oszimt.ls.aliendefence.controller for users
|
||||
* @author Clara Zufall
|
||||
* TODO implement this class
|
||||
*/
|
||||
@@ -1,4 +1,4 @@
|
||||
package toDo;
|
||||
package de.oszimt.ls.aliendefence.toDo;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
@@ -6,8 +6,8 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import model.persistence.IUserPersistance;
|
||||
import model.persistenceDB.AccessDB;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IUserPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistenceDB.AccessDB;
|
||||
|
||||
/**
|
||||
* databaseconnection for userobjects, Story usermanagement
|
||||
@@ -0,0 +1,16 @@
|
||||
package de.oszimt.ls.aliendefence.view;
|
||||
|
||||
import de.oszimt.ls.aliendefence.controller.AlienDefenceController;
|
||||
import de.oszimt.ls.aliendefence.model.persistence.IPersistance;
|
||||
import de.oszimt.ls.aliendefence.model.persistenceDummy.PersistanceDummy;
|
||||
import de.oszimt.ls.aliendefence.view.menue.MainMenu;
|
||||
|
||||
public class StartAlienDefence {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
IPersistance alienDefenceModel = new PersistanceDummy();//TODO new PersistanceDB();
|
||||
AlienDefenceController alienDefenceController = new AlienDefenceController(alienDefenceModel);
|
||||
MainMenu.show(alienDefenceController);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package view.game;
|
||||
package de.oszimt.ls.aliendefence.view.game;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Point;
|
||||
@@ -7,7 +7,8 @@ import java.awt.Toolkit;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import controller.GameController;
|
||||
import de.oszimt.ls.aliendefence.controller.GameController;
|
||||
import pictures._Res;
|
||||
|
||||
/**
|
||||
* GUI der Klasse _______
|
||||
@@ -28,7 +29,7 @@ public class GameGUI extends JFrame {
|
||||
public GameGUI(GameController gc) {
|
||||
super("Spiel v0.0 - FPS: ");
|
||||
|
||||
setCursor(Toolkit.getDefaultToolkit().createCustomCursor(new ImageIcon("pictures/crosshair.png").getImage(),
|
||||
setCursor(Toolkit.getDefaultToolkit().createCustomCursor(_Res.image("crosshair.png"),
|
||||
new Point(10, 10), "Cursor"));
|
||||
|
||||
// Fenstergestaltung
|
||||
@@ -45,6 +46,7 @@ public class GameGUI extends JFrame {
|
||||
|
||||
spielfeld = new GameJPanel(gc);
|
||||
getContentPane().add(spielfeld);
|
||||
setLocationRelativeTo(null);
|
||||
setVisible(true);
|
||||
|
||||
// Startzeit setzen
|
||||
@@ -1,21 +1,19 @@
|
||||
package view.game;
|
||||
package de.oszimt.ls.aliendefence.view.game;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
import controller.GameController;
|
||||
import model.Target;
|
||||
import de.oszimt.ls.aliendefence.controller.GameController;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
import pictures._Res;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class GameJPanel extends JPanel {
|
||||
@@ -25,7 +23,7 @@ public class GameJPanel extends JPanel {
|
||||
private GameController gc;
|
||||
private MouseClickListener mouseClickListener;
|
||||
private List<TargetPainter> rechteckePainter;
|
||||
private BufferedImage img, win, loose;
|
||||
private BufferedImage img, win, lose;
|
||||
private JLabel lblTimeleft;
|
||||
|
||||
public GameJPanel(GameController gc) {
|
||||
@@ -45,14 +43,9 @@ public class GameJPanel extends JPanel {
|
||||
* Spielfläche initialisieren
|
||||
*/
|
||||
public void init() {
|
||||
try {
|
||||
this.img = ImageIO.read(new File("./pictures/" + this.gc.getCurrLevel().getBackgroundImage()));
|
||||
this.win = ImageIO.read(new File("./pictures/YouWin.png"));
|
||||
this.loose = ImageIO.read(new File("./pictures/YouLoose.png"));
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.img = _Res.bimage(this.gc.getCurrLevel().getBackgroundImage());
|
||||
this.win = _Res.bimage("YouWin.png");
|
||||
this.lose = _Res.bimage("YouLoose.png");
|
||||
|
||||
LinkedList<TargetPainter> rechteckePainter = new LinkedList<TargetPainter>();
|
||||
for (Target t : gc.getTargets()) {
|
||||
@@ -71,7 +64,7 @@ public class GameJPanel extends JPanel {
|
||||
if (gc.isHasWon()) {
|
||||
g.drawImage(this.win, 300, 120, null);
|
||||
} else {
|
||||
g.drawImage(this.loose, 300, 120, null);
|
||||
g.drawImage(this.lose, 300, 120, null);
|
||||
}
|
||||
g.setFont(new Font("Arial", Font.PLAIN, 16));
|
||||
// g.drawString(gc.getShotsFired() + " Schüsse mit " + gc.getAccuracy() + " %
|
||||
@@ -1,9 +1,9 @@
|
||||
package view.game;
|
||||
package de.oszimt.ls.aliendefence.view.game;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import controller.GameController;
|
||||
import de.oszimt.ls.aliendefence.controller.GameController;
|
||||
|
||||
public class MouseClickListener extends MouseAdapter {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package view.game;
|
||||
package de.oszimt.ls.aliendefence.view.game;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -7,7 +7,8 @@ import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import model.Target;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
import pictures._Res;
|
||||
|
||||
public class TargetPainter {
|
||||
|
||||
@@ -17,17 +18,8 @@ public class TargetPainter {
|
||||
|
||||
public TargetPainter(Target target) {
|
||||
this.target = target;
|
||||
try {
|
||||
this.image = ImageIO.read(new File("./pictures/" + target.getImageAddress()));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
this.imageDestroyed = ImageIO.read(new File("./pictures/explosion.png"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.image = _Res.bimage(target.getImageAddress());
|
||||
this.imageDestroyed = _Res.bimage("explosion.png");
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package view.menue;
|
||||
package de.oszimt.ls.aliendefence.view.menue;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
@@ -12,8 +12,8 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import controller.AttemptController;
|
||||
import model.Level;
|
||||
import de.oszimt.ls.aliendefence.controller.AttemptController;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
|
||||
public class Highscore extends JFrame {
|
||||
|
||||
@@ -70,7 +70,8 @@ public class Highscore extends JFrame {
|
||||
pnlSouth.add(btnZielndern);
|
||||
|
||||
// fügt Panel mit Button hinzu
|
||||
add(pnlSouth, BorderLayout.SOUTH);
|
||||
add(pnlSouth, BorderLayout.SOUTH);
|
||||
this.setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
public void btnAendern_Clicked(ActionEvent evt) {
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.oszimt.ls.aliendefence.view.menue.LevelChoice">
|
||||
<grid id="27dc6" binding="panel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="6dda1" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="South"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="c85bc" class="javax.swing.JButton" binding="btnNewLevel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="Neues Level"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9382c" class="javax.swing.JButton" binding="btnUpdateLevel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="Ausgewähltes Level bearbeiten"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5f096" class="javax.swing.JButton" binding="btnDeleteLevel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="Level löschen"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="fc00" class="javax.swing.JLabel">
|
||||
<constraints border-constraint="North"/>
|
||||
<properties>
|
||||
<font size="18" style="1"/>
|
||||
<horizontalAlignment value="0"/>
|
||||
<text value="Levelauswahl"/>
|
||||
</properties>
|
||||
</component>
|
||||
<scrollpane id="231d4">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="28513" class="javax.swing.JTable" binding="tblLevels">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,90 @@
|
||||
package de.oszimt.ls.aliendefence.view.menue;
|
||||
|
||||
import de.oszimt.ls.aliendefence.controller.LevelController;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
public class LevelChoice {
|
||||
private JPanel panel;
|
||||
private JButton btnNewLevel;
|
||||
private JButton btnUpdateLevel;
|
||||
private JTable tblLevels;
|
||||
private JButton btnDeleteLevel;
|
||||
|
||||
private final LevelController lvlControl;
|
||||
private final LeveldesignWindow leveldesignWindow;
|
||||
private DefaultTableModel jTableData;
|
||||
|
||||
/**
|
||||
* Create the panel
|
||||
* @param lvlControl
|
||||
* @param leveldesignWindow
|
||||
*/
|
||||
public LevelChoice(LevelController lvlControl, LeveldesignWindow leveldesignWindow) {
|
||||
this.lvlControl = lvlControl;
|
||||
this.leveldesignWindow = leveldesignWindow;
|
||||
|
||||
btnNewLevel.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
btnNewLevel_Clicked();
|
||||
}
|
||||
});
|
||||
|
||||
btnUpdateLevel.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
btnUpdateLevel_Clicked();
|
||||
}
|
||||
});
|
||||
|
||||
btnDeleteLevel.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
btnDeleteLevel_Clicked();
|
||||
}
|
||||
});
|
||||
|
||||
tblLevels.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
this.updateTableData();
|
||||
}
|
||||
|
||||
private String[][] getLevelsAsTableModel() {
|
||||
List<Level> levels = this.lvlControl.readAllLevels();
|
||||
String[][] result = new String[levels.size()][];
|
||||
int i = 0;
|
||||
for (Level l : levels) {
|
||||
result[i++] = l.getData();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void updateTableData() {
|
||||
this.jTableData = new DefaultTableModel(this.getLevelsAsTableModel(), Level.getLevelDescriptions());
|
||||
this.tblLevels.setModel(jTableData);
|
||||
}
|
||||
|
||||
public void btnNewLevel_Clicked() {
|
||||
this.leveldesignWindow.startLevelEditor();
|
||||
}
|
||||
|
||||
public void btnUpdateLevel_Clicked() {
|
||||
int level_id = Integer
|
||||
.parseInt((String) this.tblLevels.getModel().getValueAt(this.tblLevels.getSelectedRow(), 0));
|
||||
this.leveldesignWindow.startLevelEditor(level_id);
|
||||
}
|
||||
|
||||
public void btnDeleteLevel_Clicked() {
|
||||
int level_id = Integer
|
||||
.parseInt((String) this.tblLevels.getModel().getValueAt(this.tblLevels.getSelectedRow(), 0));
|
||||
this.lvlControl.deleteLevel(level_id);
|
||||
this.updateTableData();
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package view.menue;
|
||||
package de.oszimt.ls.aliendefence.view.menue;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
@@ -6,20 +6,14 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import controller.LevelController;
|
||||
import model.Level;
|
||||
import de.oszimt.ls.aliendefence.controller.LevelController;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LevelChooser extends JPanel {
|
||||
public class LevelChooserOld extends JPanel {
|
||||
|
||||
private LevelController lvlControl;
|
||||
private LeveldesignWindow leveldesignWindow;
|
||||
@@ -31,7 +25,7 @@ public class LevelChooser extends JPanel {
|
||||
*
|
||||
* @param leveldesignWindow
|
||||
*/
|
||||
public LevelChooser(LevelController lvlControl, LeveldesignWindow leveldesignWindow) {
|
||||
public LevelChooserOld(LevelController lvlControl, LeveldesignWindow leveldesignWindow) {
|
||||
this.lvlControl = lvlControl;
|
||||
this.leveldesignWindow = leveldesignWindow;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package view.menue;
|
||||
package de.oszimt.ls.aliendefence.view.menue;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
@@ -20,10 +20,10 @@ import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import controller.LevelController;
|
||||
import controller.TargetController;
|
||||
import model.Level;
|
||||
import model.Target;
|
||||
import de.oszimt.ls.aliendefence.controller.LevelController;
|
||||
import de.oszimt.ls.aliendefence.controller.TargetController;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.model.Target;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LevelEditor extends JPanel {
|
||||
@@ -1,4 +1,4 @@
|
||||
package view.menue;
|
||||
package de.oszimt.ls.aliendefence.view.menue;
|
||||
|
||||
import java.awt.CardLayout;
|
||||
|
||||
@@ -6,16 +6,16 @@ import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import controller.LevelController;
|
||||
import controller.TargetController;
|
||||
import model.Level;
|
||||
import de.oszimt.ls.aliendefence.controller.LevelController;
|
||||
import de.oszimt.ls.aliendefence.controller.TargetController;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LeveldesignWindow extends JFrame {
|
||||
|
||||
private LevelController lvlControl;
|
||||
private JPanel contentPane;
|
||||
private LevelChooser cardChooseLevel;
|
||||
private LevelChoice cardChooseLevel;
|
||||
private LevelEditor cardLevelEditor;
|
||||
|
||||
private CardLayout cards;
|
||||
@@ -35,13 +35,14 @@ public class LeveldesignWindow extends JFrame {
|
||||
this.cards = new CardLayout();
|
||||
contentPane.setLayout(cards);
|
||||
|
||||
this.cardChooseLevel = new LevelChooser(lvlControl, this);
|
||||
contentPane.add(cardChooseLevel, "levelChooser");
|
||||
this.cardChooseLevel = new LevelChoice(lvlControl, this);
|
||||
contentPane.add(cardChooseLevel.getPanel(), "levelChooser");
|
||||
|
||||
this.cardLevelEditor = new LevelEditor(this, lvlControl, targetControl, Level.getDefaultLevel());
|
||||
contentPane.add(cardLevelEditor, "levelEditor");
|
||||
|
||||
this.showLevelChooser();
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.oszimt.ls.aliendefence.view.menue.MainMenu">
|
||||
<grid id="27dc6" binding="main" layout-manager="GridLayoutManager" row-count="13" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="326" height="715"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-16777216"/>
|
||||
<foreground color="-1"/>
|
||||
</properties>
|
||||
<border type="empty">
|
||||
<size top="5" left="5" bottom="5" right="5"/>
|
||||
</border>
|
||||
<children>
|
||||
<component id="c5b1d" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="1" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="177" height="9"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font size="26" style="1"/>
|
||||
<foreground color="-16711936"/>
|
||||
<text value="Alien Defence"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8961e" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="1" use-parent-layout="false">
|
||||
<preferred-size width="200" height="103"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
<foreground color="-3552823"/>
|
||||
<icon value="pictures/logo200.png"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="965b" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font size="14" style="1"/>
|
||||
<foreground color="-256"/>
|
||||
<text value="Login:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="14947" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font size="14" style="1"/>
|
||||
<foreground color="-256"/>
|
||||
<text value="Passwort:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b84a7" class="javax.swing.JPasswordField" binding="passwordTextField">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="4aca1" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font size="14" style="1"/>
|
||||
<foreground color="-256"/>
|
||||
<text value="Level:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a16d0" class="javax.swing.JComboBox" binding="level">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="39eaf" class="javax.swing.JButton" binding="playButton">
|
||||
<constraints>
|
||||
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<actionCommand value=""/>
|
||||
<text value="Spielen"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6cda2" class="javax.swing.JButton" binding="testButton">
|
||||
<constraints>
|
||||
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Testen"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9d215" class="javax.swing.JTextField" binding="loginTextField">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="e66c9" class="javax.swing.JButton" binding="highscoreButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Highscore"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7ae73" class="javax.swing.JButton" binding="levelEditorButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="11" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-256"/>
|
||||
<enabled value="true"/>
|
||||
<text value="LevelEditor"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ef1af" class="javax.swing.JButton" binding="exitButton">
|
||||
<constraints>
|
||||
<grid row="12" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-3552823"/>
|
||||
<enabled value="true"/>
|
||||
<text value="Beenden"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,124 @@
|
||||
package de.oszimt.ls.aliendefence.view.menue;
|
||||
|
||||
import de.oszimt.ls.aliendefence.controller.AlienDefenceController;
|
||||
import de.oszimt.ls.aliendefence.controller.GameController;
|
||||
import de.oszimt.ls.aliendefence.model.Level;
|
||||
import de.oszimt.ls.aliendefence.toDo.User;
|
||||
import de.oszimt.ls.aliendefence.view.game.GameGUI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
public class MainMenu {
|
||||
|
||||
private JPanel main;
|
||||
private JTextField loginTextField;
|
||||
private JComboBox level;
|
||||
private JButton playButton;
|
||||
private JButton testButton;
|
||||
private JButton highscoreButton;
|
||||
private JButton levelEditorButton;
|
||||
private JButton exitButton;
|
||||
private JPasswordField passwordTextField;
|
||||
|
||||
public MainMenu(AlienDefenceController alienDefenceController) {
|
||||
|
||||
//fill level chooser
|
||||
// Levelliste für die ComboBox abrufen
|
||||
List<Level> arrLevel = alienDefenceController.getLevelController().readAllLevels();
|
||||
String[] arrLevelNames = getLevelNames(arrLevel);
|
||||
level.setModel(new DefaultComboBoxModel<String>(arrLevelNames));
|
||||
|
||||
// Button Spielen - ActionListener
|
||||
playButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// User aus Datenbank holen
|
||||
User user = alienDefenceController.getAlienDefenceModel().getUserPersistance().readUser(loginTextField.getText());
|
||||
|
||||
// Spielstarten, wenn Nutzer existiert und Passwort übereinstimmt
|
||||
if (user != null && user.getPassword().equals(new String(passwordTextField.getPassword()))) {
|
||||
|
||||
Thread t = new Thread("GameThread") {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
GameController gameController = alienDefenceController.startGame(arrLevel.get(level.getSelectedIndex()), user);
|
||||
new GameGUI(gameController).start();
|
||||
}
|
||||
};
|
||||
t.start();
|
||||
} else {
|
||||
// Fehlermeldung - Zugangsdaten fehlerhaft
|
||||
JOptionPane.showMessageDialog(null, "Zugangsdaten nicht korrekt", "Fehler",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Button Testen - ActionListener
|
||||
testButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// Erstellt Modell von aktuellen Nutzer
|
||||
User user = new User(1, "test", "pass");
|
||||
|
||||
Thread t = new Thread("GameThread") {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
GameController gameController = alienDefenceController.startGame(arrLevel.get(level.getSelectedIndex()), user);
|
||||
new GameGUI(gameController).start();
|
||||
}
|
||||
};
|
||||
t.start();
|
||||
}
|
||||
});
|
||||
|
||||
// Button Highscore
|
||||
highscoreButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new Highscore(alienDefenceController.getAttemptController(), arrLevel.get(level.getSelectedIndex()));
|
||||
}
|
||||
});
|
||||
|
||||
// Button Leveleditor
|
||||
levelEditorButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new LeveldesignWindow(alienDefenceController.getLevelController(), alienDefenceController.getTargetController());
|
||||
}
|
||||
});
|
||||
|
||||
// Button Beenden
|
||||
exitButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private String[] getLevelNames(List<Level> arrLevel) {
|
||||
String[] arrLevelNames = new String[arrLevel.size()];
|
||||
|
||||
for (int i = 0; i < arrLevel.size(); i++) {
|
||||
arrLevelNames[i] = arrLevel.get(i).getName(); // Array aus Arraylist erstellt
|
||||
}
|
||||
|
||||
return arrLevelNames;
|
||||
}
|
||||
|
||||
public static void show(AlienDefenceController alienDefenceController) {
|
||||
JFrame frame = new JFrame("AlienDefence");
|
||||
frame.setContentPane(new MainMenu(alienDefenceController).main);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package model.persistence;
|
||||
|
||||
import toDo.User;
|
||||
|
||||
public interface IUserPersistance {
|
||||
|
||||
User readUser(String username);
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package view;
|
||||
|
||||
import controller.AlienDefenceController;
|
||||
import model.persistence.IPersistance;
|
||||
import model.persistenceDummy.PersistanceDummy;
|
||||
import view.menue.MainMenu;
|
||||
|
||||
public class StartAlienDefence {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
IPersistance alienDefenceModel = new PersistanceDummy();//TODO new PersistanceDB();
|
||||
AlienDefenceController alienDefenceController = new AlienDefenceController(alienDefenceModel);
|
||||
MainMenu mainMenu = new MainMenu(alienDefenceController);
|
||||
|
||||
mainMenu.setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
package view.menue;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import controller.AlienDefenceController;
|
||||
import controller.GameController;
|
||||
import model.Level;
|
||||
import model.persistenceDB.PersistanceDB;
|
||||
import toDo.User;
|
||||
import view.game.GameGUI;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MainMenu extends JFrame {
|
||||
|
||||
private AlienDefenceController alienDefenceController;
|
||||
private JTextField loginTextField;
|
||||
private JPasswordField passwordTextField;
|
||||
private int selectedLevel = 0;
|
||||
|
||||
private String[] getLevelNames(List<Level> arrLevel) {
|
||||
String[] arrLevelNames = new String[arrLevel.size()];
|
||||
|
||||
for (int i = 0; i < arrLevel.size(); i++) {
|
||||
arrLevelNames[i] = arrLevel.get(i).getName(); // Array aus Arraylist erstellt
|
||||
}
|
||||
|
||||
return arrLevelNames;
|
||||
}
|
||||
|
||||
// Konstruktor
|
||||
public MainMenu(AlienDefenceController alienDefenceController) {
|
||||
|
||||
this.alienDefenceController = alienDefenceController;
|
||||
|
||||
// Frame Formatierungen
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds(100, 100, 450, 300);
|
||||
JPanel contentPane = new JPanel();
|
||||
contentPane.setBackground(new Color(0, 0, 0));
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
setContentPane(contentPane);
|
||||
contentPane.setLayout(new GridBagLayout()); // GridBagLayout
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
|
||||
// JLable mit üBerschrift
|
||||
JLabel lblheadline = new JLabel(" ALIEN DEFENCE");
|
||||
lblheadline.setForeground(new Color(124, 252, 0));
|
||||
lblheadline.setFont(new Font("Yu Gothic UI", Font.BOLD, 20));
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
contentPane.add(lblheadline, c);
|
||||
|
||||
// JPanel mit Logo
|
||||
JPanel p = new JPanel() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ImageIcon imageIcon = new ImageIcon("./pictures/logo.png");
|
||||
private Image image = imageIcon.getImage();
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (image != null) {
|
||||
g.drawImage(image, 5, 8, 145, 145, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
c.ipady = 150; // make this component tall
|
||||
c.ipadx = 120;
|
||||
c.weightx = 0.0;
|
||||
c.gridwidth = 15;
|
||||
c.gridx = 0;
|
||||
c.gridy = 1;
|
||||
contentPane.add(p, c);
|
||||
|
||||
// Text Login
|
||||
JLabel loginText = new JLabel("Login: "); // Einfacher Text
|
||||
loginText.setForeground(Color.orange);
|
||||
c.ipady = 0;
|
||||
c.ipadx = 0;
|
||||
c.gridwidth = 0;
|
||||
c.gridx = 0;
|
||||
c.gridy = 2;
|
||||
contentPane.add(loginText, c);
|
||||
|
||||
// Textfeld
|
||||
loginTextField = new JTextField(15);
|
||||
c.gridy = 3;
|
||||
contentPane.add(loginTextField, c);
|
||||
|
||||
// Text Passwort
|
||||
JLabel passwordText = new JLabel("Passwort: "); // Einfacher Text
|
||||
passwordText.setForeground(Color.orange);
|
||||
c.gridy = 4;
|
||||
contentPane.add(passwordText, c);
|
||||
|
||||
// Textfeld
|
||||
passwordTextField = new JPasswordField(15);
|
||||
c.gridy = 5;
|
||||
contentPane.add(passwordTextField, c);
|
||||
|
||||
// Text Level
|
||||
JLabel levelText = new JLabel("Level: "); // Einfacher Text
|
||||
levelText.setForeground(Color.orange);
|
||||
c.gridy = 6;
|
||||
contentPane.add(levelText, c);
|
||||
|
||||
// Levelliste für die ComboBox abrufen
|
||||
List<Level> arrLevel = this.alienDefenceController.getLevelController().readAllLevels();
|
||||
String[] arrLevelNames = getLevelNames(arrLevel);
|
||||
|
||||
// Level Auswahlbox - ActionListener
|
||||
JComboBox<String> combo = new JComboBox<String>(arrLevelNames);
|
||||
c.gridy = 7;
|
||||
contentPane.add(combo, c);
|
||||
ActionListener actLisCombo = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selectedLevel = combo.getSelectedIndex();
|
||||
}
|
||||
};
|
||||
combo.addActionListener(actLisCombo); // Listener
|
||||
|
||||
// Button Spielen - ActionListener
|
||||
JButton btnNewButton = new JButton("Spielen");
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
// User aus Datenbank holen
|
||||
User user = alienDefenceController.getAlienDefenceModel().getUserPersistance().readUser(loginTextField.getText());
|
||||
|
||||
// Spielstarten, wenn Nutzer existiert und Passwort übereinstimmt
|
||||
if (user != null && user.getPassword().equals(new String(passwordTextField.getPassword()))) {
|
||||
|
||||
Thread t = new Thread("GameThread") {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
GameController gameController = alienDefenceController.startGame(arrLevel.get(selectedLevel), user);
|
||||
new GameGUI(gameController).start();
|
||||
}
|
||||
};
|
||||
t.start();
|
||||
} else {
|
||||
// Fehlermeldung - Zugangsdaten fehlerhaft
|
||||
JOptionPane.showMessageDialog(null, "Zugangsdaten nicht korrekt", "Fehler",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
});
|
||||
c.gridy = 8;
|
||||
contentPane.add(btnNewButton, c);
|
||||
|
||||
// Button Testen - ActionListener
|
||||
JButton btnTestButton = new JButton("Testen");
|
||||
btnTestButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
// Erstellt Modell von aktuellen Nutzer
|
||||
User user = new User(1, "test", "pass");
|
||||
|
||||
Thread t = new Thread("GameThread") {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
List<Level> arrLevel = alienDefenceController.getLevelController().readAllLevels();
|
||||
|
||||
GameController gameController = alienDefenceController.startGame(arrLevel.get(selectedLevel), user);
|
||||
new GameGUI(gameController).start();
|
||||
}
|
||||
};
|
||||
t.start();
|
||||
}
|
||||
});
|
||||
c.gridy = 9;
|
||||
contentPane.add(btnTestButton, c);
|
||||
|
||||
// Button Highscore
|
||||
JButton btnNewButton_2 = new JButton("Highscore");
|
||||
|
||||
btnNewButton_2.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new Highscore(alienDefenceController.getAttemptController(), arrLevel.get(selectedLevel));
|
||||
}
|
||||
});
|
||||
// selectedLevel
|
||||
|
||||
c.gridy = 10;
|
||||
contentPane.add(btnNewButton_2, c);
|
||||
|
||||
// Button Leveleditor
|
||||
JButton btnNewButton_1 = new JButton("Leveleditor");
|
||||
btnNewButton_1.setBackground(Color.ORANGE);
|
||||
btnNewButton_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new LeveldesignWindow(alienDefenceController.getLevelController(), alienDefenceController.getTargetController());
|
||||
}
|
||||
});
|
||||
c.gridy = 11;
|
||||
contentPane.add(btnNewButton_1, c);
|
||||
|
||||
// Button Beenden
|
||||
JButton btnNewButton_3 = new JButton("Beenden");
|
||||
btnNewButton_3.setBackground(Color.GRAY);
|
||||
btnNewButton_3.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
c.gridy = 12;
|
||||
c.anchor = GridBagConstraints.PAGE_END;
|
||||
contentPane.add(btnNewButton_3, c);
|
||||
this.pack();
|
||||
}
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,22 @@
|
||||
package pictures;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class _Res {
|
||||
public static Image image(String name){
|
||||
return new ImageIcon(_Res.class.getResource(name)).getImage();
|
||||
}
|
||||
public static BufferedImage bimage(String name){
|
||||
try {
|
||||
return ImageIO.read(_Res.class.getResource(name));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 500 KiB After Width: | Height: | Size: 500 KiB |
|
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 248 KiB |
|
Before Width: | Height: | Size: 577 KiB After Width: | Height: | Size: 577 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 310 KiB |
|
Before Width: | Height: | Size: 592 KiB After Width: | Height: | Size: 592 KiB |
|
Before Width: | Height: | Size: 326 KiB After Width: | Height: | Size: 326 KiB |
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 388 KiB |
|
Before Width: | Height: | Size: 758 KiB After Width: | Height: | Size: 758 KiB |
|
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 887 B |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |