refactor(runtime): extract local teleport and player mode
Move local teleport, player-mode, animation, shadow, and sealed-dungeon lifetimes out of GameWindow. Make player-mode entry transactional and isolate approach completions by controller lifetime and approach generation so stale callbacks cannot affect replacements. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
c557038353
commit
eeb0f6b45c
29 changed files with 3311 additions and 1073 deletions
|
|
@ -121,4 +121,30 @@ public class CameraControllerTests
|
|||
Assert.Null(ctl.Chase);
|
||||
Assert.Null(ctl.RetailChase);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RestoreState_ReestablishesPriorCameraAfterNotificationFailure()
|
||||
{
|
||||
var orbit = new OrbitCamera();
|
||||
var ctl = new CameraController(orbit, new FlyCamera());
|
||||
CameraController.CameraState prior = ctl.CaptureState();
|
||||
int notifications = 0;
|
||||
ctl.ModeChanged += _ =>
|
||||
{
|
||||
if (++notifications == 1)
|
||||
throw new InvalidOperationException("injected camera observer failure");
|
||||
};
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
ctl.EnterChaseMode(new ChaseCamera(), new RetailChaseCamera()));
|
||||
|
||||
ctl.RestoreState(prior);
|
||||
|
||||
Assert.Same(orbit, ctl.Active);
|
||||
Assert.False(ctl.IsFlyMode);
|
||||
Assert.False(ctl.IsChaseMode);
|
||||
Assert.Null(ctl.Chase);
|
||||
Assert.Null(ctl.RetailChase);
|
||||
Assert.Equal(2, notifications);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue