Skip to content

Commit

Permalink
perf: 可选canvas渲染图片
Browse files Browse the repository at this point in the history
  • Loading branch information
XasYer committed Dec 31, 2024
1 parent a074bed commit 2af9b20
Show file tree
Hide file tree
Showing 30 changed files with 363 additions and 833 deletions.
7 changes: 3 additions & 4 deletions apps/achievement.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,14 @@ const rule = {
const games = []
achievementsByGame.availableGameStats.achievements.forEach(all => {
const i = achievements.find(i => i.name === all.name)
const percent = `${i.percent.toFixed(0)}%`
const percent = i.percent.toFixed(0)
const info = {
name: all.displayName,
desc: all.hidden ? '已隐藏' : all.description,
image: i ? all.icon : all.icongray,
isAvatar: true,
appid: percent,
appidStyle: `style="background-color: #999999; width: ${percent};"`,
percent: i.percent
appid: `${percent}%`,
appidPercent: percent
}
games.push(info)
})
Expand Down
8 changes: 4 additions & 4 deletions apps/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const rule = {
desc: utils.steam.getPersonaState(i.personastate),
image: await utils.bot.getUserAvatar(userInfo.botId, userInfo.userId, userInfo.groupId) || i.avatarfull,
isAvatar: true,
descStyle: `style="background-color: #${getColor(i.personastate)};color: white;width: fit-content;border-radius: 5px; padding: 0 5px;"`
descBgColor: getColor(i.personastate)
})
}
}
Expand Down Expand Up @@ -203,10 +203,10 @@ async function checkGroup (e) {
function getColor (state) {
switch (Number(state)) {
case 1:
return 'beee11'
return '#beee11'
case 0:
return '999999'
return '#999999'
default:
return '8fbc8b'
return '#8fbc8b'
}
}
6 changes: 3 additions & 3 deletions apps/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ const rule = {
title: `${now} api调用统计`,
desc: `共${total}次`,
games: _.orderBy(apis, 'v', 'desc').map(i => {
const percent = (i.v / total * 100).toFixed(0) + '%'
const percent = (i.v / total * 100).toFixed(0)
return {
name: i.name,
appid: percent,
appidStyle: `style="background-color: #999999; width: ${percent};"`,
appid: percent + '%',
appidPercent: percent,
desc: `${i.v}次`,
noImg: true
}
Expand Down
1 change: 1 addition & 0 deletions components/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class Config {
* 获取其他配置
* @returns {{
* renderScale: number,
* renderType: number,
* hiddenLength: number,
* itemLength: number,
* steamAvatar: boolean,
Expand Down
Loading

0 comments on commit 2af9b20

Please sign in to comment.