Autumn meatgrinder

This commit is contained in:
Viktor Kholodov
2021-09-25 03:14:47 +03:00
parent e71480c1f7
commit 52baef061b
5 changed files with 51 additions and 18 deletions
+16
View File
@@ -43,6 +43,8 @@ class LobbieActor(hostUser: LobbyUser) extends Actor with LazyLogging {
private var lobbyType: LobbyType = Last3()
private var isNecrons: Boolean = false
private val mapsLobby: Set[DeciderMap] = {
val configMaps = config.getStringList("maps").asScala
configMaps.map(e => {
@@ -58,6 +60,7 @@ class LobbieActor(hostUser: LobbyUser) extends Actor with LazyLogging {
status.toString(),
playerTurn,
lobbyType.toString(),
isNecrons,
mapsLobby)),
this.self)
@@ -139,6 +142,15 @@ class LobbieActor(hostUser: LobbyUser) extends Actor with LazyLogging {
}
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!"))
@@ -202,6 +214,7 @@ class LobbieActor(hostUser: LobbyUser) extends Actor with LazyLogging {
status.toString(),
playerTurn,
lobbyType.toString(),
isNecrons,
mapsLobby)
}
}
@@ -228,6 +241,8 @@ case class MessageForLobby(message: String)
case class ChangeLobbyType(lobbyType: String)
case class ChangeIsNecronSelected(isSelected: Boolean)
case object InfoQuery
case class UserInfo(name: String, isReady: Boolean)
@@ -238,6 +253,7 @@ case class LobbyInfo(user1Info: UserInfo,
status: String,
playerTurn: BigDecimal,
selectedType: String,
isNecrons: Boolean,
maps: Set[DeciderMap])
class LobbyStatus
+6
View File
@@ -38,6 +38,7 @@ class UserActor(out: ActorRef,
"status" -> lobby.status,
"playerTurn" -> lobby.playerTurn,
"selectedType" -> lobby.selectedType,
"isNecrons" -> lobby.isNecrons,
"maps" -> Json.toJson(lobby.maps)
)
}
@@ -56,6 +57,7 @@ class UserActor(out: ActorRef,
"status" -> lobby.status,
"playerTurn" -> lobby.playerTurn,
"selectedType" -> lobby.selectedType,
"isNecrons" -> lobby.isNecrons,
"maps" -> Json.toJson(lobby.maps)
)))
}
@@ -146,6 +148,10 @@ 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)