Some restructuring
This commit is contained in:
parent
2be456964a
commit
872cd8bec4
@ -1,11 +1,15 @@
|
|||||||
bidict==0.22.1
|
bidict==0.22.1
|
||||||
click==8.1.3
|
click==8.1.3
|
||||||
colorama==0.4.6
|
colorama==0.4.6
|
||||||
|
dnspython==2.3.0
|
||||||
|
eventlet==0.33.3
|
||||||
Flask==2.2.2
|
Flask==2.2.2
|
||||||
Flask-SocketIO==5.3.2
|
Flask-SocketIO==5.3.2
|
||||||
|
greenlet==2.0.2
|
||||||
itsdangerous==2.1.2
|
itsdangerous==2.1.2
|
||||||
Jinja2==3.1.2
|
Jinja2==3.1.2
|
||||||
MarkupSafe==2.1.2
|
MarkupSafe==2.1.2
|
||||||
python-engineio==4.3.4
|
python-engineio==4.3.4
|
||||||
python-socketio==5.7.2
|
python-socketio==5.7.2
|
||||||
|
six==1.16.0
|
||||||
Werkzeug==2.2.2
|
Werkzeug==2.2.2
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
from flask import Flask, request
|
from flask import Flask, request
|
||||||
from flask_socketio import SocketIO, emit, join_room, rooms
|
from flask_socketio import SocketIO, emit, join_room, rooms
|
||||||
|
|
||||||
from venture.code import make_code
|
from gencode import make_code
|
||||||
from venture.game import Game
|
from game import Game
|
||||||
|
|
||||||
games = {}
|
games = {}
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask('venture')
|
||||||
app.config['SECRET_KEY'] = 'secret!'
|
|
||||||
socketio = SocketIO(app, cors_allowed_origins="*")
|
socketio = SocketIO(app, cors_allowed_origins="*")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
socketio.run(app)
|
|
||||||
|
|
||||||
def with_game(listener):
|
def with_game(listener):
|
||||||
global games
|
global games
|
||||||
room = rooms()[1]
|
room = rooms()[1]
|
||||||
@ -26,7 +22,6 @@ def with_game(listener):
|
|||||||
def on_newgame():
|
def on_newgame():
|
||||||
data = {}
|
data = {}
|
||||||
code = make_code()
|
code = make_code()
|
||||||
|
|
||||||
games[code] = Game(code)
|
games[code] = Game(code)
|
||||||
join_room(code)
|
join_room(code)
|
||||||
emit('set-code', {'code': code})
|
emit('set-code', {'code': code})
|
||||||
@ -39,3 +34,9 @@ def on_join_contestant(data):
|
|||||||
join_room(room)
|
join_room(room)
|
||||||
games[room].add_contestant(sid, signature)
|
games[room].add_contestant(sid, signature)
|
||||||
emit('contestant-joined', {'sid': sid, 'signature': signature }, to=room)
|
emit('contestant-joined', {'sid': sid, 'signature': signature }, to=room)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
socketio.run(app, host='0.0.0.0', debug=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user