874 lines
23 KiB
JavaScript
874 lines
23 KiB
JavaScript
var countDown = function (){
|
||
$("#second").html(waitTime);
|
||
waitTime = waitTime - 1;
|
||
if(waitTime > -1 && waitTime < parseInt($('#wait_time').val())){
|
||
if(waitTime == 4){
|
||
$(".play .video-box .countdown").addClass("slow");
|
||
}
|
||
t = setTimeout("countDown()",1000);
|
||
}
|
||
}
|
||
function stopTheTime(){
|
||
clearTimeout(t);
|
||
audioShow('stopBet');
|
||
$(".play .video-box .countdown").removeClass("slow");
|
||
$(".countdown").hide();
|
||
$(".play .maskResult").fadeIn(100,function(){
|
||
$(".play .maskResult .item").animate({"top":"50%","opacity":"1"})
|
||
});
|
||
}
|
||
var setBetStatus = function (number_tab_status){
|
||
if(number_tab_status.type == 1){
|
||
//桌子停台状态或者洗牌状态
|
||
Maskplay(number_tab_status.msg,number_tab_status.in_checkout);
|
||
}else if(number_tab_status.type == 2){
|
||
Maskplay();
|
||
$('#number_tab_status').val(number_tab_status.betStatus);
|
||
}
|
||
};
|
||
var setNumberInfo = function (round){
|
||
$('#table_id').val(round.tid);
|
||
$('#boot_dt_id').val(round.boot_id);
|
||
$('#boot_num').html(round.boot_num);
|
||
$('#number_tab_dt_id').val(round.number_tab_id);
|
||
$('#number').html(round.number_tab_number);
|
||
};
|
||
/* 桌子为停台中获知洗牌中的页面状态 */
|
||
function Maskplay(msg = '', state = 0){
|
||
if(state == 1 || state == 2){
|
||
$('body').append('<div class="Maskplay"><span class="msgbox">'+msg+'</span>'+'</div>');
|
||
}else{
|
||
$('body').find(".Maskplay").remove();
|
||
}
|
||
}
|
||
/* 声音提示 */
|
||
var audioShow = function (statusType,result,pair,previous_number_tab_id){
|
||
var audio = $("#audio").get(0);
|
||
var audioStartBetPath = "/static/wap/mp3/start.mp3";
|
||
var audioStopBetPath = "/static/wap/mp3/stop_2.mp3";
|
||
var audioBankerWinPath = "/static/wap/mp3/banker_win.mp3";
|
||
var audioPlayerWinPath = "/static/wap/mp3/player_win.mp3";
|
||
var audioTieWinPath = "/static/wap/mp3/tie.mp3";
|
||
if(statusType == 'startBet'){
|
||
$('#audio').attr('src',audioStartBetPath);
|
||
audio.play();
|
||
}
|
||
if(statusType == 'stopBet'){
|
||
$('#audio').attr('src',audioStopBetPath);
|
||
audio.play();
|
||
}
|
||
if(statusType == 'openingBaccaratResult' && result > 0){
|
||
if(result == 1){
|
||
$(".play .maskResult .banker-card").addClass("win");
|
||
$('#audio').attr('src',audioBankerWinPath);
|
||
audio.play();
|
||
}
|
||
if(result == 2){
|
||
$(".play .maskResult .player-card").addClass("win");
|
||
$('#audio').attr('src',audioPlayerWinPath);
|
||
audio.play();
|
||
}
|
||
if(result == 3){
|
||
$(".play .maskResult .tie-card").show();
|
||
$('#audio').attr('src',audioTieWinPath);
|
||
audio.play();
|
||
}
|
||
var thisResult=setTimeout(function(){
|
||
$(".play .maskResult .item").stop().animate({"top":"0","opacity":"0"},function(){
|
||
$(".play .maskResult").fadeOut(100);
|
||
$(".play .maskResult .banker-card").removeClass("win");
|
||
$(".play .maskResult .player-card").removeClass("win");
|
||
$(".play .maskResult .tie-card").hide();
|
||
})
|
||
clearTimeout(thisResult);
|
||
},2200);
|
||
|
||
setTimeout(function(){
|
||
user_bet(previous_number_tab_id);
|
||
},2300);
|
||
}
|
||
}
|
||
/* 获取会员输赢 */
|
||
var user_bet = function (previous_number_tab_id){
|
||
var user_id = parseInt($('#userid').val());
|
||
if(user_id > 0 && previous_number_tab_id > 0){
|
||
var query = new Object;
|
||
query.user_id = user_id;
|
||
query.number_tab_id = previous_number_tab_id;
|
||
query.table_id = TableId;
|
||
$.ajax({
|
||
url:"/baccarat/user_bet",
|
||
type:"POST",
|
||
dataType:"JSON",
|
||
data:query,
|
||
async:false,
|
||
success:function(data){
|
||
console.log(data)
|
||
if(data.win_total<0){
|
||
var text_total='输了',
|
||
thatclass ='lose';
|
||
|
||
}else if(data.win_total>0){
|
||
var text_total='赢了',
|
||
thatclass ='win';
|
||
}else{
|
||
var text_total='和局',
|
||
thatclass ='tie';
|
||
}
|
||
|
||
if(data.code == 1){
|
||
var downtext="",downmoney=0;
|
||
$.each(data.data,function(i,even){
|
||
downtext+='<tr> <td>'+even.name+'</td> <td>'+even.amount+'</td> <td>'+even.win+'</td> </tr>'
|
||
downmoney=even.amount++
|
||
})
|
||
$("body").append(
|
||
'<section class="result"> '+
|
||
'<div class="box clearfix">'+
|
||
'<i class="off-btn"></i>'+
|
||
'<div class="item fl">'+
|
||
'<div class="type '+thatclass+'">'+
|
||
'<span>'+text_total+'</span>'+
|
||
'<span>'+data.win_total+'</span>'+
|
||
'</div>'+
|
||
'</div>'+
|
||
'<div class="item fr data">'+
|
||
'<table>'+
|
||
'<tr> <td></td> <td>下注</td> <td>输赢</td> </tr>'+
|
||
downtext+
|
||
'<tr> <td>总数</td> <td>'+downmoney+'</td> <td>'+data.win_total+'</td> </tr>'+
|
||
'</table> '+
|
||
'</div>'+
|
||
'</div>'+
|
||
'</section>'
|
||
)
|
||
$(".play .result").animate({"bottom":0,"opacity":1})
|
||
}
|
||
}
|
||
});
|
||
}
|
||
}
|
||
/* 声音提示 end */
|
||
var setShowBet = function (showBet){
|
||
var old_now_player = parseInt($('#now_player').html()) > 0 ? parseInt($('#now_player').html()) : 0;
|
||
var old_now_playerpair = parseInt($('#now_playerpair').html()) > 0 ? parseInt($('#now_playerpair').html()) : 0;
|
||
var old_now_tie = parseInt($('#now_tie').html()) > 0 ? parseInt($('#now_tie').html()) : 0;
|
||
var old_now_banker = parseInt($('#now_banker').html()) > 0 ? parseInt($('#now_banker').html()) : 0;
|
||
var old_now_bankerpair = parseInt($('#now_bankerpair').html()) > 0 ? parseInt($('#now_bankerpair').html()) : 0;
|
||
showBet.player_amount = showBet.player_amount > 0 ? showBet.player_amount : 0;
|
||
showBet.player_pair_amount = showBet.player_pair_amount > 0 ? showBet.player_pair_amount : 0;
|
||
showBet.tie_amount = showBet.tie_amount > 0 ? showBet.tie_amount : 0;
|
||
showBet.banker_amount = showBet.banker_amount > 0 ? showBet.banker_amount : 0;
|
||
showBet.banker_pair_amount = showBet.banker_pair_amount > 0 ? showBet.banker_pair_amount : 0;
|
||
$('#now_player').html(showBet.player_amount + old_now_player);
|
||
$('#now_playerpair').html(showBet.player_pair_amount + old_now_playerpair);
|
||
$('#now_tie').html(showBet.tie_amount + old_now_tie);
|
||
$('#now_banker').html(showBet.banker_amount + old_now_banker);
|
||
$('#now_bankerpair').html(showBet.banker_pair_amount + old_now_bankerpair);
|
||
}
|
||
var clearShowBet = function (){
|
||
$('#now_player').html('0');
|
||
$('#now_playerpair').html('0');
|
||
$('#now_tie').html('0');
|
||
$('#now_banker').html('0');
|
||
$('#now_bankerpair').html('0');
|
||
}
|
||
var getLudan = function (TableId){
|
||
var ludan = false;
|
||
var query = new Object();
|
||
query.table_id = TableId;
|
||
query.reform = 1; // 调整数据结构传参,防止显示爆格
|
||
$.ajax({
|
||
url:'/dt/get_wb',
|
||
data:query,
|
||
dataType:"json",
|
||
type:"POST",
|
||
async:false,
|
||
success:function(data){
|
||
if(data.code == 1){
|
||
ludan = data.data;
|
||
}
|
||
}
|
||
});
|
||
return ludan;
|
||
}
|
||
//庄问路
|
||
var getLudanBanker = function(){
|
||
var next = new Object;
|
||
next.result = 'banker';
|
||
next.table = TableId;
|
||
next.forecast = 1;
|
||
next.reform = 1; // 调整数据结构传参,防止显示爆格
|
||
var returnData = false;
|
||
$.ajax({
|
||
url:"/waybill/waybill.php",
|
||
type:"POST",
|
||
dataType:"JSON",
|
||
data:next,
|
||
async:false,
|
||
success:function(data){
|
||
returnData = data;
|
||
}
|
||
});
|
||
return returnData;
|
||
}
|
||
|
||
//闲问路
|
||
var getLudanPlayer = function(){
|
||
var next = new Object;
|
||
next.result = 'player';
|
||
next.table = TableId;
|
||
next.reform = 1; // 调整数据结构传参,防止显示爆格
|
||
next.forecast = 1;
|
||
var returnData = false;
|
||
$.ajax({
|
||
url:"/waybill/waybill.php",
|
||
type:"POST",
|
||
dataType:"JSON",
|
||
data:next,
|
||
async:false,
|
||
success:function(data){
|
||
returnData = data;
|
||
}
|
||
});
|
||
return returnData;
|
||
}
|
||
// --------------弹窗画布 ---------------
|
||
var getLudan2 = function (TableId){
|
||
var ludan2 = false;
|
||
var query = new Object();
|
||
query.table_id = TableId;
|
||
$.ajax({
|
||
url:'/dt/get_wb',
|
||
data:query,
|
||
dataType:"json",
|
||
type:"POST",
|
||
async:false,
|
||
success:function(data){
|
||
if(data.code == 1){
|
||
ludan2 = data.data;
|
||
}
|
||
}
|
||
});
|
||
return ludan2;
|
||
}
|
||
//庄问路
|
||
var getLudanBanker2 = function(){
|
||
var next = new Object;
|
||
next.result = 'banker';
|
||
next.table = TableId;
|
||
next.forecast = 1;
|
||
var returnData = false;
|
||
$.ajax({
|
||
url:"/waybill/waybill.php",
|
||
type:"POST",
|
||
dataType:"JSON",
|
||
data:next,
|
||
async:false,
|
||
success:function(data){
|
||
returnData2 = data;
|
||
}
|
||
});
|
||
return returnData2;
|
||
}
|
||
|
||
//闲问路
|
||
var getLudanPlayer2 = function(){
|
||
var next = new Object;
|
||
next.result = 'player';
|
||
next.table = TableId;
|
||
next.forecast = 1;
|
||
var returnData2 = false;
|
||
$.ajax({
|
||
url:"/waybill/waybill.php",
|
||
type:"POST",
|
||
dataType:"JSON",
|
||
data:next,
|
||
async:false,
|
||
success:function(data){
|
||
returnData2 = data;
|
||
}
|
||
});
|
||
return returnData2;
|
||
}
|
||
|
||
$(function(){
|
||
$(window).resize(function(){
|
||
requestData(ludan);
|
||
requestData2(ludan2);
|
||
})
|
||
requestData(ludan);
|
||
requestData2(ludan2);
|
||
// 庄问路
|
||
$(".bankerask").click(function(){
|
||
var olddata =ludan;
|
||
var requestdata=getLudanBanker();
|
||
ask(requestdata,olddata)
|
||
console.log(requestdata,olddata)
|
||
|
||
})
|
||
// 闲问路
|
||
$(".playerask").click(function(){
|
||
var olddata =ludan;
|
||
var requestdata=getLudanPlayer();
|
||
ask(requestdata,olddata)
|
||
})
|
||
// 关闭结果
|
||
$(document).on("click",".result .box .off-btn",function(){
|
||
$(this).parents(".play .result").animate({"bottom":"-100%"},800,function(){
|
||
$(".play .result").remove();
|
||
})
|
||
})
|
||
|
||
|
||
// 弹窗问路
|
||
// 庄问路
|
||
$(".banker2").click(function(){
|
||
var olddata =ludan2;
|
||
var requestdata=getLudanBanker2();
|
||
ask2(requestdata,olddata)
|
||
|
||
})
|
||
// 闲问路
|
||
$(".player2").click(function(){
|
||
var olddata =ludan2;
|
||
var requestdata=getLudanPlayer2();
|
||
ask2(requestdata,olddata)
|
||
})
|
||
|
||
$(".play .canvas-box").click(function(){
|
||
$(".ludanbox").css({"visibility":"visible","opacity":1});
|
||
})
|
||
// 关闭弹窗
|
||
$(".off-btn").click(function(){
|
||
$(".ludanbox").css({"visibility":"hidden","opacity":0});
|
||
})
|
||
|
||
$(".enlarge-btn").click(function(){
|
||
var scale=$("#video-canvas").hasClass("scale")
|
||
if(scale){
|
||
$("#video-canvas").removeClass("scale")
|
||
}else{
|
||
$("#video-canvas").addClass("scale")
|
||
}
|
||
})
|
||
|
||
|
||
|
||
})
|
||
var Unit=0,Tabheight=0,Tabwidth=0;
|
||
var dpr = window.devicePixelRatio
|
||
function requestData(ludan){
|
||
var Vh=$(window).height();
|
||
var videoH=$(".video-box").outerHeight(),
|
||
betH=$(".bet-box").outerHeight(),
|
||
chipH=$(".chip-box").outerHeight(),
|
||
headH=$(".head-box").outerHeight();
|
||
Tabwidth=$(".canvas-box").width()*dpr;
|
||
canvasH=Vh-videoH-betH-chipH-headH;
|
||
Unit=Tabwidth/16;
|
||
Tabheight=Unit*6;
|
||
$("#playtab").attr("width",Tabwidth);
|
||
$("#playtab").attr("height",Tabheight);
|
||
$("#playtab").css("width",Tabwidth/dpr);
|
||
$("#playtab").css("height",Tabheight/dpr);
|
||
CanvasTable("#playtab",Unit,Tabheight,Tabwidth,ludan);
|
||
|
||
// 视频自适应
|
||
var windowHeight=$(window).height();
|
||
var mainHeight=$("#section").height();
|
||
$(".video-box").height(windowHeight-mainHeight)
|
||
}
|
||
|
||
function CanvasTable(Id,Unit,Tabheight,Tabwidth,ludan){
|
||
ctb=$(Id)[0].getContext('2d');
|
||
Drawline(ctb,Unit,Tabheight,Tabwidth)
|
||
if(ludan){
|
||
if(ludan.showRoad && ludan.showRoad.show_location){
|
||
$.each(ludan.showRoad.show_location,function(i,n){
|
||
SoloPath(ctb,Unit,n.show_x,n.show_y,n.result,n.pair);
|
||
})
|
||
}
|
||
if(ludan.bigRoad && ludan.bigRoad.show_location){
|
||
$.each(ludan.bigRoad.show_location,function(i,n){
|
||
if(i == 0 && n.result == 'tie'){
|
||
BigPathTie(ctb,Tabheight,n.tie_num);
|
||
}else{
|
||
BigPath(ctb,Unit,n.show_x,n.show_y,n.result,n.tie_num,n.pair);
|
||
}
|
||
})
|
||
}
|
||
|
||
if(ludan.bigEyeRoad && ludan.bigEyeRoad.show_location){
|
||
$.each(ludan.bigEyeRoad.show_location,function(i,n){
|
||
BigeyePath(ctb,Unit,n.show_x,n.show_y,n.result);
|
||
})
|
||
}
|
||
if(ludan.pathway && ludan.pathway.show_location){
|
||
$.each(ludan.pathway.show_location,function(i,n){
|
||
LittlePath(ctb,Unit,n.show_x,n.show_y,n.result);
|
||
})
|
||
}
|
||
if(ludan.roach && ludan.roach.show_location){
|
||
$.each(ludan.roach.show_location,function(i,n){
|
||
CockrochPath(ctb,Unit,n.show_x,n.show_y,n.result);
|
||
})
|
||
}
|
||
}
|
||
}
|
||
|
||
function requestData2(ludan2){
|
||
// console.log(ludan2)
|
||
var width=$(".ludanbox .box .canvas").width()*dpr;
|
||
CanvasTable2("#canvas1",width,ludan2);
|
||
CanvasTable2("#canvas2",width,ludan2);
|
||
}
|
||
|
||
|
||
function CanvasTable2(Id,width,ludan2){
|
||
var ctb2=$(Id)[0].getContext('2d');
|
||
if(Id=="#canvas1"){
|
||
var row=6,col=21;
|
||
var Unit=width/21;
|
||
|
||
}else if(Id=="#canvas2"){
|
||
var row=12,col=32;
|
||
var Unit=width/32;
|
||
}
|
||
$(Id).attr("width",Unit*col)
|
||
$(Id).attr("height",Unit*row)
|
||
$(Id).css("width",Unit*col/dpr);
|
||
$(Id).css("height",Unit*row/dpr);
|
||
Drawline2(ctb2,Unit,row,col)
|
||
if(Id=="#canvas1"){
|
||
if(ludan2.showRoad && ludan2.showRoad.show_location){
|
||
$.each(ludan2.showRoad.show_location,function(i,n){
|
||
SoloPath(ctb2,Unit,n.show_x,n.show_y,n.result,n.pair);
|
||
})
|
||
}
|
||
}else{
|
||
if(ludan2.bigRoad && ludan2.bigRoad.show_location){
|
||
$.each(ludan2.bigRoad.show_location,function(i,n){
|
||
if(i == 0 && n.result == 'tie'){
|
||
BigPathTie2(ctb2,Tabheight,n.tie_num);
|
||
}else{
|
||
BigPath2(ctb2,Unit,n.show_x,n.show_y,n.result,n.tie_num,n.pair);
|
||
}
|
||
})
|
||
}
|
||
// 大眼路
|
||
if(ludan2.bigEyeRoad && ludan2.bigEyeRoad.show_location){
|
||
$.each(ludan2.bigEyeRoad.show_location,function(i,n){
|
||
BigeyePath2(ctb2,Unit,n.show_x,n.show_y,n.result);
|
||
})
|
||
}
|
||
if(ludan2.pathway && ludan2.pathway.show_location){
|
||
$.each(ludan2.pathway.show_location,function(i,n){
|
||
LittlePath2(ctb2,Unit,n.show_x,n.show_y,n.result);
|
||
})
|
||
}
|
||
if(ludan2.roach && ludan2.roach.show_location){
|
||
$.each(ludan2.roach.show_location,function(i,n){
|
||
CockrochPath2(ctb2,Unit,n.show_x,n.show_y,n.result);
|
||
})
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
// 画线条
|
||
function Drawline2(ctb,Unit,row,col){
|
||
ctb.lineWidth = 1;//线条宽度
|
||
ctb.strokeStyle = "#999";//线条颜色
|
||
ctb.beginPath();
|
||
ctb.moveTo(0.5, 0);
|
||
ctb.lineTo(0.5, Unit*col);
|
||
for (var i = 1; i <= col; i++) {
|
||
ctb.moveTo(Unit*i,0);
|
||
ctb.lineTo(Unit*i,Unit*col);
|
||
}
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
ctb.beginPath();
|
||
ctb.moveTo(0, 0.5);
|
||
ctb.lineTo(Unit*col, 0.5);
|
||
for (var j = 1; j <= row; j++) {
|
||
ctb.moveTo(0,Unit*j);
|
||
ctb.lineTo(Unit*col,Unit*j);
|
||
}
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
}
|
||
|
||
|
||
// 画线条
|
||
function Drawline(ctb,Unit,Tabheight,Tabwidth){
|
||
ctb.lineWidth = 1;//线条宽度
|
||
ctb.strokeStyle = "#777";//线条颜色
|
||
ctb.beginPath();
|
||
ctb.moveTo(0.5, 0);
|
||
ctb.lineTo(0.5, Tabheight);
|
||
for (var i = 1; i <= 16; i++) {
|
||
ctb.moveTo(Unit*i,0);
|
||
ctb.lineTo(Unit*i,Tabheight);
|
||
}
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
ctb.beginPath();
|
||
ctb.moveTo(0, 0.5);
|
||
ctb.lineTo(Tabwidth, 0.5);
|
||
for (var j = 1; j <= 6; j++) {
|
||
ctb.moveTo(0,Unit*j);
|
||
ctb.lineTo(Tabwidth,Unit*j);
|
||
}
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
ctb.beginPath();
|
||
for (var k = 1; k <= 10; k++) {
|
||
ctb.moveTo(Unit*(k+6)+Unit/2,0);
|
||
ctb.lineTo(Unit*(k+6)+Unit/2,Tabheight);
|
||
}
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
ctb.beginPath();
|
||
for (var l = 0; l <= 6; l++) {
|
||
ctb.moveTo(Unit*7,Unit*l+Unit/2);
|
||
ctb.lineTo(Tabwidth,Unit*l+Unit/2);
|
||
}
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
}
|
||
|
||
|
||
// 局数 数,文字X坐标,文字Y坐标,文字大小风格
|
||
function Font_tie(ctb,num,Font_x,Font_y,fontsize,color){
|
||
if(num!==undefined){
|
||
ctb.beginPath();
|
||
ctb.font=fontsize;
|
||
ctb.textAlign = 'center';
|
||
ctb.textBaseline = 'middle';
|
||
ctb.fillStyle =color||"#ddd";
|
||
ctb.fillText(num,Font_x,Font_y);
|
||
ctb.stroke();
|
||
}
|
||
}
|
||
|
||
function SoloPath(ctb,unit,x,y,type,corners){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 0.5;
|
||
ctb.strokeStyle = "#fff";
|
||
var radius=unit/2||0;
|
||
if(type=="banker"){
|
||
var color='#de413b',
|
||
fonts='庄';
|
||
}else if(type=="player"){
|
||
var color='#1462a6',
|
||
fonts='闲';
|
||
}else if(type=="tie"){
|
||
var color='#396801',
|
||
fonts='和';
|
||
}
|
||
ctb.arc(radius+unit*(x-1), radius+unit*(y-1), unit*0.44, 0, Math.PI * 2);
|
||
ctb.fillStyle=color;
|
||
ctb.fill();
|
||
ctb.font=unit*0.5+"px Arial";
|
||
ctb.fillStyle ="#fff" ; // 颜色
|
||
ctb.textAlign = 'center';
|
||
ctb.textBaseline = 'middle';
|
||
|
||
ctb.fillText(fonts,radius+unit*(x-1),radius+unit*(y-1));
|
||
|
||
ctb.stroke();
|
||
var corner_xy=unit/3.4
|
||
if(corners=="bankerPair"){
|
||
corner(ctb,unit,x,y,corner_xy,'#ff2202');
|
||
}else if(corners=="playerPair"){
|
||
corner(ctb,unit,x,y,-corner_xy,'#0337ff');
|
||
}else if(corners=="bothPair"){
|
||
corner(ctb,unit,x,y,corner_xy,'#ff2202');
|
||
corner(ctb,unit,x,y,-corner_xy,'#0337ff');
|
||
}
|
||
}
|
||
|
||
//角标
|
||
function corner(ctb,unit,x,y,corner_xy,corner_color){
|
||
var radius=unit/2
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 0.04*unit;
|
||
ctb.strokeStyle = "#fff";
|
||
ctb.arc(radius+unit*(x-1)-corner_xy, radius+unit*(y-1)-corner_xy, unit*0.14, 0, Math.PI * 2);
|
||
ctb.fillStyle=corner_color;
|
||
ctb.fill();
|
||
ctb.stroke();
|
||
}
|
||
|
||
// 大路
|
||
function BigPath(ctb,unit,x,y,type,slash,corners){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = unit*0.035;
|
||
var radius=unit/2
|
||
var thisunit=radius/2
|
||
if(type=="player"){
|
||
var color="#1462a6";
|
||
}else if(type=="banker"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.arc(thisunit+radius*(x-1)+unit*7,thisunit+radius*(y-1), radius*0.4, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
if(slash!=0){
|
||
ctb.beginPath();
|
||
linewidth=unit*0.18;
|
||
ctb.lineWidth = thisunit*0.18;//线条宽度
|
||
ctb.lineCap = "round";
|
||
ctb.strokeStyle = "#3EA542";//线条颜色
|
||
ctb.moveTo(thisunit+radius*(x-1)-linewidth+unit*7,thisunit+radius*(y-1)+linewidth);
|
||
ctb.lineTo(thisunit+radius*(x-1)+linewidth+unit*7,thisunit+radius*(y-1)-linewidth);
|
||
ctb.stroke();
|
||
Font_tie(ctb,slash,thisunit+radius*(x-1)+unit*7, thisunit+radius*(y-1),radius*0.55+"px Arial","#000");
|
||
}
|
||
var corner_xy=radius/3.4
|
||
if(corners=="bankerPair"){
|
||
corner2(ctb,radius,x,y,corner_xy,'#ff2202');
|
||
}else if(corners=="playerPair"){
|
||
corner2(ctb,radius,x,y,-corner_xy,'#0337ff');
|
||
}else if(corners=="bothPair"){
|
||
corner2(ctb,radius,x,y,corner_xy,'#ff2202');
|
||
corner2(ctb,radius,x,y,-corner_xy,'#0337ff');
|
||
}
|
||
}
|
||
//大路角标
|
||
function corner2(ctb,unit,x,y,corner_xy,corner_color){
|
||
var radius=unit/2
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 0.04*unit;
|
||
ctb.strokeStyle = "#fff";
|
||
ctb.arc(radius*29+unit*(x-1)-corner_xy, radius+unit*(y-1)-corner_xy, unit*0.14, 0, Math.PI * 2);
|
||
ctb.fillStyle=corner_color;
|
||
ctb.fill();
|
||
ctb.stroke();
|
||
}
|
||
|
||
// 大路 第一局 和
|
||
function BigPathTie(ctb,unit,order){
|
||
var thisunit=unit/2
|
||
ctb.beginPath();
|
||
ctb.lineWidth = thisunit*0.1;//线条宽度
|
||
ctb.strokeStyle = "#3EA542";//线条颜色
|
||
ctb.lineCap = "round";
|
||
ctb.moveTo(thisunit*0.15+unit*7,thisunit/2);
|
||
ctb.lineTo(thisunit*0.85+unit*7,thisunit/2);
|
||
ctb.stroke();
|
||
Font_tie(ctb,order,thisunit/2+unit*7, thisunit/2,thisunit*0.55+"px Arial","#000");
|
||
}
|
||
// 大眼路
|
||
function BigeyePath(ctb,unit,x,y,type){
|
||
|
||
ctb.beginPath();
|
||
|
||
var radius=unit/2,
|
||
thisunit=radius/2
|
||
ctb.lineWidth = thisunit*0.12;
|
||
if(type=="blue"){
|
||
var color="#1462a6";
|
||
}else if(type=="red"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.arc(thisunit/2+thisunit*(x-1)+unit*7,thisunit/2+thisunit*(y-1)+unit*3, thisunit*0.35, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
}
|
||
//小路
|
||
function LittlePath(ctb,unit,x,y,type){
|
||
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 0;
|
||
var radius=unit/2,
|
||
thisunit=radius/2
|
||
if(type=="blue"){
|
||
var color="#1462a6";
|
||
}else if(type=="red"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.fillStyle=color;
|
||
ctb.arc(thisunit/2+thisunit*(x-1)+unit*7,thisunit/2+thisunit*(y-1)+unit*4.5, thisunit*0.35, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
ctb.fill();
|
||
}
|
||
function CockrochPath(ctb,unit,x,y,type){
|
||
|
||
var radius=unit/2,
|
||
thisunit=radius/2,
|
||
linewidth=radius*0.18;
|
||
ctb.beginPath();
|
||
ctb.lineCap = "round";
|
||
ctb.lineWidth = thisunit*0.18;//线条宽度
|
||
if(type=="blue"){
|
||
var color="#1462a6";
|
||
}else if(type=="red"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.moveTo(thisunit/2+thisunit*(x-1)-linewidth+unit*11.5,thisunit/2+thisunit*(y-1)+linewidth+unit*4.5);
|
||
ctb.lineTo(thisunit/2+thisunit*(x-1)+linewidth+unit*11.5,thisunit/2+thisunit*(y-1)-linewidth+unit*4.5);
|
||
ctb.stroke();
|
||
}
|
||
// 问路方法
|
||
function ask(newdata,olddata){
|
||
var time=8;
|
||
var nums=setInterval(function(){
|
||
time--;
|
||
var num=time%2;
|
||
if(time<0){
|
||
clearInterval(nums);
|
||
}else{
|
||
if(num==1){
|
||
ctb.clearRect(0, 0, Tabwidth, Tabheight)
|
||
CanvasTable("#playtab",Unit,Tabheight,Tabwidth,newdata)
|
||
}else{
|
||
ctb.clearRect(0, 0, Tabwidth, Tabheight)
|
||
CanvasTable("#playtab",Unit,Tabheight,Tabwidth,olddata)
|
||
}
|
||
}
|
||
},200);
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// ----------------- 弹窗画布专用----------------------------
|
||
// 大路
|
||
function BigPath2(ctb,unit,x,y,type,slash,corners){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = unit*0.08;
|
||
var radius=unit
|
||
var thisunit=radius/2
|
||
if(type=="player"){
|
||
var color="#1462a6";
|
||
}else if(type=="banker"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.arc(thisunit+radius*(x-1),thisunit+radius*(y-1), radius*0.4, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
if(slash!=0){
|
||
ctb.beginPath();
|
||
linewidth=unit*0.18;
|
||
ctb.lineWidth = thisunit*0.18;//线条宽度
|
||
ctb.lineCap = "round";
|
||
ctb.strokeStyle = "#3EA542";//线条颜色
|
||
ctb.moveTo(thisunit+radius*(x-1)-linewidth,thisunit+radius*(y-1)+linewidth);
|
||
ctb.lineTo(thisunit+radius*(x-1)+linewidth,thisunit+radius*(y-1)-linewidth);
|
||
ctb.stroke();
|
||
Font_tie(ctb,slash,thisunit+radius*(x-1), thisunit+radius*(y-1),radius*0.55+"px Arial","#000");
|
||
}
|
||
var corner_xy=unit/3.4
|
||
if(corners=="bankerPair"){
|
||
corner(ctb,unit,x,y,corner_xy,'#ff2202');
|
||
}else if(corners=="playerPair"){
|
||
corner(ctb,unit,x,y,-corner_xy,'#0337ff');
|
||
}else if(corners=="bothPair"){
|
||
corner(ctb,unit,x,y,corner_xy,'#ff2202');
|
||
corner(ctb,unit,x,y,-corner_xy,'#0337ff');
|
||
}
|
||
}
|
||
|
||
// 大路 第一局 和
|
||
function BigPathTie(ctb,unit,order){
|
||
var thisunit=unit
|
||
ctb.beginPath();
|
||
ctb.lineWidth = thisunit*0.1;//线条宽度
|
||
ctb.strokeStyle = "#3EA542";//线条颜色
|
||
ctb.lineCap = "round";
|
||
ctb.moveTo(thisunit*0.15,thisunit/2);
|
||
ctb.lineTo(thisunit*0.85,thisunit/2);
|
||
ctb.stroke();
|
||
Font_tie(ctb,order,thisunit/2, thisunit/2,thisunit*0.55+"px Arial","#000");
|
||
}
|
||
// 大眼路
|
||
function BigeyePath2(ctb,unit,x,y,type){
|
||
ctb.beginPath();
|
||
var radius=unit,
|
||
thisunit=radius/2
|
||
ctb.lineWidth = thisunit*0.15;
|
||
if(type=="blue"){
|
||
var color="#1462a6";
|
||
}else if(type=="red"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.arc(thisunit/2+thisunit*(x-1),thisunit/2+thisunit*(y-1)+unit*6, thisunit*0.35, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
}
|
||
//小路
|
||
function LittlePath2(ctb,unit,x,y,type){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 0;
|
||
var radius=unit,
|
||
thisunit=radius/2
|
||
if(type=="blue"){
|
||
var color="#1462a6";
|
||
}else if(type=="red"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.fillStyle=color;
|
||
ctb.arc(thisunit/2+thisunit*(x-1),thisunit/2+thisunit*(y-1)+unit*9, thisunit*0.35, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
ctb.fill();
|
||
}
|
||
|
||
function CockrochPath2(ctb,unit,x,y,type){
|
||
var radius=unit,
|
||
thisunit=radius/2,
|
||
linewidth=radius*0.18;
|
||
ctb.beginPath();
|
||
ctb.lineCap = "round";
|
||
ctb.lineWidth = thisunit*0.18;//线条宽度
|
||
if(type=="blue"){
|
||
var color="#1462a6";
|
||
}else if(type=="red"){
|
||
var color="#de413b"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.moveTo(thisunit/2+thisunit*(x-1)-linewidth+unit*16,thisunit/2+thisunit*(y-1)+linewidth+unit*9);
|
||
ctb.lineTo(thisunit/2+thisunit*(x-1)+linewidth+unit*16,thisunit/2+thisunit*(y-1)-linewidth+unit*9);
|
||
ctb.stroke();
|
||
}
|
||
|
||
// 问路方法
|
||
function ask2(newdata,olddata){
|
||
var time=8;
|
||
var nums=setInterval(function(){
|
||
time--;
|
||
var num=time%2;
|
||
if(time<0){
|
||
clearInterval(nums);
|
||
}else{
|
||
if(num==1){
|
||
requestData2(newdata)
|
||
}else{
|
||
requestData2(olddata)
|
||
}
|
||
}
|
||
},200);
|
||
} |