save & load wars
This commit is contained in:
parent
1218f32752
commit
dc854b4065
5 changed files with 52 additions and 50 deletions
|
|
@ -16,18 +16,19 @@ class Round:
|
|||
|
||||
def toDict(self):
|
||||
return {
|
||||
"sectors" : self.sectors,
|
||||
"choices" : self.choices,
|
||||
"battles" : self.battles,
|
||||
"id": self.id,
|
||||
# "sectors" : self.sectors,
|
||||
# "choices" : self.choices,
|
||||
# "battles" : self.battles,
|
||||
"is_over": self.is_over
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def fromDict(id, sectors, choices, battles, is_over):
|
||||
tmp = Round()
|
||||
tmp.set_id(id)
|
||||
## sectors placeholder
|
||||
## choices placeholder
|
||||
## battles placeholder
|
||||
tmp.set_state(is_over)
|
||||
return tmp
|
||||
def fromDict(data: dict):
|
||||
rnd = Round()
|
||||
rnd.set_id(data["id"])
|
||||
# rnd.sectors = data.get("sectors", {})
|
||||
# rnd.choices = data.get("choices", {})
|
||||
# rnd.battles = data.get("battles", {})
|
||||
rnd.set_state(data.get("is_over", False))
|
||||
return rnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue