feat: SodiumPet 小钠桌宠 v0.1.0(Live2D 桌宠 / 经济任务 / 音乐 / 成就 / 编辑器 / MOD)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const fs = require('fs')
|
||||
const p = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/renderer/src/App.tsx'
|
||||
let c = fs.readFileSync(p, 'utf8')
|
||||
|
||||
function rep(from, to) {
|
||||
if (!c.includes(from)) {
|
||||
console.log('MISS ::', from.slice(0, 60).replace(/\n/g, '\\n'))
|
||||
return
|
||||
}
|
||||
c = c.replace(from, to)
|
||||
}
|
||||
|
||||
// 组件级 ref
|
||||
rep(
|
||||
" const cfgRef = useRef<PetConfig>(DEFAULT_CONFIG)",
|
||||
" const cfgRef = useRef<PetConfig>(DEFAULT_CONFIG)\n const loadedSkinRef = useRef('')"
|
||||
)
|
||||
// 移除 effect 内局部声明
|
||||
rep(
|
||||
" const loadedSkinRef = { value: '' }\n\n async function boot(): Promise<void> {",
|
||||
" async function boot(): Promise<void> {"
|
||||
)
|
||||
rep(
|
||||
" loadedSkinRef.value = cfgRef.current.currentSkin || 'xiaona'",
|
||||
" loadedSkinRef.current = cfgRef.current.currentSkin || 'xiaona'"
|
||||
)
|
||||
rep(
|
||||
" if ((cfg.currentSkin || 'xiaona') !== loadedSkinRef.value) {",
|
||||
" if ((cfg.currentSkin || 'xiaona') !== loadedSkinRef.current) {"
|
||||
)
|
||||
|
||||
fs.writeFileSync(p, c, 'utf8')
|
||||
console.log('app skin ref fixed')
|
||||
Reference in New Issue
Block a user