This repository has been archived by the owner on Apr 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from bb30/develop
Get project to run on Travis again
- Loading branch information
Showing
46 changed files
with
1,633 additions
and
1,501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
language: scala | ||
|
||
scala: | ||
- 2.12.4 | ||
|
||
script: | ||
- sbt clean coverage test coverageReport | ||
after_success: | ||
- sbt coveralls | ||
language: scala | ||
|
||
scala: | ||
- 2.12.6 | ||
|
||
jdk: | ||
- openjdk11 | ||
|
||
script: | ||
- sbt clean coverage test coverageReport | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) -t 2289df37-0bc4-41a7-8803-45e20561b24f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"version": "2.0.0", | ||
"command": "sbt", | ||
"type": "shell", | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"type": "shell", | ||
"command": "sbt compile", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "test", | ||
"type": "shell", | ||
"command": "sbt test", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "run", | ||
"type": "shell", | ||
"command": "sbt run" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
# 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. | ||
|
||
## 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 | ||
# Learn Duel | ||
|
||
## Build status | ||
Travis: | ||
* develop [![Build Status](https://travis-ci.org/bb30/learn-duel.svg?branch=develop)](https://travis-ci.org/bb30/learn-duel) | ||
* master [![Build Status](https://travis-ci.org/bb30/learn-duel.svg?branch=master)](https://travis-ci.org/bb30/learn-duel) | ||
|
||
codecov: | ||
* develop [![codecov](https://codecov.io/gh/bb30/learn-duel/branch/develop/graph/badge.svg)](https://codecov.io/gh/bb30/learn-duel) | ||
* master [![codecov](https://codecov.io/gh/bb30/learn-duel/branch/master/graph/badge.svg)](https://codecov.io/gh/bb30/learn-duel) | ||
|
||
## 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. | ||
|
||
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
name := "LearnDuel" | ||
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.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 | ||
name := "LearnDuel" | ||
organization := "de.htwg.se" | ||
version := "0.0.1" | ||
scalaVersion := "2.12.6" | ||
|
||
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.4" | ||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" | ||
libraryDependencies += "junit" % "junit" % "4.12" % "test" | ||
|
||
// Add dependency on ScalaFX library | ||
libraryDependencies += "org.scalafx" %% "scalafx" % "12.0.2-R18" | ||
|
||
// Determine OS version of JavaFX binaries | ||
lazy val osName = System.getProperty("os.name") match { | ||
case n if n.startsWith("Linux") => "linux" | ||
case n if n.startsWith("Mac") => "mac" | ||
case n if n.startsWith("Windows") => "win" | ||
case _ => throw new Exception("Unknown platform!") | ||
} | ||
|
||
// Add dependency on JavaFX libraries, OS dependent | ||
lazy val javaFXModules = Seq("base", "controls", "fxml", "graphics", "media", "swing", "web") | ||
libraryDependencies ++= javaFXModules.map( m => | ||
"org.openjfx" % s"javafx-$m" % "12.0.2" classifier osName | ||
) | ||
|
||
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" | ||
|
||
unmanagedSourceDirectories in Compile := (unmanagedSourceDirectories in Compile).value.filter{ _.exists } | ||
unmanagedSourceDirectories in Test := (unmanagedSourceDirectories in Test).value.filter{ _.exists } | ||
|
||
import org.scoverage.coveralls.Imports.CoverallsKeys._ | ||
coverageExcludedPackages := ".*view.*;.*GuiceModule.*;.*LearnDuel.*" | ||
coverageEnabled := true | ||
coverageHighlighting := true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.0.3 | ||
sbt.version=1.3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
package de.htwg.se.learn_duel | ||
|
||
import de.htwg.se.learn_duel.controller.Controller | ||
import de.htwg.se.learn_duel.model.impl.Game | ||
import java.io.BufferedReader | ||
|
||
import com.google.inject.Guice | ||
import de.htwg.se.learn_duel.model.Question | ||
import de.htwg.se.learn_duel.view.{GUI, TUI} | ||
import play.api.libs.json.Json | ||
|
||
import scala.io.Source | ||
|
||
object LearnDuel { | ||
def main(args: Array[String]): Unit = { | ||
val injector = Guice.createInjector(new GuiceModule()) | ||
val controller = injector.getInstance(classOf[Controller]) | ||
def main(args: Array[String]): Unit = { | ||
val injector = Guice.createInjector(new GuiceModule()) | ||
val controller = injector.getInstance(classOf[Controller]) | ||
|
||
val tui = TUI.create(controller) | ||
GUI.create(controller) | ||
val tui = TUI.create(controller) | ||
GUI.create(controller) | ||
|
||
controller.requestUpdate | ||
tui.processInput(new BufferedReader(Console.in)) | ||
} | ||
controller.requestUpdate() | ||
tui.processInput(new BufferedReader(Console.in)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package de.htwg.se.learn_duel | ||
|
||
trait Observable { | ||
private var observers: List[Observer] = List() | ||
def addObserver(observer: Observer): Unit = observers = observer :: observers | ||
def removeObserver(observer: Observer): Unit = observers = observers.filter(_ != observer) | ||
protected def notifyObservers(updateParam: UpdateData): Unit = observers.foreach(o => o.update(updateParam)) | ||
private var observers: List[Observer] = List() | ||
def addObserver(observer: Observer): Unit = observers = observer :: observers | ||
def removeObserver(observer: Observer): Unit = | ||
observers = observers.filter(_ != observer) | ||
protected def notifyObservers(updateParam: UpdateData): Unit = | ||
observers.foreach(o => o.update(updateParam)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
package de.htwg.se.learn_duel | ||
|
||
object UpdateAction extends Enumeration { | ||
type UpdateAction = Value | ||
val BEGIN, CLOSE_APPLICATION, PLAYER_UPDATE, SHOW_HELP, | ||
SHOW_GAME, SHOW_RESULT, TIMER_UPDATE = Value | ||
type UpdateAction = Value | ||
val BEGIN, CLOSE_APPLICATION, PLAYER_UPDATE, SHOW_HELP, SHOW_GAME, | ||
SHOW_RESULT, TIMER_UPDATE = Value | ||
} | ||
import UpdateAction._ | ||
import de.htwg.se.learn_duel.model.Game | ||
|
||
class UpdateData(updateAction: UpdateAction, gameState: Game) { | ||
def getAction(): UpdateAction = updateAction | ||
def getState(): Game = gameState | ||
def getAction: UpdateAction = updateAction | ||
def getState: Game = gameState | ||
} | ||
|
||
trait Observer { | ||
def update(updateData: UpdateData): Unit | ||
def update(updateData: UpdateData): Unit | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/main/scala/de/htwg/se/learn_duel/controller/ControllerException.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package de.htwg.se.learn_duel.controller | ||
|
||
trait ControllerException { | ||
self: Throwable => | ||
val message: String | ||
self: Throwable => | ||
val message: String | ||
} |
Oops, something went wrong.