feat(v0.1.1): 周期表五大分区 / 分区与单格改色 / 全屏视线跟随 / 窗口图标 / 跨平台打包

This commit is contained in:
TianXiaRi
2026-12-02 10:27:25 +08:00
parent a9adcd0088
commit 1faee09484
37 changed files with 2477 additions and 127 deletions
+45
View File
@@ -0,0 +1,45 @@
const fs = require('fs')
const p = 'E:/SodiumPet/WorkPlace/v0.1.1/src/main/index.ts'
let c = fs.readFileSync(p, 'utf8')
// 1) helper:取表情包作为窗口图标
const anchor = 'function appIcon(): NativeImage | undefined {'
if (!c.includes(anchor)) {
console.log('MISS appIcon')
process.exit(1)
}
const helper = `function stickerIcon(name: string, size = 64): NativeImage | undefined {
try {
const p = path.join(bundledDir('stickers'), name)
if (fs.existsSync(p)) return nativeImage.createFromPath(p).resize({ width: size, height: size })
} catch {
/* 忽略 */
}
return undefined
}
function appIcon(): NativeImage | undefined {`
c = c.replace(anchor, helper)
// 2) 按出现顺序给每个窗口分配表情包图标
const mapping = [
'1.0.png', // 主窗口(桌宠)
'2.0.png', // 气泡
'3.0.png', // 右键底栏
'20.0.png', // 音乐
'9.0.png', // 歌词浮窗
'23.1.png', // 编辑器
'4.0.png', // 详细面板
'16.0.png', // 资料库
'8.0.png', // 对话条
'5.0.png' // 面板
]
let idx = 0
c = c.replace(/= new BrowserWindow\(\{/g, (m) => {
const file = mapping[idx] ?? '1.0.png'
idx++
return `${m} icon: stickerIcon('${file}'),`
})
console.log('windows iconified:', idx)
fs.writeFileSync(p, c, 'utf8')