Просмотр исходного кода

add discard button; remove sync module

Roman Dayneko 11 лет назад
Родитель
Сommit
54536e5090
3 измененных файлов с 9 добавлено и 3 удалено
  1. 1 1
      Makefile
  2. 8 1
      apps/face/src/index.erl
  3. 0 1
      rels/web/reltool.config

+ 1 - 1
Makefile

@@ -1,6 +1,6 @@
 RELEASE := kakaranet
 COOKIE  := sample
-APPS    := kernel stdlib sasl sync gproc cowboy mimetypes ranch erlydtl n2o face db server
+APPS    := kernel stdlib sasl gproc cowboy mimetypes ranch erlydtl n2o face db server
 VER     := 1.0.0
 VM      := rels/web/files/vm.args
 SYS     := rels/web/files/sys.config

+ 8 - 1
apps/face/src/index.erl

@@ -15,7 +15,7 @@ body() ->
       #button{ id = attach, body = <<"Attach">>, postback = attach},
       #button{ id = join, body = <<"Join">>, postback = join},
       #button{ id = take, body = <<"Take">>, postback = take},
-      #button{ id = discard, body = <<"Discard">>, postback = discard}
+      #textbox{ id = tbcolor }, #textbox{ id = tbvalue }, #button{ id = discard, body = <<"Discard">>, postback = discard, source = [tbcolor, tbvalue]}
     ].
 
 event(init) ->
@@ -58,6 +58,13 @@ event(take) ->
 %%         }).
 
 
+event(discard) ->
+    Color = wf:q(tbcolor),
+    Value = wf:q(tbvalue),
+    Msg = "ws.send(Bert.encodebuf(Bert.tuple(Bert.atom('client'),"
+        " Bert.tuple(Bert.atom('game_action'), 1000001, Bert.atom('okey_discard')," 
+        " [Bert.tuple(Bert.atom('tile'), Bert.tuple(Bert.atom('OkeyPiece'), " ++ Color ++ ", " ++ Value ++ "))]) )));",
+    wf:wire(Msg);
 
 
 event(Event) -> wf:info("Event: ~p", [Event]).

+ 0 - 1
rels/web/reltool.config

@@ -9,7 +9,6 @@
          sasl,
          mimetypes,
          gproc,
-         sync,
          n2o,
          erlydtl,
          db,