Created
May 15, 2015 11:44
-
-
Save pjazdzewski1990/f91210062609f636f0bf to your computer and use it in GitHub Desktop.
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
class GameManager extends Actor { | |
override def receive = { | |
case CreateGame => | |
val id = GameId.createRandom | |
context.actorOf(GameActor.props(id), id.value) | |
sender() ! GameCreated(id) | |
case SendCommand(gameId, command) => | |
context.child(gameId.value) match { | |
case Some(game) => game forward command | |
case None => sender() ! GameDoesNotExist | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment