init: 从宝塔同步到 Gitea
This commit is contained in:
@@ -0,0 +1,457 @@
|
||||
var roleBet={};
|
||||
var chipnum=0;
|
||||
var banker_1_double=0,banker_1_haploid=0,player_1_double=0,player_1_haploid=0;
|
||||
var banker_2_double=0,banker_2_haploid=0,player_2_double=0,player_2_haploid=0;
|
||||
var banker_3_double=0,banker_3_haploid=0,player_3_double=0,player_3_haploid=0;
|
||||
|
||||
var roleType="",tabType="",chipType="";
|
||||
|
||||
|
||||
|
||||
$(function(){
|
||||
// 选择筹码
|
||||
$(".main .chip-box .swiper-slide").click(function(){
|
||||
chipnum=parseInt($(this).attr("chip-data"));
|
||||
$(this).addClass("choice").siblings().removeClass("choice")
|
||||
})
|
||||
|
||||
// 选择下注区
|
||||
$(".main .bet-tab .list .item").click(function(){
|
||||
// 分别为1,2,3玩家 banker/player double(翻倍) haploid(平倍)
|
||||
roleType=$(this).parents(".list").attr("role-data");
|
||||
tabType=$(this).attr("type-data");
|
||||
chipType=$(this).attr("bet-data");
|
||||
|
||||
console.log(roleType,tabType,chipType,chipnum)
|
||||
|
||||
if(chipnum!=0){
|
||||
// 计算各个区块的下注
|
||||
// var $nunu=$(".games .niuniu .chip-table");
|
||||
var usermoney=$("#money").attr("data-money");
|
||||
var role_1_pd=roleBet.amount_player_1_times||0;
|
||||
var role_1_bh=roleBet.amount_player_1_banker||0;
|
||||
var role_1_bd=roleBet.amount_player_1_banker_times||0;
|
||||
var role_1_ph=roleBet.amount_player_1||0;
|
||||
|
||||
// // 玩家2
|
||||
var role_2_pd=roleBet.amount_player_2_times||0;
|
||||
var role_2_bh=roleBet.amount_player_2_banker||0;
|
||||
var role_2_bd=roleBet.amount_player_2_banker_times||0;
|
||||
var role_2_ph=roleBet.amount_player_2||0;
|
||||
|
||||
// // 玩家3
|
||||
var role_3_pd=roleBet.amount_player_3_times||0;
|
||||
var role_3_bh=roleBet.amount_player_3_banker||0;
|
||||
var role_3_bd=roleBet.amount_player_3_banker_times||0;
|
||||
var role_3_ph=roleBet.amount_player_3||0;
|
||||
|
||||
|
||||
// 翻倍中下注
|
||||
var doubleBet=role_1_bd+role_1_pd+role_2_bd+role_2_pd+role_3_bd+role_3_pd;
|
||||
// 平倍总下注
|
||||
var haploidBet=role_1_bh+role_1_ph+role_2_bh+role_2_ph+role_3_bh+role_3_ph;
|
||||
// 总下注
|
||||
var allensureBet=doubleBet*5+haploidBet;
|
||||
if(chipType=="haploid"){
|
||||
var _thischipunm=chipnum
|
||||
}else if(chipType=="double"){
|
||||
var _thischipunm=chipnum*5
|
||||
}
|
||||
// 判断是否超额
|
||||
if(usermoney<allensureBet+_thischipunm){
|
||||
alert_box(lang.to_bet_fail_1);
|
||||
return false;
|
||||
}
|
||||
// 判断限红
|
||||
if(limit_low>allensureBet+_thischipunm){
|
||||
alert_box('最小限红为'+limit_low);
|
||||
return false;
|
||||
}else if(limit_high<allensureBet+_thischipunm){
|
||||
alert_box('最大限红为'+limit_high);
|
||||
return false;
|
||||
}
|
||||
if(count==false||count<5){
|
||||
alert_box(lang.game_not_start);
|
||||
}else{
|
||||
|
||||
|
||||
if(roleType==1){
|
||||
if(tabType=="banker"&&chipType=="double"){
|
||||
var successBet=role_1_bd;
|
||||
}else if(tabType=="banker"&&chipType=="haploid"){
|
||||
var successBet=role_1_bh;
|
||||
}else if(tabType=="player"&&chipType=="double"){
|
||||
var successBet=role_1_pd;
|
||||
}else if(tabType=="player"&&chipType=="haploid"){
|
||||
var successBet=role_1_ph;
|
||||
}
|
||||
}else if(roleType==2){
|
||||
if(tabType=="banker"&&chipType=="double"){
|
||||
var successBet=role_2_bd;
|
||||
}else if(tabType=="banker"&&chipType=="haploid"){
|
||||
var successBet=role_2_bh;
|
||||
}else if(tabType=="player"&&chipType=="double"){
|
||||
var successBet=role_2_pd;
|
||||
}else if(tabType=="player"&&chipType=="haploid"){
|
||||
var successBet=role_2_ph;
|
||||
}
|
||||
}else if(roleType==3){
|
||||
if(tabType=="banker"&&chipType=="double"){
|
||||
var successBet=role_3_bd;
|
||||
}else if(tabType=="banker"&&chipType=="haploid"){
|
||||
var successBet=role_3_bh;
|
||||
}else if(tabType=="player"&&chipType=="double"){
|
||||
var successBet=role_3_pd;
|
||||
}else if(tabType=="player"&&chipType=="haploid"){
|
||||
var successBet=role_3_ph;
|
||||
}
|
||||
}
|
||||
downBetAdd(roleType,tabType,chipType,successBet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
// 确定下注
|
||||
$(".main .btn-box .confirm").click(function(){
|
||||
var downBet={
|
||||
"role1":{
|
||||
"banker_double":banker_1_double,
|
||||
"banker_haploid":banker_1_haploid,
|
||||
"player_double":player_1_double,
|
||||
"player_haploid":player_1_haploid
|
||||
},
|
||||
"role2":{
|
||||
"banker_double":banker_2_double,
|
||||
"banker_haploid":banker_2_haploid,
|
||||
"player_double":player_2_double,
|
||||
"player_haploid":player_2_haploid
|
||||
},
|
||||
"role3":{
|
||||
"banker_double":banker_3_double,
|
||||
"banker_haploid":banker_3_haploid,
|
||||
"player_double":player_3_double,
|
||||
"player_haploid":player_3_haploid
|
||||
},
|
||||
}
|
||||
|
||||
console.log(downBet)
|
||||
|
||||
if(count == false){
|
||||
alert_box(lang.game_not_start);
|
||||
}else if(count > 5){
|
||||
toBet(downBet);
|
||||
}else{
|
||||
alert_box(lang.game_stop_bet);
|
||||
}
|
||||
banker_1_double=0,banker_1_haploid=0,player_1_double=0,player_1_haploid=0;
|
||||
banker_2_double=0,banker_2_haploid=0,player_2_double=0,player_2_haploid=0;
|
||||
banker_3_double=0,banker_3_haploid=0,player_3_double=0,player_3_haploid=0;
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 退押 下注
|
||||
$(".main .btn-box .cancel").click(function(){
|
||||
$(".main .bet-tab .list .item").find(".chipbox").html("");
|
||||
lineLoginchip(roleBet);
|
||||
banker_1_double=0,banker_1_haploid=0,player_1_double=0,player_1_haploid=0;
|
||||
banker_2_double=0,banker_2_haploid=0,player_2_double=0,player_2_haploid=0;
|
||||
banker_3_double=0,banker_3_haploid=0,player_3_double=0,player_3_haploid=0;
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// 计算各个下注区总和
|
||||
|
||||
function downBetAdd(roleType,tabType,chipType,successBet){
|
||||
playBetaudio();
|
||||
var _thisBet=window[tabType+'_'+roleType+'_'+chipType];
|
||||
var $node=$(".main .bet-tab .tab"+roleType+" ."+tabType+"."+chipType);
|
||||
|
||||
_thisBet+=chipnum||0;
|
||||
window[tabType+'_'+roleType+'_'+chipType]=_thisBet;
|
||||
showChip($node,_thisBet+successBet,chipType);
|
||||
console.log(_thisBet)
|
||||
}
|
||||
|
||||
|
||||
|
||||
function playBetaudio(){
|
||||
// $("#betaudio")[0].src="/static/horizontal/mp3/raise.ogg"
|
||||
// $("#betaudio")[0].play();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 计算筹码个数
|
||||
function showChip(_this,downbet,type){
|
||||
var w5=parseInt(downbet/50000)
|
||||
var w2=parseInt((downbet-w5*50000)/20000)
|
||||
var w1=parseInt((downbet-w5*50000-w2*20000)/10000)
|
||||
var w=parseInt(downbet/10000)
|
||||
var k5=parseInt((downbet-w*10000)/5000)
|
||||
var k2=parseInt((downbet-w*10000-k5*5000)/2000)
|
||||
var k1=parseInt((downbet-w*10000-k5*5000-k2*2000)/1000)
|
||||
var k=parseInt((downbet-w*10000)/1000)
|
||||
var b5=parseInt((downbet-w*10000-k*1000)/500)
|
||||
var b2=parseInt((downbet-w*10000-k*1000-b5*500)/200)
|
||||
var b1=parseInt((downbet-w*10000-k*1000-b5*500-b2*200)/100)
|
||||
var b=parseInt((downbet-w*10000-k*1000)/100)
|
||||
var s5=parseInt((downbet-w*10000-k*1000-b*100)/50)
|
||||
var s2=parseInt((downbet-w*10000-k*1000-b*100-s5*50)/20)
|
||||
var s1=parseInt((downbet-w*10000-k*1000-b*100-s5*50-s2*20)/10)
|
||||
var s=parseInt((downbet-w*10000-k*1000-b*100)/10)
|
||||
var y5=parseInt((downbet-w*10000-k*1000-b*100-s*10)/5)
|
||||
|
||||
_this.find(".chipbox").html("");
|
||||
for(var o=0;o<w5;o++){
|
||||
_this.find(".chipbox").append('<i class="chip-5w" style="margin-bottom:'+o*4+'px"></i>')
|
||||
}
|
||||
for(var p=0;p<w2;p++){
|
||||
_this.find(".chipbox").append('<i class="chip-2w" style="margin-bottom:'+(w5+p)*4+'px"></i>')
|
||||
}
|
||||
for(var q=0;q<w1;q++){
|
||||
_this.find(".chipbox").append('<i class="chip-1w" style="margin-bottom:'+(w5+w2+q)*4+'px"></i>')
|
||||
}
|
||||
for(var r=0;r<k5;r++){
|
||||
_this.find(".chipbox").append('<i class="chip-5k" style="margin-bottom:'+(w5+w2+w1+r)*4+'px"></i>')
|
||||
}
|
||||
for(var t=0;t<k2;t++){
|
||||
_this.find(".chipbox").append('<i class="chip-2k" style="margin-bottom:'+(w5+w2+w1+k5+t)*4+'px"></i>')
|
||||
}
|
||||
for(var u=0;u<k1;u++){
|
||||
_this.find(".chipbox").append('<i class="chip-1k" style="margin-bottom:'+(w5+w2+w1+k5+k2+u)*4+'px"></i>')
|
||||
}
|
||||
for(var v=0;v<b5;v++){
|
||||
_this.find(".chipbox").append('<i class="chip-500" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+v)*4+'px"></i>')
|
||||
}
|
||||
for(var w=0;w<b2;w++){
|
||||
_this.find(".chipbox").append('<i class="chip-200" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+w)*4+'px"></i>')
|
||||
}
|
||||
for(var x=0;x<b1;x++){
|
||||
_this.find(".chipbox").append('<i class="chip-100" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+b2+x)*4+'px"></i>')
|
||||
}
|
||||
for(var z=0;z<s5;z++){
|
||||
_this.find(".chipbox").append('<i class="chip-50" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+b2+b1+z)*4+'px"></i>')
|
||||
}
|
||||
|
||||
for(var k=0;k<s2;k++){
|
||||
_this.find(".chipbox").append('<i class="chip-20" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+b2+b1+s5+k)*4+'px"></i>')
|
||||
}
|
||||
for(var j=0;j<s1;j++){
|
||||
_this.find(".chipbox").append('<i class="chip-10" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+b2+b1+s5+s2+j)*4+'px"></i>')
|
||||
}
|
||||
for(var l=0;l<y5;l++){
|
||||
_this.find(".chipbox").append('<i class="chip-5" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+b2+b1+s5+s2+s1+l)*4+'px"></i>')
|
||||
}
|
||||
|
||||
if(type=="double"){
|
||||
var withhold=downbet*4
|
||||
_this.find(".chipbox").append('<p class="money" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+b2+b1+s5+s2+s1+l)*4+'px"><span>'+downbet+'</span><span class="small"><strong>预扣: </strong>'+withhold+'</span></p>')
|
||||
}else{
|
||||
var withhold=downbet
|
||||
_this.find(".chipbox").append('<p class="money" style="margin-bottom:'+(w5+w2+w1+k5+k2+k1+b5+b2+b1+s5+s2+s1+l)*4+'px"><span>'+downbet+'</span></p>')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 下注回显示
|
||||
function lineLoginchip(data){
|
||||
var _thisdata=data;
|
||||
if(_thisdata!=""){
|
||||
$.each(_thisdata,function(i,v){
|
||||
if(v>0){
|
||||
switch (i){
|
||||
case 'amount_player_1':
|
||||
var _this=$(".main .bet-tab .tab1").find(".player.haploid"), chiptype='haploid', downbet=v;
|
||||
break;
|
||||
case 'amount_player_1_times':
|
||||
var _this=$(".main .bet-tab .tab1").find(".player.double"), chiptype='double', downbet=v;
|
||||
break;
|
||||
case 'amount_player_1_banker':
|
||||
var _this=$(".main .bet-tab .tab1").find(".banker.haploid"), chiptype='haploid', downbet=v;
|
||||
break;
|
||||
case 'amount_player_1_banker_times':
|
||||
var _this=$(".main .bet-tab .tab1").find(".banker.double"), chiptype='double', downbet=v;
|
||||
break;
|
||||
|
||||
case 'amount_player_2':
|
||||
var _this=$(".main .bet-tab .tab2").find(".player.haploid"), chiptype='haploid', downbet=v;
|
||||
break;
|
||||
case 'amount_player_2_times':
|
||||
var _this=$(".main .bet-tab .tab2").find(".player.double"), chiptype='double', downbet=v;
|
||||
break;
|
||||
case 'amount_player_2_banker':
|
||||
var _this=$(".main .bet-tab .tab2").find(".banker.haploid"), chiptype='haploid', downbet=v;
|
||||
break;
|
||||
case 'amount_player_2_banker_times':
|
||||
var _this=$(".main .bet-tab .tab2").find(".banker.double"), chiptype='double', downbet=v;
|
||||
break;
|
||||
|
||||
case 'amount_player_3':
|
||||
var _this=$(".main .bet-tab .tab3").find(".player.haploid"), chiptype='haploid', downbet=v;
|
||||
break;
|
||||
case 'amount_player_3_times':
|
||||
var _this=$(".main .bet-tab .tab3").find(".player.double"), chiptype='double', downbet=v;
|
||||
break;
|
||||
case 'amount_player_3_banker':
|
||||
var _this=$(".main .bet-tab .tab3").find(".banker.haploid"), chiptype='haploid', downbet=v;
|
||||
break;
|
||||
case 'amount_player_3_banker_times':
|
||||
var _this=$(".main .bet-tab .tab3").find(".banker.double"), chiptype='double', downbet=v;
|
||||
break;
|
||||
}
|
||||
if(downbet!=undefined){
|
||||
showChip(_this,downbet,chiptype)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setBetStatus(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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* 桌子为停台中获知洗牌中的页面状态 */
|
||||
function Maskplay(msg, state){
|
||||
var state=state||0,msg=msg||'';
|
||||
if(state == 1 || state == 2){
|
||||
var table_state = 'table_status_' + state;
|
||||
$('body').append('<div class="Maskplay"><span class="msgbox">'+lang[table_state]+'</span>'+'</div>');
|
||||
}else{
|
||||
$('body').find(".Maskplay").remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 确认下注数据
|
||||
function toBet(BetData){
|
||||
var role1=BetData.role1,
|
||||
role2=BetData.role2,
|
||||
role3=BetData.role3;
|
||||
var tab_id = number_tab_id;
|
||||
var user_id = $('#userid').val();
|
||||
if(role1.banker_double > 0 || role1.banker_haploid > 0 || role1.player_double > 0 || role1.player_haploid || role2.banker_double > 0 || role2.banker_haploid > 0 || role2.player_double > 0 || role2.player_haploid || role3.banker_double > 0 || role3.banker_haploid > 0 || role3.player_double > 0 || role3.player_haploid ){
|
||||
webSocket.send('{"connect":"client","mode":"toBet","user_id":"'+user_id+'","number_tab_id":"'+parseInt(tab_id)+'", "amount_player_1":"'+role1.player_haploid+'", "amount_player_1_times":"'+role1.player_double+'", "amount_player_1_banker":"'+role1.banker_haploid+'", "amount_player_1_banker_times":"'+role1.banker_double+'", "amount_player_2":"'+role2.player_haploid+'", "amount_player_2_times":"'+role2.player_double+'", "amount_player_2_banker":"'+role2.banker_haploid+'", "amount_player_2_banker_times":"'+role2.banker_double+'", "amount_player_3":"'+role3.player_haploid+'", "amount_player_3_times":"'+role3.player_double+'", "amount_player_3_banker":"'+role3.banker_haploid+'", "amount_player_3_banker_times":"'+role3.banker_double+'"}');
|
||||
}else{
|
||||
alert_box(lang.to_bet_confirm_tip);
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 回显开牌状态
|
||||
function showbackCard(data){
|
||||
if(data.round.bet_status==2){
|
||||
$(".niuniu .poker-box").addClass("show");
|
||||
$.each(data.card_info,function(i,v){
|
||||
var _thisdata={}
|
||||
_thisdata.status=true
|
||||
_thisdata.round=v
|
||||
showCard(_thisdata)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 显示牌
|
||||
function showCard(data){
|
||||
console.log(data)
|
||||
var whichpoker=null,pokerindex=null,pokercard=null;
|
||||
if(data.status==true){
|
||||
var which=parseInt(data.round.order_num);
|
||||
|
||||
var position=parseInt(which/10);
|
||||
pokerindex=which%10;
|
||||
pokercard=data.round.card;
|
||||
whichpoker="role"+position;
|
||||
|
||||
var $poker=$('.niuniu .poker-box '+'.'+ whichpoker).find(".card").eq(pokerindex-1)
|
||||
var src='../static/poker/'+pokercard+'.png'
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).addClass("active").siblings().removeClass("active")
|
||||
$poker.css("background-image","url("+src+")");
|
||||
$poker.addClass('active');
|
||||
if(which==15){
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").html(data.round.result)
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").fadeIn();
|
||||
}
|
||||
if(which==25){
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").html(data.round.result)
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").fadeIn();
|
||||
}
|
||||
if(which==35){
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").html(data.round.result)
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").fadeIn();
|
||||
}
|
||||
if(which==45){
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").html(data.round.result)
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).find(".result").fadeIn();
|
||||
}
|
||||
if(data.round.position==20){
|
||||
$('.niuniu .poker-box '+'.'+ whichpoker).removeClass("active");
|
||||
$(".main .poker-box .list .card").removeClass("active")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // 定时器弹窗提示
|
||||
// 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);
|
||||
// }
|
||||
|
||||
|
||||
function alert_box(msg){
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['380px', '165px'],
|
||||
closeBtn: false,
|
||||
btn: lang.confirm,
|
||||
title: lang.message,
|
||||
content: '\<\div class="box">' + msg + '\<\/div>',
|
||||
yes: function (index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
|
||||
|
||||
$(function(){
|
||||
NNConfig();
|
||||
viewFax();
|
||||
|
||||
|
||||
|
||||
|
||||
$(".main .chip-box .swiper-slide").click(function(){
|
||||
$(".main .chip-box .swiper-slide").removeClass("choice");
|
||||
$(this).addClass("choice")
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$(window).resize(function(){
|
||||
NNConfig(waybill);
|
||||
viewFax();
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 获取单张桌子数据
|
||||
function getWaybill(game_id,boot_id){
|
||||
var query = new Object();
|
||||
query.game_id = game_id;
|
||||
query.boot_id = boot_id;
|
||||
$.ajax({
|
||||
url:'/index/waybill',
|
||||
data:query,
|
||||
dataType:"json",
|
||||
type:"POST",
|
||||
async:false,
|
||||
success:function(data){
|
||||
waybill = data
|
||||
}
|
||||
});
|
||||
return waybill;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function viewFax() {
|
||||
var VH=$(window).height();
|
||||
var headerH=$("#header").outerHeight();
|
||||
var canvasH=$(".waybill-box").outerHeight();
|
||||
$(".main").height(VH-headerH-canvasH-1.5)
|
||||
$(".video-box").height(VH-headerH-canvasH-1.5);
|
||||
$(".video-box").width((VH-headerH-canvasH-1.5)*16/9)
|
||||
var main_width = $(".main").width();
|
||||
var rule_w = (main_width-(VH-headerH-canvasH-1.5)*16/9)/2.1;
|
||||
$(".rule").width(rule_w);
|
||||
if(rule_w<210){
|
||||
$(".rule").hide();
|
||||
}else{
|
||||
$('.rule').show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function NNConfig(waybill_data){
|
||||
console.log(waybill_data);
|
||||
|
||||
var dpr = window.devicePixelRatio;
|
||||
var _thiscanvas=$("#waybill")
|
||||
var W=$(".waybill-box").width()
|
||||
var cols=24,rows=4;
|
||||
var unit_x=W/cols*dpr;
|
||||
var unit_y=unit_x*0.68;
|
||||
|
||||
_thiscanvas.height(unit_y*rows/dpr);
|
||||
_thiscanvas.attr("width",W*dpr);
|
||||
_thiscanvas.attr("height",unit_y*rows)
|
||||
var ctb =_thiscanvas[0].getContext('2d');
|
||||
|
||||
if(waybill_data!=undefined){
|
||||
var path=waybill_data.waybill;
|
||||
var total_num = waybill_data.total_num;
|
||||
}else{
|
||||
var path=false;
|
||||
var total_num = false;
|
||||
}
|
||||
NNcanvas(ctb,unit_x,unit_y,rows,cols,path,total_num)
|
||||
}
|
||||
|
||||
// -------牛牛路单---------
|
||||
|
||||
function NNcanvas(ctb,unit_x,unit_y,rows,cols,roadData,total_num){
|
||||
if(roadData!=""&&roadData!=undefined){
|
||||
var L=roadData.length;
|
||||
var new_roadData=[];
|
||||
var Tab=cols-3;
|
||||
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)
|
||||
NNtotal(ctb,unit_x,unit_y,cols,total_num)
|
||||
NNline(ctb,unit_x,unit_y,rows,cols)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 局数 数,文字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 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="#ce2837";
|
||||
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");
|
||||
}
|
||||
}else if(type==2){
|
||||
color="#1d4999 ";
|
||||
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++){
|
||||
var grd=ctb.createLinearGradient(0,unit_x,0,0);
|
||||
if(i==0){
|
||||
var color="#fff",font="庄家";
|
||||
grd.addColorStop(0,'#ae0b1a');
|
||||
grd.addColorStop(0.5,'#ff0017');
|
||||
grd.addColorStop(1,'#ae0b1a');
|
||||
}else{
|
||||
var color="#fff",font="闲"+i;
|
||||
grd.addColorStop(0,'#0321a2');
|
||||
grd.addColorStop(0.5,'#002ffb');
|
||||
grd.addColorStop(1,'#092679');
|
||||
}
|
||||
ctb.fillStyle = grd;
|
||||
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.3+"px Arial",color);
|
||||
}
|
||||
}
|
||||
|
||||
// 画表尾
|
||||
function NNtotal(ctb,unit_x,unit_y,cols,data) {
|
||||
if(data){
|
||||
for(var i=0;i<4;i++){
|
||||
var font=0;num=0;
|
||||
if(i==0){
|
||||
font='总数';
|
||||
num=data.num;
|
||||
}else if(i==1){
|
||||
font='闲1';
|
||||
num=data.player_1;
|
||||
}else if(i==2){
|
||||
font='闲2';
|
||||
num=data.player_2;
|
||||
}else if(i==3){
|
||||
font='闲3';
|
||||
num=data.player_3;
|
||||
}
|
||||
ctb.fillStyle = '#ab783d';
|
||||
ctb.fillRect (unit_x*(cols-2),i*unit_y,unit_x,unit_y);
|
||||
Font_tie(ctb,font,unit_x*(cols-1.5), i*unit_y+unit_y/2,unit_x*0.3+"px Arial",'#fff');
|
||||
Font_tie(ctb,num,unit_x*(cols-0.5), i*unit_y+unit_y/2,unit_x*0.3+"px Arial",'#000');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 画线条
|
||||
function NNline(ctb,unit_x,unit_y,rows,cols){
|
||||
var CanvasWidht=unit_x*cols;
|
||||
var CanvasHeight=unit_y*rows;
|
||||
ctb.lineWidth = 1;//线条宽度
|
||||
ctb.strokeStyle = "#deded9";//线条颜色
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var audio=$("#audio").get(0);
|
||||
var mp3List;
|
||||
var mp3num=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(){
|
||||
mp3num=1+mp3num
|
||||
if(mp3num<mp3List.length){
|
||||
audio.src="/static/horizontal/mp3/"+mp3List[mp3num];
|
||||
audio.play();
|
||||
}else{
|
||||
audio.pause();
|
||||
audio.currentTime = 0.0;
|
||||
|
||||
mp3num=0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 牛牛声音提示 */
|
||||
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){
|
||||
$(".niuniu .main .bet-tab .tab1 .banker").addClass("win")
|
||||
}else if(win_player_1==1){
|
||||
$(".niuniu .main .bet-tab .tab1 .player").addClass("win")
|
||||
$(".niuniu .poker-box .role1").addClass("win")
|
||||
mp3List.push('nn_X1.ogg')
|
||||
}
|
||||
if(win_player_2==0){
|
||||
$(".niuniu .main .bet-tab .tab2 .banker").addClass("win")
|
||||
}else if(win_player_2==1){
|
||||
$(".niuniu .main .bet-tab .tab2 .player").addClass("win")
|
||||
$(".niuniu .poker-box .role2").addClass("win")
|
||||
mp3List.push('nn_X2.ogg')
|
||||
}
|
||||
if(win_player_3==0){
|
||||
$(".niuniu .main .bet-tab .tab3 .banker").addClass("win")
|
||||
}else if(win_player_3==1){
|
||||
$(".niuniu .main .bet-tab .tab3 .player").addClass("win")
|
||||
$(".niuniu .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'];
|
||||
$(".niuniu .poker-box .role4").addClass("win")
|
||||
}
|
||||
console.log(mp3List)
|
||||
audioMp3(mp3List).Play();
|
||||
var thisResult=setTimeout(function(){
|
||||
|
||||
$(".niuniu .main .bet-tab .list .item").removeClass("win")
|
||||
$(".main .bet-tab .list .item").find(".chipbox").html("");
|
||||
$(".niuniu .poker-box .list").removeClass("win")
|
||||
$(".niuniu .poker-box .list .result").fadeOut();
|
||||
|
||||
$(".main .poker-box .list .card").css("background-image","url(../static/onlinechip/nn/img/pokerbg.png)")
|
||||
clearTimeout(thisResult);
|
||||
},5200);
|
||||
// setTimeout(function(){
|
||||
|
||||
// },5300);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* 获取会员输赢 */
|
||||
function openWin (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:"/nn/user_bet_result",
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
if(data.bet_result.win_total<0){
|
||||
var text_total='<span style="color: #1DA275;">'+lang.lose+' '+data.bet_result.win_total+'</span>'
|
||||
}else{
|
||||
var text_total='<span style="color: #F00;">'+lang.win+' +'+data.bet_result.win_total+'</span>'
|
||||
}
|
||||
if(data.code == 1){
|
||||
var str = '<div class="box table_box"><table>';
|
||||
str +='<tr style="background:#333;"><td>本局输赢</td><td>--</td><td>'+text_total+'</td></tr>'
|
||||
str += '<tr style="background:#333;"><td>可用余额</td><td>--</td><td style="color:#ffcc00">'+data.bet_result.end_money+'</td></tr></table></div>';
|
||||
layer.open({
|
||||
type: 1,
|
||||
title:'本局结算',
|
||||
area: ['480px', 'auto'],
|
||||
btn: [lang.confirm],
|
||||
yes: function(){
|
||||
layer.closeAll();
|
||||
},
|
||||
content: str
|
||||
});
|
||||
}
|
||||
roleBet="";
|
||||
banker_1_double=0,banker_1_haploid=0,player_1_double=0,player_1_haploid=0;
|
||||
banker_2_double=0,banker_2_haploid=0,player_2_double=0,player_2_haploid=0;
|
||||
banker_3_double=0,banker_3_haploid=0,player_3_double=0,player_3_haploid=0;
|
||||
playerbet=0,tigerbet=0,bankerbet=0,dragonbet=0,tiebet=0,ppairbet=0,bpairbet=0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user