refactor(runtime): expose canonical gameplay state
Move character options and movement skills into the Runtime-owned character graph, expose borrowed inventory, character, and social views, and route retained UI state commands through generation-gated typed Runtime contracts. Preserve the existing synchronous wire path while deleting the App-owned option and skill mirrors and extending normalized parity checkpoints. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
9d0d9b07e0
commit
dcb61efb5a
34 changed files with 2076 additions and 103 deletions
|
|
@ -6,6 +6,44 @@ namespace AcDream.Runtime.Tests.Gameplay;
|
|||
|
||||
public sealed class RuntimeInventoryStateTests
|
||||
{
|
||||
[Fact]
|
||||
public void ViewBorrowsTransactionShortcutAndManaOwners()
|
||||
{
|
||||
using var entities = new RuntimeEntityObjectLifetime();
|
||||
using var inventory = new RuntimeInventoryState(entities);
|
||||
inventory.Shortcuts.Replace(
|
||||
[
|
||||
new AcDream.Core.Items.ShortcutEntry(3, 0x80000001u, 0u),
|
||||
new AcDream.Core.Items.ShortcutEntry(4, 0u, 42u),
|
||||
]);
|
||||
inventory.ItemMana.OnQueryItemManaResponse(
|
||||
0x80000001u,
|
||||
0.75f,
|
||||
valid: true);
|
||||
inventory.Transactions.IncrementBusyCount();
|
||||
|
||||
RuntimeInventoryStateSnapshot snapshot = inventory.View.Snapshot;
|
||||
|
||||
Assert.Equal(2, snapshot.ShortcutCount);
|
||||
Assert.Equal(1, snapshot.ItemManaCount);
|
||||
Assert.Equal(1, snapshot.BusyCount);
|
||||
Assert.False(snapshot.CanBeginRequest);
|
||||
Assert.True(inventory.View.TryGetShortcut(
|
||||
3,
|
||||
out RuntimeShortcutSnapshot itemShortcut));
|
||||
Assert.Equal(
|
||||
new RuntimeShortcutSnapshot(3, 0x80000001u, 0u),
|
||||
itemShortcut);
|
||||
Assert.True(inventory.View.TryGetShortcut(
|
||||
4,
|
||||
out RuntimeShortcutSnapshot spellShortcut));
|
||||
Assert.Equal(new RuntimeShortcutSnapshot(4, 0u, 42u), spellShortcut);
|
||||
Assert.True(inventory.View.TryGetItemMana(
|
||||
itemShortcut.ObjectId,
|
||||
out float fraction));
|
||||
Assert.Equal(0.75f, fraction);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OwnsOneGameplayGraphOverExactEntityObjectTable()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue