ys图显示新尘歌壶,优化昵称过长会和UID重叠的问题

This commit is contained in:
CMHopeSunshine 2022-11-03 15:31:15 +08:00
parent 93bbe007f6
commit e6f208d4fb
2 changed files with 3 additions and 4 deletions

View File

@ -171,7 +171,7 @@ async def draw_gacha_log(user_id: str, uid: str, nickname: Optional[str], signat
# 签名和uid # 签名和uid
if signature: if signature:
await img.text(signature, 165, 116, fm.get('hywh', 32), '#252525') await img.text(signature, 165, 116, fm.get('hywh', 32), '#252525')
nickname_length = img.text_length(nickname, fm.get('hywh', 40)) nickname_length = img.text_length(nickname, fm.get('hywh', 48))
await img.text(f'UID{uid}', 166 + nickname_length + 36, 58, await img.text(f'UID{uid}', 166 + nickname_length + 36, 58,
fm.get('bahnschrift_regular', 48, 'Regular'), fm.get('bahnschrift_regular', 48, 'Regular'),
'#252525') '#252525')

View File

@ -151,7 +151,7 @@ async def draw_player_card(player: Player, info: PlayerInfo, characters: List[Ch
# 签名和uid # 签名和uid
if info.signature: if info.signature:
await img.text(info.signature, 223, 150, fm.get('hywh', 48), '#ddcdba') await img.text(info.signature, 223, 150, fm.get('hywh', 48), '#ddcdba')
nickname_length = img.text_length(info.nickname[:25], fm.get('hywh', 64)) nickname_length = img.text_length(info.nickname, fm.get('hywh', 64))
await img.text(f'UID{player.uid}', 223 + nickname_length + 29, 90, fm.get('hywh', 48), '#ddcdba') await img.text(f'UID{player.uid}', 223 + nickname_length + 29, 90, fm.get('hywh', 48), '#ddcdba')
else: else:
await img.text(f'UID{player.uid}', 223, 150, fm.get('hywh', 48), '#ddcdba') await img.text(f'UID{player.uid}', 223, 150, fm.get('hywh', 48), '#ddcdba')
@ -170,13 +170,12 @@ async def draw_player_card(player: Player, info: PlayerInfo, characters: List[Ch
await asyncio.gather(*[ await asyncio.gather(*[
img.text(str(home_data[i]), (155 + 225 * (i % 4), 252 + 225 * (i % 4)), 961, fm.get('hywh', 48), 'black', img.text(str(home_data[i]), (155 + 225 * (i % 4), 252 + 225 * (i % 4)), 961, fm.get('hywh', 48), 'black',
'center') for i in range(len(home_data))]) 'center') for i in range(len(home_data))])
home_name = {'罗浮洞': 168, '翠黛峰': 392, '清琼岛': 617, '绘绮庭': 841} home_name = {'罗浮洞': 168, '翠黛峰': 336, '清琼岛': 505, '绘绮庭': 673, '妙香林': 841}
await asyncio.gather(*[ await asyncio.gather(*[
img.text(name if name in info.home.unlock else '未解锁', home_name[name], 923, fm.get('hywh', 24), img.text(name if name in info.home.unlock else '未解锁', home_name[name], 923, fm.get('hywh', 24),
(0, 0, 0, 153), 'center') for name in home_name]) (0, 0, 0, 153), 'center') for name in home_name])
# 世界探索 # 世界探索
# await asyncio.gather(*[draw_world_card(img, w) for w in info.world_explore.list()])
for w in info.world_explore.list(): for w in info.world_explore.list():
await draw_world_card(img, w) await draw_world_card(img, w)