Start of fileio
This commit is contained in:
@@ -48,4 +48,17 @@ object CardBaseManager extends CardManager {
|
||||
Hand(hand.toList)
|
||||
}
|
||||
|
||||
class CardManagerSnapshot(val cc: List[Card], val currentIdx: Int) {
|
||||
|
||||
def restore(): Unit = {
|
||||
CardBaseManager.cc = cc
|
||||
CardBaseManager.currentIdx = currentIdx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object CardManagerSnapshot {
|
||||
def apply(): CardManagerSnapshot = new CardManagerSnapshot(CardBaseManager.cc, CardBaseManager.currentIdx)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,22 +7,16 @@ import de.knockoutwhist.rounds.{Match, Round, Trick}
|
||||
trait Maincomponent {
|
||||
|
||||
def startMatch(): Unit
|
||||
|
||||
|
||||
def enteredPlayers(players: List[AbstractPlayer]): Unit
|
||||
|
||||
|
||||
def controlMatch(matchImpl: Match): Unit
|
||||
|
||||
|
||||
def controlRound(matchImpl: Match, round: Round): Unit
|
||||
|
||||
|
||||
def endRound(matchImpl: Match, round: Round, winner: AbstractPlayer, playersOut: List[AbstractPlayer]): Unit
|
||||
|
||||
|
||||
def controlTrick(matchImpl: Match, round: Round, trick: Trick, currentIndex: Int = 0): Unit
|
||||
|
||||
|
||||
def controlPlayer(matchImpl: Match, round: Round, trick: Trick, player: AbstractPlayer, currentIndex: Int): Unit
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package de.knockoutwhist.persistence
|
||||
|
||||
import de.knockoutwhist.player.AbstractPlayer
|
||||
import de.knockoutwhist.rounds.{Match, Round, Trick}
|
||||
|
||||
case class MatchSnapshot(
|
||||
matchImpl: Option[Match],
|
||||
round: Option[Round],
|
||||
trick: Option[Trick],
|
||||
currentPlayer: Option[AbstractPlayer],
|
||||
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
package de.knockoutwhist.persistence;
|
||||
|
||||
public interface PersistanceManager {
|
||||
|
||||
def saveCurrentGame(game: Game): Unit
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user