Start of fileio

This commit is contained in:
2025-01-15 20:24:25 +01:00
parent 2e0d24adbd
commit a33e404378
4 changed files with 32 additions and 6 deletions

View File

@@ -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)
}
}

View File

@@ -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

View File

@@ -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],
)

View File

@@ -0,0 +1,7 @@
package de.knockoutwhist.persistence;
public interface PersistanceManager {
def saveCurrentGame(game: Game): Unit
}