From 58e2b0c39d27f593b5a152d4d39c54d68d473c01 Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:42:07 -0700 Subject: [PATCH] Optimize some CSSs. (cherry picked from commit 93b954629451a004679bc887fb44d01a2c8d8dbe) --- game/game.js | 31 +++++++++++++++++-------------- game/package.js | 12 ++++++------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/game/game.js b/game/game.js index 08b927054..27f5de54d 100644 --- a/game/game.js +++ b/game/game.js @@ -6827,10 +6827,11 @@ }, placePoppedDialog:function(dialog,e){ if(dialog._place_text){ - if(dialog._place_text.firstChild.offsetWidth>=190|| - dialog._place_text.firstChild.offsetHeight>=30){ - dialog._place_text.style.textAlign='left'; + if(dialog._place_text.firstChild.offsetWidth>=190||dialog._place_text.firstChild.offsetHeight>=30){ dialog._place_text.style.marginLeft='14px'; + dialog._place_text.style.marginRight='14px'; + dialog._place_text.style.textAlign='left'; + dialog._place_text.style.width='calc(100% - 28px)'; } } if(e.touches&&e.touches[0]){ @@ -7805,17 +7806,19 @@ if(pack.font){ ui.css.fontsheet=lib.init.sheet(); - for(i in pack.font){ - lib.configMenu.appearence.config.name_font.item[i]=pack.font[i]; - lib.configMenu.appearence.config.identity_font.item[i]=pack.font[i]; - lib.configMenu.appearence.config.cardtext_font.item[i]=pack.font[i]; - lib.configMenu.appearence.config.global_font.item[i]=pack.font[i]; - ui.css.fontsheet.sheet.insertRule("@font-face {font-family: '"+i+"'; src: url('"+lib.assetURL+"font/"+i+".ttf');}",0); - if(lib.config.suits_font) ui.css.fontsheet.sheet.insertRule("@font-face {font-family: '"+i+"'; src: url('"+lib.assetURL+"font/suits.ttf');}",0); - } - if(lib.config.suits_font) ui.css.fontsheet.sheet.insertRule("@font-face {font-family: 'Suits'; src: url('"+lib.assetURL+"font/suits.ttf');}",0); - lib.configMenu.appearence.config.cardtext_font.item.default='默认'; - lib.configMenu.appearence.config.global_font.item.default='默认'; + const appearenceConfig=lib.configMenu.appearence.config,fontSheet=ui.css.fontsheet.sheet,suitsFont=lib.config.suits_font; + Object.keys(pack.font).forEach(value=>{ + const font=pack.font[value]; + appearenceConfig.name_font.item[value]=font; + appearenceConfig.identity_font.item[value]=font; + appearenceConfig.cardtext_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); + 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: 'Suits'; src: local('Noname Suit'), url('${lib.assetURL}font/suits.ttf');}`,0); + appearenceConfig.cardtext_font.item.default='默认'; + appearenceConfig.global_font.item.default='默认'; } var ua=navigator.userAgent.toLowerCase(); diff --git a/game/package.js b/game/package.js index 959fd63c8..7a9b66af8 100644 --- a/game/package.js +++ b/game/package.js @@ -128,12 +128,12 @@ window.noname_package={ music_jilve:'极略', }, font:{ - xiaozhuan:'小篆', - xinwei:'新魏', - huangcao:'黄草', - yuanli:'楷体', - xingkai:'行楷', - shousha:'手杀', + xiaozhuan:'方正小篆体', + xinwei:'华文新魏_GBK', + huangcao:'方正黄草_GBK', + yuanli:'方正北魏楷书_GBK', + xingkai:'方正行楷_GBK', + shousha:'方正隶变_GBK', }, theme:{ woodden:'木纹',