1036 lines
30 KiB
JavaScript
1036 lines
30 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:"/baccarat/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;">'+lang.lose+' '+data.win_total+'</span>'
|
||
}else{
|
||
var text_total='<span style="color: #F00;">'+lang.win+' +'+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 audio=$("#audio").get(0);
|
||
var mp3List;
|
||
var num=0;
|
||
/* 声音提示 */
|
||
var audioShow = function (statusType,result,pair,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 == 'openingBaccaratResult' && result > 0){
|
||
if(result == 1){
|
||
if(pair==1){
|
||
mp3List = ['banker_win.mp3','banker_pair.mp3'];
|
||
$(".play .bet-box .chip-box .bpair-chip").addClass("win")
|
||
}else if(pair==2){
|
||
mp3List = ['banker_win.mp3','player_pair.mp3'];
|
||
$(".play .bet-box .chip-box .ppair-chip").addClass("win");
|
||
}else if(pair==3){
|
||
mp3List = ['banker_win.mp3','banker_pair.mp3','player_pair.mp3'];
|
||
$(".play .bet-box .chip-box .bpair-chip").addClass("win")
|
||
$(".play .bet-box .chip-box .ppair-chip").addClass("win");
|
||
}else{
|
||
mp3List = ['banker_win.mp3'];
|
||
}
|
||
$(".play .bet-box .chip-box .banker-chip").addClass("win");
|
||
audioMp3(mp3List).Play();
|
||
}
|
||
if(result == 2){
|
||
if(pair==1){
|
||
mp3List = ['player_win.mp3','banker_pair.mp3'];
|
||
$(".play .bet-box .chip-box .bpair-chip").addClass("win")
|
||
}else if(pair==2){
|
||
mp3List = ['player_win.mp3','player_pair.mp3'];
|
||
$(".play .bet-box .chip-box .ppair-chip").addClass("win");
|
||
}else if(pair==3){
|
||
mp3List = ['player_win.mp3','banker_pair.mp3','player_pair.mp3'];
|
||
$(".play .bet-box .chip-box .bpair-chip").addClass("win")
|
||
$(".play .bet-box .chip-box .ppair-chip").addClass("win");
|
||
}else{
|
||
mp3List = ['player_win.mp3'];
|
||
}
|
||
console.log(1111);
|
||
$(".play .bet-box .chip-box .player-chip").addClass("win");
|
||
audioMp3(mp3List).Play();
|
||
}
|
||
if(result == 3){
|
||
if(pair==1){
|
||
mp3List = ['tie.mp3','banker_pair.mp3'];
|
||
$(".play .bet-box .chip-box .bpair-chip").addClass("win")
|
||
}else if(pair==2){
|
||
mp3List = ['tie.mp3','player_pair.mp3'];
|
||
$(".play .bet-box .chip-box .ppair-chip").addClass("win");
|
||
}else if(pair==3){
|
||
mp3List = ['tie.mp3','banker_pair.mp3','player_pair.mp3'];
|
||
$(".play .bet-box .chip-box .bpair-chip").addClass("win")
|
||
$(".play .bet-box .chip-box .ppair-chip").addClass("win");
|
||
}else{
|
||
mp3List = ['tie.mp3'];
|
||
}
|
||
$(".play .bet-box .chip-box .tie-chip").addClass("win");
|
||
audioMp3(mp3List).Play();
|
||
}
|
||
var thisResult=setTimeout(function(){
|
||
$(".play .bet-box .chip-box .item").removeClass("win");
|
||
clearTimeout(thisResult);
|
||
},4200);
|
||
|
||
setTimeout(function(){
|
||
user_bet(previous_number_tab_id);
|
||
},4300);
|
||
}
|
||
}
|
||
/* 声音提示*/
|
||
function audioMp3(mp3List){
|
||
var mp3=new Object();
|
||
mp3.mp3List=mp3List;
|
||
mp3.url="/static/online/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;
|
||
}
|
||
audio.addEventListener("ended", nextAudio);
|
||
function nextAudio(){
|
||
num+=1
|
||
if(num<mp3List.length){
|
||
audio.src="/static/onlinechip/mp3/"+mp3List[num];
|
||
audio.play();
|
||
}else{
|
||
audio.pause();
|
||
audio.currentTime = 0.0;
|
||
// console.log("播完")
|
||
num=0;
|
||
}
|
||
}
|
||
/* 声音提示 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 showForecast = function(br,pr){
|
||
// 庄自动问路
|
||
if(br && br.status == true){
|
||
var bankerResult = br;
|
||
}else{
|
||
var bankerResult = getLudanBanker();
|
||
}
|
||
if(bankerResult.status == true){
|
||
var bankerResult = bankerResult.waybill;
|
||
// 大眼路
|
||
if(bankerResult.bigEyeRoad!=""){
|
||
len = bankerResult.bigEyeRoad.length - 1;
|
||
$('#bankerask').find('.circle').css('display','inline-block').removeClass('red').removeClass('blue');
|
||
if(bankerResult.bigEyeRoad[len].result == 1){
|
||
$('#bankerask').find('.circle').addClass('red');
|
||
}else if(bankerResult.bigEyeRoad[len].result == 2){
|
||
$('#bankerask').find('.circle').addClass('blue');
|
||
}
|
||
}else{
|
||
$('#bankerask').find('.circle').css('display','none');
|
||
}
|
||
// 小路
|
||
if(bankerResult.pathway!=""){
|
||
len = bankerResult.pathway.length - 1;
|
||
$('#bankerask').find('.round').css('display','inline-block').removeClass('red').removeClass('blue');
|
||
if(bankerResult.pathway[len].result == 1){
|
||
$('#bankerask').find('.round').addClass('red');
|
||
}else if(bankerResult.pathway[len].result == 2){
|
||
$('#bankerask').find('.round').addClass('blue');
|
||
}
|
||
}else{
|
||
$('#bankerask').find('.round').css('display','none');
|
||
}
|
||
// 曱甴路
|
||
if(bankerResult.roach!=""){
|
||
len = bankerResult.roach.length - 1;
|
||
$('#bankerask').find('.bar').css('display','inline-block').removeClass('red').removeClass('blue');
|
||
if(bankerResult.roach[len].result == 1){
|
||
$('#bankerask').find('.bar').addClass('red');
|
||
}else if(bankerResult.roach[len].result == 2){
|
||
$('#bankerask').find('.bar').addClass('blue');
|
||
}
|
||
}else{
|
||
$('#bankerask').find('.bar').css('display','none');
|
||
}
|
||
}
|
||
|
||
// 闲自动问路
|
||
if(pr && pr.status == true){
|
||
var playerResult = pr;
|
||
}else{
|
||
var playerResult = getLudanPlayer();
|
||
}
|
||
if(playerResult.status == true){
|
||
var playerResult = playerResult.waybill;
|
||
// 大眼路
|
||
if(playerResult.bigEyeRoad!=""){
|
||
var len = playerResult.bigEyeRoad.length - 1;
|
||
$('#playerask').find('.circle').css('display','inline-block').removeClass('red').removeClass('blue');
|
||
if(playerResult.bigEyeRoad[len].result == 1){
|
||
$('#playerask').find('.circle').addClass('red');
|
||
}else if(playerResult.bigEyeRoad[len].result == 2){
|
||
$('#playerask').find('.circle').addClass('blue');
|
||
}
|
||
}else{
|
||
$('#playerask').find('.circle').css('display','none');
|
||
}
|
||
// 小路
|
||
if(playerResult.pathway!=""){
|
||
len = playerResult.pathway.length - 1;
|
||
$('#playerask').find('.round').css('display','inline-block').removeClass('red').removeClass('blue');
|
||
if(playerResult.pathway[len].result == 1){
|
||
$('#playerask').find('.round').addClass('red');
|
||
}else if(playerResult.pathway[len].result == 2){
|
||
$('#playerask').find('.round').addClass('blue');
|
||
}
|
||
}else{
|
||
$('#playerask').find('.round').css('display','none');
|
||
}
|
||
// 曱甴路
|
||
if(playerResult.roach!=""){
|
||
len = playerResult.roach.length - 1;
|
||
$('#playerask').find('.bar').css('display','inline-block').removeClass('red').removeClass('blue');
|
||
if(playerResult.roach[len].result == 1){
|
||
$('#playerask').find('.bar').addClass('red');
|
||
}else if(playerResult.roach[len].result == 2){
|
||
$('#playerask').find('.bar').addClass('blue');
|
||
}
|
||
}else{
|
||
$('#playerask').find('.bar').css('display','none');
|
||
}
|
||
}
|
||
}
|
||
|
||
//庄问路
|
||
var getLudanBanker = function(){
|
||
var next = new Object;
|
||
next.game_id = $('#game_id').val();
|
||
next.boot_id = $('#boot_dt_id').val();
|
||
next.forecast = 1;
|
||
$.ajax({
|
||
url:"/index/waybill",
|
||
type:"POST",
|
||
dataType:"JSON",
|
||
data:next,
|
||
async:false,
|
||
success:function(data){
|
||
console.log(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 (){
|
||
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;
|
||
}
|
||
requestData(ludan);
|
||
|
||
}
|
||
});
|
||
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);
|
||
$('#result_total_bankerpair').html(resultToatl.bankerPair);
|
||
$('#result_total_playerpair').html(resultToatl.playerPair);
|
||
var ld = data.waybill.waybill;
|
||
requestData(ld);
|
||
ludan = ld;
|
||
var ld_n_b = data.waybill_next_banker;
|
||
var ld_n_p = data.waybill_next_player;
|
||
showForecast(ld_n_b,ld_n_p);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
var getLastBet = function (TableId){
|
||
var query = new Object();
|
||
query.table_id = TableId;
|
||
$.ajax({
|
||
url:'/dt/get_last_bet',
|
||
data:query,
|
||
dataType:"json",
|
||
type:"POST",
|
||
async:false,
|
||
success:function(data){
|
||
if(data.code == 1 && data.data){
|
||
var strHtml = '';
|
||
$.each(data.data,function(i,n){
|
||
var strHtmlChild = '';
|
||
var resultStr = '';
|
||
if(n.result == 1){
|
||
resultStr = lang.banker_all;
|
||
}else if(n.result == 2){
|
||
resultStr = lang.player_all;
|
||
}else if(n.result == 3){
|
||
resultStr = lang.tie_all;
|
||
}
|
||
if(n.pair == 1){
|
||
resultStr = resultStr + '-'+lang.banker_pair_all;
|
||
}else if(n.pair == 2){
|
||
resultStr = resultStr + '-'+lang.player_par_all;
|
||
}else if(n.pair == 3){
|
||
resultStr = resultStr + '-'+lang.both_pair_all;
|
||
}
|
||
strHtmlChild += '<tr class="list"><td>'+n.banker_amount+'</td><td>'+n.player_amount+'</td><td>'+n.tie_amount+'</td><td>'+n.banker_pair_amount+'</td><td>'+n.player_pair_amount+'</td><td>'+n.amount+'</td><td>'+resultStr+'</td></tr>';
|
||
strHtml += strHtmlChild;
|
||
})
|
||
$('#last_bet_tbody').html(strHtml);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
/* 获取游戏桌子路单列表 */
|
||
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);
|
||
window.count = time;
|
||
if(time == 5){
|
||
$(".play .bet-box .bet-tab .countdown").addClass("slow");
|
||
}
|
||
}
|
||
|
||
function stopTheTime(){
|
||
audioShow('stopBet');
|
||
$(".play .bet-box .bet-tab .countdown").removeClass("slow");
|
||
$(".play .bet-box .bet-tab .countdown").hide();
|
||
$(".play .begincard").fadeIn(100,function(){
|
||
$(".play .begincard .box").animate({"bottom":"20","opacity":"1"})
|
||
});
|
||
toBetCancel();
|
||
toBetSuccessdata=false;
|
||
}
|
||
|
||
|
||
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)
|
||
// $("#Toph").height(Toph)
|
||
$(".play .visual .item.bet-box").width(Topw*0.36)
|
||
|
||
|
||
|
||
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*0.52)
|
||
|
||
// 计算扑克的宽高
|
||
var Bleft=$(".play .visual .item.video-box").offset().left
|
||
$("#begincard .box").css('min-width',(Topw-Chipw)*0.65-30)
|
||
$("#begincard .box").css('left',Bleft)
|
||
$("#begincard .list .card").height(Footh/2)
|
||
$("#begincard .list .card").width(Footh*13/36)
|
||
$("#begincard .list .draw").height(Footh*13/36)
|
||
$("#begincard .list .draw .card").height(Footh*13/36)
|
||
$("#begincard .list .draw .card").width(Footh*169/648)
|
||
|
||
|
||
|
||
var Beth= $(".play .bet-box .line").outerHeight(true)+2
|
||
$(".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.22)
|
||
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,n.pair);
|
||
}
|
||
})
|
||
}
|
||
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.banker;
|
||
}else if(type==2){
|
||
var color='#0543bc',
|
||
fonts=lang.player;
|
||
}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();
|
||
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 corner(ctb,unit,x,y,corner_xy,corner_color){
|
||
var radius=unit/2
|
||
ctb.beginPath();
|
||
ctb.lineWidth = 0.1;
|
||
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 = "#3EA542";//线条颜色
|
||
|
||
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();
|
||
} |