Esempio n. 1
0
 def from_dict(_dict):
     gid = _dict["gid"]
     gname = _dict["gname"]
     status = _dict.get("status", None)
     hostID = _dict["hostID"]
     hostName = _dict["hostName"]
     hostAvatar = _dict["hostAvatar"]
     checkpoints = [Checkpoint.from_dict(cp) for cp in _dict["checkpoints"]]
     players = [
         Player.from_dict(player) for player in _dict.get("players", [])
     ]
     min_players, max_players = _dict.get("min_players",
                                          6), _dict.get("max_players", 20)
     teams = _dict.get("teams", None)
     startTime = _dict.get("startTime", None)
     endTime = _dict.get("endTime", None)
     capturedCount = _dict.get("capturedCount", None)
     unCapturedCount = _dict.get("unCapturedCount", None)
     winTeam = _dict.get("winTeam", None)
     statsCount = dict.get(_dict, "statsCount", 0)
     return Game(gid, gname, status, hostID, hostName, hostAvatar,
                 checkpoints, players, teams, min_players, max_players,
                 startTime, endTime, capturedCount, unCapturedCount,
                 winTeam, statsCount)
Esempio n. 2
0
 def from_dict(_dict):
     gpid = _dict["gpid"]
     checkpoints = [Checkpoint.from_dict(checkpoint) for checkpoint in _dict.get("checkpoints", [])]
     players = [Player.from_dict(player) for player in _dict.get("players", [])]
     min_players, max_players = _dict.get("min_players", 8), _dict.get("max_players", 20)
     return GameParameters(gpid, checkpoints, players, min_players, max_players)