Pro/public/static/onlinechip/js/dt.js
2026-02-25 01:50:31 +08:00

406 lines
11 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$(function(){
var setup=true
$("#setup").click(function(){
if(setup==true){
$(".hide-nav").height("233")
setup=false
}else{
$(".hide-nav").height("0")
setup=true
}
})
// 点击空白开关
$(document).click(function(e){
if(setup==false){
var $cont=$("#setup,.hide-nav")
if(!$cont.is(e.target) && $cont.has(e.target).length === 0){
$(".hide-nav").height("0")
setup=true;
}
}
})
// 充值记录
$("#recharge_record").click(function(){
$("#recharge-box").show(200);
$("#record-box").hide(200);
$(".modification-box").hide(200);
$(".hide-nav").height("0")
setup=true;
})
// 游戏记录
$("#game_record").click(function(){
$("#record-box").show(200);
$(".modification-box").hide(200);
$("#recharge-box").hide(200);
$(".hide-nav").height("0")
setup=true;
})
$(".close-btn").click(function(){
$("#recharge-box").hide(200);
$("#record-box").hide(200);
})
// 修改密码
$("#modification").click(function(){
$(".modification-box").show(200);
$("#recharge-box").hide(200);
$("#record-box").hide(200);
$(".hide-nav").height("0")
setup=true;
})
$("#modification-off").click(function(){
$(".modification-box").hide(200);
$(".modification-box").find("input").val("")
})
// 显示密码
$(".seepassword").click(function(){
$(this).parents(".item").find("input").attr("type","text")
})
})
function resizeCanvas(id,CanvasConfig,data=false){
CanvasId = $(id),
ctb = CanvasId[0].getContext('2d')
Canvas_w = $(CanvasConfig["resizeid"]).width(),
Tab_w= Canvas_w/CanvasConfig["Tab_num"],
tab_a_rows = CanvasConfig["tab_a_rows"],
tab_a_cols = CanvasConfig["tab_a_cols"],
Canvas_h = Tab_w*tab_a_cols,
tab_a_x = Tab_w*tab_a_rows,
tab_a_height = Tab_w*tab_a_cols,
tab_b_rows = CanvasConfig["tab_b_rows"],
tab_b_cols = tab_a_cols*2,
tab_b=Tab_w/2,
Font_Size =Math.floor(Tab_w/1.8)+"px Arial"
Font_Size_s =Math.floor(Tab_w/2.8)+"px Arial"
CanvasId.attr("width",Canvas_w);
CanvasId.attr("height",Canvas_h+1);
tabCanvas(); //表格转图片
if(data != false){
var a_tab=data.showRoad.show_location,
b_tab=data.bigRoad.show_location,
c_tab=data.bigEyeRoad.show_location,
d_tab=data.pathway.show_location,
e_tab=data.roach.show_location
if(a_tab){
$.each(a_tab,function(a){
a_Tab(a_tab[a].show_x,a_tab[a].show_y,a_tab[a].result,a_tab[a].pair);
})
}
if(b_tab){
$.each(b_tab,function(b){
b_Tab(b_tab[b].show_x,b_tab[b].show_y,b_tab[b].result,b_tab[b].tie_num);
})
}
if(c_tab){
$.each(c_tab,function(c){
c_Tab(c_tab[c].show_x,c_tab[c].show_y,c_tab[c].result);
})
}
if(d_tab){
$.each(d_tab,function(d){
d_Tab(d_tab[d].show_x,d_tab[d].show_y,d_tab[d].result);
})
}
if(e_tab){
$.each(e_tab,function(e){
e_Tab(e_tab[e].show_x,e_tab[e].show_y,e_tab[e].result);
})
}
}
}
$("#banker_ask").click(function(){
$("#player_ask,#banker_ask").attr("disabled","disabled");
twinkle()
})
$("#player_ask").click(function(){
$("#player_ask,#banker_ask").attr("disabled","disabled");
twinkle()
})
// 庄闲问路
function twinkle(){
var b=8
nums=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(nums);
$("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
a_Tab(2,1,'player',1);
b_Tab(3,1,1,1,8);
c_Tab(3,1,2);
d_Tab(3,1,2);
e_Tab(5,1,1);
// 数据
ctb.globalAlpha=0.5
}
},200);
}
// 局数 数文字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 a_Tab(x,y,type,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
var x_z=x-0.5,
y_z=y-0.5;
if(type=="banker"){
var color='#ff2202',
fonts='龙';
}else if(type=="player"){
var color='#331d9a',
fonts='虎';
}else if(type=="tie"){
var color='#396801',
fonts='和';
}
ctb.clearRect(Tab_w*(x-1), Tab_w*(y-1), Tab_w, Tab_w);
ctb.arc(Tab_w*x_z, Tab_w*y_z, Tab_w*0.45, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
ctb.font=Font_Size;
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,Tab_w*x_z,Tab_w*y_z);
ctb.stroke();
var corner_xy=Tab_w/3.1
if(corners=="1"){
corner(x_z,y_z,corner_xy,'#0337ff');
}else if(corners=="2"){
corner(x_z,y_z,'-corner_xy','#0337ff');
}else if(corners=="3"){
corner(x_z,y_z,corner_xy,'#ff2202');
}else if(corners=="4"){
corner(x_z,y_z,-corner_xy,'#ff2202');
}else if(corners=="5"){
corner(x_z,y_z,corner_xy,'#ff2202');
corner(x_z,y_z,-corner_xy,'#0337ff');
}
}
// a区角标
function corner(x_z,y_z,corner_xy,corner_color){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
ctb.arc(Tab_w*x_z-corner_xy, Tab_w*y_z-corner_xy, Tab_w*0.14, 0, Math.PI * 2);
ctb.fillStyle=corner_color;
ctb.fill();
ctb.stroke();
}
// b区
function b_Tab(x,y,type,slash){
var b_x=tab_a_x,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(b_x+tab_b*x_z-tab_b/2.1, tab_b*y_z-tab_b/2.1, tab_b*0.9, tab_b*0.9);
if(type=="player"){
var color="#331a98";
}else if(type=="banker"){
var color="#fb2603"
}
ctb.beginPath();
ctb.lineWidth = 1.5;
ctb.strokeStyle = color;
ctb.arc(b_x+tab_b*x_z-0.5, tab_b*y_z-0.5, tab_b*0.38, 0, Math.PI * 2);
ctb.stroke();
if(slash!=0){
ctb.beginPath();
linewidth=tab_b/4;
ctb.lineWidth = 2;//线条宽度
ctb.lineCap = "round";
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.moveTo(b_x+x_z*tab_b-linewidth,tab_b*y_z+linewidth);
ctb.lineTo(b_x+x_z*tab_b+linewidth,tab_b*y_z-linewidth);
ctb.stroke();
if(slash!=1){
Font_tie(slash,b_x+tab_b*x_z, tab_b*y_z,Font_Size_s);
}
}
}
// b区第一局 和
function b_Tie(order){
var b_x=tab_a_x
ctb.clearRect(b_x+tab_b/20, 1, tab_b*0.9, tab_b*0.9);
// console.log(tab_b/20)
ctb.beginPath();
linewidth=tab_b/4;
ctb.lineWidth = 3.5;//线条宽度
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.lineCap = "round";
ctb.moveTo(b_x+tab_b/20,tab_b/2);
ctb.lineTo(b_x+tab_b*0.9,tab_b/2);
ctb.stroke();
Font_tie(order,b_x+tab_b/2, tab_b/2,Font_Size_s);
}
// c区
function c_Tab(x,y,type){
var c_x=tab_a_x,
c_y=tab_b*tab_b_cols/2,
tab_c=tab_b/2,
x_z=x-0.5,
y_z=y-0.5;
if(type=="blue"){
ctb.strokeStyle = '#3b39f2';
}else if(type=="red"){
ctb.strokeStyle = '#ff0000';
}
ctb.clearRect(c_x+tab_c*(x-1), c_y+tab_c*(y-1), tab_c, tab_c);
ctb.beginPath();
ctb.lineWidth = 1;
ctb.arc(c_x+tab_c*x_z, c_y+tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.stroke();
}
// d区
function d_Tab(x,y,type){
var d_x=tab_a_x,
d_y=tab_b*tab_b_cols/2*1.5,
tab_c=tab_b/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(d_x+tab_c*(x-1), d_y+tab_c*(y-1), tab_c, tab_c);
ctb.beginPath();
ctb.lineWidth = 0.2;
if(type=="blue"){
ctb.strokeStyle = '#3b39f2';
ctb.fillStyle='#3b39f2';
}else if(type=="red"){
ctb.strokeStyle = '#ff0000';
ctb.fillStyle='#ff0000';
}
ctb.arc(d_x+tab_c*x_z, d_y+tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.fill();
ctb.stroke();
}
// e区
function e_Tab(x,y,type){
var d_x=tab_a_x+tab_b*tab_b_rows/2,
d_y=tab_b*tab_b_cols/2*1.5,
linewidth=tab_b/3;
x_z=x-0.2,
y_z=y-0.2,
tab_d_x=tab_b/2;
ctb.clearRect(d_x+tab_d_x*(x-1), d_y+tab_d_x*(y-1), tab_d_x, tab_d_x);
ctb.beginPath();
ctb.lineCap = "butt";
ctb.lineWidth = 2;//线条宽度
//线条颜色
if(type=="blue"){
ctb.strokeStyle = '#331a98';
}else if(type=="red"){
ctb.strokeStyle = '#fd2203';
}
ctb.moveTo(d_x+tab_d_x*x_z,d_y-linewidth+tab_d_x*y_z);
ctb.lineTo(d_x-linewidth+tab_d_x*x_z,d_y+tab_d_x*y_z);
ctb.stroke();
}
// 画布表格
function tabCanvas(){
// 开始划线
ctb.beginPath();
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#ccc";//线条颜色
// A区
ctb.moveTo(0, 0.5);
ctb.lineTo(Tab_w*tab_a_rows, 0.5);
for (var a_col = 1; a_col <= tab_a_cols; a_col++) {
var a_y = a_col * Tab_w;
ctb.moveTo(0,a_y);
ctb.lineTo(Tab_w*tab_a_rows,a_y);
}
// 竖线
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, Tab_w*tab_a_cols);
for (var a_row = 1; a_row <= tab_a_rows; a_row++) {
var a_x = a_row * Tab_w;
ctb.moveTo(a_x,0);
ctb.lineTo(a_x,tab_a_height);
}
// BCDE区
ctb.moveTo(tab_a_x, 0.5);
ctb.lineTo(tab_b*tab_b_rows+tab_a_x, 0.5);
for (var a_col = 0; a_col <= tab_b_cols; a_col++) {
var b_y = a_col * tab_b;
ctb.moveTo(tab_a_x,b_y);
ctb.lineTo(tab_b*tab_b_rows+tab_a_x,b_y);
}
for (var b_row = 1; b_row <= tab_b_rows; b_row++) {
var b_x = b_row * tab_b+tab_a_x;
ctb.moveTo(b_x-0.5,0);
ctb.lineTo(b_x-0.5,tab_a_height);
}
ctb.stroke();
var image = new Image();
image.src = CanvasId[0].toDataURL("image/png");
CanvasId[0].style.backgroundImage = 'url(' + image.src +')';
return image;
ctb.clearRect(0, 0, 10000, 10000);
}