fix listenTransition

This commit is contained in:
Spmario233 2023-10-03 16:19:34 +08:00
parent b43a346fe7
commit 4b291cb03a
2 changed files with 26 additions and 20 deletions

View File

@ -8207,17 +8207,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
enable:['chooseToUse','chooseToRespond'],
hiddenCard:function(player,name){
if(!['sha','shan'].contains(name)) return false;
if(!['sha','shan'].includes(name)) return false;
return player.hasCard(function(card){
return card.name=='sha'||card.name=='shan';
const name2=get.name(card);
return (name2=='sha'||name2=='shan')&&name!=name2;
},'hs');
},
filter:function(event,player){
if(event.filterCard({name:'sha'},player,event)||event.filterCard({name:'shan'},player,event)){
return player.hasCard(function(card){
return card.name=='sha'||card.name=='shan';
},'hs');
}
const names=[];
if(event.filterCard({name:'sha'},player,event)) names.push('shan');
if(event.filterCard({name:'shan'},player,event)) names.push('sha');
return names.length>0&&player.hasCard(function(card){
return names.includes(get.name(card));
},'hs');
return false;
},
group:'twchaofeng_compare',
@ -8256,8 +8258,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:'twchaofeng',
name:links[0][2],
filterCard:function(card,player,target){
if(lib.skill.twchaofeng_backup.name=='sha') return card.name=='shan';
else return card.name=='sha';
if(lib.skill.twchaofeng_backup.name=='sha') return get.name(card)=='shan';
else return get.name(card)=='sha';
},
selectCard:1,
check:function(card,player,target){
@ -8355,7 +8357,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{player:'phaseZhunbeiBegin'},
limited:true,
skillAnimation:true,
animationColor:'legend',
animationColor:'qun',
direct:true,
content:function(){
'step 0'

View File

@ -8265,13 +8265,17 @@
return this;
};
HTMLDivElement.prototype.listenTransition=function(func,time){
let done=false;
const callback=()=>{
func.call(this);
if(!done){
done=true;
func.call(this);
}
clearTimeout(timer);
this.removeEventListener('webkitTransitionEnd',callback);
};
const timer=setTimeout(callback,time||1000);
this.addEventListener('webkitTransitionEnd',callback,{once:true});
this.addEventListener('webkitTransitionEnd',callback);
return timer;
};
HTMLDivElement.prototype.setPosition=function(){
@ -27801,7 +27805,7 @@
node1.style.transform='perspective(600px) rotateY(180deg) translateX(0)';
var onEnd01=function(){
node1.removeEventListener('webkitTransitionEnd',onEnd01);
//node1.removeEventListener('webkitTransitionEnd',onEnd01);
setTimeout(function(){
node1.style.transition='all ease-in 0.3s';
node1.style.transform='perspective(600px) rotateY(270deg) translateX(52px)';
@ -27814,7 +27818,7 @@
node1.style.transition='';
ui.refresh(node1);
node1.style.transform='';
node1.removeEventListener('webkitTransitionEnd',onEnd);
//node1.removeEventListener('webkitTransitionEnd',onEnd);
}
node1.listenTransition(onEnd);
},300);
@ -27849,7 +27853,7 @@
}
node2.style.transform='perspective(600px) rotateY(180deg) translateX(0)';
var onEnd02=function(){
node2.removeEventListener('webkitTransitionEnd',onEnd02);
//node2.removeEventListener('webkitTransitionEnd',onEnd02);
setTimeout(function(){
node2.style.transition='all ease-in 0.3s';
node2.style.transform='perspective(600px) rotateY(270deg) translateX(52px)';
@ -27862,7 +27866,7 @@
node2.style.transition='';
ui.refresh(node2);
node2.style.transform='';
node2.removeEventListener('webkitTransitionEnd',onEnd);
//node2.removeEventListener('webkitTransitionEnd',onEnd);
}
node2.listenTransition(onEnd);
},200);
@ -27894,7 +27898,7 @@
node1.style.transform='perspective(600px) rotateY(180deg) translateX(0)';
var onEnd01=function(){
node1.removeEventListener('webkitTransitionEnd',onEnd01);
//node1.removeEventListener('webkitTransitionEnd',onEnd01);
setTimeout(function(){
node1.style.transition='all ease-in 0.3s';
node1.style.transform='perspective(600px) rotateY(270deg) translateX(52px)';
@ -27907,7 +27911,7 @@
node1.style.transition='';
ui.refresh(node1);
node1.style.transform='';
node1.removeEventListener('webkitTransitionEnd',onEnd);
//node1.removeEventListener('webkitTransitionEnd',onEnd);
}
node1.listenTransition(onEnd);
},300);
@ -27929,7 +27933,7 @@
}
node2.style.transform='perspective(600px) rotateY(180deg) translateX(0)';
var onEnd02=function(){
node2.removeEventListener('webkitTransitionEnd',onEnd02);
//node2.removeEventListener('webkitTransitionEnd',onEnd02);
setTimeout(function(){
node2.style.transition='all ease-in 0.3s';
node2.style.transform='perspective(600px) rotateY(270deg) translateX(52px)';
@ -27942,7 +27946,7 @@
node2.style.transition='';
ui.refresh(node2);
node2.style.transform='';
node2.removeEventListener('webkitTransitionEnd',onEnd);
//node2.removeEventListener('webkitTransitionEnd',onEnd);
}
node2.listenTransition(onEnd);
},200);