var getOnlineNumber = function (connections){ var query = new Object(); query.connections = connections; $.ajax({ url:'/index/get_online_number', data:query, dataType:"json", type:"POST", async:false, success:function(data){ if(data.code == 1){ $('#onlineNumber').html(data.data); } } }); } var getResultToatl = function (TableId,BootId){ var query = new Object(); query.table_id = TableId; query.boot_id = BootId; $.ajax({ url:'/index/get_result_total', data:query, dataType:"json", type:"POST", async:false, success:function(data){ if(data.code == 1){ var resultToatl = data.data; $('#result_total_player').html(resultToatl.player); $('#result_total_banker').html(resultToatl.banker); $('#result_total_tie').html(resultToatl.tie); } } }); } var showPng = function (opening){ if(opening == 1) $('#openingPng').attr('src','/static/console/img/dragon.png'); if(opening == 2) $('#openingPng').attr('src','/static/console/img/tiger.png'); if(opening == 3) $('#openingPng').attr('src','/static/console/img/tie.png'); $('#openingElement').show().delay(1000).hide(300); } $(document).on("click","#next_banker",function(){ var next = new Object; next.result = 'banker'; next.table = TableId; next.forecast = 1; $.ajax({ url:"/waybill/waybill.php", type:"POST", dataType:"JSON", data:next, success:function(data){ var twinkledata=data; resizeCanvas(twinkledata); resizeCanvas2(twinkledata); resizeCanvas3("","","","",twinkledata); } }); }) $(document).on("click","#next_player",function(){ var next = new Object; next.result = 'player'; next.table = TableId; next.forecast = 1; $.ajax({ url:"/waybill/waybill.php", type:"POST", dataType:"JSON", data:next, success:function(data){ var twinkledata=data; resizeCanvas(twinkledata); resizeCanvas2(twinkledata); resizeCanvas3("","","","",twinkledata); } }); }) // 请求所有路单数据,执行画布刷新 function waybillFunc(){ var data = new Object; data.result = "allData"; data.table = TableId; $.ajax({ url:"/waybill/waybill.php", type:"POST", dataType:"JSON", data:data, success:function(data){ // 将数据结果存session ludan = data; // 执行画布刷新 resizeCanvas(); resizeCanvas2(); resizeCanvas3(); } }); } $(window).resize(function(){ resizeCanvas(); resizeCanvas2(); resizeCanvas3(); }); // canvas 路单 function resizeCanvas(twinkledata){ var canvaswidth= parseInt($(".baccarat_mian ").width()-30); $(".index .canvas-box .canvas").width(canvaswidth); var table=document.getElementById('single1'), ctb=table.getContext('2d'); var tab_width=canvaswidth, tab_cols=60, tab_rows=6, Tab_w=tab_width/tab_cols tab_height=Tab_w*tab_rows||183 Font_Size =Math.floor(Tab_w/1.8)+"px Arial" Font_Size_s=Math.floor(Tab_w/2.8)+"px Arial" $("#single1").attr("height",tab_height+0.4) $("#single1").attr("width",canvaswidth+0.4) canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w); if(twinkledata!=undefined){ var twin=twinkledata.bigRoad.show_location, twinlength=twin.length-1 twinkle(ctb,twin[twinlength].show_x,twin[twinlength].show_y,twin[twinlength].result); } // 获取本地session里的路单数据 var waybill = ludan; if(waybill == false) return false; var bigRoad = waybill.bigRoad; var showRoad = waybill.showRoad; // 第一局为和,大路展示 if(showRoad != undefined && showRoad.show_location != undefined && showRoad.first_tie_num != undefined && showRoad.first_tie_num > 0){ b_Tie(showRoad.first_tie_num); } // 大路路单展示 if( bigRoad != undefined && bigRoad.show_location != undefined){ for(var i=0; i 0){ b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num); }else{ b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2); } } // 闲赢 if(bigRoad.show_location[i].result == "player"){ // 判断是否是和局 if(bigRoad.show_location[i].tie_num > 0){ b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num); }else{ b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1); } } // 和 if(bigRoad.show_location[i].tie_num > 0){ if(bigRoad.first_tie_num != undefined && bigRoad.first_tie_num == 1 && i == 0){ b_Tie(bigRoad.show_location[i].tie_num) }else{ if(bigRoad.show_location[i].result == 'banker'){ b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num); }else{ b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num); } } } } } ctb.closePath(); // 局数 数,文字X坐标,文字Y坐标,文字大小风格 function Font_tie(num,Font_x,Font_y,fontsize){ if(num!==undefined){ ctb.beginPath(); ctb.font=fontsize; ctb.textAlign = 'center'; ctb.textBaseline = 'middle'; ctb.fillStyle ="#000" ; ctb.fillText(num,Font_x,Font_y); ctb.stroke(); } } function b_Tab(x,y,type,slash,order){ x_z=x-0.5, y_z=y-0.5; ctb.clearRect(Tab_w*x_z-Tab_w/2.1, Tab_w*y_z-Tab_w/2.1, Tab_w*0.9, Tab_w*0.9); if(type=="1"){ var color="#331a98"; }else if(type=="2"){ var color="#fb2603" } ctb.beginPath(); ctb.lineWidth = 1.5; ctb.strokeStyle = color; ctb.arc(Tab_w*x_z-0.5, Tab_w*y_z-0.5, Tab_w*0.38, 0, Math.PI * 2); ctb.stroke(); if(slash=="1"){ ctb.beginPath(); linewidth=Tab_w/4; ctb.lineWidth = 2;//线条宽度 ctb.lineCap = "round"; ctb.strokeStyle = "#3EA542";//线条颜色 ctb.moveTo(x_z*Tab_w-linewidth,Tab_w*y_z+linewidth); ctb.lineTo(x_z*Tab_w+linewidth,Tab_w*y_z-linewidth); ctb.stroke(); Font_tie(order,Tab_w*x_z, Tab_w*y_z,Font_Size); } } // b区第一局 和 function b_Tie(order){ ctb.clearRect(Tab_w/20, 1, Tab_w*0.9, Tab_w*0.9); ctb.beginPath(); linewidth=Tab_w/4; ctb.lineWidth = 3.5;//线条宽度 ctb.strokeStyle = "#3EA542";//线条颜色 ctb.lineCap = "round"; ctb.moveTo(Tab_w/20,Tab_w/2); ctb.lineTo(Tab_w*0.9,Tab_w/2); ctb.stroke(); Font_tie(order,Tab_w/2, Tab_w/2,Font_Size); } // 问路 function twinkle(ctb,show_x,show_y,result){ var b=10 num1=setInterval(function(){ b--; var num=b%2; if(b<0){ clearInterval(num1); // $("#player_ask,#banker_ask").removeAttr("disabled"); }else{ ctb.globalAlpha=num; // 数据 if(result=="banker"){ b_Tab(show_x,show_y,2) }else if(result=="player"){ b_Tab(show_x,show_y,1) } // // 数据 ctb.globalAlpha=0.5 } },200); } } function resizeCanvas2(twinkledata){ var canvaswidth= parseInt($(".baccarat_mian ").width()-30); $(".index .canvas-box .canvas").width(canvaswidth); var table=document.getElementById('single2'), ctb=table.getContext('2d'); // ctb.beginPath(); var tab_width=canvaswidth, tab_cols=60, tab_rows=6, tab_b_cols = 6, Tab_w=tab_width/tab_cols, tab_height=Tab_w*tab_rows||183; $("#single2").attr("height",tab_height+0.8) $("#single2").attr("width",canvaswidth+0.4) canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w); var waybill = ludan; if(!waybill) return false; var bigEyeRoad = waybill.bigEyeRoad; // 大眼路数据 var pathway = waybill.pathway; // 小路数据 var roach = waybill.roach; // 小强路数据 if(twinkledata!=undefined){ twinkle(ctb,twinkledata); } // 大眼路数据 if(bigEyeRoad != undefined && bigEyeRoad.show_location != undefined){ for(var i=0; i