791 lines
21 KiB
JavaScript
791 lines
21 KiB
JavaScript
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);
|
|
getResultToatl(TableId,round.boot_id);
|
|
//getLastBet(TableId); //获取最后3盘的下注记录
|
|
};
|
|
/* 桌子为停台中获知洗牌中的页面状态 */
|
|
function Maskplay(msg, state){
|
|
if(state == 1 || state == 2){
|
|
var table_state = 'table_status_' + state;
|
|
$('#Toph').append('<div class="Maskplay"><span class="msgbox">'+lang[table_state]+'</span>'+'</div>');
|
|
}else{
|
|
$('#Toph').find(".Maskplay").remove();
|
|
}
|
|
}
|
|
/* 获取会员输赢 */
|
|
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:"/dt/user_bet",
|
|
type:"POST",
|
|
dataType:"JSON",
|
|
data:query,
|
|
async:false,
|
|
success:function(data){
|
|
if(data.win_total<0){
|
|
var text_total='<span style="color: #1DA275;">输 '+data.win_total+'</span>'
|
|
}else{
|
|
var text_total='<span style="color: #F00;">赢 +'+data.win_total+'</span>'
|
|
}
|
|
if(data.code == 1){
|
|
var str = '<div class="box table_box"><table>';
|
|
$.each(data.data,function (i,e){
|
|
str += '<tr><td>'+lang.bet+'<span style="color: #fadf47;"> '+e.amount+' </span></td><td><span>'+e.name+'</span></td><td>'+e.win+'</td></tr>';
|
|
})
|
|
str += '<tr style="background:#333;"><td>'+lang.total+'</td><td>-</td><td>'+text_total+'</td></tr></table></div>';
|
|
layer.open({
|
|
type: 1,
|
|
title:lang.settlement,
|
|
area: ['480px', 'auto'],
|
|
btn: [lang.confirm],
|
|
yes: function(){
|
|
layer.closeAll();
|
|
},
|
|
content: str
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
/* 声音提示 */
|
|
var audioShow = function (statusType,result,previous_number_tab_id){
|
|
var audio = $("#audio").get(0);
|
|
var audioStartBetPath = "/static/online/mp3/start.mp3";
|
|
var audioStopBetPath = "/static/online/mp3/stop_2.mp3";
|
|
var audioBankerWinPath = "/static/online/mp3/dragon_win.mp3";
|
|
var audioPlayerWinPath = "/static/online/mp3/tiger_win.mp3";
|
|
var audioTieWinPath = "/static/online/mp3/tie.mp3";
|
|
if(statusType == 'startBet'){
|
|
$('#audio').attr('src',audioStartBetPath);
|
|
audio.play();
|
|
}
|
|
if(statusType == 'stopBet'){
|
|
$('#audio').attr('src',audioStopBetPath);
|
|
audio.play();
|
|
}
|
|
if(statusType == 'openingDtResult' && 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").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);
|
|
|
|
}
|
|
}
|
|
/* 声音提示 end */
|
|
var setShowBet = function (showBet){
|
|
var old_now_player = parseInt($('#now_player').html()) > 0 ? parseInt($('#now_player').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;
|
|
showBet.player_amount = showBet.player_amount > 0 ? showBet.player_amount : 0;
|
|
showBet.tie_amount = showBet.tie_amount > 0 ? showBet.tie_amount : 0;
|
|
showBet.banker_amount = showBet.banker_amount > 0 ? showBet.banker_amount : 0;
|
|
$('#now_player').html(showBet.player_amount + old_now_player);
|
|
$('#now_tie').html(showBet.tie_amount + old_now_tie);
|
|
$('#now_banker').html(showBet.banker_amount + old_now_banker);
|
|
}
|
|
var clearShowBet = function (){
|
|
$('#now_banker').html('0');
|
|
$('#now_tie').html('0');
|
|
$('#now_player').html('0');
|
|
}
|
|
//庄问路
|
|
var getLudanBanker = function(){
|
|
var next = new Object;
|
|
next.game_id = $('#game_id').val();
|
|
next.boot_id = $('#boot_dt_id').val();
|
|
next.forecast = 1;
|
|
var returnData = false;
|
|
$.ajax({
|
|
url:'/index/waybill',
|
|
type:"POST",
|
|
dataType:"JSON",
|
|
data:next,
|
|
async:false,
|
|
success:function(data){
|
|
returnData = data;
|
|
}
|
|
});
|
|
return returnData
|
|
}
|
|
|
|
//闲问路
|
|
var getLudanPlayer = function(){
|
|
var next = new Object;
|
|
next.game_id = $('#game_id').val();
|
|
next.boot_id = $('#boot_dt_id').val();
|
|
next.forecast = 2;
|
|
var returnData = false;
|
|
$.ajax({
|
|
url:'/index/waybill',
|
|
type:"POST",
|
|
dataType:"JSON",
|
|
data:next,
|
|
async:false,
|
|
success:function(data){
|
|
returnData = data;
|
|
}
|
|
});
|
|
return returnData
|
|
}
|
|
var getLudan = function (TableId){
|
|
var ludan = false;
|
|
var query = new Object();
|
|
query.game_id = $('#game_id').val();
|
|
query.boot_id = $('#boot_dt_id').val();
|
|
$.ajax({
|
|
url:'/index/waybill',
|
|
data:query,
|
|
dataType:"json",
|
|
type:"POST",
|
|
async:false,
|
|
success:function(data){
|
|
if(data.status == true){
|
|
ludan = data.waybill;
|
|
}
|
|
}
|
|
});
|
|
return ludan;
|
|
}
|
|
var getResultToatl = function (TableId,BootId){
|
|
var query = new Object();
|
|
query.table_id = TableId;
|
|
query.boot_id = BootId;
|
|
$.ajax({
|
|
url:'/dt/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 getTableBigpath = function (game){
|
|
var returnData = false;
|
|
var query = new Object();
|
|
query.game = game;
|
|
$.ajax({
|
|
url:'/dt/get_table_ludan',
|
|
data:query,
|
|
dataType:"json",
|
|
type:"POST",
|
|
async:false,
|
|
success:function(data){
|
|
if(data.code == 1 && data.data){
|
|
returnData = data.data;
|
|
}
|
|
}
|
|
});
|
|
return returnData;
|
|
}
|
|
var tabObj=[];
|
|
$(function(){
|
|
$(window).resize(function(){
|
|
requestData(ludan);
|
|
TabRoadcanvas(tabObj);
|
|
})
|
|
requestData(ludan);
|
|
// 滚动广告
|
|
var roll=0;
|
|
LiWidth=0;
|
|
$(".single .notice ul li").each(function(){
|
|
LiWidth+=$(this).innerWidth()
|
|
})
|
|
$(".single .notice ul").append($(".single .notice ul").html())
|
|
var timer = setInterval(notice, 20);
|
|
$(".notice .roll-box").hover(function() {
|
|
clearInterval(timer);
|
|
},function() {
|
|
timer = setInterval(notice, 20);
|
|
})
|
|
function notice(){
|
|
if (roll == -LiWidth) {
|
|
roll = 0;
|
|
}
|
|
roll -= 1;
|
|
$(".notice .scroll").css({
|
|
left: roll
|
|
})
|
|
}
|
|
|
|
// 庄问路
|
|
$(".bankerask").click(function(){
|
|
var newdata=getLudanBanker();
|
|
ask(newdata.waybill,ludan);
|
|
})
|
|
// 闲问路
|
|
$(".playerask").click(function(){
|
|
var newdata=getLudanPlayer();
|
|
ask(newdata.waybill,ludan);
|
|
})
|
|
// 换桌
|
|
$(".play .game-tab .game-menu .item").click(function(){
|
|
$(this).addClass("active").siblings().removeClass("active");
|
|
var thisid = $(this).attr('id');
|
|
if(thisid == 'allTable') var game = 0;
|
|
if(thisid == 'baccaratTable') var game = 1;
|
|
if(thisid == 'dtTable') var game = 2;
|
|
tabObj = getTableBigpath(game);
|
|
TabRoadcanvas(tabObj);
|
|
})
|
|
$("#road,.table_icon").click(function(){
|
|
$(".play .game-tab").show();
|
|
$(".mask-bg").show();
|
|
tabObj = getTableBigpath(0);
|
|
TabRoadcanvas(tabObj);
|
|
})
|
|
$(".mask-bg").click(function(){
|
|
$(".play .game-tab").hide();
|
|
$(".mask-bg").hide();
|
|
})
|
|
|
|
var setbox=true;
|
|
$(".play .header .setbox").click(function(){
|
|
var right=$(".play .header .tab-control").attr("right")
|
|
if(setbox==true){
|
|
$(".play .header .tab-control").animate({"right":"60px"},800)
|
|
setbox=false
|
|
}else{
|
|
$(".play .header .tab-control").animate({"right":"-600px"},800)
|
|
setbox=true
|
|
}
|
|
|
|
})
|
|
|
|
// 静音
|
|
var voiced_icon=true;
|
|
$(".play .control-btn .voiced_icon").click(function(){
|
|
if(voiced_icon==true){
|
|
$(this).children("i").css("backgroundImage","url('/static/online/img/silent_icon.png')")
|
|
$("#audio").get(0).muted = true
|
|
voiced_icon=false
|
|
}else{
|
|
$(this).children("i").css("backgroundImage","url('/static/online/img/voiced_icon.png')")
|
|
$("#audio").get(0).muted = false
|
|
voiced_icon=true
|
|
}
|
|
})
|
|
//拖拽效果
|
|
window.addEventListener("load", function() {
|
|
var addEventListener = 'addEventListener';
|
|
var elems = document.getElementsByClassName('dragscroll');
|
|
for (var i = 0; i < elems.length;) {
|
|
(function(elem, lastClientX, lastClientY, pushed) {
|
|
elem[addEventListener]('mousedown', function(e) {
|
|
pushed = 1;
|
|
lastClientX = e.clientX;
|
|
lastClientY = e.clientY;
|
|
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
}, 0);
|
|
|
|
window[addEventListener]('mousemove', function(e) {
|
|
if (pushed) {
|
|
elem.scrollLeft -=
|
|
(- lastClientX + (lastClientX=e.clientX));
|
|
elem.scrollTop -=
|
|
(- lastClientY + (lastClientY=e.clientY));
|
|
}
|
|
}, 0);
|
|
|
|
window[addEventListener]('mouseup', function(){
|
|
pushed = 0;
|
|
}, 0);
|
|
|
|
})(elems[i++]);
|
|
}
|
|
}, 0);
|
|
|
|
// 切换语言
|
|
$('.changeLang').click(function(){
|
|
layer.open({type: 1, area: ['380px', '300px'], closeBtn: false,title:lang.message,btn: [lang.confirm,lang.cancel], content: '<div class="box"><div id="zh-cn" class="language">简体中文</div><div id="zh-tw" class="language">繁体中文</div><div id="en-us" class="language">English</div></div>',yes:function(index, layero){
|
|
var language = $('.language.red_bg').attr('id');
|
|
if(language == "zh-cn" || language == "zh-tw" || language == "en-us"){
|
|
localStorage.setItem("lang", language);
|
|
$.ajax({
|
|
url:'/login/lang',
|
|
data:{lang:language},
|
|
dataType:"json",
|
|
type:"POST",
|
|
success:function(data){
|
|
location.reload();
|
|
}
|
|
})
|
|
}
|
|
layer.close(index);
|
|
}
|
|
})
|
|
if(lang.lang == "zh-cn"){
|
|
$('#zh-cn').addClass('red_bg');
|
|
}else if(lang.lang == "zh-tw"){
|
|
$('#zh-tw').addClass('red_bg');
|
|
}else if(lang.lang == "en-us"){
|
|
$('#en-us').addClass('red_bg');
|
|
}
|
|
});
|
|
$(document).on('click','.language',function(){
|
|
$(this).siblings().removeClass('red_bg');
|
|
$(this).addClass('red_bg');
|
|
});
|
|
|
|
})
|
|
|
|
var Vh=0,Vw=0;
|
|
// 问路方法
|
|
// 问路方法
|
|
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){
|
|
requestData(newdata,'ask')
|
|
}else{
|
|
requestData(olddata,'ask')
|
|
}
|
|
}
|
|
},200);
|
|
}
|
|
function countDown(time) {
|
|
$("#second").html(time);
|
|
if(time == 4){
|
|
$(".play .countdown").addClass("slow");
|
|
}
|
|
}
|
|
function stopTheTime(){
|
|
audioShow('stopBet');
|
|
$(".play .countdown").removeClass("slow");
|
|
$(".play .countdown").hide();
|
|
$(".play .maskResult").fadeIn(100,function(){
|
|
$(".play .maskResult .item").animate({"top":"62%","opacity":"1"})
|
|
});
|
|
}
|
|
|
|
var Obj={};
|
|
var SoloWidth=0,BigPathWidth=0,SmallPathWidth=0;canvasFil=0;
|
|
function requestData(ludan,ask){
|
|
Vh=$(window).height(),
|
|
Vw=$(window).width();
|
|
|
|
if(Vw>1480){
|
|
$(".play .header .tab-control").css("right","45px")
|
|
}else{
|
|
$(".play .header .tab-control").css("right","-600px")
|
|
}
|
|
// if(Vw<1270){
|
|
// $(".play .game-logo").hide()
|
|
// }else{
|
|
// $(".play .game-logo").show()
|
|
// }
|
|
|
|
var Toph=Vh*0.66
|
|
var Footh=Vh*0.34-20
|
|
var Mainh=Toph-$(".play .header").outerHeight(true);
|
|
$(".play .main").css("marginTop",$(".play .header").outerHeight(true))
|
|
|
|
|
|
var Topw=$(".play .visual").width();
|
|
$("#single").height(Footh)
|
|
$(".play .visual .item.bet-box").width(Topw*0.35)
|
|
|
|
|
|
|
|
var Chipw=$(".play .visual .item.bet-box").outerWidth(true);
|
|
$(".play .visual .item.video-box").width((Topw-Chipw)*0.65)
|
|
$(".play .visual .control-box").width((Topw-Chipw)*0.35)
|
|
$(".play .main").height(Mainh)
|
|
$(".play .video-mini").height(Mainh-20)
|
|
|
|
|
|
|
|
var Beth= $(".play .bet-box .line").outerHeight(true)
|
|
$(".bet-view").height(Mainh-Beth)
|
|
$(".play .bet-box .chip-box").height(Mainh-Beth-90)
|
|
|
|
|
|
|
|
var BigPath=Math.abs((Footh-35-30)/10),
|
|
SmallPath=Math.abs((BigPath*4)/6),
|
|
Solo=Math.abs((Footh-8-20-30)/6)
|
|
|
|
var SingleWidth=$(".play .main").width();
|
|
SoloWidth=(SingleWidth/50)*20
|
|
BigPathWidth=SingleWidth/50*30
|
|
SmallPathWidth=(SingleWidth/50*30-16)/3
|
|
$(".single .left").width(SoloWidth);
|
|
$(".single .right").width(BigPathWidth);
|
|
$(".single .right .small-path .item").width(SmallPathWidth);
|
|
|
|
$("#control-btn").css("bottom",Toph*0.28)
|
|
if(Toph<500){
|
|
$(".play .control-btn").css("display","none")
|
|
}else{
|
|
$(".play .control-btn").css("display","block")
|
|
}
|
|
var showRoad=ludan.showRoad||''
|
|
var bigRoad=ludan.bigRoad||''
|
|
var bigEyeRoad=ludan.bigEyeRoad||''
|
|
var pathway=ludan.pathway||''
|
|
var roach=ludan.roach||''
|
|
CanvasTable("#solo",Solo,6,200,showRoad,ask);
|
|
CanvasTable("#big-path",BigPath,6,100,bigRoad,ask);
|
|
CanvasTable("#bigeye-path",SmallPath,6,100,bigEyeRoad,ask);
|
|
CanvasTable("#little-path",SmallPath,6,100,pathway,ask);
|
|
CanvasTable("#cockroch-path",SmallPath,6,100,roach,ask);
|
|
|
|
|
|
|
|
$(".prev").click(function(){
|
|
var MoveRecord=parseFloat($(this).siblings("canvas").css("marginLeft")),
|
|
TypeId=$(this).siblings("canvas").attr("id"),
|
|
Move=0;
|
|
if(TypeId=="solo"){
|
|
Move=Solo
|
|
}else if(TypeId=="big-path"){
|
|
Move=BigPath
|
|
}else{
|
|
Move=SmallPath
|
|
}
|
|
if(parseInt(MoveRecord)<0){
|
|
MoveRecord= MoveRecord+Move
|
|
$(this).siblings("canvas").css({marginLeft:MoveRecord})
|
|
}else{
|
|
$(this).siblings("canvas").css({marginLeft:0})
|
|
}
|
|
})
|
|
$(".next").click(function(){
|
|
var MoveRecord=parseFloat($(this).siblings("canvas").css("marginLeft")),
|
|
TypeId=$(this).siblings("canvas").attr("id"),
|
|
Move=0;
|
|
if(TypeId=="solo"){
|
|
Move=Solo
|
|
}else if(TypeId=="big-path"){
|
|
Move=BigPath
|
|
}else{
|
|
Move=SmallPath
|
|
}
|
|
MoveRecord= MoveRecord-Move
|
|
$(this).siblings("canvas").css({marginLeft:MoveRecord})
|
|
})
|
|
}
|
|
|
|
function CanvasTable(Id,tabHeight,row,col,path,ask){
|
|
var TabHeight=Math.abs(tabHeight),
|
|
TabWidth=TabHeight,
|
|
|
|
rows=row, //排
|
|
cols=col, //列
|
|
thisdata=path,
|
|
CanvasWidht=TabWidth*cols, //画布宽
|
|
CanvasHeight=TabHeight*rows, //画布高
|
|
canvasId=$(Id),
|
|
ctb=canvasId[0].getContext('2d');
|
|
|
|
$(Id).attr("width",CanvasWidht)
|
|
$(Id).attr("height",CanvasHeight)
|
|
|
|
|
|
|
|
switch(true){
|
|
case Id=="#solo":
|
|
ctb.clearRect(0, 0, TabHeight*200, TabHeight*6)
|
|
Drawline(ctb,TabHeight,CanvasWidht,CanvasHeight,rows,cols)
|
|
if(path){
|
|
$.each(path,function (i,n){
|
|
SoloPath(ctb,TabHeight,n.show_x,n.show_y,n.result,n.pair)
|
|
})
|
|
}
|
|
canvasFill=SoloWidth;
|
|
break;
|
|
case Id=="#big-path":
|
|
ctb.clearRect(0, 0, TabHeight*100, TabHeight*6)
|
|
Drawline(ctb,TabHeight,CanvasWidht,CanvasHeight,rows,cols)
|
|
if(path){
|
|
$.each(path,function (i,n){
|
|
if(i == 0 && n.result == 3){
|
|
BigPathTie(ctb,TabHeight,n.tie_num);
|
|
}else{
|
|
BigPath(ctb,TabHeight,n.show_x,n.show_y,n.result,n.tie_num);
|
|
}
|
|
})
|
|
}
|
|
canvasFill=BigPathWidth;
|
|
break;
|
|
case Id=="#bigeye-path":
|
|
ctb.clearRect(0, 0, TabHeight*100, TabHeight*6)
|
|
Drawline(ctb,TabHeight,CanvasWidht,CanvasHeight,rows,cols)
|
|
if(path){
|
|
$.each(path,function (i,n){
|
|
BigeyePath(ctb,TabHeight,n.show_x,n.show_y,n.result);
|
|
})
|
|
}
|
|
canvasFill=SmallPathWidth;
|
|
break;
|
|
case Id=="#little-path":
|
|
ctb.clearRect(0, 0, TabHeight*100, TabHeight*6)
|
|
Drawline(ctb,TabHeight,CanvasWidht,CanvasHeight,rows,cols)
|
|
if(path){
|
|
$.each(path,function (i,n){
|
|
LittlePath(ctb,TabHeight,n.show_x,n.show_y,n.result);
|
|
})
|
|
}
|
|
canvasFill=SmallPathWidth;
|
|
break;
|
|
case Id=="#cockroch-path":
|
|
ctb.clearRect(0, 0, TabHeight*100, TabHeight*6)
|
|
Drawline(ctb,TabHeight,CanvasWidht,CanvasHeight,rows,cols)
|
|
if(path){
|
|
$.each(path,function (i,n){
|
|
CockrochPath(ctb,TabHeight,n.show_x,n.show_y,n.result);
|
|
})
|
|
}
|
|
canvasFill=SmallPathWidth;
|
|
break;
|
|
}
|
|
if(path!=''){
|
|
var canvasmove=path[path.length-1].show_x*TabHeight
|
|
if(canvasFill<canvasmove&&ask==undefined){
|
|
$(Id).css("margin-left",-canvasmove+canvasFill-TabHeight)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// 画线条
|
|
function Drawline(ctb,TabHeight,CanvasWidht,CanvasHeight,rows,cols){
|
|
TabWidth=TabHeight
|
|
ctb.lineWidth = 1;//线条宽度
|
|
ctb.strokeStyle = "#ffa042";//线条颜色
|
|
ctb.beginPath();
|
|
ctb.moveTo(0, 0.5);
|
|
ctb.lineTo(CanvasWidht, 0.5);
|
|
for (var i = 1; i <= rows; i++) {
|
|
ctb.moveTo(0, TabHeight*i);
|
|
ctb.lineTo(CanvasWidht, TabHeight*i);
|
|
}
|
|
ctb.closePath()
|
|
ctb.stroke();
|
|
ctb.beginPath();
|
|
ctb.moveTo(0.5, 0);
|
|
ctb.lineTo(0.5, CanvasHeight);
|
|
for (var j = 1; j <= cols; j++) {
|
|
ctb.moveTo(TabWidth*j,0);
|
|
ctb.lineTo(TabWidth*j,CanvasHeight);
|
|
}
|
|
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==1){
|
|
var color='#b20a00',
|
|
fonts=lang.dragon;
|
|
}else if(type==2){
|
|
var color='#0543bc',
|
|
fonts=lang.tiger;
|
|
}else if(type==3){
|
|
var color='#1d8701',
|
|
fonts=lang.tie;
|
|
}
|
|
ctb.arc(radius+unit*(x-1), radius+unit*(y-1), unit*0.4, 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();
|
|
}
|
|
|
|
//角标
|
|
function corner(ctb,unit,x,y,corner_xy,corner_color){
|
|
var radius=unit/2
|
|
ctb.beginPath();
|
|
ctb.lineWidth = 0.5;
|
|
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.09;
|
|
var radius=unit/2
|
|
if(type==2){
|
|
var color="#0543bc";
|
|
}else if(type==1){
|
|
var color="#b20a00"
|
|
}
|
|
ctb.strokeStyle = color;
|
|
ctb.arc(radius+unit*(x-1),radius+unit*(y-1), unit*0.38, 0, Math.PI * 2);
|
|
ctb.closePath()
|
|
ctb.stroke();
|
|
|
|
|
|
if(slash!=0){
|
|
ctb.beginPath();
|
|
linewidth=unit*0.2;
|
|
ctb.lineWidth = 2;//线条宽度
|
|
ctb.lineCap = "round";
|
|
ctb.strokeStyle = "#1d8701";//线条颜色
|
|
|
|
ctb.moveTo(radius+unit*(x-1)-linewidth,radius+unit*(y-1)+linewidth);
|
|
ctb.lineTo(radius+unit*(x-1)+linewidth,radius+unit*(y-1)-linewidth);
|
|
|
|
ctb.stroke();
|
|
if(slash!=0){
|
|
Font_tie(ctb,slash,radius+unit*(x-1), radius+unit*(y-1),unit*0.55+"px Arial","#000");
|
|
}
|
|
}
|
|
var corner_xy=unit/3.5
|
|
if(corners==1){
|
|
corner(ctb,unit,x,y,corner_xy,'#ff2202');
|
|
}else if(corners==2){
|
|
corner(ctb,unit,x,y,-corner_xy,'#0337ff');
|
|
}else if(corners==3){
|
|
corner(ctb,unit,x,y,corner_xy,'#ff2202');
|
|
corner(ctb,unit,x,y,-corner_xy,'#0337ff');
|
|
}
|
|
}
|
|
|
|
// 大路 第一局 和
|
|
function BigPathTie(ctb,unit,order){
|
|
ctb.beginPath();
|
|
ctb.lineWidth = 3;//线条宽度
|
|
ctb.strokeStyle = "#3EA542";//线条颜色
|
|
ctb.lineCap = "round";
|
|
ctb.moveTo(unit*0.15,unit/2);
|
|
ctb.lineTo(unit*0.85,unit/2);
|
|
ctb.stroke();
|
|
Font_tie(ctb,order,unit/2, unit/2,unit*0.55+"px Arial","#000");
|
|
}
|
|
|
|
|
|
// 大眼路
|
|
function BigeyePath(ctb,unit,x,y,type){
|
|
ctb.beginPath();
|
|
ctb.lineWidth = 2;
|
|
var radius=unit/2
|
|
if(type==2){
|
|
var color="#0543bc";
|
|
}else if(type==1){
|
|
var color="#b20a00"
|
|
}
|
|
ctb.strokeStyle = color;
|
|
ctb.arc(radius+unit*(x-1),radius+unit*(y-1), unit*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
|
|
if(type==2){
|
|
var color="#0543bc";
|
|
}else if(type==1){
|
|
var color="#b20a00"
|
|
}
|
|
ctb.strokeStyle = color;
|
|
ctb.fillStyle=color;
|
|
ctb.arc(radius+unit*(x-1),radius+unit*(y-1), unit*0.35, 0, Math.PI * 2);
|
|
ctb.closePath()
|
|
ctb.stroke();
|
|
ctb.fill();
|
|
}
|
|
|
|
|
|
function CockrochPath(ctb,unit,x,y,type){
|
|
var radius=unit/2,
|
|
linewidth=unit*0.28;
|
|
ctb.beginPath();
|
|
ctb.lineCap = "round";
|
|
ctb.lineWidth = 3;//线条宽度
|
|
if(type==2){
|
|
var color="#0543bc";
|
|
}else if(type==1){
|
|
var color="#b20a00"
|
|
}
|
|
ctb.strokeStyle = color;
|
|
ctb.moveTo(radius+unit*(x-1)-linewidth,radius+unit*(y-1)+linewidth);
|
|
ctb.lineTo(radius+unit*(x-1)+linewidth,radius+unit*(y-1)-linewidth);
|
|
ctb.stroke();
|
|
} |