This commit is contained in:
libccy 2015-12-02 23:34:34 +08:00
parent f73ed28a3e
commit d67b829008
5 changed files with 56 additions and 114 deletions

View File

@ -83,20 +83,9 @@
game.saveConfig('low_performance',bool); game.saveConfig('low_performance',bool);
if(bool){ if(bool){
ui.arena.classList.add('low_performance'); ui.arena.classList.add('low_performance');
ui.updatehl();
} }
else{ else{
ui.arena.classList.remove('low_performance'); ui.arena.classList.remove('low_performance');
if(ui.me){
var hs=ui.me.querySelectorAll('.handcards>.card');
for(var i=0;i<hs.length;i++){
hs[i].style.transform='';
hs[i].classList.remove('drawinghidden');
}
ui.handcards1.style.width='';
ui.handcards2.style.width='';
ui.updateh(true);
}
} }
} }
}, },
@ -753,20 +742,6 @@
if(!lib.config.title) document.title='无名杀'; if(!lib.config.title) document.title='无名杀';
} }
}, },
fold_card:{
name:'折叠手牌',
init:true,
onclick:function(bool){
game.saveConfig('fold_card',bool);
if(bool){
ui.css.fold=lib.init.css('layout/default','fold');
}
else if(ui.css.fold){
ui.css.fold.remove();
}
},
unfrequent:true,
},
blur_ui:{ blur_ui:{
name:'模糊效果', name:'模糊效果',
init:false, init:false,
@ -2350,8 +2325,8 @@
} }
} }
ui.css.layout=lib.init.css('layout/'+layout,'layout'); ui.css.layout=lib.init.css('layout/'+layout,'layout');
if(lib.config.fold_card) ui.css.fold=lib.init.css('layout/default','fold'); // if(lib.config.fold_card) ui.css.fold=lib.init.css('layout/default','fold');
if(lib.config.threed_card) ui.css.threed=lib.init.css('layout/default','fold2'); // if(lib.config.threed_card) ui.css.threed=lib.init.css('layout/default','fold2');
if(lib.config.blur_ui) ui.css.blur_ui=lib.init.css('layout/default','blur'); if(lib.config.blur_ui) ui.css.blur_ui=lib.init.css('layout/default','blur');
ui.css.theme=lib.init.css('theme/'+lib.config.theme,'style'); ui.css.theme=lib.init.css('theme/'+lib.config.theme,'style');
ui.css.card_style=lib.init.css('theme/style/card',lib.config.card_style); ui.css.card_style=lib.init.css('theme/style/card',lib.config.card_style);
@ -2368,7 +2343,6 @@
if(totouch){ if(totouch){
game.saveConfig('touchscreen',true); game.saveConfig('touchscreen',true);
game.saveConfig('low_performance',true); game.saveConfig('low_performance',true);
game.saveConfig('fold_card',false);
game.reload(); game.reload();
} }
} }
@ -3873,10 +3847,7 @@
if(lib.config.reverse_sort) sort=-sort; if(lib.config.reverse_sort) sort=-sort;
cards[num].fix(); cards[num].fix();
cards[num].style.transform=''; cards[num].style.transform='';
if(!lib.config.low_performance){ if(player==game.me){
cards[num].animate('start');
}
else if(player==game.me){
cards[num].classList.add('drawinghidden'); cards[num].classList.add('drawinghidden');
} }
@ -3950,9 +3921,7 @@
cards[i].original=null; cards[i].original=null;
} }
} }
if(lib.config.low_performance){ cards[i].style.transform+=' scale(0.2)';
cards[i].style.transform+=' scale(0.2)';
}
if(event.position){ if(event.position){
cards[i].goto(event.position); cards[i].goto(event.position);
} }
@ -4673,9 +4642,9 @@
this.node.count.innerHTML=numh; this.node.count.innerHTML=numh;
} }
// this.node.equips.dataset.number=this.num('e'); // this.node.equips.dataset.number=this.num('e');
if(this==game.me){ // if(this==game.me){
ui.updateh(); // ui.updateh();
} // }
if(this.updates){ if(this.updates){
for(var i=0;i<lib.element.player.updates.length;i++){ for(var i=0;i<lib.element.player.updates.length;i++){
lib.element.player.updates[i](this); lib.element.player.updates[i](this);
@ -5710,10 +5679,7 @@
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
cards[i].fix(); cards[i].fix();
var sort=lib.config.sort_card(cards[i]); var sort=lib.config.sort_card(cards[i]);
if(animate!==false&&!lib.config.low_performance){ if(this==game.me){
cards[i].animate('start');
}
else if(this==game.me){
cards[i].classList.add('drawinghidden'); cards[i].classList.add('drawinghidden');
} }
if(lib.isSingleHandcard()||sort>0){ if(lib.isSingleHandcard()||sort>0){
@ -8783,7 +8749,7 @@
} }
ui.arena.dataset.number=8; ui.arena.dataset.number=8;
} }
ui.updateh(true); ui.updatehl();
for(var i=0;i<players.length;i++){ for(var i=0;i<players.length;i++){
if(lib.config.mode=='identity'){ if(lib.config.mode=='identity'){
game.players[i].init(players[i].name,players[i].name2); game.players[i].init(players[i].name,players[i].name2);
@ -8846,7 +8812,7 @@
ui.arena.style.display=''; ui.arena.style.display='';
ui.refresh(ui.arena); ui.refresh(ui.arena);
ui.arena.show(); ui.arena.show();
ui.updateh(true); ui.updatehl();
} }
}, },
playAudio:function(str){ playAudio:function(str){
@ -9313,7 +9279,7 @@
ui.handcards2=player.node.handcards2.animate('start').fix(); ui.handcards2=player.node.handcards2.animate('start').fix();
ui.handcards1Container.appendChild(ui.handcards1); ui.handcards1Container.appendChild(ui.handcards1);
ui.handcards2Container.appendChild(ui.handcards2); ui.handcards2Container.appendChild(ui.handcards2);
ui.updateh(true); ui.updatehl();
game.setChessInfo(); game.setChessInfo();
} }
}, },
@ -9399,21 +9365,11 @@
var cards1=get.infoCards(cards12[0]); var cards1=get.infoCards(cards12[0]);
var cards2=get.infoCards(cards12[1]); var cards2=get.infoCards(cards12[1]);
for(var i=0;i<cards1.length;i++){ for(var i=0;i<cards1.length;i++){
if(lib.config.low_performance){ cards1[i].classList.add('drawinghidden');
cards1[i].classList.add('drawinghidden');
}
else{
cards1[i].animate('start');
}
player.node.handcards1.insertBefore(cards1[i],player.node.handcards1.firstChild); player.node.handcards1.insertBefore(cards1[i],player.node.handcards1.firstChild);
} }
for(var i=0;i<cards2.length;i++){ for(var i=0;i<cards2.length;i++){
if(lib.config.low_performance){ cards2[i].classList.add('drawinghidden');
cards2[i].classList.add('drawinghidden');
}
else{
cards2[i].animate('start');
}
player.node.handcards2.insertBefore(cards2[i],player.node.handcards2.firstChild); player.node.handcards2.insertBefore(cards2[i],player.node.handcards2.firstChild);
} }
ui.updatehl(); ui.updatehl();
@ -9662,7 +9618,7 @@
ui.handcards2Container.insertBefore(ui.handcards2,ui.handcards2Container.firstChild); ui.handcards2Container.insertBefore(ui.handcards2,ui.handcards2Container.firstChild);
game.me=player; game.me=player;
ui.updateh(true); ui.updatehl();
if(lib.config.mode=='chess'){ if(lib.config.mode=='chess'){
ui.create.fakeme(); ui.create.fakeme();
} }
@ -9698,7 +9654,7 @@
ui.handcards1Container.appendChild(ui.handcards1); ui.handcards1Container.appendChild(ui.handcards1);
ui.handcards2Container.appendChild(ui.handcards2); ui.handcards2Container.appendChild(ui.handcards2);
ui.updateh(true); ui.updatehl();
game.playerMap={}; game.playerMap={};
var players=game.players.concat(game.dead); var players=game.players.concat(game.dead);
@ -11031,7 +10987,7 @@
ui.handcards1Container.appendChild(ui.handcards1); ui.handcards1Container.appendChild(ui.handcards1);
ui.handcards2Container.appendChild(ui.handcards2); ui.handcards2Container.appendChild(ui.handcards2);
ui.updateh(true); ui.updatehl();
} }
if(game.me.isAlive()){ if(game.me.isAlive()){
if(ui.auto) ui.auto.show(); if(ui.auto) ui.auto.show();
@ -11064,7 +11020,7 @@
ui.handcards2=player.node.handcards2.animate('start').fix(); ui.handcards2=player.node.handcards2.animate('start').fix();
ui.handcards1Container.insertBefore(ui.handcards1,ui.handcards1Container.firstChild); ui.handcards1Container.insertBefore(ui.handcards1,ui.handcards1Container.firstChild);
ui.handcards2Container.insertBefore(ui.handcards2,ui.handcards2Container.firstChild); ui.handcards2Container.insertBefore(ui.handcards2,ui.handcards2Container.firstChild);
ui.updateh(true); ui.updatehl();
game.addVideo('swapControl',player,get.cardsInfo(player.get('h'))); game.addVideo('swapControl',player,get.cardsInfo(player.get('h')));
if(game.me.isAlive()){ if(game.me.isAlive()){
@ -15007,7 +14963,7 @@
ui.handcards2=game.me.node.handcards2; ui.handcards2=game.me.node.handcards2;
ui.handcards1Container.appendChild(ui.handcards1); ui.handcards1Container.appendChild(ui.handcards1);
ui.handcards2Container.appendChild(ui.handcards2); ui.handcards2Container.appendChild(ui.handcards2);
ui.updateh(true); ui.updatehl();
} }
}, },
card:function(position,info,noclick){ card:function(position,info,noclick){
@ -16654,6 +16610,8 @@
game.swapPlayer(this); game.swapPlayer(this);
}, },
mousewheel:function(evt){ mousewheel:function(evt){
if(this.firstChild&&this.firstChild.classList.contains('handcards')&&
!this.classList.contains('scrollh')) return;
var node=this; var node=this;
var num=this._scrollnum||6; var num=this._scrollnum||6;
var speed=this._scrollspeed||16; var speed=this._scrollspeed||16;
@ -17022,18 +16980,6 @@
ui.css.scrollbar.remove(); ui.css.scrollbar.remove();
} }
}, },
mousewheel:function(bool){
game.saveConfig('mousewheel',bool);
if(lib.config.touchscreen) return;
if(lib.config.mousewheel){
game.me.node.handcards1.onmousewheel=ui.click.mousewheel;
game.me.node.handcards2.onmousewheel=ui.click.mousewheel;
}
else{
game.me.node.handcards1.onmousewheel=null;
game.me.node.handcards2.onmousewheel=null;
}
},
touchscreen:function (bool){ touchscreen:function (bool){
game.saveConfig('touchscreen',bool); game.saveConfig('touchscreen',bool);
if(bool){ if(bool){
@ -17045,24 +16991,6 @@
} }
ui.sidebarrestart.classList.add('thundertext'); ui.sidebarrestart.classList.add('thundertext');
}, },
fold_card:function(bool){
game.saveConfig('fold_card',bool);
if(bool){
ui.css.fold=lib.init.css('layout/default','fold');
}
else if(ui.css.fold){
ui.css.fold.remove();
}
},
threed_card:function(bool){
game.saveConfig('threed_card',bool);
if(bool){
ui.css.threed=lib.init.css('layout/default','fold2');
}
else if(ui.css.threed){
ui.css.threed.remove();
}
},
blur_ui:function(bool){ blur_ui:function(bool){
game.saveConfig('blur_ui',bool); game.saveConfig('blur_ui',bool);
if(bool){ if(bool){
@ -17294,11 +17222,10 @@
}, },
updatex:function(){ updatex:function(){
ui.update.apply(this,arguments); ui.update.apply(this,arguments);
ui.updateh(true); ui.updatehl();
}, },
updatehl:function(){ updatehl:function(){
if(!game.me) return; if(!game.me) return;
if(!lib.config.low_performance) return;
if(!ui.handcards1Container||!ui.handcards2Container) return; if(!ui.handcards1Container||!ui.handcards2Container) return;
var hs1=[],hs2=[]; var hs1=[],hs2=[];
for(var i=0;i<ui.handcards1Container.firstChild.childElementCount;i++){ for(var i=0;i<ui.handcards1Container.firstChild.childElementCount;i++){
@ -17311,19 +17238,34 @@
hs2.push(ui.handcards2Container.firstChild.childNodes[i]); hs2.push(ui.handcards2Container.firstChild.childNodes[i]);
} }
} }
// var offset1=112; var offset1=Math.min(112,(ui.handcards1Container.offsetWidth-128)/(hs1.length-1));
if(offset1<32){
offset1=32;
ui.handcards1Container.classList.add('scrollh');
}
else{
ui.handcards1Container.classList.remove('scrollh');
}
for(var i=0;i<hs1.length;i++){ for(var i=0;i<hs1.length;i++){
hs1[i].style.transform='translateX('+(i*112)+'px)'; hs1[i].style.transform='translateX('+(i*offset1)+'px)';
ui.refresh(hs1[i]); ui.refresh(hs1[i]);
hs1[i].classList.remove('drawinghidden'); hs1[i].classList.remove('drawinghidden');
} }
ui.handcards1Container.firstChild.style.width=(112*hs1.length+8)+'px'; ui.handcards1Container.firstChild.style.width=(offset1*(hs1.length-1)+118)+'px';
var offset2=Math.min(112,(ui.handcards2Container.offsetWidth-128)/(hs2.length-1));
if(offset2<32){
offset2=32;
ui.handcards2Container.classList.add('scrollh');
}
else{
ui.handcards2Container.classList.remove('scrollh');
}
for(var i=0;i<hs2.length;i++){ for(var i=0;i<hs2.length;i++){
hs2[i].style.transform='translateX('+(i*112)+'px)'; hs2[i].style.transform='translateX('+(i*offset2)+'px)';
ui.refresh(hs2[i]); ui.refresh(hs2[i]);
hs2[i].classList.remove('drawinghidden'); hs2[i].classList.remove('drawinghidden');
} }
ui.handcards2Container.firstChild.style.width=(112*hs2.length+8)+'px'; ui.handcards2Container.firstChild.style.width=(offset2*(hs2.length-1)+118)+'px';
}, },
updateh:function(compute){ updateh:function(compute){
if(!game.me) return; if(!game.me) return;

View File

@ -81,7 +81,7 @@ table{table-layout: fixed;}
#arena.playerfocus #chess>div:not(.playerfocus):not(.removing){ #arena.playerfocus #chess>div:not(.playerfocus):not(.removing){
opacity: 0.3 !important; opacity: 0.3 !important;
} }
#arena.low_performance #me>div>div>.card{ #arena #me>div>div>.card{
position: absolute; position: absolute;
left:8px; left:8px;
} }
@ -138,27 +138,27 @@ table{table-layout: fixed;}
} }
#me,#mebg{width: 100%;height: 140px;top:calc(100% - 140px);left:0;} #me,#mebg{width: 100%;height: 140px;top:calc(100% - 140px);left:0;}
#mebg{z-index:-1} #mebg{z-index:-1}
#handcards1,#handcards2{width: calc(50% - 140px);height: 127px;padding: 10px;} #handcards1,#handcards2{
#handcards1,#handcards2{white-space:nowrap;overflow-x: scroll;overflow-y:hidden;display: block;text-align: center;} width: calc(50% - 140px);height: 127px;padding: 10px;
text-align: left;
}
#handcards1,#handcards2{white-space:nowrap;overflow-x: hidden;overflow-y:hidden;display: block;}
#handcards1.scrollh,#handcards2.scrollh{overflow-x: scroll;}
#handcards1{left: 0;top:calc(100% - 140px);} #handcards1{left: 0;top:calc(100% - 140px);}
#handcards2{left: calc(50% + 120px);top:calc(100% - 140px);} #handcards2{left: calc(50% + 120px);top:calc(100% - 140px);}
#arena #handcards1>div, #arena #handcards1>div,
#arena #handcards2>div{ #arena #handcards2>div{
height: 100%; height: 100%;
position: relative; position: relative;
margin-right: 15px;
margin-left: -7px;
}
#arena.low_performance #handcards1,
#arena.low_performance #handcards2{
text-align: left;
}
#arena.low_performance #handcards1>div,
#arena.low_performance #handcards2>div{
margin-left: 2px; margin-left: 2px;
margin-right: 10px; margin-right: 10px;
} }
#arena:not(.mobile):not(.single-handcard) #handcards1>div,
#arena:not(.mobile):not(.single-handcard) #handcards2>div{
left:-10px;
}
#arena.single-handcard #handcards1{width: calc(100% - 120px);left:120px;} #arena.single-handcard #handcards1{width: calc(100% - 120px);left:120px;}
#arena:not(.mobile).single-handcard #handcards1{width: calc(100% - 140px);}
#arena.single-handcard #handcards2{display: none;} #arena.single-handcard #handcards2{display: none;}
#system{padding: 6px;width: calc(100% - 12px);white-space: nowrap;z-index: 3;pointer-events: none} #system{padding: 6px;width: calc(100% - 12px);white-space: nowrap;z-index: 3;pointer-events: none}
#system>div{height: 100%;position: relative;margin: 0;padding: 0;} #system>div{height: 100%;position: relative;margin: 0;padding: 0;}

View File

@ -362,7 +362,7 @@
#control{ #control{
z-index:5; z-index:5;
top:auto; top:auto;
bottom:190px; bottom:210px;
width: calc(100% - 300px); width: calc(100% - 300px);
left:150px; left:150px;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "noname", "name": "noname",
"xwalk_version": "1.6.2", "xwalk_version": "1.6.3",
"start_url": "index.html", "start_url": "index.html",
"icons": [ "icons": [
{ {

View File

@ -1,5 +1,5 @@
{ {
"name" : "无名杀", "name" : "无名杀",
"version" : "1.6.2", "version" : "1.6.3",
"main" : "main.js" "main" : "main.js"
} }