fix(ui): assess retained items on right click
Port UIElement_ItemList's physical-item right-click branch through the shared retained list. Select and appraise backpack, loot, paperdoll, and shortcut items through their canonical owners, while preventing RMB movement from lifting items or issuing appraisal requests. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
5ad32d5753
commit
2dd5cb80d2
17 changed files with 264 additions and 5 deletions
|
|
@ -62,7 +62,8 @@ public class InventoryControllerTests
|
|||
string? ownerName = null,
|
||||
Action? onClose = null,
|
||||
SelectionState? selection = null,
|
||||
StackSplitQuantityState? stackSplitQuantity = null)
|
||||
StackSplitQuantityState? stackSplitQuantity = null,
|
||||
ItemInteractionController? itemInteraction = null)
|
||||
=> InventoryController.Bind(layout, objects, () => Player,
|
||||
iconIds: (_, _, _, _, _) => 0u,
|
||||
strength: () => strength, datFont: null,
|
||||
|
|
@ -76,7 +77,8 @@ public class InventoryControllerTests
|
|||
notifyMergeAttempt: mergeNotices is null ? null : (s, t) => mergeNotices.Add((s, t)),
|
||||
onClose: onClose,
|
||||
selection: selection ?? new SelectionState(),
|
||||
stackSplitQuantity: stackSplitQuantity);
|
||||
stackSplitQuantity: stackSplitQuantity,
|
||||
itemInteraction: itemInteraction);
|
||||
|
||||
private static UiButton MakeButton(uint id)
|
||||
{
|
||||
|
|
@ -494,6 +496,37 @@ public class InventoryControllerTests
|
|||
Assert.True(grid.GetItem(1)!.Selected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RightClickGridItem_selectsAndUsesSharedAppraisalOwner()
|
||||
{
|
||||
var (layout, grid, _, _, _, _, _, _) = BuildLayout();
|
||||
var objects = new ClientObjectTable();
|
||||
SeedContained(objects, 0xAu, Player, slot: 0);
|
||||
var selection = new SelectionState();
|
||||
var appraisals = new List<uint>();
|
||||
using var interaction = new ItemInteractionController(
|
||||
objects,
|
||||
playerGuid: () => Player,
|
||||
sendUse: null,
|
||||
sendUseWithTarget: null,
|
||||
sendWield: null,
|
||||
sendDrop: null,
|
||||
sendExamine: appraisals.Add);
|
||||
Bind(
|
||||
layout,
|
||||
objects,
|
||||
selection: selection,
|
||||
itemInteraction: interaction);
|
||||
|
||||
grid.GetItem(0)!.OnEvent(
|
||||
new UiEvent(0u, grid.GetItem(0), UiEventType.RightClick));
|
||||
|
||||
Assert.Equal(0xAu, selection.SelectedObjectId);
|
||||
Assert.True(grid.GetItem(0)!.Selected);
|
||||
Assert.Equal(new uint[] { 0xAu }, appraisals);
|
||||
Assert.Equal(1, interaction.BusyCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TargetMode_suppressesSelectedSquare_onPendingSource()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue