Merge pull request #424 from lieren2023/lieren2023-patch-29

显示武将名注解和显示技能名注解增加一种样式
This commit is contained in:
Spmario233 2023-09-30 01:01:45 +08:00 committed by GitHub
commit 90858bc959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 271 additions and 174 deletions

View File

@ -4038,8 +4038,9 @@
unfrequent:true,
item:{
doNotShow:'不显示',
showPinyin:'显示拼音',
showCodeIdentifier:'显示代码ID'
showPinyin:'拼音(样式一)',
showCodeIdentifier:'代码ID(样式一)',
showPinyin2:'拼音(样式二)',
},
visualMenu:(node,link,name)=>{
node.classList.add('button','character');
@ -4051,7 +4052,7 @@
style.display='flex';
style.height='60px';
style.justifyContent='center';
style.width='150px';
style.width='200px';
const firstChild=node.firstChild;
firstChild.removeAttribute('class');
firstChild.style.position='initial';
@ -54108,6 +54109,100 @@
else if(lib.config.favouriteCharacter.contains(name)){
fav.classList.add('active');
}
// 样式二
if(lib.config.show_characternamepinyin=='showPinyin2'||lib.config.show_skillnamepinyin=='showPinyin2'){
var intro=ui.create.div('.characterintro',get.characterIntro(name),uiintro);
if(lib.config.show_characternamepinyin=='showPinyin2'){
var charactername=get.rawName(name);
var characterpinyin=get.pinyin(charactername);
var nameinfo=get.character(name);
var charactersex=get.translation(nameinfo[0]);
const charactergroups=get.is.double(name,true);
let charactergroup;
if(charactergroups) charactergroup=charactergroups.map(i=>get.translation(i)).join('/')
else charactergroup=get.translation(nameinfo[1]);
var characterhp=nameinfo[2];
var characterintroinfo=get.characterIntro(name);
var spacemark=' | ';
if(charactername.length>3) spacemark='<span style="font-size:7px">'+' '+'</span>'+'|'+'<span style="font-size:7px">'+' '+'</span>';
intro.innerHTML='<span style="font-weight:bold;margin-right:5px">'+charactername+'</span>'+'<span style="font-size:14px;font-family:SimHei,STHeiti,sans-serif">'+'['+characterpinyin+']'+'</span>'+spacemark+charactersex+spacemark+charactergroup+spacemark+characterhp+'<span style="line-height:2"></span>'+'<br>'+characterintroinfo;
}
var intro2=ui.create.div('.characterintro.intro2',uiintro);
var list=get.character(name,3)||[];
var skills=ui.create.div('.characterskill',uiintro);
if(lib.config.touchscreen){
lib.setScroll(intro);
lib.setScroll(intro2);
lib.setScroll(skills);
}
if(lib.config.mousewheel){
skills.onmousewheel=ui.click.mousewheel;
}
var clickSkill=function(e){
while(intro2.firstChild){
intro2.removeChild(intro2.lastChild);
}
var current=this.parentNode.querySelector('.active');
if(current){
current.classList.remove('active');
}
this.classList.add('active');
var skillname=get.translation(this.link);
var skilltranslationinfo=get.skillInfoTranslation(this.link);
if(lib.config.show_skillnamepinyin=='showPinyin2'&&skillname!='阵亡'){
var skillpinyin=get.pinyin(skillname);
intro2.innerHTML='<span style="font-weight:bold;margin-right:5px">'+skillname+'</span>'+'<span style="font-size:14px;font-family:SimHei,STHeiti,sans-serif">'+'['+skillpinyin+']'+'</span>'+' '+skilltranslationinfo;
}else{
intro2.innerHTML='<span style="font-weight:bold;margin-right:5px">'+skillname+'</span>'+skilltranslationinfo;
}
var info=get.info(this.link);
var skill=this.link;
var playername=this.linkname;
var skillnode=this;
if(info.derivation){
var derivation=info.derivation;
if(typeof derivation=='string'){
derivation=[derivation];
}
for(var i=0;i<derivation.length;i++){
var derivationname=get.translation(derivation[i]);
var derivationtranslationinfo=get.skillInfoTranslation(derivation[i]);
if(lib.config.show_skillnamepinyin=='showPinyin2'&&derivationname.length<=5&&derivation[i].indexOf('_faq')==-1){
var derivationpinyin=get.pinyin(derivationname);
intro2.innerHTML+='<br><br><span style="font-weight:bold;margin-right:5px">'+derivationname+'</span>'+'<span style="font-size:14px;font-family:SimHei,STHeiti,sans-serif">'+'['+derivationpinyin+']'+'</span>'+' '+derivationtranslationinfo;
}else{
intro2.innerHTML+='<br><br><span style="font-weight:bold;margin-right:5px">'+derivationname+'</span>'+derivationtranslationinfo;
}
}
}
if(info.alter){
intro2.innerHTML+='<br><br><div class="hrefnode skillversion"></div>';
var skillversionnode=intro2.querySelector('.hrefnode.skillversion');
if(lib.config.vintageSkills.contains(skill)){
skillversionnode.innerHTML='切换至新版';
}
else{
skillversionnode.innerHTML='切换至旧版';
}
skillversionnode.listen(function(){
if(lib.config.vintageSkills.contains(skill)){
lib.config.vintageSkills.remove(skill);
lib.translate[skill+'_info']=lib.translate[skill+'_info_alter'];
}
else{
lib.config.vintageSkills.push(skill);
lib.translate[skill+'_info']=lib.translate[skill+'_info_origin'];
}
game.saveConfig('vintageSkills',lib.config.vintageSkills);
clickSkill.call(skillnode,'init');
});
}
if(e!=='init') game.trySkillAudio(this.link,playername);
}
}else{
// 样式一
const introduction=ui.create.div('.characterintro',uiintro),showCharacterNamePinyin=lib.config.show_characternamepinyin;
if(showCharacterNamePinyin!='doNotShow'){
const characterIntroTable=ui.create.div('.character-intro-table',introduction),span=document.createElement('span');
@ -54305,6 +54400,8 @@
}
if(e!=='init') game.trySkillAudio(this.link,playername);
}
}
var initskill=false;
for(var i=0;i<list.length;i++){
if(!get.info(list[i])||get.info(list[i]).nopop) continue;