Browse Source

Merge branch 'master' of github.com:kakaranet/games

Roman Dayneko 11 years ago
parent
commit
dee57ab43f
3 changed files with 3 additions and 4 deletions
  1. 1 1
      apps/face/priv/templates/index.html
  2. 1 1
      apps/face/src/index.erl
  3. 1 2
      apps/face/src/protocol.erl

+ 1 - 1
apps/face/priv/templates/index.html

@@ -7,7 +7,7 @@
 <body>
 {{body}}
 <script>var transition = {pid: '', port: '8000' };</script>
-<script>function handle_web_socket(body) { console.log(String(bert.decodebuf(body))); } </script>
+<script>function handle_web_socket(body) { console.log(String(dec(body))); } </script>
 <script src='/static/nitrogen/bullet.js' type='text/javascript' charset='utf-8'></script>
 <script src='/static/nitrogen/n2o.js' type='text/javascript' charset='utf-8'></script>
 <script src='/static/nitrogen/bert.js' type='text/javascript' charset='utf-8'></script>

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

@@ -141,7 +141,7 @@ event(reveal) ->
         {_, {CD, VD} = Key} ->
             Hand = [{C,V} || {_, {C, V}} <- lists:keydelete(Key, 2, TilesList) ],
             HandJS = "[[" ++ string:join([
-                wf:f("bert.tuple(bert.atom('OkeyPiece'),~p,~p)",[C,V]) || {C,V} <- Hand],",") ++ "],[]]",
+                wf:f("tuple(atom('OkeyPiece'),~p,~p)",[C,V]) || {C,V} <- Hand],",") ++ "],[]]",
             RevealJS = protocol:reveal(wf:to_list(?GAMEID),wf:f("~p",[CD]),wf:f("~p",[VD]),HandJS),
             wf:info("RevealJS: ~p",[lists:flatten(RevealJS)]),
             wf:wire(RevealJS);

+ 1 - 2
apps/face/src/protocol.erl

@@ -1,13 +1,12 @@
 -module(protocol).
 -compile({parse_transform, shen}).
 -compile(export_all).
--include_lib("n2o/include/wf.hrl").
 -jsmacro([take/2,attach/1,join/1,discard/3,player_info/2,reveal/4,piece/2,logout/0,pause/2]).
 
 attach(Token) -> ws:send(enc(tuple(atom('client'),tuple(atom("session_attach"), Token)))).
 join(Game) -> ws:send(enc(tuple(atom('client'),tuple(atom("join_game"), Game)))).
 logout() -> ws:send(enc(tuple(atom('client'),tuple(atom("logout"))))).
-pause(GameId, Action) -> ws:send(enc(tuple(atom("client"),tuple(atom("pause_game"),atom("undefined"),GameId,atom(Action))))).
+pause(GameId, Action) -> ws:send(enc(tuple(atom('client'),tuple(atom("pause_game"),atom('undefined'),GameId,atom(Action))))).
 take(GameId,Place) -> ws:send(enc(tuple(atom('client'),tuple(atom("game_action"),GameId,atom("okey_take"),[{pile,Place}])))).
 discard(GameId, Color, Value) -> ws:send(enc(tuple(atom('client'),tuple(atom("game_action"),GameId,atom("okey_discard"),
     [{tile,tuple(atom("OkeyPiece"), Color, Value)}])))).