fix: 设置页重构——插件层实证 + 系统仪表盘回归 + 宽度用满
- 插件层区块(0.1.9 版面重写时丢失)回归设置页顶部:M* 清单(core-systems/ core-data/core-events 核心保护 + 第三方可卸载),并新增「▶ 安装示例插件」按钮—— 一键安装 护山妖兽 插件(注入事件池 + 年首护山之力),直观演示万物皆是插件 - 系统仪表盘回归:12 张能力卡开关网格(停用即拔插,启用恢复),每个卡片列 desc - 布局根治:.set-row max-width 660 废除(右侧大片空白根因)→ 设置页改为 settings-table 全宽两列 + plugin-grid + sys-grid(auto-fill 240px 填满宽度), 内容不再左靠堆挤,右空白消除 - store 增 setNextToast 公开接口;demo-plugins 从 tests/helpers 移至 engine(renderer 可 import) - 全量 937 测试通过、typecheck/build 通过
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { CotycPlugin } from '../core/plugin'
|
||||
|
||||
/** 示例内容插件:注入事件池 + 一个护山能力(开发范本) */
|
||||
export const examplePlugin: CotycPlugin = {
|
||||
id: 'demo-peaks',
|
||||
name: '护山妖兽',
|
||||
version: '0.1.0',
|
||||
author: 'demo',
|
||||
description: '示例插件:山鬼妖气事件与护山之力(+2% 战力)。',
|
||||
kind: 'content',
|
||||
install(ctx) {
|
||||
ctx.addCapability({ id: 'demo-guardian', name: '护山之力', version: '0.1.0', desc: '示例:年首山灵庇佑,全族修为小幅精进。' })
|
||||
ctx.onYearStart((w) => {
|
||||
if (w.sysEnabled('demo-guardian')) {
|
||||
for (const c of w.aliveMembers()) {
|
||||
c.realmProgress = Math.min(100, c.realmProgress + 1.5)
|
||||
}
|
||||
}
|
||||
})
|
||||
ctx.addEventPool('demo-peaks', [
|
||||
{
|
||||
id: 'ev-demo-guardian',
|
||||
name: '山鬼怒吼',
|
||||
category: 'daily',
|
||||
weight: 3,
|
||||
text: '夜半山鸣,护山兽影现身墙外——莫非是山中精怪在拜望?',
|
||||
options: [{ label: '蒸饼供奉', hint: '声望+2', eff: { rep: 2 } }]
|
||||
}
|
||||
])
|
||||
},
|
||||
uninstall(ctx) {
|
||||
ctx.removeEventPool('demo-peaks')
|
||||
ctx.removeCapability('demo-guardian')
|
||||
}
|
||||
}
|
||||
|
||||
/** 依赖缺失的坏插件:应被拒绝安装 */
|
||||
export const brokenPlugin: CotycPlugin = {
|
||||
id: 'demo-broken',
|
||||
name: '依赖断链的插件',
|
||||
version: '0.1.0',
|
||||
kind: 'events',
|
||||
description: '故意缺少依赖的示例插件(安装应被拒绝)。',
|
||||
dependencies: ['demo-not-exists'],
|
||||
install() {}
|
||||
}
|
||||
@@ -116,6 +116,7 @@ export class PluginManager {
|
||||
installed: rt.status.installed,
|
||||
enabled: rt.status.enabled,
|
||||
protected: !!p.protected,
|
||||
description: p.description,
|
||||
dependencies: p.dependencies
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user