Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiplayer #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

varfigstar
Copy link

No description provided.

Copy link

@zotho zotho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight changes

Comment on lines +33 to +36
"""
Only available in multiplayer.
:return:
"""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""
Only available in multiplayer.
:return:
"""
"""Draw score table.
Only available in multiplayer.
"""

daemon=True
).start()
while not self.client_running:
...
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
...
pass

Comment on lines +36 to +39
if event["event_type"] == Events.update_score.value:
self.score_table = event["value"]

elif event["event_type"] == Events.id_message.value:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enums can be checked for equality by is:

Suggested change
if event["event_type"] == Events.update_score.value:
self.score_table = event["value"]
elif event["event_type"] == Events.id_message.value:
event_variant = Events(event["event_type"])
if event_variant is Events.update_score:
self.score_table = event["value"]
elif event_variant is Events.id_message:

self.id = event["value"]

def on_open(self, ws: WebSocketApp):
self.logger.info("open connection with host: {}".format(ws.url))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logging library does formatting for us:
See: https://docs.python.org/3/howto/logging.html#logging-variable-data

Suggested change
self.logger.info("open connection with host: {}".format(ws.url))
self.logger.info("open connection with host: %s", ws.url)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other places too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants