Additional races

This commit is contained in:
v.holodov
2023-08-05 16:08:50 +03:00
parent 31ce4b7beb
commit ecc69cd7d3
13 changed files with 633 additions and 666 deletions
+1 -15
View File
@@ -48,7 +48,6 @@ class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with L
private var secondPlayerSelectedRaces: Option[SelectedRaces] = None
private val isSolo: Boolean = Try(config.getBoolean(s"deciders.$deciderName.isSolo")).getOrElse(false)
private val mapsLobby: Set[DeciderMap] = {
val configMaps = config.getList(s"deciders.$deciderName.maps").asScala
configMaps.map(e => {
@@ -66,7 +65,6 @@ class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with L
status.toString(),
playerTurn,
lobbyType.toString(),
isSolo,
mapsLobby)),
this.self)
@@ -78,16 +76,6 @@ class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with L
// notify watchers
logger.info(s"Ban map $mapName by ${sender.path.name}")
if (isSolo) {
mapsLobby.find(p => p.map == mapName).foreach(m => m.isBanned = true)
if (isFinish) {
status = Finish()
} else {
status = Draft()
}
refreshAndBanMap(mapName)
}
if (status == Draft()) {
if ((playerTurn == 1 && sender == host.actorRef) ||
(playerTurn == 2 && secondPlayer.exists(_.actorRef == sender))) {
@@ -227,7 +215,6 @@ class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with L
status.toString(),
playerTurn,
lobbyType.toString(),
isSolo,
mapsLobby)
}
@@ -274,7 +261,7 @@ case class ChangeIsNecronSelected(isSelected: Boolean)
case object InfoQuery
case class SelectedRaces(firstRace: Int, secondRace: Int, thirdRace: Int, fourthRace: Int)
case class SelectedRaces(mainRaces: List[Int], additionalRaces: List[Int])
case class UserInfo(name: String, isReady: Boolean, selectedRaces: Option[SelectedRaces] = None)
@@ -285,7 +272,6 @@ case class LobbyInfo(user1Info: UserInfo,
status: String,
playerTurn: BigDecimal,
selectedType: String,
isSolo: Boolean,
maps: Set[DeciderMap])
class LobbyStatus
+4 -5
View File
@@ -173,11 +173,10 @@ class UserActor(out: ActorRef,
lobbieActor.foreach(lobby => lobby ! BanMap(map))
case Some("selectRace") =>
val firstRace = (json \ "raceFirst").as[Int]
val secondRace = (json \ "raceSecond").as[Int]
val thirdRace = (json \ "raceThird").as[Int]
val fourthRace = (json \ "raceFourth").as[Int]
lobbieActor.foreach(lobby => lobby ! SelectedRaces(firstRace, secondRace, thirdRace, fourthRace))
logger.info("RACES: " + json.toString())
val races = (json \ "mainRaces").as[List[Int]]
val additionalRaces = (json \ "additionalRaces").as[List[Int]]
lobbieActor.foreach(lobby => lobby ! SelectedRaces(races, additionalRaces))
case Some("getLobbies") =>
logger.debug("Get all lobby request")