Maxim Sokhatsky 11 лет назад
Родитель
Сommit
6ca4676d29

+ 14 - 1
apps/web/priv/static/app/js/bootloader.js

@@ -86,7 +86,8 @@ function PatchSVG()
     initDiscards();
     initChat();
     initChatSample();
-    initEditorsSafari()
+    initEditorsSafari();
+    initPauseOverlay();
 
     if ((hours() < 6 || hours() >= 18)) {
         $("#Sky").attr({fill:"#0E4B69"});
@@ -195,3 +196,15 @@ function manualForeignObjectPositioning()
 }
 
 function hours() { return (new Date()).getHours(); }
+
+function initPauseOverlay() {
+    var html = '<g xmlns="http://www.w3.org/2000/svg" id="overlay" style="display:none;">'+
+        '<rect x="216" y="91" stroke-width="0" stroke="red" width="641" height="367" rx="6" fill="white" opacity="0.7"></rect>'+
+        '<g>'+
+        '<text fill="blue" font-family="Exo 2" y="280" x="-116" text-anchor="middle" dx="641" font-size="26pt"> Someone paused the game</text></g>'+
+        '</g>';
+    var page = document.getElementById("Kakaranet-12-maxim");
+    var kakush = document.getElementById("Kakush");
+    page.insertBefore(svg(html),kakush);
+
+}

+ 5 - 2
apps/web/priv/static/app/js/okey/okey.js

@@ -233,7 +233,8 @@ function PostLoad()
     var whoPausedGame = false;
 
     $overlay = $("#overlay");
-    $overlay.on("click", function() { whoPausedGame == scope.user && apiProvider.pause(!0); });
+    $overlay.on("click", function() {
+        apiProvider.pause(scope.paused); });
 
     apiProvider.on("game_paused", function(x) {
         var e = {detail: x.detail.json, raw: x.detail.bert};
@@ -241,7 +242,7 @@ function PostLoad()
             $overlay.show();
             for (var player in playersMap) playersMap[player].timer.pause();
             var player = playersMap[e.detail[3]];
-            $overlay.find("text").text(player.name + " paused the game");
+            $overlay.find("text").text(player.name + "\n paused the game");
         } else {
             $overlay.hide();
             for (var player in playersMap) playersMap[player].timer.resume();
@@ -288,6 +289,8 @@ function initOkeyScene(x)
                      j = playerPile.length; j--; ) hand.discard(playerPile[j]);
     }
 
+    scope.paused = e.detail.paused;
+
     e.detail.whos_move && "null" != e.detail.whos_move && 
         (e.detail.next_turn_in && "null" != e.detail.next_turn_in && 
          playersMap[e.detail.whos_move].timer.from(e.detail.next_turn_in),

+ 6 - 1
apps/web/priv/static/app/js/okey/okey_protocol.js

@@ -124,7 +124,12 @@ function OkeyApiProviderScope(scope) {
             }))));
         },
         pause: function(resume) {
-            this.socket.send(enc(tuple(atom("client"), tuple(atom("pause_game"), atom("undefined"), this.gameId, atom(resume ? "resume" : "pause")))));
+            console.log(resume ? "resume" : "pause");
+            this.socket.send(enc(tuple(atom("client"),
+                tuple(atom("pause_game"),
+                    atom("undefined"),
+                    this.gameId,
+                    atom(resume ? "resume" : "pause")))));
         }
     }),
 

+ 1 - 0
apps/web/priv/static/app/js/selector.js

@@ -6,6 +6,7 @@ var scope = {
     CARD_SMALL_SOURCE: "svg/Card-Small.svg",
     CARD_COLORS: [ "#CE290F", "#3B5998", "#48AF5E", "#F8E81C" ],
     SKIN_NAMES: [ "Alina", "Gabrielo", "Mustafa" ],
+    paused: false,
     version: 1206201401
 };