0.1.40 P2-1~P2-3: 天下大事记叙事层 + WorldPanel展示区 + LegacyPanel引用 (saga.ts + buildSaga + 8类标签色系)

This commit is contained in:
2026-09-13 14:17:26 +08:00
parent 2c7596cec7
commit 989bc3f444
4 changed files with 154 additions and 0 deletions
+21
View File
@@ -5,6 +5,8 @@ import { ResolveModal } from '../components/ResolveModal'
import { buildBiography } from '../../game/engine/narrative/biography'
import { yearAxis, decadeLabel } from '../../game/engine/narrative/yearaxis'
import { buildReport, verdictLine } from '../../game/engine/narrative/legacyreport'
import { buildSaga, sagaKindName, sagaKindClass } from '../../game/engine/narrative/saga'
import type { WorldSimState } from '../../game/engine/sim/worldsim-data'
export default function LegacyPanel() {
@@ -155,6 +157,25 @@ function LegacyReportView() {
<div className="dim" style={{ marginTop: 10 }}>{Object.entries(r.deathCauses).filter(([k]) => k !== '').sort((a, b) => b[1] - a[1]).slice(0, 4).map(([k, v]) => `${k}×${v}`).join(' · ') || '尚无记录'}</div>
<div className="dim" style={{ marginTop: 6 }}>{r.breakthroughs.slice(-6).map((b) => `${b.year}年×${b.count}`).join(' · ')}</div>
<div className="resolve-poem" style={{ marginTop: 14 }}>{verdictLine(r)}</div>
{/* 0.1.40 天下大事记摘要 */}
{(() => {
const ws = world.state.worldSim as WorldSimState | undefined
if (!ws) return null
const saga = buildSaga(ws).slice(0, 12)
if (saga.length === 0) return null
return (
<div style={{ marginTop: 14 }}>
<div className="dim" style={{ marginBottom: 4 }}></div>
{saga.map((e, i) => (
<div key={i} className="ch-item" style={{ padding: '4px 8px', fontSize: '0.84rem' }}>
<span className="ch-month">{e.year}</span>
<span className={`tag ${sagaKindClass(e.kind)}`} style={{ marginRight: 6, fontSize: '0.72rem' }}>{sagaKindName(e.kind)}</span>
<span className="dim">{e.text}</span>
</div>
))}
</div>
)
})()}
</>
)}
</div>
+18
View File
@@ -8,6 +8,7 @@ import { combatPowerOf } from '../../game/engine/runtime/Systems/combat'
import { sellItem, buyItem, marketPrice } from '../../game/engine/sim/Market'
import { useState } from 'react'
import type { World } from '../../game/engine/runtime/World'
import { buildSaga, sagaKindName, sagaKindClass } from '../../game/engine/narrative/saga'
const RES_LABEL: Record<string, string> = { lingcao: '灵草', lingkuang: '灵矿', beastcore: '兽核' }
const REALM_IDX = ['mortal', 'qi', 'foundation', 'core', 'nascent', 'spirit'] as const
@@ -239,6 +240,23 @@ export default function WorldPanel() {
</div>
</div>
</div>
{/* 0.1.40 天下大事记展示区 */}
<div style={{ marginTop: 16 }}>
<h4 className="dim" style={{ margin: '4px 0 6px' }}></h4>
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, maxHeight: 300, overflowY: 'auto' }}>
{(() => {
const saga = buildSaga(ws)
if (saga.length === 0) return <div className="dim2"></div>
return saga.slice(0, 30).map((e, i) => (
<div key={i} className="ch-item" style={{ padding: '5px 8px' }}>
<span className="ch-month">{e.year}</span>
<span className={`tag ${sagaKindClass(e.kind)}`} style={{ marginRight: 6 }}>{sagaKindName(e.kind)}</span>
<span>{e.text}</span>
</div>
))
})()}
</div>
</div>
</div>
)
}
+10
View File
@@ -1978,3 +1978,13 @@ html[data-blade] .battle-lines {
background: linear-gradient(180deg, #2a1e3d, #1a1228);
border-color: #6b4c9a;
}
/* ---------- 0.1.40 天下大事记标签色系 ---------- */
.saga-era { color: #c9a227; border-color: #c9a227; }
.saga-calamity { color: #c05a41; border-color: #a33; }
.saga-succession { color: #6b8a9a; border-color: #4a6a7a; }
.saga-split { color: #8a5a8a; border-color: #6a4a6a; }
.saga-newborn { color: #5a8a44; border-color: #4a6a34; }
.saga-war { color: #c08a4a; border-color: #a06a3a; }
.saga-wonder { color: #7a5aa8; border-color: #6b4c9a; }
.saga-annal { color: #8a7a5a; border-color: #6a5a3a; }