Save unfinished work
This commit is contained in:
parent
b73b4a6de4
commit
9f111aec4e
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
from plugins import writing
|
from plugins import writing
|
||||||
from engine import CurrentScene, Plugin
|
from engine import CurrentScene, Plugin
|
||||||
from engine.ecs import Entity, World
|
from engine.ecs import Entity, World
|
||||||
|
@ -21,6 +22,8 @@ def new_score(world: World, e: Entity):
|
||||||
try:
|
try:
|
||||||
post = {"name": name[Text], "score": world[game.Player1Score]}
|
post = {"name": name[Text], "score": world[game.Player1Score]}
|
||||||
rq.post(f"https://{IP}/new_score", post)
|
rq.post(f"https://{IP}/new_score", post)
|
||||||
|
with open("username.txt", "w") as f:
|
||||||
|
f.write(name[Text])
|
||||||
world.set(CurrentScene(thanks.THANKS))
|
world.set(CurrentScene(thanks.THANKS))
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print("Error with the serveur:", error)
|
print("Error with the serveur:", error)
|
||||||
|
@ -38,6 +41,14 @@ def __spawn_elements(world: World):
|
||||||
Ajoute les éléments du menu dans le monde.
|
Ajoute les éléments du menu dans le monde.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if os.path.exists("username.txt"):
|
||||||
|
with open("username.txt", "r") as f:
|
||||||
|
name = f.read()
|
||||||
|
post = {"name": name, "score": world[game.Player1Score]}
|
||||||
|
rq.post(f"https://{IP}/new_score", post)
|
||||||
|
world.set(CurrentScene(thanks.THANKS))
|
||||||
|
return
|
||||||
|
|
||||||
world.new_entity().set(SpriteBundle("background.png", -5))
|
world.new_entity().set(SpriteBundle("background.png", -5))
|
||||||
world.new_entity().set(
|
world.new_entity().set(
|
||||||
TextBundle(
|
TextBundle(
|
||||||
|
|
1
username.txt
Normal file
1
username.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
david
|
Loading…
Reference in a new issue