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

View File

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