From 60bbc83d9a1d047933e4128e7b48e1c61c925a14 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 21 Sep 2026 22:57:50 +0800 Subject: feat(desktop): P15 开局职业选择页——新档四选一+暂不选择,接入 v3 存档与当日任务 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MenuState:新增 OccupationSelect 页与 StartNewGameWith 命令;occupationOptions=农夫/渔夫/货郎/书生/暂不选择, 默认高亮「暂不选择」= 不写职业的旧行为;四选一确认后发 StartNewGameWith,ESC 返回主菜单(既有 MainMenu 行为与测试不变)。 - WorldBootstrap.occupationStateFor/refreshOccupationToday:按 seed+职业种子生成/跨日刷新当日 Offered 任务。 - Game:主菜单「开始新游戏」→ 职业选择页;选定后 initialWorldWithOccupation 注入 Money/Energy 与 Today, m5View.Task 随之写入 v3 存档;游玩中按日刷新;autoplay/flow 默认走「暂不选择」保持旧演示行为;DrawMenu 渲染职业页。 - 测试 Desktop 93(新增 6):职业页选项顺序/默认 None/标签、确认命令与返回、bootstrap 四职业 Money/Energy+当日池内 Offered 任务、四职业 v3 round-trip(职业+任务逐字段)、T 面板显示所选职业的模板名与「待接受」、跨日刷新保持同日。 --- src/LivingVillage.Desktop/WorldBootstrap.fs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/LivingVillage.Desktop/WorldBootstrap.fs') diff --git a/src/LivingVillage.Desktop/WorldBootstrap.fs b/src/LivingVillage.Desktop/WorldBootstrap.fs index 0e8ea30..f8ba775 100644 --- a/src/LivingVillage.Desktop/WorldBootstrap.fs +++ b/src/LivingVillage.Desktop/WorldBootstrap.fs @@ -18,6 +18,23 @@ module WorldBootstrap = let private daylightStartTick = 6L * Sim.ticksPerDay / 24L + /// 新档职业状态:按世界 seed 与职业种子生成 nowTick 所属日的 Offered 任务(design §3)。 + let occupationStateFor (seed: uint64) (kind: Occupation.Kind) (nowTick: int64) : Occupation.State = + let baseState = Occupation.stateOf kind + { baseState with + Today = Occupation.dailyTaskOf seed (Occupation.occupationSeedOf kind) (Occupation.dayIndexOf nowTick) kind } + + /// 跨日刷新当日任务;同日(含 Done/Failed 终态)原样保留。 + let refreshOccupationToday (seed: uint64) (state: Occupation.State) (nowTick: int64) : Occupation.State = + { state with + Today = + Occupation.refreshToday + seed + (Occupation.occupationSeedOf state.Profile.Kind) + state.Profile.Kind + nowTick + state.Today } + let initialWorldWithOccupation (startAtDaylight: bool) (seed: uint64) (count: int) (occupation: Occupation.State option) : World = if count < 0 || count > npcSpawnTiles.Length then invalidArg (nameof count) "Desktop bootstrap supports at most 30 NPCs." -- cgit v1.2.3