视为牌代码抽离为ui.create.cardTempName

This commit is contained in:
shijian 2023-09-12 14:20:45 +08:00
parent 4dcec776da
commit 8fbd74bcb1
1 changed files with 18 additions and 14 deletions

View File

@ -37424,18 +37424,17 @@
var cardname=get.name(cards[i]); var cardname=get.name(cards[i]);
var cardnature=get.nature(cards[i]); var cardnature=get.nature(cards[i]);
if(cards[i].name!=cardname||((cardnature||cards[i].nature)&&cards[i].nature!=cardnature)){ if(cards[i].name!=cardname||((cardnature||cards[i].nature)&&cards[i].nature!=cardnature)){
if(!cards[i]._tempName) cards[i]._tempName=ui.create.div('.tempname',cards[i]);
var tempname=get.translation(cardname); var tempname=get.translation(cardname);
cards[i]._tempName.classList[lib.config.cardtempname=='default'?'add':'remove']('vertical'); var datasetNature='fire';
cards[i]._tempName.dataset.nature='fire';
if(cardname=='sha'){ if(cardname=='sha'){
if(cardnature) tempname=get.translation(cardnature)+tempname; if(cardnature) tempname=get.translation(cardnature)+tempname;
if(cardnature=='thunder') cards[i]._tempName.dataset.nature='thunder'; if(cardnature=='thunder') datasetNature='thunder';
if(cardnature=='kami') cards[i]._tempName.dataset.nature='kami'; if(cardnature=='kami') datasetNature='kami';
if(cardnature=='ice') cards[i]._tempName.dataset.nature='ice'; if(cardnature=='ice') datasetNature='ice';
} }
cards[i]._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname; var node=ui.create.cardTempName(cards[i],tempname,datasetNature);
cards[i]._tempName.tempname=tempname; var cardtempnameConfig=lib.config.cardtempname;
if(cardtempnameConfig!=='default') node.classList.remove('vertical');
} }
} }
var nochess=true; var nochess=true;
@ -39749,6 +39748,16 @@
void window.getComputedStyle(node, null).getPropertyValue("opacity"); void window.getComputedStyle(node, null).getPropertyValue("opacity");
}, },
create:{ 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;
return node;
},
connectRooms:function(list){ connectRooms:function(list){
ui.rooms=[]; ui.rooms=[];
ui.roombase=ui.create.dialog(); ui.roombase=ui.create.dialog();
@ -49047,12 +49056,7 @@
lib.setIntro(node); lib.setIntro(node);
} }
if(get.position(item)=='j'&&item.viewAs&&item.viewAs!=item.name&&lib.config.cardtempname!='off'){ if(get.position(item)=='j'&&item.viewAs&&item.viewAs!=item.name&&lib.config.cardtempname!='off'){
node._tempName=ui.create.div('.tempname',node); ui.create.cardTempName(node,item.viewAs,'wood');
var tempname=get.translation(item.viewAs);
if(lib.config.cardtempname=='default') node._tempName.classList.add('vertical');
node._tempName.dataset.nature='wood';
node._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname;
node._tempName.tempname=tempname;
} }
break; break;