优化ui.create.cardTempName,变为两个参数

This commit is contained in:
shijian 2023-09-12 19:53:20 +08:00
parent 8fbd74bcb1
commit 4459785dfa
1 changed files with 25 additions and 18 deletions

View File

@ -37424,15 +37424,7 @@
var cardname=get.name(cards[i]);
var cardnature=get.nature(cards[i]);
if(cards[i].name!=cardname||((cardnature||cards[i].nature)&&cards[i].nature!=cardnature)){
var tempname=get.translation(cardname);
var datasetNature='fire';
if(cardname=='sha'){
if(cardnature) tempname=get.translation(cardnature)+tempname;
if(cardnature=='thunder') datasetNature='thunder';
if(cardnature=='kami') datasetNature='kami';
if(cardnature=='ice') datasetNature='ice';
}
var node=ui.create.cardTempName(cards[i],tempname,datasetNature);
var node=ui.create.cardTempName(cards[i]);
var cardtempnameConfig=lib.config.cardtempname;
if(cardtempnameConfig!=='default') node.classList.remove('vertical');
}
@ -39748,14 +39740,29 @@
void window.getComputedStyle(node, null).getPropertyValue("opacity");
},
create:{
cardTempName:function(card,tempName,nature){
const node=card._tempName||ui.create.div('.tempname',card);
card._tempName=node;
const tempname=get.translation(tempName);
if(lib.config.cardtempname=='default') card._tempName.classList.add('vertical');
card._tempName.dataset.nature=nature||'wood';
card._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname;
card._tempName.tempname=tempname;
cardTempName:function(card,applyNode){
const getApplyNode=applyNode||card;
const cardName=get.name(card);
const cardNature=get.nature(card);
let tempname=get.translation(cardName);
const node=getApplyNode._tempName||ui.create.div('.tempname',getApplyNode);
getApplyNode._tempName=node;
let datasetNature='fire';
if(get.position(card)=='j'&&card.viewAs&&card.viewAs!=card.name) {
datasetNature = 'wood';
tempname=get.translation(card.viewAs);
}else{
if(cardName=='sha'){
if(cardNature) tempname=get.translation(cardNature)+tempname;
if(cardNature=='thunder') datasetNature='thunder';
if(cardNature=='kami') datasetNature='kami';
if(cardNature=='ice') datasetNature='ice';
}
}
if(lib.config.cardtempname=='default') getApplyNode._tempName.classList.add('vertical');
getApplyNode._tempName.dataset.nature=datasetNature;
getApplyNode._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname;
getApplyNode._tempName.tempname=tempname;
return node;
},
connectRooms:function(list){
@ -49056,7 +49063,7 @@
lib.setIntro(node);
}
if(get.position(item)=='j'&&item.viewAs&&item.viewAs!=item.name&&lib.config.cardtempname!='off'){
ui.create.cardTempName(node,item.viewAs,'wood');
ui.create.cardTempName(item,node);
}
break;