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

BIN
apps/web/priv/static/doc/Kakaranet-Scene.sketch/Data


+ 1 - 1
apps/web/priv/static/doc/Kakaranet-Scene.sketch/metadata

@@ -15,7 +15,7 @@
 		<string>LucidaGrande-Bold</string>
 	</array>
 	<key>length</key>
-	<integer>2564030</integer>
+	<integer>2564442</integer>
 	<key>version</key>
 	<integer>36</integer>
 </dict>

+ 1 - 1
apps/web/priv/static/doc/Kakaranet-Scene.svg

@@ -732,7 +732,7 @@
             <g id="Dialog-2" sketch:type="MSShapeGroup">
                 <rect id="Rectangle-54" stroke="#48AF5E" stroke-width="10" fill="#FFFFFF" x="0" y="0" width="643" height="515" rx="30"></rect>
                 <rect id="Rectangle-55" stroke="#979797" fill="#48AF5E" x="5" y="4" width="633" height="67"></rect>
-                <path d="M10,170.877714 L10,506.000011 L633,506.000018 L633,283.000003 C73.6559486,412.100111 648.096463,130.846676 10,170.877714 Z" id="Rectangle-60" fill="#DFF1F4"></path>
+                <path d="M10,170.877714 L10,486.007158 C10,497.048906 18.9566601,506.000011 30.0008497,506.000011 L612.99915,506.000018 C624.045315,506.000018 633,497.050485 633,486.002368 L633,283.000003 C73.6559486,412.100111 648.096463,130.846676 10,170.877714 Z" id="Rectangle-60" fill="#DFF1F4"></path>
             </g>
             <text id="Notes" sketch:type="MSTextLayer" font-family="Exo 2" font-size="20" font-weight="normal" fill="#4A4A4A">
                 <tspan x="24" y="453.5">How good is Player (win/lose) per each game type, and how </tspan>

+ 10 - 4
apps/web/priv/static/doc/svg.js

@@ -34,7 +34,7 @@ function handle_web_socket(body) {
             for (var i=1;i<=a.length;i++) {
                 var c = a[i-1].value[0][1];
                 var v = a[i-1].value[0][2];
-                console.log("Card: " + c + " " + v);
+//                console.log("Card: " + c + " " + v);
                 place_card(i,1,c,v);
             }
             break;
@@ -192,15 +192,21 @@ loadFile('templates/Card.svg', function() {
         for (var y=0;y<a.length;y++) for (var x=0;x<a[y].pathes.length;x++)
             loadAnimationForButton(a[y].pathes[x],a[y].button);
 
-        document.getElementById("Right-Menu").setAttribute('onclick', 'onRightMenu(evt)');
-        document.getElementById("Play")      .setAttribute('onclick', 'onRightMenuDown(evt)');
-        document.getElementById("Create")    .setAttribute('onclick', 'onRightMenuDown(evt)');
+        document.getElementById("Right-Menu") .setAttribute('onclick', 'onRightMenu(evt)');
+        document.getElementById("Play")       .setAttribute('onclick', 'onRightMenuDown(evt)');
+        document.getElementById("Create")     .setAttribute('onclick', 'onRightMenuDown(evt)');
+        document.getElementById("Point-Table").setAttribute('onclick', 'onPlayerInfo(evt)');
         
 //        onRightMenuDown();
 
     });
 });
 
+function onPlayerInfo(evt) {
+    ws.send(enc(tuple(atom('client'),
+        tuple(atom('stats_action'),bin('ali_erdem1500001'),atom('game_okey')))));
+    }
+
 function onRightMenu(evt) {
     localStorage.clear();
     ["PlayShow","CreateShow"].map(function (x) {

+ 5 - 3
apps/web/src/okey.erl

@@ -112,12 +112,14 @@ event(take) ->
     wf:wire(protocol:take(wf:to_list(GameId), wf:q(take_src)));
 
 event(player_info) -> 
-    wf:info(?MODULE,"Cowboy Cookies: ~p",[wf:cookies_req(?REQ)]),
+%    wf:info(?MODULE,"Cowboy Cookies: ~p",[wf:cookies_req(?REQ)]),
 %    wf:info(?MODULE,"Cookie Reqt: ~p",[wf:cookie("Name","Value","/",0,?REQ)]),
     User = user(),
     wf:cookie(<<"user">>,<<"macim">>,<<"/ws/">>,24 * 60 * 60),
-    wf:wire(protocol:player_info(
-        wf:f("'~s'",[wf:to_list(User#user.id)]),wf:f("'~s'",[game_okey])));
+    Wire = protocol:player_info(
+        wf:f("'~s'",[wf:to_list(User#user.id)]),wf:f("'~s'",[game_okey])),
+    wf:info(?MODULE,"PlayeInfoJS: ~s",[Wire]),
+    wf:wire(Wire);
 
 event(attach) -> 
     {ok,GamePid} = game_session:start_link(self()),

+ 0 - 15
apps/web/src/users.erl

@@ -1,15 +0,0 @@
--module(users).
--behaviour(rest).
--compile({parse_transform, rest}).
--include("users.hrl").
--export([init/0, populate/1, exists/1, get/0, get/1, post/1, delete/1]).
--rest_record(user).
-
-init() -> ets:new(users, [public, named_table, {keypos, #user.id}]).
-populate(Users) -> ets:insert(users, Users).
-exists(Id) -> ets:member(users, wf:to_list(Id)).
-get() -> ets:tab2list(users).
-get(Id) -> [User] = ets:lookup(users, wf:to_list(Id)), User. % should return record #user{}
-delete(Id) -> ets:delete(users, wf:to_list(Id)).
-post(#user{} = User) -> ets:insert(users, User);
-post(Data) -> post(from_json(Data, #user{})).