Merge pull request #237 from Tipx-L/PR-Branch

Update fonts and optimize the double group related code.
This commit is contained in:
Spmario233 2023-08-26 20:58:50 +08:00 committed by GitHub
commit 36a6200727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 83 additions and 109 deletions

Binary file not shown.

BIN
font/huangcao.woff2 Normal file

Binary file not shown.

Binary file not shown.

BIN
font/shousha.woff2 Normal file

Binary file not shown.

Binary file not shown.

BIN
font/suits.woff2 Normal file

Binary file not shown.

Binary file not shown.

BIN
font/xiaozhuan.woff2 Normal file

Binary file not shown.

BIN
font/xingkai.woff2 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
font/yuanli.woff2 Normal file

Binary file not shown.

View File

@ -7082,40 +7082,32 @@
this.classList.remove('removing'); this.classList.remove('removing');
return this; return this;
}; };
HTMLDivElement.prototype.setBackground=function(name,type,ext,subfolder){ Object.defineProperty(HTMLDivElement.prototype,'setBackground',{
configurable:true,
enumerable:false,
writable:true,
value:function(name,type,ext,subfolder){
if(!name) return; if(!name) return;
var src; let src;
if(ext=='noskin'){ if(ext=='noskin') ext='.jpg';
ext='.jpg';
}
ext=ext||'.jpg'; ext=ext||'.jpg';
subfolder=subfolder||'default' subfolder=subfolder||'default';
if(type){ if(type){
var dbimage=null,extimage=null,modeimage=null; let dbimage=null,extimage=null,modeimage=null,nameinfo,gzbool=false;
var nameinfo; const mode=get.mode();
var gzbool=false;
var mode=get.mode();
if(type=='character'){ if(type=='character'){
if(lib.characterPack['mode_'+mode]&&lib.characterPack['mode_'+mode][name]){ if(lib.characterPack[`mode_${mode}`]&&lib.characterPack[`mode_${mode}`][name]) if(mode=='guozhan'){
if(mode=='guozhan'){
nameinfo=lib.character[name]; nameinfo=lib.character[name];
if(name.indexOf('gz_shibing')==0){ if(name.indexOf('gz_shibing')==0) name=name.slice(3,11);
name=name.slice(3,11);
}
else{ else{
if(lib.config.mode_config.guozhan.guozhanSkin&&lib.character[name]&&lib.character[name][4].contains('gzskin')) gzbool=true; if(lib.config.mode_config.guozhan.guozhanSkin&&lib.character[name]&&lib.character[name][4].contains('gzskin')) gzbool=true;
name=name.slice(3); name=name.slice(3);
} }
} }
else{ else modeimage=mode;
modeimage=mode; else if(lib.character[name]) nameinfo=lib.character[name];
}
}
else if(lib.character[name]){
nameinfo=lib.character[name];
}
else if(lib.config.show_extensionimage){ else if(lib.config.show_extensionimage){
var pack=Object.keys(lib.characterPack).find(pack => Object.keys(lib.characterPack[pack]).contains(name)); const pack=Object.keys(lib.characterPack).find(pack=>Object.keys(lib.characterPack[pack]).contains(name));
if(pack) nameinfo=lib.characterPack[pack][name]; if(pack) nameinfo=lib.characterPack[pack][name];
} }
else if(name.indexOf('::')!=-1){ else if(name.indexOf('::')!=-1){
@ -7124,51 +7116,41 @@
name=name[1]; name=name[1];
} }
} }
if(!modeimage&&nameinfo&&nameinfo[4]){ if(!modeimage&&nameinfo&&nameinfo[4]) for(const value of nameinfo[4]){
for(var i=0;i<nameinfo[4].length;i++){ if(value.indexOf('ext:')==0){
if(nameinfo[4][i].indexOf('ext:')==0){ extimage=value;
extimage=nameinfo[4][i];break; break;
} }
else if(nameinfo[4][i].indexOf('db:')==0){ else if(value.indexOf('db:')==0){
dbimage=nameinfo[4][i];break; dbimage=value;
break;
} }
else if(nameinfo[4][i].indexOf('mode:')==0){ else if(value.indexOf('mode:')==0){
modeimage=nameinfo[4][i].slice(5);break; modeimage=value.slice(5);
break;
} }
else if(nameinfo[4][i].indexOf('character:')==0){ else if(value.indexOf('character:')==0){
name=nameinfo[4][i].slice(10);break; name=value.slice(10);
break;
} }
} }
} if(extimage) src=extimage.replace(/ext:/,'extension/');
if(extimage){
src=extimage.replace(/ext:/,'extension/');
}
else if(dbimage){ else if(dbimage){
this.setBackgroundDB(dbimage.slice(3)); this.setBackgroundDB(dbimage.slice(3));
return this; return this;
} }
else if(modeimage){ else if(modeimage) src=`image/mode/${modeimage}/character/${name}${ext}`;
src='image/mode/'+modeimage+'/character/'+name+ext; else if(type=='character'&&lib.config.skin[name]&&arguments[2]!='noskin') src=`image/skin/${name}/${lib.config.skin[name]}${ext}`;
} else if(type=='character') src=`image/character/${gzbool?'gz_':''}${name}${ext}`;
else if(type=='character'&&lib.config.skin[name]&&arguments[2]!='noskin'){ else src=`image/${type}/${subfolder}/${name}${ext}`;
src='image/skin/'+name+'/'+lib.config.skin[name]+ext;
}
else{
if(type=='character'){
src='image/character/'+(gzbool?'gz_':'')+name+ext;
}
else{
src='image/'+type+'/'+subfolder+'/'+name+ext;
}
}
}
else{
src='image/'+name+ext;
} }
else src=`image/${name}${ext}`;
this.setBackgroundImage(src); this.setBackgroundImage(src);
this.style.backgroundSize="cover"; this.style.backgroundPositionX='center';
this.style.backgroundSize='cover';
return this; return this;
}; }
});
HTMLDivElement.prototype.setBackgroundDB=function(img){ HTMLDivElement.prototype.setBackgroundDB=function(img){
var node=this; var node=this;
game.getDB('image',img,function(src){ game.getDB('image',img,function(src){
@ -7813,10 +7795,10 @@
appearenceConfig.identity_font.item[value]=font; appearenceConfig.identity_font.item[value]=font;
appearenceConfig.cardtext_font.item[value]=font; appearenceConfig.cardtext_font.item[value]=font;
appearenceConfig.global_font.item[value]=font; appearenceConfig.global_font.item[value]=font;
fontSheet.insertRule(`@font-face {font-family: '${value}'; src: local('${font}'), url('${lib.assetURL}font/${value}.ttf');}`,0); fontSheet.insertRule(`@font-face {font-family: '${value}'; src: local('${font}'), url('${lib.assetURL}font/${value}.woff2');}`,0);
if(suitsFont) fontSheet.insertRule(`@font-face {font-family: '${value}'; src: local('${font}'), url('${lib.assetURL}font/suits.ttf');}`,0); if(suitsFont) fontSheet.insertRule(`@font-face {font-family: '${value}'; src: local('${font}'), url('${lib.assetURL}font/suits.woff2');}`,0);
}); });
if(suitsFont) fontSheet.insertRule(`@font-face {font-family: 'Suits'; src: local('Noname Suit'), url('${lib.assetURL}font/suits.ttf');}`,0); if(suitsFont) fontSheet.insertRule(`@font-face {font-family: 'Suits'; src: local('Noname Suit'), url('${lib.assetURL}font/suits.woff2');}`,0);
appearenceConfig.cardtext_font.item.default='默认'; appearenceConfig.cardtext_font.item.default='默认';
appearenceConfig.global_font.item.default='默认'; appearenceConfig.global_font.item.default='默认';
} }
@ -37563,7 +37545,7 @@
} }
if(info.ai==undefined) info.ai={}; if(info.ai==undefined) info.ai={};
const skill=info.ai,card=lib.card[info.viewAs.name].ai; const skill=info.ai,card=lib.card[info.viewAs.name].ai;
Object.keys(card).forEach(value=>{ if(card) Object.keys(card).forEach(value=>{
if(skill[value]==undefined) skill[value]=card[value]; if(skill[value]==undefined) skill[value]=card[value];
else if(typeof skill[value]=='object') Object.keys(card[value]).forEach(element=>{ else if(typeof skill[value]=='object') Object.keys(card[value]).forEach(element=>{
if(skill[value][element]==undefined) skill[value][element]=card[value][element]; if(skill[value][element]==undefined) skill[value][element]=card[value][element];
@ -37572,7 +37554,7 @@
} }
if(info.inherit){ if(info.inherit){
const skill=lib.skill[info.inherit]; const skill=lib.skill[info.inherit];
Object.keys(skill).forEach(value=>{ if(skill) Object.keys(skill).forEach(value=>{
if(info[value]!=undefined) return; if(info[value]!=undefined) return;
if(value=='audio'&&(typeof info[value]=='number'||typeof info[value]=='boolean')) info[value]=info.inherit; if(value=='audio'&&(typeof info[value]=='number'||typeof info[value]=='boolean')) info[value]=info.inherit;
else info[value]=skill[value]; else info[value]=skill[value];
@ -40148,11 +40130,11 @@
zip.load(data); zip.load(data);
var images=[],audios=[],fonts=[],directories={},directorylist=[]; var images=[],audios=[],fonts=[],directories={},directorylist=[];
for(var i in zip.files){ for(var i in zip.files){
var ext=i.slice(i.lastIndexOf('.')+1); var ext=i.slice(i.lastIndexOf('.')+1).toLowerCase();
if(i.indexOf('audio/')==0&&(ext=='mp3'||ext=='ogg')){ if(i.indexOf('audio/')==0&&(ext=='mp3'||ext=='ogg')){
audios.push(i); audios.push(i);
} }
else if(i.indexOf('font/')==0&&ext=='ttf'){ else if(i.indexOf('font/')==0&&ext=='woff2'){
fonts.push(i); fonts.push(i);
} }
else if(i.indexOf('image/')==0&&(ext=='jpg'||ext=='png')){ else if(i.indexOf('image/')==0&&(ext=='jpg'||ext=='png')){
@ -47855,14 +47837,8 @@
node.node.group.style.display='none'; node.node.group.style.display='none';
} }
node.classList.add('newstyle'); node.classList.add('newstyle');
if(double&&double.length){
node.node.name.dataset.nature=get.groupnature(double[0]);
node.node.group.dataset.nature=get.groupnature(double[double.length==2?1:0]);
}
else{
node.node.name.dataset.nature=get.groupnature(get.bordergroup(infoitem)); node.node.name.dataset.nature=get.groupnature(get.bordergroup(infoitem));
node.node.group.dataset.nature=get.groupnature(get.bordergroup(infoitem),'raw'); node.node.group.dataset.nature=get.groupnature(get.bordergroup(infoitem),'raw');
}
ui.create.div(node.node.hp); ui.create.div(node.node.hp);
var hp=get.infoHp(infoitem[2]),maxHp=get.infoMaxHp(infoitem[2]),hujia=get.infoHujia(infoitem[2]); var hp=get.infoHp(infoitem[2]),maxHp=get.infoMaxHp(infoitem[2]),hujia=get.infoHujia(infoitem[2]);
var str=get.numStr(hp); var str=get.numStr(hp);
@ -47920,18 +47896,12 @@
} }
if(infoitem[1]){ if(infoitem[1]){
if(double){ if(double){
var str='<div>'; node.node.group.innerHTML=double.reduce((previousValue,currentValue)=>`${previousValue}<div data-nature="${get.groupnature(currentValue)}">${get.translation(currentValue)}</div>`,'');
if(double.length==2){ if(double.length>4) if(new Set([5,6,9]).has(double.length)) node.node.group.style.height='48px';
for(var i of double){ else node.node.group.style.height='64px';
str+=get.translation(i);
} }
} else node.node.group.innerHTML=`<div>${get.translation(infoitem[1])}</div>`;
else str+=get.translation(double[0]); node.node.group.style.backgroundColor=get.translation(`${get.bordergroup(infoitem)}Color`);
str+='</div>';
node.node.group.innerHTML=str;
}
else node.node.group.innerHTML='<div>'+get.translation(infoitem[1])+'</div>';
node.node.group.style.backgroundColor=get.translation(get.bordergroup(infoitem)+'Color');
} }
else{ else{
node.node.group.style.display='none'; node.node.group.style.display='none';

View File

@ -1970,8 +1970,12 @@ div:not(.handcards)>.card>.info>span,
left: 0; left: 0;
} }
.button.character>.identity { .button.character>.identity {
top: -6px; align-items: flex-end;
display: flex;
flex-direction: column;
flex-wrap: wrap-reverse;
left: 72px; left: 72px;
top: -6px;
} }
.button.character.newstyle>.identity{ .button.character.newstyle>.identity{
/*display: none;*/ /*display: none;*/
@ -1979,8 +1983,8 @@ div:not(.handcards)>.card>.info>span,
background: none !important; background: none !important;
/*box-shadow: none;*/ /*box-shadow: none;*/
left: auto; left: auto;
right: 3px; right: 6px;
top: 3px; top: 5px;
/*font-size: 20px;*/ /*font-size: 20px;*/
} }
.button.newstyle>.name{ .button.newstyle>.name{
@ -2768,11 +2772,11 @@ div:not(.handcards)>.card>.info>span,
} }
.identity { .identity {
text-align: center; text-align: center;
width: 22px;
height: 22px;
} }
.identity>div { .identity>div {
line-height: 16px;
position: relative; position: relative;
text-align: right;
top: 2px; top: 2px;
} }
@ -3833,19 +3837,19 @@ div:hover>.intro {
} }
.player .identity { .player .identity {
align-items: flex-end;
border: none; border: none;
width: 24px;
height: 24px;
border-radius: 100%; border-radius: 100%;
display: inline-flex; display: flex;
flex-direction: column;
transition: all 0.2s; transition: all 0.2s;
} }
.player .identity>div { .player .identity>div {
margin: auto;
position: relative; position: relative;
font-family: 'huangcao','xinwei'; font-family: 'huangcao','xinwei';
font-size: 24px; font-size: 24px;
line-height: 24px;
top: 0; top: 0;
} }
.player .identity.animate { .player .identity.animate {

View File

@ -320,8 +320,8 @@
} }
.player .identity{ .player .identity{
top: -8px; right: -6px;
left: 132px; top: -5px;
} }
.player.minskin .identity{ .player.minskin .identity{
left:102px; left:102px;