2 new map, fix map name 4+ players
This commit is contained in:
@@ -163,15 +163,6 @@ class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with L
|
||||
}
|
||||
users.foreach(_ ! RefreshLobbyInfo(getLobbyInfoResponse))
|
||||
|
||||
case ChangeIsNecronSelected(isSelected) =>
|
||||
isNecrons = isSelected
|
||||
if (isSelected) {
|
||||
mapsLobby.foreach(map => if (map.map == "2p_meeting_of_minds" || map.map == "2p_shrine_of_excellion_[Rem]") map.isBanned = true)
|
||||
} else {
|
||||
mapsLobby.foreach(map => map.isBanned = false)
|
||||
}
|
||||
users.foreach(_ ! RefreshLobbyInfo(getLobbyInfoResponse))
|
||||
|
||||
case KickSecondPlayer =>
|
||||
if (sender() == host.actorRef) {
|
||||
secondPlayer.foreach(player => player.actorRef ! LobbyFatal("You were kicked from lobby!"))
|
||||
|
||||
@@ -13,10 +13,13 @@ import scala.concurrent.duration.DurationInt
|
||||
import scala.util.{Failure, Success}
|
||||
|
||||
class UserActor(out: ActorRef,
|
||||
userParentActor: ActorRef) extends Actor with LazyLogging {
|
||||
userParentActor: ActorRef,
|
||||
ip: String) extends Actor with LazyLogging {
|
||||
|
||||
implicit val timeout: Timeout = 3.seconds
|
||||
|
||||
val ipAddress: String = ip
|
||||
|
||||
var lobbieActor: Option[ActorRef] = None
|
||||
|
||||
implicit val mapJson: Writes[DeciderMap] = new Writes[DeciderMap] {
|
||||
@@ -42,7 +45,6 @@ class UserActor(out: ActorRef,
|
||||
"status" -> lobby.status,
|
||||
"playerTurn" -> lobby.playerTurn,
|
||||
"selectedType" -> lobby.selectedType,
|
||||
"isNecrons" -> lobby.isNecrons,
|
||||
"maps" -> Json.toJson(lobby.maps)
|
||||
)
|
||||
}
|
||||
@@ -62,7 +64,6 @@ class UserActor(out: ActorRef,
|
||||
"status" -> lobby.status,
|
||||
"playerTurn" -> lobby.playerTurn,
|
||||
"selectedType" -> lobby.selectedType,
|
||||
"isNecrons" -> lobby.isNecrons,
|
||||
"maps" -> Json.toJson(lobby.maps)
|
||||
)))
|
||||
}
|
||||
@@ -154,10 +155,6 @@ class UserActor(out: ActorRef,
|
||||
val lobbyType = (json \ "lobbyType").as[String]
|
||||
lobbieActor.foreach(lobby => lobby ! ChangeLobbyType(lobbyType))
|
||||
|
||||
case Some("changeIsNecronSelected") =>
|
||||
val isNecronSelected = (json \ "isNecronSelected").as[Boolean]
|
||||
lobbieActor.foreach(lobby => lobby ! ChangeIsNecronSelected(isNecronSelected))
|
||||
|
||||
case Some("kickSecondPlayer") =>
|
||||
lobbieActor.foreach(lobby => lobby ! KickSecondPlayer)
|
||||
|
||||
@@ -210,10 +207,11 @@ class UserParentActor(actorSystem: ActorSystem) extends Actor with ActorLogging
|
||||
import UserParentActor._
|
||||
|
||||
override def receive: Receive = LoggingReceive {
|
||||
case Create(id, out) =>
|
||||
val child: ActorRef = actorSystem.actorOf(Props(classOf[UserActor], out, self), s"userActor-$id")
|
||||
case Create(id, ipAddress, out) =>
|
||||
val child: ActorRef = actorSystem.actorOf(Props(classOf[UserActor], out, self, ipAddress), s"userActor-$id")
|
||||
sender() ! child
|
||||
case GetAllUsers =>
|
||||
System.out.print("12123" + context.children)
|
||||
sender() ! context.children
|
||||
}
|
||||
}
|
||||
@@ -221,7 +219,7 @@ class UserParentActor(actorSystem: ActorSystem) extends Actor with ActorLogging
|
||||
|
||||
object UserParentActor {
|
||||
|
||||
case class Create(id: String, out: ActorRef)
|
||||
case class Create(id: String, ipAddress: String, out: ActorRef)
|
||||
|
||||
case object GetAllUsers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user