Browse Source

slight qol changes

Nicolas Winkler 4 years ago
parent
commit
469c6805b4
8 changed files with 36 additions and 19 deletions
  1. 5 3
      questions.txt
  2. 1 8
      src/game.rs
  3. 4 0
      src/server/messages.rs
  4. 1 0
      src/server/protocol.rs
  5. 10 1
      src/server/server.rs
  6. 1 0
      static/comm.js
  7. 1 1
      static/index.html
  8. 13 6
      static/style.css

+ 5 - 3
questions.txt

@@ -65,7 +65,7 @@ Videokonferenztool
 lateinischer Pflanzenname
 lateinischer Pflanzenname
 Maler aus dem 18. Jahrhundert
 Maler aus dem 18. Jahrhundert
 Benutzername für MSN
 Benutzername für MSN
-niederländische Velomarke 
+Niederländische Velomarke 
 Drachenname
 Drachenname
 Figur aus einem Kindermärchen
 Figur aus einem Kindermärchen
 Von Red Bull gesponserter Extremsport
 Von Red Bull gesponserter Extremsport
@@ -98,9 +98,11 @@ Südseefisch
 Schmerzmittel
 Schmerzmittel
 Chemisches Element, das nicht reagiert
 Chemisches Element, das nicht reagiert
 Spotifyplaylist
 Spotifyplaylist
-italienischer Vulkan
+Italienischer Vulkan
 Fluss in Uganda
 Fluss in Uganda
 Schneckenart mit einem Auge
 Schneckenart mit einem Auge
 Tätigkeit gegen Corona
 Tätigkeit gegen Corona
 Pferd von Napoleon
 Pferd von Napoleon
-"Danke" in einer afrikanischen Stammessprache
+"Danke" in einer afrikanischen Stammessprache
+Böser König in einem Märchen
+Umweltschutzorganisation

+ 1 - 8
src/game.rs

@@ -149,13 +149,6 @@ impl Game {
                 where F: FnMut() -> String,
                 where F: FnMut() -> String,
                       G: FnMut() -> Vec<char> {
                       G: FnMut() -> Vec<char> {
         self.clear_submissions();
         self.clear_submissions();
-
-        /*let mut exes = vec![
-            CreatingEx{ question: "Delikatessfutter für Hunde".to_owned(), letters: vec!['a', 'b', 'c'] },
-            CreatingEx{ question: "Ein Hotel für die ganze Familie".to_owned(), letters: vec!['b', 'c', 'd'] },
-            CreatingEx{ question: "Brasilianischer Superstar".to_owned(), letters: vec!['c', 'd', 'e'] },
-            CreatingEx{ question: "Buchstabe des griechischen Alphabets".to_owned(), letters: vec!['d', 'e', 'f'] },
-        ];*/
         for p in &mut self.players {
         for p in &mut self.players {
             p.creating_exercise = Some(
             p.creating_exercise = Some(
                 CreatingEx{
                 CreatingEx{
@@ -167,7 +160,7 @@ impl Game {
         self.additional_questions.clear();
         self.additional_questions.clear();
 
 
         self.additional_questions.push(word_generator());
         self.additional_questions.push(word_generator());
-        self.additional_questions.push(word_generator());
+        //self.additional_questions.push(word_generator());
 
 
         self.state = GameState::Creating;
         self.state = GameState::Creating;
     }
     }

+ 4 - 0
src/server/messages.rs

@@ -29,6 +29,10 @@ pub struct GameAlreadyStartedMsg(pub String);
 
 
 #[derive(Message)]
 #[derive(Message)]
 #[rtype(result = "()")]
 #[rtype(result = "()")]
+pub struct LobbyAlreadyExistsMsg(pub String);
+
+#[derive(Message)]
+#[rtype(result = "()")]
 pub struct NickAlreadyExistsMsg {
 pub struct NickAlreadyExistsMsg {
     pub game_id: String,
     pub game_id: String,
     pub nick: String
     pub nick: String

+ 1 - 0
src/server/protocol.rs

@@ -53,6 +53,7 @@ pub struct RoundResultData {
 pub enum UpdateMessage {
 pub enum UpdateMessage {
     GameNotFound{ game_id: String },
     GameNotFound{ game_id: String },
     GameAlreadyStarted{ game_id: String },
     GameAlreadyStarted{ game_id: String },
+    GameAlreadyExists{ game_id: String },
     NickAlreadyExists{ game_id: String, nick: String },
     NickAlreadyExists{ game_id: String, nick: String },
     LeftLobby{ nick: String },
     LeftLobby{ nick: String },
     GameState(GameData),
     GameState(GameData),

+ 10 - 1
src/server/server.rs

@@ -51,7 +51,9 @@ impl Handler<CreateLobbyRequest> for Server {
     fn handle(&mut self, clr: CreateLobbyRequest, ctx: &mut Self::Context) -> Self::Result {
     fn handle(&mut self, clr: CreateLobbyRequest, ctx: &mut Self::Context) -> Self::Result {
         let existing_lobby = self.lobbies.get(&clr.lobby_id);
         let existing_lobby = self.lobbies.get(&clr.lobby_id);
         match existing_lobby {
         match existing_lobby {
-            Some(_) => {},
+            Some(_) => {
+                clr.p.do_send(LobbyAlreadyExistsMsg(clr.lobby_id));
+            },
             None => {
             None => {
                 let lobby = GameLobby::new(clr.lobby_id.clone(), self.default_data.clone(), ctx.address());
                 let lobby = GameLobby::new(clr.lobby_id.clone(), self.default_data.clone(), ctx.address());
                 let lobby_addr = lobby.start();
                 let lobby_addr = lobby.start();
@@ -108,6 +110,13 @@ impl Handler<NoSuchLobby> for GameConnection {
     }
     }
 }
 }
 
 
+impl Handler<LobbyAlreadyExistsMsg> for GameConnection {
+    type Result = ();
+    fn handle(&mut self, laem: LobbyAlreadyExistsMsg, ctx: &mut Self::Context) -> Self::Result {
+        self.send_message(&UpdateMessage::GameAlreadyExists{ game_id: laem.0 }, ctx);
+    }
+}
+
 impl Handler<GameAlreadyStartedMsg> for GameConnection {
 impl Handler<GameAlreadyStartedMsg> for GameConnection {
     type Result = ();
     type Result = ();
     fn handle(&mut self, gas: GameAlreadyStartedMsg, ctx: &mut Self::Context) -> Self::Result {
     fn handle(&mut self, gas: GameAlreadyStartedMsg, ctx: &mut Self::Context) -> Self::Result {

+ 1 - 0
static/comm.js

@@ -233,6 +233,7 @@ $(function() {
             if (!row_shows[i] && result.words[i][0] == nick) {
             if (!row_shows[i] && result.words[i][0] == nick) {
                 var $butt = $("<button/>");
                 var $butt = $("<button/>");
                 $butt.attr("id", "reveal-button");
                 $butt.attr("id", "reveal-button");
+                $butt.attr("class", "mini-button");
                 $butt.text("Reveal");
                 $butt.text("Reveal");
                 $wordline.append($butt);
                 $wordline.append($butt);
             }
             }

+ 1 - 1
static/index.html

@@ -8,7 +8,7 @@
     <script src="comm.js"></script>
     <script src="comm.js"></script>
     <script src="draggame.js"></script>
     <script src="draggame.js"></script>
     <link rel="stylesheet" href="style.css">
     <link rel="stylesheet" href="style.css">
-    <title>Eichelhäutgerät</title>
+    <title>Elchhäutgerät</title>
 </head>
 </head>
 <body>
 <body>
     <div class="header">
     <div class="header">

+ 13 - 6
static/style.css

@@ -32,7 +32,7 @@ body {
     right: 0;
     right: 0;
     margin: 0 auto;
     margin: 0 auto;
     min-height: 140px;
     min-height: 140px;
-    max-width: 860px;
+    max-width: 820px;
 }
 }
 
 
 .loginform {
 .loginform {
@@ -45,7 +45,7 @@ body {
     left: 0;
     left: 0;
     right: 0;
     right: 0;
     margin: 0 auto;
     margin: 0 auto;
-    max-width: 860px;
+    max-width: 820px;
     padding: 20px;
     padding: 20px;
     align-content: stretch;
     align-content: stretch;
     border-radius: 12px;
     border-radius: 12px;
@@ -76,7 +76,7 @@ body {
     background-color: var(--color-unready);
     background-color: var(--color-unready);
 }
 }
 
 
-@media screen and (max-width: 1260px) {
+@media screen and (max-width: 1240px) {
     .header {
     .header {
         min-height: unset;
         min-height: unset;
     }
     }
@@ -87,7 +87,7 @@ body {
         margin: 0 auto;
         margin: 0 auto;
         padding: 20px;
         padding: 20px;
         width: auto;
         width: auto;
-        max-width: 860px;
+        max-width: 820px;
         align-content: stretch;
         align-content: stretch;
     }
     }
     .player-list p {
     .player-list p {
@@ -141,6 +141,12 @@ input[type="button"]:hover, input[type="submit"]:hover, button:hover {
     display: inline;
     display: inline;
 }
 }
 
 
+.mini-button {
+    padding: 6px 10px;
+    margin: 4px 4px 4px 0px;
+    font-size: 14px;
+}
+
 
 
 input[type="text"], textarea {
 input[type="text"], textarea {
     border: 1px solid var(--color3);
     border: 1px solid var(--color3);
@@ -290,6 +296,7 @@ label {
     width: 100%;
     width: 100%;
     border-collapse: collapse;
     border-collapse: collapse;
     margin: 12px 0px;
     margin: 12px 0px;
+    font-size: medium;
 }
 }
 
 
 .result-table td, th {
 .result-table td, th {
@@ -311,8 +318,8 @@ label {
 }
 }
 
 
 .result-correct {
 .result-correct {
-    background-color: #005218;
+    background-color: #142218;
 }
 }
 .result-wrong {
 .result-wrong {
-    background-color: #520000;
+    background-color: #291616;
 }
 }