From db4b5e56c266023df0493488bf9a0843bfa7bc46 Mon Sep 17 00:00:00 2001 From: Leonhard Strohmidel <strohmidel@sitepark.com> Date: Wed, 24 Apr 2019 09:04:12 +0200 Subject: [PATCH] +Socketwrapper, +Model on client side --- src/socket.py | 11 +++ .../frontend => static/styles}/frontend.css | 0 src/templates/frontend/frontend.jinja | 96 +------------------ src/templates/frontend/frontend.js | 36 +++++++ 4 files changed, 49 insertions(+), 94 deletions(-) create mode 100644 src/socket.py rename src/{templates/frontend => static/styles}/frontend.css (100%) diff --git a/src/socket.py b/src/socket.py new file mode 100644 index 0000000..3ae0854 --- /dev/null +++ b/src/socket.py @@ -0,0 +1,11 @@ +from flask_socketio import SocketIO + +class Socket: + + def __init__(self, app) + self.socket = SocketIO(app) + + def init_team(self, team, side): + team_dict = { + + } \ No newline at end of file diff --git a/src/templates/frontend/frontend.css b/src/static/styles/frontend.css similarity index 100% rename from src/templates/frontend/frontend.css rename to src/static/styles/frontend.css diff --git a/src/templates/frontend/frontend.jinja b/src/templates/frontend/frontend.jinja index a4b732f..5135e4b 100644 --- a/src/templates/frontend/frontend.jinja +++ b/src/templates/frontend/frontend.jinja @@ -3,8 +3,8 @@ <head> <title>CFD Frontend</title> <meta name="viewport" content="width = device-width, initial-scale = 1"> - <link type="text/css" rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"> - <!--<link type="text/css" rel="stylesheet" href="frontend.css"/>--> + <link type="text/css" rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"/> + <link type="text/css" rel="stylesheet" href="../../static/styles/frontend.css"/> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.8/socket.io.min.js"></script> <script> @@ -86,98 +86,6 @@ }); </script> - <style> - @font-face { font-family: PressStart2P; src: url('../../static/PressStart2P-Regular.ttf'); } - - body{ - font-family: PressStart2P; - } - - #player_select{ - display: none; - } - - #final_screen{ - display: none; - } - - #oponents{ - display: none; - } - - h1, h2, h3, h4, h5 .h1, .h2, .h3, .h4, .h5{ - font-family: PressStart2P; - } - - .defult_row{ - height: 33px; - } - - .answer_row{ - height: 298px; - } - - .team_row{ - height: 200px; - } - - .answer_bg{ - height: 50px; - font-size: 20px; - } - - .fails{ - height: 37px; - color: #c83200; - font-size: 34px; - font-family: PressStart2P; - margin-bottom: 7px; - } - - .largest{ - font-size: 150px; - } - - .xxl{ - font-size: 50px; - } - - .xl{ - font-size: 42px; - } - - .l{ - font-size: 34px; - } - - .ccc-blue{ - color: #0084b0; - } - - .ccc-green{ - color: #00a356; - } - - .bg-black{ - background-color: black !important; - } - - .bg-grey{ - background-color: #1e1e3c; - } - - .table td{ - border: none; - } - - .vertical-center { - min-height: 100%; /* Fallback for browsers do NOT support vh unit */ - min-height: 100vh; /* These two lines are counted as one :-) */ - - display: flex; - align-items: center; - } - </style> </head> <body class="bg-black text-light vertical-center"> diff --git a/src/templates/frontend/frontend.js b/src/templates/frontend/frontend.js index 46e11ce..0d4bd9e 100644 --- a/src/templates/frontend/frontend.js +++ b/src/templates/frontend/frontend.js @@ -30,6 +30,42 @@ class Team{ } } +class Answer{ + constructor (){ + this.points = 0; + this.hidden = True; + this.modifier = 1; + this.answer = ""; + this.uuid = ""; + } +} + +class Question{ + constructor(){ + this.uuid = ""; + this.question = ""; + this.answers = []; + } +} + +class Game{ + constructor (){ + this.name = ""; + this.team_left = null; + this.team_right = null; + this.points_left = 0; + this.ponts_right = 0; + this.round = null; + } +} + +class Round{ + constructor (){ + this.points = 0; + this. + } +} + var socket = io.connect("ws://localhost:5000"); var team_left; -- GitLab