feat: SodiumPet 小钠桌宠 v0.1.0(Live2D 桌宠 / 经济任务 / 音乐 / 成就 / 编辑器 / MOD)

This commit is contained in:
Tian_XiaRi
2026-12-01 16:41:07 +08:00
commit d25e726ef7
261 changed files with 33676 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
const fs = require('fs')
const base = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/'
function patch(file, pairs) {
const p = base + file
let c = fs.readFileSync(p, 'utf8')
for (const [from, to] of pairs) {
if (!c.includes(from)) {
console.log('MISS in', file, '::', from.slice(0, 70).replace(/\n/g, '\\n'))
continue
}
c = c.replace(from, to)
}
fs.writeFileSync(p, c, 'utf8')
}
// 路由
patch('renderer/src/main.tsx', [
[
"import Detail from './detail/Detail'",
"import Detail from './detail/Detail'\nimport Editor from './editor/Editor'"
],
[
" if (view === 'detail') return <Detail />",
" if (view === 'detail') return <Detail />\n if (view === 'editor') return <Editor />"
]
])
// 菜单:设置 → 编辑模式
patch('renderer/src/menu/Menu.tsx', [
[
" action?: 'sleep' | 'storage'",
" action?: 'sleep' | 'storage' | 'editor'"
],
[
` { label: '图库', tab: 'photos' },
{ label: '资料库', action: 'storage' }`,
` { label: '图库', tab: 'photos' },
{ label: '资料库', action: 'storage' },
{ label: '编辑模式', action: 'editor' }`
],
[
` if (item.action === 'storage') {
api()?.openStorage()
return
}`,
` if (item.action === 'storage') {
api()?.openStorage()
return
}
if (item.action === 'editor') {
api()?.openEditor()
return
}`
]
])
// 设置·存档分区:编辑器入口
patch('renderer/src/panel/Panel.tsx', [
[
` <p className="tips">一个月只能改一次;生日当天她会给你庆祝。</p>`,
` <p className="tips">一个月只能改一次;生日当天她会给你庆祝。</p>
<div className="section-title">编辑模式</div>
<div className="new-profile">
<button className="mini" onClick={() => api()?.openEditor()}>
打开编辑器
</button>
</div>
<p className="tips">
可以修改物品 / 活动的名字、图标、简介、价格、解锁等级与奖励,并增删条目。
</p>`
]
])
// Detail:名字优先 nameNormal
patch('renderer/src/detail/Detail.tsx', [
[
` const itemName = (id: string): string => {
const item = ITEMS.find((i) => i.id === id)
if (!item) return id
return flavor === 'normal' ? (NORMAL_ITEM_NAMES[id] ?? item.name) : item.name
}
const jobName = (id: string): string => {
const job = JOBS.find((j) => j.id === id)
if (!job) return id
return flavor === 'normal' ? (NORMAL_JOB_NAMES[id] ?? job.name) : job.name
}`,
` const itemName = (id: string): string => {
const item = ITEMS.find((i) => i.id === id)
if (!item) return id
return flavor === 'normal'
? (item.nameNormal ?? NORMAL_ITEM_NAMES[id] ?? item.name)
: item.name
}
const jobName = (id: string): string => {
const job = JOBS.find((j) => j.id === id)
if (!job) return id
return flavor === 'normal'
? (job.nameNormal ?? NORMAL_JOB_NAMES[id] ?? job.name)
: job.name
}`
]
])
console.log('editor entry patched')