1038 lines
29 KiB
JavaScript
1038 lines
29 KiB
JavaScript
|
||
//判断屏幕方向
|
||
if(window.orientation==90||window.orientation==-90){
|
||
console.log("横屏状态!")
|
||
$('#page-landscape').hide();
|
||
}else{
|
||
console.log("竖屏状态!");
|
||
$('#page-landscape').show();
|
||
}
|
||
|
||
$('.full-screen').click(function(){
|
||
requestFullScreen();
|
||
$('.full-screen').hide();
|
||
});
|
||
function requestFullScreen() {
|
||
var de = document.documentElement;
|
||
if (de.requestFullscreen) {
|
||
de.requestFullscreen();
|
||
} else if (de.mozRequestFullScreen) {
|
||
de.mozRequestFullScreen();
|
||
} else if (de.webkitRequestFullScreen) {
|
||
de.webkitRequestFullScreen();
|
||
}
|
||
}
|
||
|
||
//监听屏幕方向
|
||
window.onorientationchange = function(){
|
||
switch(window.orientation){
|
||
case -90:
|
||
case 90:
|
||
$('#page-landscape').hide();
|
||
console.log("横屏:" + window.orientation);
|
||
break;
|
||
case 0:
|
||
case 180:
|
||
$('#page-landscape').show();
|
||
console.log("竖屏:" + window.orientation);
|
||
break;
|
||
}
|
||
}
|
||
|
||
// 定时器弹窗提示
|
||
function alert_box(ale_dynamic,d_time){
|
||
$(".a_lert").remove();
|
||
$("body").append('<div class="a_lert"><div class="a_box"><p></p></div></div>');
|
||
$(".a_lert .a_box p").append(ale_dynamic);
|
||
var d_time = d_time || 3000;
|
||
setTimeout(function(){
|
||
$(".a_lert").remove();
|
||
},d_time);
|
||
}
|
||
|
||
// 按钮弹窗
|
||
var pop=new Object();
|
||
pop.alert=function (i){
|
||
$(".pop").remove();
|
||
if(i.btn == undefined){
|
||
i.btn = "确定";
|
||
}
|
||
$("body").append(
|
||
'<div class="pop"> <div class="pop-box">'+
|
||
'<p class="txt">'+i.content+'</p>'+
|
||
'<button class="btn off-btn">'+i.btn+'</button> </div>'+
|
||
'</div>')
|
||
$(document).on("click",".off-btn",function(){
|
||
var transmit=i.yes
|
||
if(transmit!=undefined && transmit!=""){
|
||
transmit();
|
||
}
|
||
$(".pop").remove();
|
||
})
|
||
}
|
||
|
||
|
||
// 无缝滚动公告
|
||
var roll=0;
|
||
LiWidth=0;
|
||
Notice(".notice ul",".notice ul li");
|
||
function Notice(lu,li){
|
||
$(".notice ul li").each(function(){
|
||
LiWidth+=$(this).innerWidth()
|
||
})
|
||
$(".notice ul").width(LiWidth*3)
|
||
$(".notice ul").append($(".notice ul").html())
|
||
var timer = setInterval(notice,15);
|
||
}
|
||
function notice(){
|
||
if (roll == -LiWidth) {
|
||
roll = 0;
|
||
}
|
||
roll -= 1;
|
||
$(".notice .scroll").css({
|
||
"left": roll
|
||
})
|
||
}
|
||
|
||
|
||
// url传参截取
|
||
function getUrlParam(name) {
|
||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
|
||
var r = window.location.search.substr(1).match(reg); //匹配目标参数
|
||
if (r != null) return unescape(r[2]);
|
||
return null; //返回参数值
|
||
}
|
||
|
||
|
||
function Waybill(ctb,unit,rows,cols,path,gameId,ask,askroad){
|
||
var ask=ask||false;
|
||
var askroad=askroad||{
|
||
"askshowroad":false,
|
||
"askbigRoad":false,
|
||
"askbigEyeRoad":false,
|
||
"askpathway":false,
|
||
"askroach":false,
|
||
};
|
||
|
||
ctb.clearRect(0, 0, unit*100, unit*rows)
|
||
Drawline(ctb,unit,rows,cols);
|
||
if(path){
|
||
var showRoad=path.showRoad;
|
||
var bigRoad=path.bigRoad;
|
||
var bigEyeRoad=path.bigEyeRoad;
|
||
var pathway=path.pathway;
|
||
var roach=path.roach;
|
||
if(showRoad!=''){
|
||
var roadType="showWay"
|
||
cutRoad(roadType,ctb,unit,showRoad,cols,gameId,ask,askroad.askshowroad);
|
||
}
|
||
if(bigRoad!=''){
|
||
if(bigRoad[0].result==3&&bigRoad[0].show_x==1&&bigRoad[0].show_y==1){
|
||
BigPathTie(ctb,unit,cols,bigRoad[0].tie_num)
|
||
}else{
|
||
var roadType="bigWay";
|
||
cutRoad(roadType,ctb,unit,bigRoad,cols,gameId,ask,askroad.askbigRoad);
|
||
}
|
||
}
|
||
if(bigEyeRoad!=''){
|
||
var roadType="bigeyeWay"
|
||
cutRoad(roadType,ctb,unit,bigEyeRoad,cols,gameId,ask,askroad.askbigEyeRoad);
|
||
};
|
||
if(pathway!=''){
|
||
var roadType="littlWay"
|
||
cutRoad(roadType,ctb,unit,pathway,cols,gameId,ask,askroad.askpathway);
|
||
};
|
||
if(roach!=''){
|
||
var roadType="roachWay";
|
||
cutRoad(roadType,ctb,unit,roach,cols,gameId,ask,askroad.askroach);
|
||
};
|
||
}
|
||
}
|
||
|
||
|
||
// 前端路单数据截取
|
||
function cutRoad(roadType,ctb,unit,roadData,cols,gameId,ask,askroad){
|
||
var L=roadData.length;
|
||
var new_roadData=[];
|
||
var Tab=0
|
||
if(roadType=="showWay"||roadType=="bigWay"){
|
||
if(roadType=="showWay"){
|
||
if(ask&&askroad){
|
||
Tab=cols/2;
|
||
}else{
|
||
Tab=cols/2-1;
|
||
}
|
||
|
||
}else{
|
||
if(ask&&askroad){
|
||
Tab=cols;
|
||
}else{
|
||
Tab=cols-1;
|
||
}
|
||
}
|
||
}else{
|
||
if(ask&&askroad){
|
||
Tab=cols-1;
|
||
}else{
|
||
Tab=cols-2;
|
||
}
|
||
|
||
}
|
||
var start_x=cols/2+0.25;
|
||
if(L>=1){
|
||
var last_x=roadData[L-1].show_x
|
||
if(last_x>Tab){
|
||
var cut=last_x-Tab
|
||
$.each(roadData,function(i,v){
|
||
if(v.show_x>cut){
|
||
new_roadData.push(v)
|
||
}
|
||
})
|
||
}else{
|
||
new_roadData=roadData;
|
||
cut=0;
|
||
}
|
||
}else{
|
||
new_roadData=roadData;
|
||
cut=0;
|
||
}
|
||
|
||
$.each(new_roadData,function(i,v){
|
||
if(roadType=="roachWay"){
|
||
CockrochPath(ctb,unit,start_x,v.show_x-cut,v.show_y,v.result)
|
||
}else if(roadType=="littlWay"){
|
||
LittlePath(ctb,unit,start_x,v.show_x-cut,v.show_y,v.result)
|
||
}else if(roadType=="bigeyeWay"){
|
||
BigeyePath(ctb,unit,start_x,v.show_x-cut,v.show_y,v.result)
|
||
}else if(roadType=="showWay"){
|
||
SoloPath(gameId,ctb,unit,v.show_x-cut,v.show_y,v.result,v.pair)
|
||
}else if(roadType=="bigWay"){
|
||
BigPath(ctb,unit,start_x,v.show_x-cut,v.show_y,v.result,v.tie_num,v.pair)
|
||
|
||
}
|
||
})
|
||
}
|
||
|
||
|
||
|
||
// 画线条
|
||
function Drawline(ctb,unit,rows,cols){
|
||
var CanvasWidht=unit*cols;
|
||
var CanvasHeight=unit*rows;
|
||
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, unit*i);
|
||
ctb.lineTo(CanvasWidht, unit*i);
|
||
}
|
||
ctb.moveTo(0.5, 0);
|
||
ctb.lineTo(0.5, CanvasHeight);
|
||
for (var j = 1; j <= cols; j++) {
|
||
ctb.moveTo(unit*j,0);
|
||
ctb.lineTo(unit*j,CanvasHeight);
|
||
}
|
||
for (var l = 0; l <= rows; l++) {
|
||
ctb.moveTo( CanvasWidht*0.5,(l+ 0.5)*unit);
|
||
ctb.lineTo(CanvasWidht,(l+ 0.5)*unit);
|
||
}
|
||
for (var k = 0; k <=cols- Math.floor(0.5*cols); k++) {
|
||
ctb.moveTo(( Math.floor(0.5*cols)+k+0.5)*unit,0);
|
||
ctb.lineTo(( Math.floor(0.5*cols)+k+0.5)*unit,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||"#000";
|
||
ctb.fillText(num,Font_x,Font_y);
|
||
ctb.stroke();
|
||
}
|
||
}
|
||
function SoloPath(gameId,ctb,unit,x,y,type,corners){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = unit*0.02;
|
||
ctb.strokeStyle = "#fff";
|
||
var radius=unit/2||0;
|
||
if(gameId==1){
|
||
if(type==1){
|
||
var color='#b20a00',
|
||
fonts= lang.banker;
|
||
ctb.strokeStyle = "#b20a00";
|
||
}else if(type==2){
|
||
var color='#0543bc',
|
||
fonts= lang.player;
|
||
ctb.strokeStyle = "#0543bc";
|
||
}else if(type==3){
|
||
var color='#1d8701',
|
||
fonts= lang.tie;
|
||
ctb.strokeStyle = "#1d8701";
|
||
}
|
||
}else if(gameId==2){
|
||
if(type==1){
|
||
var color='#b20a00',
|
||
fonts= lang.dragon;
|
||
ctb.strokeStyle = "#b20a00";
|
||
}else if(type==2){
|
||
var color='#0543bc',
|
||
fonts= lang.tiger;
|
||
ctb.strokeStyle = "#0543bc";
|
||
}else if(type==3){
|
||
var color='#1d8701',
|
||
fonts= lang.tie;
|
||
ctb.strokeStyle = "#1d8701";
|
||
}
|
||
}
|
||
|
||
|
||
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.48+"px Arial";
|
||
ctb.fillStyle ="#ddd" ; // 颜色
|
||
ctb.textAlign = 'center';
|
||
ctb.textBaseline = 'middle';
|
||
|
||
ctb.fillText(fonts,radius+unit*(x-1),radius+unit*(y-1));
|
||
|
||
ctb.stroke();
|
||
var corner_xy=unit/3.5
|
||
if(corners==1){
|
||
corner(ctb,unit,x,y,corner_xy,'#b20a00');
|
||
}else if(corners==2){
|
||
corner(ctb,unit,x,y,-corner_xy,'#0543bc');
|
||
}else if(corners==3){
|
||
corner(ctb,unit,x,y,corner_xy,'#b20a00');
|
||
corner(ctb,unit,x,y,-corner_xy,'#0543bc');
|
||
}
|
||
}
|
||
//SoloPath角标
|
||
function corner(ctb,unit,x,y,corner_xy,corner_color){
|
||
var radius=unit/2
|
||
ctb.beginPath();
|
||
ctb.lineWidth = unit*0.01;
|
||
ctb.strokeStyle = "#fff";
|
||
ctb.arc(radius+unit*(x-1)-corner_xy, radius+unit*(y-1)-corner_xy, unit*0.12, 0, Math.PI * 2);
|
||
ctb.fillStyle=corner_color;
|
||
ctb.fill();
|
||
ctb.stroke();
|
||
}
|
||
|
||
// 大路
|
||
function BigPath(ctb,unit,start_x,x,y,type,slash,corners){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = unit*0.06;
|
||
var radius=unit/2
|
||
if(type==2){
|
||
var color="#0543bc";
|
||
}else if(type==1){
|
||
var color="#b20a00"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.arc( radius*(x-1)+start_x*unit , radius*(y-0.5) , radius*0.38, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
if(slash!=0){
|
||
ctb.beginPath();
|
||
linewidth=unit*0.15;
|
||
ctb.lineWidth = radius*0.14;//线条宽度
|
||
ctb.lineCap = "round";
|
||
ctb.strokeStyle = "#1d8701";//线条颜色
|
||
ctb.moveTo(radius*(x-1)+start_x*unit-linewidth,radius*(y-0.5)+linewidth);
|
||
ctb.lineTo(radius*(x-1)+start_x*unit+linewidth,radius*(y-0.5)-linewidth);
|
||
ctb.stroke();
|
||
if(slash!=0){
|
||
Font_tie(ctb,slash,radius*(x-1)+start_x*unit, radius*(y-0.5),radius*0.6+"px Arial");
|
||
}
|
||
}
|
||
var corner_xy=radius/3.5
|
||
if(corners==1){
|
||
BigPathcorner(ctb,unit,start_x,x,y,corner_xy,'#b20a00');
|
||
}else if(corners==2){
|
||
BigPathcorner(ctb,unit,start_x,x,y,-corner_xy,'#0543bc');
|
||
}else if(corners==3){
|
||
BigPathcorner(ctb,unit,start_x,x,y,corner_xy,'#b20a00');
|
||
BigPathcorner(ctb,unit,start_x,x,y,-corner_xy,'#0543bc');
|
||
}
|
||
}
|
||
//大路角标
|
||
function BigPathcorner(ctb,unit,start_x,x,y,corner_xy,corner_color){
|
||
var radius=unit/2
|
||
ctb.beginPath();
|
||
ctb.lineWidth = unit*0.025;
|
||
ctb.strokeStyle = "#fff";
|
||
ctb.arc(radius*(x-1)+start_x*unit-corner_xy, radius*(y-0.5)-corner_xy, radius*0.16, 0, Math.PI * 2);
|
||
ctb.fillStyle=corner_color;
|
||
ctb.fill();
|
||
ctb.stroke();
|
||
}
|
||
|
||
|
||
|
||
|
||
// 大路 第一局 和
|
||
function BigPathTie(ctb,unit,cols,order){
|
||
var start_x=unit*cols*0.5;
|
||
var radius=unit/2
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 3;//线条宽度
|
||
ctb.strokeStyle = "#3EA542";//线条颜色
|
||
ctb.lineCap = "round";
|
||
ctb.moveTo(radius*0.15+start_x,radius/2);
|
||
ctb.lineTo(radius*0.85+start_x,radius/2);
|
||
ctb.stroke();
|
||
Font_tie(ctb,order,radius*0.5+start_x, radius/2,radius*0.8+"px Arial");
|
||
}
|
||
|
||
|
||
|
||
|
||
// 大眼路
|
||
function BigeyePath(ctb,unit,start_x,x,y,type){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = unit*0.06;
|
||
var radius=unit/4
|
||
if(type==2){
|
||
var color="#0543bc";
|
||
}else if(type==1){
|
||
var color="#b20a00"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.arc(radius/2+radius*(x-2)+start_x*unit, unit*3.25+radius*(y-1.5), unit*0.09, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
}
|
||
//小路
|
||
function LittlePath(ctb,unit,start_x,x,y,type){
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 0;
|
||
var radius=unit/4
|
||
if(type==2){
|
||
var color="#0543bc";
|
||
}else if(type==1){
|
||
var color="#b20a00"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.fillStyle=color;
|
||
ctb.arc( radius/2+radius*(x-2)+(1+0.49)*start_x*unit , unit*3.25+radius*(y-1.5) , radius*0.28, 0, Math.PI * 2);
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
ctb.fill();
|
||
}
|
||
function CockrochPath(ctb,unit,start_x,x,y,type){
|
||
var radius=unit/4,
|
||
linewidth=radius*0.3;
|
||
ctb.beginPath();
|
||
ctb.lineCap = "round";
|
||
ctb.lineWidth = radius*0.3;//线条宽度
|
||
if(type==2){
|
||
var color="#0543bc";
|
||
}else if(type==1){
|
||
var color="#b20a00"
|
||
}
|
||
ctb.strokeStyle = color;
|
||
ctb.moveTo(start_x*unit+radius*(x-1.5)-linewidth,radius/2+radius*(y-1)+linewidth+4.5*unit);
|
||
ctb.lineTo(start_x*unit+radius*(x-1.5)+linewidth,radius/2+radius*(y-1)-linewidth+4.5*unit);
|
||
ctb.stroke();
|
||
}
|
||
|
||
|
||
|
||
|
||
// 问路方法
|
||
var askInterval;
|
||
function ask(newdata,olddata){
|
||
var nshowRoad=newdata.waybill.showRoad;
|
||
var nbigEyeRoad=newdata.waybill.bigEyeRoad;
|
||
var nbigRoad=newdata.waybill.bigRoad;
|
||
var npathway=newdata.waybill.pathway;
|
||
var nroach=newdata.waybill.roach;
|
||
var oshowRoad=olddata.waybill.showRoad;
|
||
var obigEyeRoad=olddata.waybill.bigEyeRoad;
|
||
var obigRoad=olddata.waybill.bigRoad;
|
||
var opathway=olddata.waybill.pathway;
|
||
var oroach=olddata.waybill.roach;
|
||
if(nshowRoad.length>0){
|
||
var n_s_last_x=nshowRoad[nshowRoad.length-1].show_x
|
||
}else{
|
||
var n_s_last_x=0
|
||
}
|
||
if(nbigEyeRoad.length>0){
|
||
var n_e_last_x=nbigEyeRoad[nbigEyeRoad.length-1].show_x
|
||
}else{
|
||
var n_e_last_x=0
|
||
}
|
||
if(nbigRoad.length>0){
|
||
var n_b_last_x=nbigRoad[nbigRoad.length-1].show_x
|
||
}else{
|
||
var n_b_last_x=0
|
||
}
|
||
if(npathway.length>0){
|
||
var n_p_last_x=npathway[npathway.length-1].show_x
|
||
}else{
|
||
var n_p_last_x=0
|
||
}
|
||
if(nroach.length>0){
|
||
var n_r_last_x=nroach[nroach.length-1].show_x
|
||
}else{
|
||
var n_r_last_x=0
|
||
}
|
||
if(oshowRoad.length>0){
|
||
var o_s_last_x=oshowRoad[oshowRoad.length-1].show_x
|
||
}else{
|
||
var o_s_last_x=0
|
||
}
|
||
if(obigEyeRoad.length>0){
|
||
var o_e_last_x=obigEyeRoad[obigEyeRoad.length-1].show_x
|
||
}else{
|
||
var o_e_last_x=0
|
||
}
|
||
if(obigRoad.length>0){
|
||
var o_b_last_x=obigRoad[obigRoad.length-1].show_x
|
||
}else{
|
||
var o_b_last_x=0
|
||
}
|
||
if(opathway.length>0){
|
||
var o_p_last_x=opathway[opathway.length-1].show_x
|
||
}else{
|
||
var o_p_last_x=0
|
||
}
|
||
if(oroach.length>0){
|
||
var o_r_last_x=oroach[oroach.length-1].show_x
|
||
}else{
|
||
var o_r_last_x=0
|
||
}
|
||
var askroad={
|
||
"askshowroad":false,
|
||
"askbigRoad":false,
|
||
"askbigEyeRoad":false,
|
||
"askpathway":false,
|
||
"askroach":false,
|
||
};
|
||
if(n_s_last_x>o_s_last_x){
|
||
askroad.askshowroad=true;
|
||
}else{
|
||
askroad.askshowroad=false;
|
||
}
|
||
if(n_e_last_x>o_e_last_x){
|
||
askroad.askbigEyeRoad=true;
|
||
}else{
|
||
askroad.askbigEyeRoad=false;
|
||
}
|
||
if(n_b_last_x>o_b_last_x){
|
||
askroad.askbigRoad=true;
|
||
}else{
|
||
askroad.askbigRoad=false;
|
||
}
|
||
if(n_p_last_x>o_p_last_x){
|
||
askroad.askpathway=true;
|
||
}else{
|
||
askroad.askpathway=false;
|
||
}
|
||
if(n_r_last_x>o_r_last_x){
|
||
askroad.askroach=true;
|
||
}else{
|
||
askroad.askroach=false;
|
||
}
|
||
var time=8;
|
||
askInterval=setInterval(function(){
|
||
time--;
|
||
var num=time%2;
|
||
if(time<0){
|
||
clearInterval(askInterval);
|
||
}else{
|
||
if(num==1){
|
||
waybillConfig(newdata,true,askroad)
|
||
}else{
|
||
waybillConfig(olddata,true)
|
||
}
|
||
|
||
}
|
||
},200);
|
||
}
|
||
|
||
|
||
|
||
|
||
// -------牛牛路单---------
|
||
|
||
|
||
function NNcanvas(ctb,unit_x,unit_y,rows,cols,roadData){
|
||
if(roadData!=""&&roadData!=undefined){
|
||
var L=roadData.length;
|
||
var new_roadData=[];
|
||
var Tab=cols-2;
|
||
if(L>=1){
|
||
var last_x=roadData[L-1].show_x
|
||
if(last_x>Tab){
|
||
var cut=last_x-Tab
|
||
$.each(roadData,function(i,v){
|
||
if(v.show_x>cut){
|
||
new_roadData.push(v)
|
||
}
|
||
})
|
||
}else{
|
||
new_roadData=roadData;
|
||
cut=0;
|
||
}
|
||
}else{
|
||
new_roadData=roadData;
|
||
cut=0;
|
||
}
|
||
$.each(roadData,function(i,v){
|
||
NNwaybill(ctb,unit_x,unit_y,v.show_x-cut,v.show_y,v.type,v.result,v.is_win)
|
||
})
|
||
}
|
||
NNtitle(ctb,unit_x,unit_y,unit_y)
|
||
NNline(ctb,unit_x,unit_y,rows,cols)
|
||
}
|
||
|
||
function NNwaybill(ctb,unit_x,unit_y,x,y,type,result,win){
|
||
var fonts="",color="#000";
|
||
if(result == 0){
|
||
fonts = '无牛';
|
||
}else if(result == 1){
|
||
fonts = '牛1';
|
||
}else if(result == 2){
|
||
fonts = '牛2';
|
||
}else if(result == 3){
|
||
fonts = '牛3';
|
||
}else if(result == 4){
|
||
fonts = '牛4';
|
||
}else if(result == 5){
|
||
fonts = '牛5';
|
||
}else if(result == 6){
|
||
fonts = '牛6';
|
||
}else if(result == 7){
|
||
fonts = '牛7';
|
||
}else if(result == 8){
|
||
fonts = '牛8';
|
||
}else if(result == 9){
|
||
fonts = '牛9';
|
||
}else if(result == 10){
|
||
fonts = '牛牛';
|
||
}else if(result == 11){
|
||
fonts = '五公';
|
||
}
|
||
if(type==1){
|
||
color="#cb0000";
|
||
}else if(type==2){
|
||
color="#0040be";
|
||
// 判断闲赢
|
||
if(win==1){
|
||
ctb.fillStyle = color;
|
||
ctb.fillRect (unit_x*x,unit_y*(y-0.3),unit_x,unit_y*0.3);
|
||
Font_tie(ctb,"WIN",unit_x*(0.5+x),unit_y*(y-0.14),unit_x*0.15+"px Arial","#fff");
|
||
}
|
||
}
|
||
Font_tie(ctb,fonts,unit_x*(0.5+x),unit_y*(y-0.5),unit_x*0.28+"px Arial",color);
|
||
}
|
||
|
||
|
||
// 画表头
|
||
function NNtitle(ctb,unit_x,unit_y){
|
||
for(var i=0;i<=4;i++){
|
||
if(i==0){
|
||
var color="#cb0000",font="庄家",fontcolor="#f3af98";
|
||
}else{
|
||
var color="#0040be",font="闲"+i,fontcolor="#21b1c9";
|
||
}
|
||
ctb.fillStyle = fontcolor;
|
||
ctb.fillRect (0,i*unit_y,unit_x,unit_y);
|
||
Font_tie(ctb,font,unit_x/2, i*unit_y+unit_y/2,unit_x*0.35+"px Arial",color);
|
||
}
|
||
}
|
||
// 画线条
|
||
function NNline(ctb,unit_x,unit_y,rows,cols){
|
||
var CanvasWidht=unit_x*cols;
|
||
var CanvasHeight=unit_y*rows;
|
||
ctb.lineWidth = 1;//线条宽度
|
||
ctb.strokeStyle = "#ffa042";//线条颜色
|
||
ctb.beginPath();
|
||
for (var i = 0; i <= rows; i++) {
|
||
ctb.moveTo(0, unit_y*i);
|
||
ctb.lineTo(CanvasWidht, unit_y*i);
|
||
}
|
||
for (var j = 1; j <= cols; j++) {
|
||
ctb.moveTo(unit_x*j,0);
|
||
ctb.lineTo(unit_x*j,CanvasHeight);
|
||
}
|
||
ctb.closePath()
|
||
ctb.stroke();
|
||
|
||
}
|
||
|
||
|
||
|
||
// ---------------
|
||
// ---------------
|
||
|
||
// function setNumberInfo(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 - 1);
|
||
// }
|
||
var audio=$("#audio").get(0);
|
||
var mp3List;
|
||
var num=0;
|
||
function audioMp3(mp3List){
|
||
var mp3=new Object();
|
||
mp3.mp3List=mp3List;
|
||
mp3.url="/static/horizontal/mp3/";
|
||
mp3.auto_play=false;
|
||
mp3.loop=false;
|
||
|
||
mp3.Play=function(){
|
||
audio.src=this.url+this.mp3List[0];
|
||
audio.play();
|
||
}
|
||
mp3.Muted=function(){
|
||
audio.muted ? audio.muted = false : audio.muted = true;
|
||
}
|
||
mp3.volumeAdd=function(){
|
||
if(audio.volume.toFixed(1)>=1){
|
||
audio.volume=1
|
||
}else{
|
||
audio.volume = audio.volume + 0.1;
|
||
}
|
||
}
|
||
mp3.volumeMinus=function(){
|
||
if(audio.volume.toFixed(1)<=0){
|
||
audio.volume=0
|
||
}else{
|
||
audio.volume = audio.volume - 0.1;
|
||
}
|
||
}
|
||
return mp3;
|
||
}
|
||
if(audio!=undefined){
|
||
audio.addEventListener("ended", nextAudio);
|
||
}
|
||
function nextAudio(){
|
||
num+=1
|
||
if(num<mp3List.length){
|
||
audio.src="/static/horizontal/mp3/"+mp3List[num];
|
||
audio.play();
|
||
}else{
|
||
audio.pause();
|
||
audio.currentTime = 0.0;
|
||
// console.log("播完")
|
||
num=0;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/* 百家乐声音提示 */
|
||
function audioBaccarat(statusType,round){
|
||
|
||
var result=round||"",pair="",previous_number_tab_id="";
|
||
if(round!=undefined){
|
||
result=round.opening,
|
||
pair=round.pair,
|
||
previous_number_tab_id=round.previous_number_tab_id;
|
||
}
|
||
|
||
if(statusType == 'startBet'){
|
||
mp3List = ['start.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
}else if(statusType == 'stopBet'){
|
||
mp3List = ['stop_2.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
}else if(statusType == 'openingBaccaratResult' && result > 0){
|
||
|
||
// 扫牌 点数
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .player-card .result").html(round.player+"点");
|
||
$(".games .poker-box .banker-card .result").html(round.banker+"点");
|
||
}
|
||
if(result == 1){
|
||
if(pair==1){
|
||
mp3List = ['banker_win.mp3','banker_pair.mp3'];
|
||
$(".games .chip-table.bg .list .bpair").addClass("win")
|
||
}else if(pair==2){
|
||
mp3List = ['banker_win.mp3','player_pair.mp3'];
|
||
$(".games .chip-table.bg .list .ppair").addClass("win")
|
||
}else if(pair==3){
|
||
mp3List = ['banker_win.mp3','banker_pair.mp3','player_pair.mp3'];
|
||
$(".games .chip-table.bg .list .bpair").addClass("win")
|
||
|
||
$(".games .chip-table.bg .list .ppair").addClass("win")
|
||
|
||
}else{
|
||
mp3List = ['banker_win.mp3'];
|
||
}
|
||
audioMp3(mp3List).Play();
|
||
$(".games .chip-table.bg .list .banker").addClass("win");
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .banker-card").addClass("win");
|
||
}
|
||
}else if(result == 2){
|
||
if(pair==1){
|
||
mp3List = ['player_win.mp3','banker_pair.mp3'];
|
||
$(".games .chip-table.bg .list .bpair").addClass("win");
|
||
}else if(pair==2){
|
||
mp3List = ['player_win.mp3','player_pair.mp3'];
|
||
$(".games .chip-table.bg .list .ppair").addClass("win");
|
||
}else if(pair==3){
|
||
mp3List = ['player_win.mp3','banker_pair.mp3','player_pair.mp3'];
|
||
$(".games .chip-table.bg .list .bpair").addClass("win");
|
||
$(".games .chip-table.bg .list .ppair").addClass("win");
|
||
|
||
}else{
|
||
mp3List = ['player_win.mp3'];
|
||
}
|
||
audioMp3(mp3List).Play();
|
||
$(".games .chip-table.bg .list .player").addClass("win");
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .player-card").addClass("win");
|
||
}
|
||
}else if(result == 3){
|
||
if(pair==1){
|
||
mp3List = ['tie.mp3','banker_pair.mp3'];
|
||
$(".games .chip-table.bg .list .bpair").addClass("win")
|
||
}else if(pair==2){
|
||
mp3List = ['tie.mp3','player_pair.mp3'];
|
||
$(".games .chip-table.bg .list .ppair").addClass("win")
|
||
}else if(pair==3){
|
||
mp3List = ['tie.mp3','banker_pair.mp3','player_pair.mp3'];
|
||
$(".games .chip-table.bg .list .bpair").addClass("win");
|
||
$(".games .chip-table.bg .list .ppair").addClass("win");
|
||
}else{
|
||
mp3List = ['tie.mp3'];
|
||
}
|
||
audioMp3(mp3List).Play();
|
||
$(".games .chip-table.bg .list .tie").addClass("win");
|
||
}
|
||
|
||
var thisResult=setTimeout(function(){
|
||
$(".games .chip-table.bg .list .item").removeClass("win");
|
||
clearTimeout(thisResult);
|
||
},5200);
|
||
|
||
setTimeout(function(){
|
||
gameResult(previous_number_tab_id,"baccarat");
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .list").removeClass("win");
|
||
$(".games .poker-box").removeClass("show");
|
||
$(".games .poker-box .list .result").html("");
|
||
$(".games .poker-box .list").find(".card").removeClass("active");
|
||
$(".games .poker-box .list").find(".card").css("background-image","url(static/poker/faces.png)");
|
||
$(".games .poker-box .banker-card .item").eq(2).find(".card").css("display","none");
|
||
$(".games .poker-box .player-card .item").eq(2).find(".card").css("display","none");
|
||
}
|
||
},5300);
|
||
}
|
||
}
|
||
|
||
|
||
/* 龙虎声音提示 */
|
||
function audioDt(statusType,round){
|
||
console.log(round)
|
||
var result="",pair="",previous_number_tab_id="";
|
||
if(round!=undefined){
|
||
result=round.opening,
|
||
pair=round.pair,
|
||
previous_number_tab_id=round.previous_number_tab_id;
|
||
}
|
||
if(statusType == 'startBet'){
|
||
mp3List = ['start.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
}
|
||
if(statusType == 'stopBet'){
|
||
mp3List = ['stop_2.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
}
|
||
if(statusType == 'openingDtResult' && result > 0){
|
||
// 扫牌 点数
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .player-card .result").html(round.player+"点");
|
||
$(".games .poker-box .banker-card .result").html(round.banker+"点");
|
||
}
|
||
if(result == 1){
|
||
mp3List = ['dragon_win.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
$(".games .chip-table.bg .list .banker").addClass("win")
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .banker-card").addClass("win");
|
||
}
|
||
|
||
}
|
||
if(result == 2){
|
||
mp3List = ['tiger_win.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
$(".games .chip-table.bg .list .player").addClass("win")
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .player-card").addClass("win");
|
||
}
|
||
}
|
||
if(result == 3){
|
||
mp3List = ['tie.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
$(".games .chip-table.bg .list .tie").addClass("win");
|
||
}
|
||
var thisResult=setTimeout(function(){
|
||
$(".games .chip-table.bg .list .item").removeClass("win")
|
||
clearTimeout(thisResult);
|
||
},5200);
|
||
|
||
setTimeout(function(){
|
||
gameResult(previous_number_tab_id,"dt");
|
||
if(is_scavenging==1){
|
||
$(".games .poker-box .list").removeClass("win");
|
||
$(".games .poker-box").removeClass("show");
|
||
$(".games .poker-box .list .result").html("");
|
||
$(".games .poker-box .list").find(".card").removeClass("active");
|
||
$(".games .poker-box .list").find(".card").css("background-image","url(static/poker/faces.png)");
|
||
}
|
||
},5300);
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/* 牛牛声音提示 */
|
||
function audioNn(statusType,data){
|
||
var win_player_1='',win_player_2='',win_player_3='',previous_number_tab_id='';
|
||
if(data!=undefined){
|
||
win_player_1=data.round.opening.win_player_1,
|
||
win_player_2=data.round.opening.win_player_2,
|
||
win_player_3=data.round.opening.win_player_3,
|
||
previous_number_tab_id=data.round.previous_number_tab_id;
|
||
}
|
||
|
||
if(statusType == 'startBet'){
|
||
mp3List = ['start.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
}
|
||
if(statusType == 'stopBet'){
|
||
mp3List = ['stop_2.mp3'];
|
||
audioMp3(mp3List).Play();
|
||
}
|
||
if(statusType == 'openingNnResult'){
|
||
mp3List = [];
|
||
if(win_player_1==0){
|
||
$(".games .niuniu .tab1 .banker").addClass("win")
|
||
}else if(win_player_1==1){
|
||
$(".games .niuniu .tab1 .player").addClass("win")
|
||
$(".games .poker-box .role1").addClass("win")
|
||
mp3List.push('nn_X1.ogg')
|
||
}
|
||
if(win_player_2==0){
|
||
$(".games .niuniu .tab2 .banker").addClass("win")
|
||
}else if(win_player_2==1){
|
||
$(".games .niuniu .tab2 .player").addClass("win")
|
||
$(".games .poker-box .role2").addClass("win")
|
||
mp3List.push('nn_X2.ogg')
|
||
}
|
||
if(win_player_3==0){
|
||
$(".games .niuniu .tab3 .banker").addClass("win")
|
||
}else if(win_player_3==1){
|
||
$(".games .niuniu .tab3 .player").addClass("win")
|
||
$(".games .poker-box .role3").addClass("win")
|
||
mp3List.push('nn_X3.ogg')
|
||
}
|
||
if(win_player_1==0&&win_player_2==0&&win_player_3==0){
|
||
mp3List = ['nn_Zwin.ogg'];
|
||
$(".games .poker-box .role4").addClass("win")
|
||
}
|
||
console.log(mp3List)
|
||
audioMp3(mp3List).Play();
|
||
var thisResult=setTimeout(function(){
|
||
$(".games .poker-box").removeClass("show");
|
||
$(".games .niuniu .chip-table .cols .list .item").removeClass("win")
|
||
$(".games .poker-box .item").removeClass("win")
|
||
clearTimeout(thisResult);
|
||
},5200);
|
||
setTimeout(function(){
|
||
gameResult(previous_number_tab_id,'nn');
|
||
},5300);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
// 倒计时
|
||
function countDown(waitTime){
|
||
$("#countdown").find(".num").html(waitTime)
|
||
$("#countdown").show();
|
||
$(".games .canvas-box .text").html(waitTime);
|
||
count = waitTime;
|
||
if(count==0){
|
||
count=false;
|
||
}
|
||
}
|
||
function stopTheTime(type,auto){
|
||
if(type=="baccarat"){
|
||
audioBaccarat('stopBet');
|
||
}else if(type=="Dt"){
|
||
audioDt('stopBet');
|
||
}else if(type=="Nn"){
|
||
audioNn('stopBet');
|
||
$(".games .poker-box").addClass("show");
|
||
}
|
||
$(".games .canvas-box .text").html("停止下注");
|
||
$("#countdown").find(".num").html("停")
|
||
$("#countdown").hide();
|
||
|
||
if(auto==1){
|
||
$(".games .poker-box").addClass("show")
|
||
}
|
||
}
|
||
|
||
|
||
|
||
// 加载
|
||
function loading(){
|
||
var loading='<div class="spinner">'+
|
||
'<div class="rect1"></div>'+
|
||
'<div class="rect3"></div>'+
|
||
'<div class="rect4"></div>'+
|
||
'<div class="rect5"></div>'+
|
||
'<p class="text">...加载中</p>'+
|
||
'</div>'
|
||
$("body").append(loading)
|
||
setTimeout(function(){
|
||
$(".spinner").remove();
|
||
},3000);
|
||
}
|
||
|
||
function goBack(){
|
||
if(history.length > 0){
|
||
window.history.go( -1 );
|
||
}else{
|
||
window.location.href = "/index?display=2";
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|