summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/Game.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-21 08:16:10 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-21 08:16:10 +0800
commitf64045ca6245ed853f4d8ac1bcce6f4fe13068ce (patch)
tree8f637a981c7099aa6216c1bdebb0921c3b9b513d /src/LivingVillage.Desktop/Game.fs
parentdd0907573e13981035a5ff264831edb0534e3496 (diff)
downloadliving-village-f64045ca6245ed853f4d8ac1bcce6f4fe13068ce.tar.gz
feat(desktop): 固化样例世界与昼光呈现
[变更性质] - this commit adds a deterministic desktop bootstrap for the playable sample world. [新增功能] - this commit places the avatar away from the home doorway and separates villagers from scene footprints. - this commit provides a warm high-contrast daylight tint and exits autoplay after SampleComplete. [实现方案] - this commit isolates desktop spawn policy in WorldBootstrap and routes game startup and sample tests through it. - this commit adds regression coverage for spawn positions, spacing, determinism, and daylight tint. [影响范围] - this commit affects the Desktop application and Desktop tests only. - this commit preserves Kernel behavior and does not include unrelated worktree changes.
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
-rw-r--r--src/LivingVillage.Desktop/Game.fs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs
index 1245e02..27e44a7 100644
--- a/src/LivingVillage.Desktop/Game.fs
+++ b/src/LivingVillage.Desktop/Game.fs
@@ -124,7 +124,7 @@ type LivingVillageGame() as this =
let mutable cjkAtlas = Unchecked.defaultof<Texture2D>
let mutable pixel = Unchecked.defaultof<Texture2D>
let renderPlan = VillageArt.sampleRenderPlan ()
- let mutable world = Sim.initialWorldN 42UL Sim.npcCount
+ let mutable world = WorldBootstrap.initialWorld 42UL Sim.npcCount
let mutable camera = Vector2.Zero
let mutable avatarFacing = VillageArt.SouthFacing
let mutable fpsFrames = 0
@@ -168,7 +168,7 @@ type LivingVillageGame() as this =
this.CenterCamera()
member private this.StartNewGame() =
- world <- Sim.initialWorldN 42UL Sim.npcCount
+ world <- WorldBootstrap.initialWorld 42UL Sim.npcCount
this.ResetWorldView()
menu <- menu |> MenuState.setCurrentWorld true |> MenuState.enterGame
printfn $"new-game=ok seed=42 npcs={Sim.npcCount}"
@@ -258,6 +258,9 @@ type LivingVillageGame() as this =
this.CenterCamera()
if nextState.Stage <> stageBefore then
printfn $"sample stage={nextState.Stage} tick={nextWorld.Tick} pos=({nextWorld.Avatar.Pos.X:F0},{nextWorld.Avatar.Pos.Y:F0})"
+ if nextState.Stage = SampleScript.SampleComplete then
+ printfn (if nextState.TimedOut then "sample result=timeout" else "sample result=ok")
+ this.Exit()
member private this.UpdatePlaying (gameTime: GameTime) (kb: KeyboardState) (pressed: Keys -> bool) (pressedAny: Keys list -> bool) =
if sampleMode then
@@ -552,9 +555,9 @@ type LivingVillageGame() as this =
spriteBatch.Begin()
match m5View.HomeMode with
| Inside _ ->
- VillageArt.drawInterior spriteBatch pixel artTextures viewport.Width viewport.Height renderPlan.Interior Color.White
+ VillageArt.drawInterior spriteBatch pixel artTextures viewport.Width viewport.Height renderPlan.Interior profile.WorldTint
let interiorAvatarSpec = VillageArt.avatarSpriteSpec avatarFacing world.Tick
- VillageArt.drawInteriorCharacter spriteBatch artTextures viewport.Width viewport.Height world.Avatar.Pos interiorAvatarSpec Color.White
+ VillageArt.drawInteriorCharacter spriteBatch artTextures viewport.Width viewport.Height world.Avatar.Pos interiorAvatarSpec profile.WorldTint
| Outside ->
VillageArt.drawWorld
spriteBatch