Permalink
Browse files

fixed chess pieces

  • Loading branch information...
1 parent 0a604e1 commit 547e5a1e263ec225bb14129b324261d0325cf643 @Brucer Brucer committed May 26, 2011
Showing with 19 additions and 15 deletions.
  1. +2 −2 chess/chess.js
  2. +1 −1 chess/chess.manifest
  3. +1 −1 chess/index.shtml
  4. +0 −1 chess/pieces.js
  5. +1 −1 engine/include/min.include
  6. +14 −9 lib/graph.js
View
@@ -232,8 +232,8 @@ var Chess = (function() {
Input.hookEvents('gamebody');
newGameState('login');
Publish.fbInit(fb_app_id);
- loadImageList('/chess/images/',['Pirate_King.png']);
- //loadImageList('/chess/images/',['Pirate_King.png', 'Ninja_King.png', 'Pirate_Queen.png', 'Ninja_Queen.png', 'Pirate_Bishop.png', 'Ninja_Bishop.png', 'Pirate_Knight.png', 'Ninja_Knight.png', 'Pirate_Rook.png', 'Ninja_Rook.png', 'Pirate_Pawn.png', 'Ninja_Pawn.png']);
+ //loadImageList('/chess/images/',['Pirate_King.png']);
+ loadImageList('/chess/images/',['Pirate_King.png', 'Ninja_King.png', 'Pirate_Queen.png', 'Ninja_Queen.png', 'Pirate_Bishop.png', 'Ninja_Bishop.png', 'Pirate_Knight.png', 'Ninja_Knight.png', 'Pirate_Rook.png', 'Ninja_Rook.png', 'Pirate_Pawn.png', 'Ninja_Pawn.png']);
//loadAnimList('/chess/images/',[['small_explo.png', 6]]);
}
View
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# version 1.3
+# version 1.4
images/Ninja_Bishop.png
images/Ninja_King.png
View
@@ -30,7 +30,7 @@
<script type="text/javascript"> logtime('css load') </script>
<link rel="stylesheet" type="text/css" href="/chess/style.css" />
<script type="text/javascript"> logtime('jssdk lib load') </script>
- <script type="text/javascript" src="/chess/mc_all.js"></script>
+ #include '/engine/include/fb_jssdk.include'
<script type="text/javascript"> logtime('jssdk lib load-done') </script>
#include '/engine/include/portrait.include'
#include 'app_id'
View
@@ -65,7 +65,6 @@ var Pieces = (function() {
sprite = color == White ? "Pirate_King" : "Ninja_King";
break;
}
- sprite = "Pirate_King";
square.piece = Gob.add(Utils.uuidv4(), sprite, 0, [square.left+square.delta*0.5,square.top+square.delta*0.5], [0,0], 10, default_scale*square.delta/piecescales[type]);
square.piece.type = type;
square.piece.color = color;
@@ -1,4 +1,4 @@
-<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi"/>
+<meta name="viewport" content="initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
View
@@ -39,7 +39,6 @@ function params_from_url(url)
}
-// signed_request=ht5LfzRGGug4CxR2eGTJJ80mTDj9-FjtxXj8_51hR48.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTMwNTc1NTcyOCwidXNlciI6eyJjb3VudHJ5IjoidXMiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX19
function post_handler(request, callback) {
var body = '';
@@ -63,7 +62,7 @@ function graph_get(path,end_cb) {
data = '';
https.get(
{
- host: 'graph.dev.facebook.com',
+ host: 'graph.facebook.com',
path: path
},
function(res) {
@@ -127,7 +126,6 @@ function graph_post(path, body, end_cb) {
function og_action_get(res, action_name, access_token)
{
- // curl 'https://graph.dev.facebook.com/me/superfbrps:paper_covers_rock?access_token=224658110883993%7C2.AQBXJXLB4afinN9o.3600.1305936000.0-827884427%7CE9Fg6j9zpTSlhiSwyYb1_aqc454'
graph_get(
'/me/superfbrps:'+action_name+'?access_token='+escape(access_token),
function(d) {
@@ -139,9 +137,6 @@ function og_action_get(res, action_name, access_token)
function og_action_create(res, action_name, object_name, access_token)
{
- // curl -F 'access_token=224658110883993|2.AQBXJXLB4afinN9o.3600.1305936000.0-827884427|E9Fg6j9zpTSlhiSwyYb1_aqc454' \
- // -F 'to=http://example.com/' \
- // 'https://graph.dev.facebook.com/me/superfbrps:paper_covers_rock'
var body = 'to='+escape(base_url)+'/client/og/'+object_name+'.shtml'+'&'
+ 'access_token='+escape(access_token);
@@ -157,7 +152,6 @@ function og_action_create(res, action_name, object_name, access_token)
function og_score_set(res, score, access_token, app_secret)
{
- // https://graph.facebook.com/me/games.scores?
var body =
'score='+escape(score)
+ '&access_token='+escape(access_token)
@@ -175,19 +169,30 @@ function og_score_set(res, score, access_token, app_secret)
function og_score_delete_all(access_token)
{
- // https://graph.facebook.com/[app_id]/games.scores?
+}
+
+function getCheevos(fb_info, res) {
+ graph_get(
+ '/me/games.achieves?access_token='+escape(fb_info.access_token),
+ function (data) {
+ console.log('data: ' + data);
+ res.end(data);
+ }
+ );
+ return;
}
function addCheevo(fb_info, res, cheevo) {
var cheevo_url = escape('pirateninjachess.com/chess/cheevo/' + cheevo +'.shtml');
var path = '/me/games.achieves?';
- var body = 'achievement='+cheevo_url+'&access_token='+escape(fb_info.access_token)+'&client_secret='+Server.fb_app_info.secret;
+ var body = 'achievement='+cheevo_url+'&access_token='+escape(fb_info.access_token)+'&client_secret='+Server.fb_app_info.chess.secret;
var graph_req = graph_post(
path,
body,
function(d) {
sys.debug('og achieves response:'+d);
res.end('og achieves response: '+cheevo+' response: '+d);
+ getCheevos(fb_info, res);
}
);
}

0 comments on commit 547e5a1

Please sign in to comment.