feat(ui): centralize retail selection state
This commit is contained in:
parent
c7607f019c
commit
7983309d23
30 changed files with 591 additions and 108 deletions
|
|
@ -6,6 +6,7 @@ using AcDream.App.UI.Testing;
|
|||
using AcDream.Core.Combat;
|
||||
using AcDream.Core.Items;
|
||||
using AcDream.Core.Net.Messages;
|
||||
using AcDream.Core.Selection;
|
||||
using AcDream.UI.Abstractions;
|
||||
using AcDream.UI.Abstractions.Panels.Chat;
|
||||
using AcDream.UI.Abstractions.Panels.Settings;
|
||||
|
|
@ -31,7 +32,7 @@ public sealed record ChatRuntimeBindings(ChatVM ViewModel, Func<ICommandBus> Com
|
|||
|
||||
public sealed record RadarRuntimeBindings(
|
||||
Func<UiRadarSnapshot> Snapshot,
|
||||
Action<uint> SelectObject,
|
||||
SelectionState Selection,
|
||||
Action<bool> SetUiLocked);
|
||||
|
||||
public sealed record ToolbarRuntimeBindings(
|
||||
|
|
@ -43,8 +44,7 @@ public sealed record ToolbarRuntimeBindings(
|
|||
ItemInteractionController ItemInteraction,
|
||||
Action<uint, uint>? SendAddShortcut,
|
||||
Action<uint>? SendRemoveShortcut,
|
||||
Action<Action<uint?>> SubscribeSelectionChanged,
|
||||
Action<Action<uint?>> UnsubscribeSelectionChanged,
|
||||
SelectionState Selection,
|
||||
Action<Action<uint, float>> SubscribeHealthChanged,
|
||||
Action<Action<uint, float>> UnsubscribeHealthChanged,
|
||||
Func<uint, bool> IsHealthTarget,
|
||||
|
|
@ -65,7 +65,8 @@ public sealed record InventoryRuntimeBindings(
|
|||
Action<uint>? SendNoLongerViewing,
|
||||
Action<uint, uint, int>? SendPutItemInContainer,
|
||||
Action<uint, uint>? SendWield,
|
||||
ItemInteractionController ItemInteraction);
|
||||
ItemInteractionController ItemInteraction,
|
||||
SelectionState Selection);
|
||||
|
||||
public sealed record RetailUiPersistenceBindings(
|
||||
SettingsStore Store,
|
||||
|
|
@ -256,7 +257,7 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
RadarController controller = RadarController.Bind(
|
||||
layout,
|
||||
_bindings.Radar.Snapshot,
|
||||
_bindings.Radar.SelectObject,
|
||||
guid => _bindings.Radar.Selection.Select(guid, SelectionChangeSource.Radar),
|
||||
setUiLocked: _bindings.Radar.SetUiLocked,
|
||||
datFont: _bindings.Assets.DefaultFont);
|
||||
RetailWindowFrame.Mount(Host.Root, radarRoot, _bindings.Assets.ResolveSprite,
|
||||
|
|
@ -354,8 +355,7 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
peace, war, empty, b.ItemInteraction, b.SendAddShortcut, b.SendRemoveShortcut);
|
||||
SelectedObjectController = Layout.SelectedObjectController.Bind(
|
||||
layout,
|
||||
b.SubscribeSelectionChanged,
|
||||
b.UnsubscribeSelectionChanged,
|
||||
b.Selection,
|
||||
b.SubscribeHealthChanged,
|
||||
b.UnsubscribeHealthChanged,
|
||||
b.IsHealthTarget,
|
||||
|
|
@ -570,13 +570,13 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
|
||||
InventoryRuntimeBindings b = _bindings.Inventory;
|
||||
InventoryController inventory = InventoryController.Bind(
|
||||
layout, b.Objects, b.PlayerGuid, b.ResolveIcon, b.Strength,
|
||||
layout, b.Objects, b.PlayerGuid, b.ResolveIcon, b.Strength, b.Selection,
|
||||
_bindings.Assets.DefaultFont, _bindings.Character.Provider.CharacterName,
|
||||
contents, sideBag, mainPack, b.SendUse, b.SendNoLongerViewing,
|
||||
b.SendPutItemInContainer, b.ItemInteraction,
|
||||
() => CloseWindow(WindowNames.Inventory));
|
||||
PaperdollController paperdoll = PaperdollController.Bind(
|
||||
layout, b.Objects, b.PlayerGuid, b.ResolveIcon, b.SendWield,
|
||||
layout, b.Objects, b.PlayerGuid, b.ResolveIcon, b.Selection, b.SendWield,
|
||||
contents, _bindings.Assets.DefaultFont, b.ItemInteraction);
|
||||
Host.WindowManager.AttachController(
|
||||
WindowNames.Inventory,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue