From 8fbd74bcb1bf6969e57e57e4e45461b702913f96 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Tue, 12 Sep 2023 14:20:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=86=E4=B8=BA=E7=89=8C=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=8A=BD=E7=A6=BB=E4=B8=BAui.create.cardTempName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/game/game.js b/game/game.js index 7a110467a..d980edf6a 100644 --- a/game/game.js +++ b/game/game.js @@ -37424,18 +37424,17 @@ 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)){ - if(!cards[i]._tempName) cards[i]._tempName=ui.create.div('.tempname',cards[i]); var tempname=get.translation(cardname); - cards[i]._tempName.classList[lib.config.cardtempname=='default'?'add':'remove']('vertical'); - cards[i]._tempName.dataset.nature='fire'; + var datasetNature='fire'; if(cardname=='sha'){ if(cardnature) tempname=get.translation(cardnature)+tempname; - if(cardnature=='thunder') cards[i]._tempName.dataset.nature='thunder'; - if(cardnature=='kami') cards[i]._tempName.dataset.nature='kami'; - if(cardnature=='ice') cards[i]._tempName.dataset.nature='ice'; + if(cardnature=='thunder') datasetNature='thunder'; + if(cardnature=='kami') datasetNature='kami'; + if(cardnature=='ice') datasetNature='ice'; } - cards[i]._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname; - cards[i]._tempName.tempname=tempname; + var node=ui.create.cardTempName(cards[i],tempname,datasetNature); + var cardtempnameConfig=lib.config.cardtempname; + if(cardtempnameConfig!=='default') node.classList.remove('vertical'); } } var nochess=true; @@ -39749,6 +39748,16 @@ 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; + return node; + }, connectRooms:function(list){ ui.rooms=[]; ui.roombase=ui.create.dialog(); @@ -49047,12 +49056,7 @@ lib.setIntro(node); } if(get.position(item)=='j'&&item.viewAs&&item.viewAs!=item.name&&lib.config.cardtempname!='off'){ - node._tempName=ui.create.div('.tempname',node); - 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; + ui.create.cardTempName(node,item.viewAs,'wood'); } break; From 4459785dfacf075c7ff973b6dd0552614cb20395 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Tue, 12 Sep 2023 19:53:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96ui.create.cardTempName?= =?UTF-8?q?=EF=BC=8C=E5=8F=98=E4=B8=BA=E4=B8=A4=E4=B8=AA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/game/game.js b/game/game.js index d980edf6a..213296f7e 100644 --- a/game/game.js +++ b/game/game.js @@ -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;