Maxim Sokhatsky 11 years ago
parent
commit
55fe44794d
3 changed files with 11 additions and 1 deletions
  1. 1 0
      apps/face/rebar.config
  2. 9 1
      apps/face/src/index.erl
  3. 1 0
      rels/web/reltool.config

+ 1 - 0
apps/face/rebar.config

@@ -1,5 +1,6 @@
 {deps, [
     {erlydtl,".*",{git,"git://github.com/evanmiller/erlydtl.git",{tag,"0.8.0"}}},
+    {shen,          ".*", {git, "git://github.com/5HT/shen",                "HEAD"}},
     {n2o,           ".*", {git, "git://github.com/5HT/n2o",                "HEAD"}}
 ]}.
 {erlydtl_opts, [

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

@@ -1,8 +1,14 @@
 -module(index).
+-compile({parse_transform, shen}).
 -compile(export_all).
 -include_lib("n2o/include/wf.hrl").
 -include_lib("server/include/requests.hrl").
 -include_lib("server/include/settings.hrl").
+-jsmacro([take/2]).
+
+take(GameId,Place) ->
+    ws:send(bert:encodebuf(bert:tuple(bert:atom('client'),
+        bert:tuple(bert:atom("game_action"),GameId,bert:atom("okey_take"),[{pile,Place}])))).
 
 main() -> 
     case wf:user() of
@@ -43,10 +49,12 @@ event(join) ->
 %%          pile :: integer() %% 0 or 1
 %%         }).
 
+
+
 event(take) ->
     Msg = "ws.send(Bert.encodebuf(Bert.tuple(Bert.atom('client'),"
         " Bert.tuple(Bert.atom('game_action'), 1000001, Bert.atom('okey_take'), {pile: 0} ) )));",
-    wf:wire(Msg);
+    wf:wire(take("1000001","0"));
 
 %%-record('OkeyPiece', {
 %%          color = -1 :: integer(),           %% 1..4

+ 1 - 0
rels/web/reltool.config

@@ -7,6 +7,7 @@
          kernel,
          stdlib,
          sasl,
+         shen,
          mimetypes,
          gproc,
          sync,