From c2394b872a7635de90b77be599068483da43c26a Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:08:25 -0700 Subject: [PATCH 1/4] Use lib.path. --- game/game.js | 222 +++++++++++++++++++-------------------------------- 1 file changed, 84 insertions(+), 138 deletions(-) diff --git a/game/game.js b/game/game.js index 277770392..68586be25 100644 --- a/game/game.js +++ b/game/game.js @@ -4022,11 +4022,11 @@ show_characternamepinyin:{ name:'显示武将名注解', intro:'在武将资料卡显示武将名及其注解、性别、势力、体力等信息', - init:true, + init:'showPinyin', unfrequent:true, item:{ - false:'不显示', - true:'显示拼音', + doNotShow:'不显示', + showPinyin:'显示拼音', showCodeIdentifier:'显示代码ID' }, visualMenu:(node,link,name)=>{ @@ -4062,41 +4062,17 @@ show_skillnamepinyin:{ name:'显示技能名注解', intro:'在武将资料卡显示技能名注解', - init:true, - unfrequent:true, - item:{ - false:'不显示', - true:'显示拼音', - showCodeIdentifier:'显示代码ID' + get init(){ + return lib.configMenu.view.config.show_characternamepinyin.init; }, - visualMenu:(node,link,name)=>{ - node.classList.add('button','character'); - const style=node.style; - style.alignItems='center'; - style.animation='background-position-left-center-right-center-left-center 15s ease infinite'; - style.background='linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB)'; - style.backgroundSize='400% 400%'; - style.display='flex'; - style.height='60px'; - style.justifyContent='center'; - style.width='150px'; - const firstChild=node.firstChild; - firstChild.removeAttribute('class'); - firstChild.style.position='initial'; - if(link=='false') return; - const ruby=document.createElement('ruby'); - ruby.textContent=name; - const leftParenthesisRP=document.createElement('rp'); - leftParenthesisRP.textContent='('; - ruby.appendChild(leftParenthesisRP); - const rt=document.createElement('rt'); - rt.style.fontSize='smaller'; - rt.textContent=link=='showCodeIdentifier'?link:get.pinyin(name).join(' '); - ruby.appendChild(rt); - const rightParenthesisRP=document.createElement('rp'); - rightParenthesisRP.textContent=')'; - ruby.appendChild(rightParenthesisRP); - firstChild.innerHTML=ruby.outerHTML; + get unfrequent(){ + return lib.configMenu.view.config.show_characternamepinyin.unfrequent; + }, + get item(){ + return lib.configMenu.view.config.show_characternamepinyin.item; + }, + get visualMenu(){ + return lib.configMenu.view.config.show_characternamepinyin.visualMenu; } } } @@ -20027,7 +20003,7 @@ } return this; }, - assgin(obj) { + assign(obj) { if(lib.skill[skillName]!=skill) throw `This skill has been destroyed`; if(typeof obj=='object'&&obj!==null) Object.assign(skill,obj); return this; @@ -34012,67 +33988,51 @@ } return node; }, - changeLand:function(url,player){ + changeLand:(url,player)=>{ game.addVideo('changeLand',player,url); - if(url.indexOf('/')===-1){ - url='image/card/'+url; - } - if(url.indexOf('.png')==-1&&url.indexOf('.jpg')==-1){ - url+='.jpg'; - } - var name=url.slice(url.lastIndexOf('/')+1,url.lastIndexOf('.')); - var skill=name+'_skill'; - var node=ui.create.div('.background.upper.land'); - node.setBackgroundImage(url); - node.destroy=function(){ - if (this.skill) { - game.removeGlobalSkill(this.skill); - if(this.system){ - this.system.remove(); + const parsedPath=lib.path.parse(url); + delete parsedPath.base; + if(!parsedPath.dir) parsedPath.dir='image/card'; + if(!parsedPath.ext) parsedPath.ext='.jpg'; + game.broadcastAll((formattedPath,name,skill,player)=>{ + const node=ui.create.div('.background.upper.land'); + node.setBackgroundImage(formattedPath); + node.destroy=()=>{ + if (node.skill) { + game.removeGlobalSkill(node.skill); + if(node.system) node.system.remove(); } + node.classList.add('hidden'); + setTimeout(()=>node.remove(),3000); + if(ui.land==node) ui.land=null; } - this.classList.add('hidden'); - var node=this; - setTimeout(function(){ - node.remove(); - },3000); - if(ui.land==this){ - ui.land=null; + if(ui.land){ + document.body.insertBefore(node,ui.land); + ui.land.destroy(); } - } - if(ui.land){ - document.body.insertBefore(node,ui.land); - ui.land.destroy(); - } - else{ - node.classList.add('hidden'); - document.body.insertBefore(node,ui.window); - ui.refresh(node); - node.classList.remove('hidden'); - } - ui.land=node; - if(name){ + else{ + node.classList.add('hidden'); + document.body.insertBefore(node,ui.window); + ui.refresh(node); + node.classList.remove('hidden'); + } + ui.land=node; + if(!name) return; node.name=name; node.skill=skill; if(player){ node.player=player; player.addTempSkill('land_used'); } - node.system=ui.create.system(lib.translate[skill],null,true,true); - lib.setPopped(node.system,function(){ - var uiintro=ui.create.dialog('hidden'); - var str='地图'; - if(player){ - str='来源:'+get.translation(player); - } - var caption=uiintro.addText(str); - caption.style.margin='0'; - uiintro._place_text=uiintro.add('
IwXAs5_I~DVkIuQ-@`RMlIYojgVWyP1w<95
zJ)aY%hvi+(3D-J3Fs+&67oU#L-W?4G#XG*GhTfA!4d?(U0kwcQKM?fuE%cdb
zwD?P37rK)YK$KOnWqdjES5A1oQw>6|s&Fj_*B+)wKUqO;t~WqQwRn~!7qiJW8g5DH
z0>Uc?XizFGN>Z|t=e+?*XT-IAyoH_j9Rl!zSPk+A*#~1LQEX>dTqTFxq9ujAf#i(H84iw^dJEz$HGt>xCaDkB
zl+E8|V-ufPT>u@jvI@s>CZPZ}`0xHZ#p6a3MaN*g9^*4Z^A-ch<6c3y7w0q8IMoN>
zf~muWPU0*E`Smn9W|e=_qm2&dt;2XBK8W834x=-MszURut|Ys60U+`n>hYTMx(`!6
zw-^-H+$Gc{gh%qWl}y}9aHZMT4H(V0DT5@gPrfB)jLDq>C3dYV822?zi)Nx`9lbT_
zfJHCA-h&gqAe@1TFH6&l&$O2mD{iA`vAR#cw^JdR(^a9`W_RLR&)Cg(z@)mi22am2
z>lGIRyYQkcdc~o1T1>kkL~Tl1bfC|lqF@4Sa8_vU64)7c(MSe8ghORT`Rau$Ao-tr
z=R&8Zzp$R3sfKcTnnsK2lIZ9OFXth(Ao;b7(Ya)HsOGeGYL=?LV%|YW=B5YYe}Kqa
zPUz$3r&NigNmVi7ujH|*S)Z^9AfCA)T)Uxn$$NJRD|dkISm;FgD}DZZ{BYtpD
r)fe*b}I<~4iH4`*i2PrEz2?@e=ewHFeU6y)RM6LNI0Im^cf
zkoa?7gn|Cp5ND0$KgR`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