Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #5 from DonatJR/develop
Browse files Browse the repository at this point in the history
'finished' state
  • Loading branch information
DonatJR authored Jan 25, 2018
2 parents 8e6f305 + 4b7a522 commit 82e020b
Show file tree
Hide file tree
Showing 54 changed files with 2,310 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ project/.sbtserver
.sonar/

# Application
yourgame.log
learn-duel.log
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: scala

scala:
- 2.12.4

script:
- sbt clean coverage test coverageReport
after_success:
- sbt coveralls
43 changes: 12 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
# Htwg Scala Seed Project
=====================================================
## the easiest way to start a project for the lecture SE
# Learn Duel [![Build Status](https://travis-ci.org/DonatJR/learn-duel.svg?branch=develop)](https://travis-ci.org/DonatJR/learn-duel) [![Coverage Status](https://coveralls.io/repos/github/DonatJR/learn-duel/badge.svg?branch=develop)](https://coveralls.io/github/DonatJR/learn-duel?branch=develop)

## About
Learn Duel is based on QuizDuel and works in a similar fashion, but with a new twist:
You play with questions based on your school or study assignments.

This is a seed project to create a basic scala project as used in the
class Software Engineering at the University of Applied Science HTWG Konstanz.

It requires Java 8 on your local platform.
The project has
* a folder structure prepared for a MVC-style application
* *ScalaTest* and as dependency aswell as dependencies to other libraries in the build.sbt (commented out at start).
* *scalastyle-sbt-plugin* and *sbt-scoverage* sbt plugins
* .gitignore defaults

The easiest way to create your own project from this seed is
* create an account on github
* navigate to this project on github (https://github.com/markoboger/htwg-scala-seed)
* fork this project on github (button on top right "Fork")
* copy the URL to your fork
* clone the forked project from your local git (git clone <URL>) or IDE (IDEA: File > New > Import from Version Controll > github)

After that, please rename
* the Project name from htwg-scala-seed to <your game name>
* the the package structure from de.htwg.se.yourgame to de.htwg.se.<your game name>
* the name of the project in the build.sbt file from htwg-scala-seed to <your game name>
* the main Class YourGame to <YourGameName>

Then
* push to git
* add team partner to your project on github (Settings > Collaborators)
* clone on partners account
* push and pull back and forth
## Current features
For now, there is only local play, but online features will be added later.
If you are playing alone, the answers can be selected with the mouse or the keys 1-4.
In local multiplayer mode player 1 can specify his answer with the keys 1-4 and
player 2 with the keys 6-9.


## Future features:
- define your own questions
- play with up to 3 friends online and compete against each other
30 changes: 14 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ organization := "de.htwg.se"
version := "0.0.1"
scalaVersion := "2.12.4"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.4"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test"

libraryDependencies += "junit" % "junit" % "4.8" % "test"

//*******************************************************************************//
//Libraries that we will use in later lectures compatible with this scala version
// uncomment to use!!

//libraryDependencies += "org.scala-lang.modules" % "scala-swing_2.12" % "2.0.1"

//libraryDependencies += "com.google.inject" % "guice" % "4.1.0"

//libraryDependencies += "net.codingwell" %% "scala-guice" % "4.1.0"

//libraryDependencies += "org.scala-lang.modules" % "scala-xml_2.12" % "1.0.6"

//libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.6"
libraryDependencies += "junit" % "junit" % "4.12" % "test"

libraryDependencies += "org.scalafx" %% "scalafx" % "8.0.144-R12"
libraryDependencies += "com.google.inject" % "guice" % "4.1.0"
libraryDependencies += "net.codingwell" %% "scala-guice" % "4.1.0"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.6"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.7.2"

import org.scoverage.coveralls.Imports.CoverallsKeys._
coverageExcludedPackages := ".*view.*;.*GuiceModule.*;.*LearnDuel.*"
coverageEnabled := true
coverageHighlighting := true
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ resolvers += Classpaths.sbtPluginReleases
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.2")
2 changes: 1 addition & 1 deletion scalastyle-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<check level="warning" class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.file.RegexChecker" enabled="true">
<check level="warning" class="org.scalastyle.file.RegexChecker" enabled="false">
<parameters>
<parameter name="regex"><![CDATA[println]]></parameter>
</parameters>
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>

<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<!-- path to your log file, where you want to store logs -->
<file>learn-duel.log</file>
<append>false</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<root level="debug">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
52 changes: 52 additions & 0 deletions src/main/resources/questions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[
{
"id": 1,
"text": "What is 1+1?",
"points": 20,
"answers": [
{
"id": 1,
"text": "1"
},
{
"id": 2,
"text": "2"
},
{
"id": 3,
"text": "3"
},
{
"id": 4,
"text": "4"
}
],
"correctAnswer": 2,
"time": 60
},
{
"id": 2,
"text": "What is 5*20?",
"points": 50,
"answers": [
{
"id": 1,
"text": "168"
},
{
"id": 2,
"text": "934"
},
{
"id": 3,
"text": "236"
},
{
"id": 4,
"text": "100"
}
],
"correctAnswer": 4,
"time": 60
}
]
196 changes: 196 additions & 0 deletions src/main/resources/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
/* @import url('https://fonts.googleapis.com/css?family=Roboto:100,300,400,700'); */

.headline {
-fx-font-size: 36px;
-fx-font-family: 'Roboto', sans-serif
}

/* ============================================ */
/* MENU */
/* ============================================ */

.menu {
background-color: #fff;
-fx-font-family: 'Roboto', sans-serif;
-fx-alignment: center;
-fx-spacing: 50px;
}

.play-button {
-fx-text-fill: #fff;
-fx-min-width: 430px;
-fx-min-height: 60px;
-fx-background-color: #259A40;
-fx-cursor: hand;
}

.play-button:hover {
-fx-background-color: #1e7e34;
}

.player-rows-container {
-fx-spacing: 10px;
}

.player-container {
-fx-alignment: center;
-fx-spacing: 10px;
}

.player-textfield {
-fx-min-width: 360px;
-fx-min-height: 30px;
-fx-faint-focus-color: transparent;
-fx-focus-color: gray;
}

.player-textfield-non-editable {
-fx-focus-color: rgb(221,221,221);
-fx-background-color: rgb(221,221,221);
}

.add-remove-buttons {
-fx-min-width: 60px;
-fx-min-height: 30px;
-fx-background-color: rgb(221,221,221);
-fx-cursor: hand;
}

.help-button {
-fx-min-width: 430px;
-fx-min-height: 30px;
-fx-background-color: rgb(221,221,221);
-fx-cursor: hand;
}

.add-remove-buttons:hover, .help-button:hover {
-fx-background-color: lightgray;
}

/* ============================================ */
/* GAME */
/* ============================================ */

.game {
-fx-background-color: #fff;
-fx-font-family: 'Roboto', sans-serif;
-fx-alignment: center;
-fx-spacing: 50px;
}

.answer-container {
-fx-alignment: center;
-fx-spacing: 10px;
}

.answer-button {
-fx-min-width: 430px;
-fx-min-height: 50px;
-fx-background-color: rgb(221,221,221);
-fx-cursor: hand;
}

.answer-button:hover {
-fx-background-color: lightgray;
}

.remaining-time {
-fx-font-family: 'Roboto', sans-serif;
-fx-font-size: 20px;
}

/* ============================================ */
/* RESULT */
/* ============================================ */

.result {
-fx-background-color: #fff;
-fx-font-family: 'Roboto', sans-serif;
-fx-alignment: center;
-fx-spacing: 50px;
}

.player-results {
-fx-alignment: center;
-fx-spacing: 35px;
}

.player-result {
-fx-alignment: center;
-fx-spacing: 20px;
}

.player-name {
-fx-font-size: 20px;
}

.player-points {
-fx-font-size: 12px;
-fx-font-weight: bold;
}

.correct-container {
-fx-alignment: center;
}

.correct-text {
-fx-font-size: 14px;
-fx-fill: #28a745;
}

.correct-answer { }

.wrong-container {
-fx-alignment: center;
}

.wrong-text {
-fx-font-size: 14px;
-fx-fill: #d43f3a;
}

.wrong-answer {}

.winner {
-fx-font-size: 14px;
}

.back-button {
-fx-min-width: 430px;
-fx-min-height: 50px;
-fx-background-color: rgb(221,221,221);
-fx-cursor: hand;
}

.back-button:hover {
-fx-background-color: lightgray;
}

/* ============================================ */
/* HELP */
/* ============================================ */

.dialog-pane {
-fx-background-color: white;
}

.dialog-pane > .content {
-fx-background-color: white;
-fx-background-insets: 10px 20px;
-fx-padding: 10px 20px;
}

.dialog-pane > .button-bar > .container {
-fx-background-color: white;
}

.dialog-pane > .button-bar > .container > .button {
-fx-min-width: 430px;
-fx-min-height: 30px;
-fx-background-color: rgb(221,221,221);
-fx-cursor: hand;
}

.dialog-pane > .button-bar > .container > .button:hover {
-fx-background-color: lightgray;
}
Loading

0 comments on commit 82e020b

Please sign in to comment.