More fixes
This commit is contained in:
@@ -77,7 +77,7 @@ public class AddonCategoryConfigurationWindow : NativeAddon
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private void OnOptionChanged(CategoryWrapper? newOption)
|
||||
private void OnOptionChanged(CategoryWrapper? newOption)
|
||||
{
|
||||
if (_configNode is null) return;
|
||||
|
||||
@@ -118,7 +118,7 @@ public class AddonCategoryConfigurationWindow : NativeAddon
|
||||
listNode.AddOption(newWrapper);
|
||||
|
||||
RefreshSelectionList();
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
|
||||
private void OnRemoveCategory(CategoryWrapper categoryWrapper)
|
||||
@@ -134,7 +134,7 @@ public class AddonCategoryConfigurationWindow : NativeAddon
|
||||
{
|
||||
OnOptionChanged(null);
|
||||
}
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
|
||||
private void RefreshSelectionList()
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using AetherBags;
|
||||
using AetherBags.Inventory;
|
||||
using AetherBags.Inventory.Categories;
|
||||
using AetherBags.Inventory.State;
|
||||
using AetherBags.Nodes.Input;
|
||||
@@ -12,6 +10,8 @@ using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using KamiToolKit;
|
||||
using KamiToolKit.Nodes;
|
||||
|
||||
namespace AetherBags.Addons;
|
||||
|
||||
public abstract unsafe class InventoryAddonBase : NativeAddon
|
||||
{
|
||||
protected readonly InventoryCategoryHoverCoordinator HoverCoordinator = new();
|
||||
@@ -21,7 +21,7 @@ public abstract unsafe class InventoryAddonBase : NativeAddon
|
||||
protected WrappingGridNode<InventoryCategoryNode> CategoriesNode = null!;
|
||||
protected TextInputWithHintNode SearchInputNode = null!;
|
||||
protected InventoryFooterNode FooterNode = null!;
|
||||
protected TextNode? SlotCounterNode { get; set; }
|
||||
protected TextNode? SlotCounterNode { get; set; }
|
||||
protected CircleButtonNode SettingsButtonNode = null!;
|
||||
|
||||
protected virtual float MinWindowWidth => 600;
|
||||
@@ -37,6 +37,7 @@ public abstract unsafe class InventoryAddonBase : NativeAddon
|
||||
|
||||
protected bool RefreshQueued;
|
||||
protected bool RefreshAutosizeQueued;
|
||||
private bool _isRefreshing;
|
||||
|
||||
protected abstract InventoryStateBase InventoryState { get; }
|
||||
|
||||
@@ -44,11 +45,30 @@ public abstract unsafe class InventoryAddonBase : NativeAddon
|
||||
protected virtual bool HasPinning => true;
|
||||
protected virtual bool HasSlotCounter => false;
|
||||
|
||||
public void ManualInventoryRefresh()
|
||||
public void ManualRefresh()
|
||||
{
|
||||
if (!Services.ClientState.IsLoggedIn) return;
|
||||
InventoryState.RefreshFromGame();
|
||||
RefreshCategoriesCore(autosize: true);
|
||||
if (_isRefreshing) return;
|
||||
try
|
||||
{
|
||||
_isRefreshing = true;
|
||||
InventoryState.RefreshFromGame();
|
||||
RefreshCategoriesCore(autosize: true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isRefreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void RefreshAllInventoryWindows()
|
||||
{
|
||||
Services.Framework.RunOnTick(() =>
|
||||
{
|
||||
System.AddonInventoryWindow?.ManualRefresh();
|
||||
System.AddonSaddleBagWindow?.ManualRefresh();
|
||||
//AetherBags.System.AddonRetainerWindow?.ManualRefresh();
|
||||
}, delayTicks: 2);
|
||||
}
|
||||
|
||||
protected virtual void RefreshCategoriesCore(bool autosize)
|
||||
@@ -79,8 +99,7 @@ public abstract unsafe class InventoryAddonBase : NativeAddon
|
||||
if (HasPinning)
|
||||
{
|
||||
bool pinsChanged = PinCoordinator.ApplyPinnedStates(CategoriesNode);
|
||||
if (pinsChanged)
|
||||
HoverCoordinator.ResetAll(CategoriesNode);
|
||||
if (pinsChanged) HoverCoordinator.ResetAll(CategoriesNode);
|
||||
}
|
||||
|
||||
WireHoverHandlers();
|
||||
@@ -99,6 +118,8 @@ public abstract unsafe class InventoryAddonBase : NativeAddon
|
||||
return new InventoryCategoryNode
|
||||
{
|
||||
Size = ContentSize with { Y = 120 },
|
||||
OnRefreshRequested = ManualRefresh,
|
||||
OnDragEnd = RefreshAllInventoryWindows,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class CommandHandler : IDisposable
|
||||
break;
|
||||
|
||||
case "refresh":
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
PrintChat("Inventory refreshed.");
|
||||
break;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class CommandHandler : IDisposable
|
||||
|
||||
case "import-sk":
|
||||
ImportExportResetHelper.TryImportSortaKindaFromClipboard(true);
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
break;
|
||||
|
||||
case "export":
|
||||
@@ -77,12 +77,12 @@ public class CommandHandler : IDisposable
|
||||
|
||||
case "import":
|
||||
ImportExportResetHelper.TryImportConfigFromClipboard();
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
break;
|
||||
|
||||
case "reset":
|
||||
ImportExportResetHelper.TryResetConfig();
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
break;
|
||||
|
||||
case "count":
|
||||
|
||||
@@ -9,7 +9,7 @@ public static unsafe class InventoryMoveHelper
|
||||
Services.Logger.Debug($"[MoveItem] {sourceContainer}@{sourceSlot} -> {destContainer}@{destSlot}");
|
||||
InventoryManager.Instance()->MoveItemSlot(sourceContainer, sourceSlot, destContainer, destSlot, true);
|
||||
Services.Framework.DelayTicks(2);
|
||||
Services.Framework.RunOnFrameworkThread(System.AddonInventoryWindow.ManualInventoryRefresh);
|
||||
Services.Framework.RunOnFrameworkThread(System.AddonInventoryWindow.ManualRefresh);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -342,7 +342,7 @@ public sealed class CategoryDefinitionConfigurationNode : VerticalListNode
|
||||
|
||||
private static void NotifyChanged()
|
||||
{
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
|
||||
private void NotifyCategoryPropertyChanged()
|
||||
|
||||
@@ -81,7 +81,7 @@ internal sealed class FunctionalConfigurationNode : TabbedVerticalListNode
|
||||
if (Enum.TryParse<InventoryStackMode>(selected, out var parsed))
|
||||
{
|
||||
config.StackMode = parsed;
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,5 +30,5 @@ public sealed class GeneralScrollingAreaNode : ScrollingAreaNode<VerticalListNod
|
||||
ContentNode.AddNode(_debugCheckboxNode);
|
||||
}
|
||||
|
||||
private void RefreshInventory() => System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
private void RefreshInventory() => System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
@@ -33,7 +33,7 @@ internal sealed class CompactLookaheadNode : SimpleComponentNode
|
||||
OnValueUpdate = value =>
|
||||
{
|
||||
config.CompactLookahead = value;
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
};
|
||||
CompactLookahead.AttachNode(this);
|
||||
|
||||
@@ -32,7 +32,7 @@ internal class LayoutConfigurationNode : TabbedVerticalListNode
|
||||
OnClick = isChecked =>
|
||||
{
|
||||
config.ShowCategoryItemCount = isChecked;
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
};
|
||||
AddNode(showCategoryItemAmountCheckboxNode);
|
||||
@@ -49,7 +49,7 @@ internal class LayoutConfigurationNode : TabbedVerticalListNode
|
||||
_preferLargestFitCheckboxNode.IsEnabled = isChecked;
|
||||
_useStableInsertCheckboxNode.IsEnabled = isChecked;
|
||||
_compactLookaheadNode.CompactLookahead.IsEnabled = isChecked;
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
};
|
||||
AddNode(compactPackingCheckboxNode);
|
||||
@@ -65,7 +65,7 @@ internal class LayoutConfigurationNode : TabbedVerticalListNode
|
||||
OnClick = isChecked =>
|
||||
{
|
||||
config.CompactPreferLargestFit = isChecked;
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
};
|
||||
AddNode(_preferLargestFitCheckboxNode);
|
||||
@@ -80,7 +80,7 @@ internal class LayoutConfigurationNode : TabbedVerticalListNode
|
||||
OnClick = isChecked =>
|
||||
{
|
||||
config.CompactStableInsert = isChecked;
|
||||
System.AddonInventoryWindow.ManualInventoryRefresh();
|
||||
System.AddonInventoryWindow.ManualRefresh();
|
||||
}
|
||||
};
|
||||
AddNode(_useStableInsertCheckboxNode);
|
||||
|
||||
@@ -36,6 +36,7 @@ public class InventoryCategoryNode : SimpleComponentNode
|
||||
|
||||
public event Action<InventoryCategoryNode, bool>? HeaderHoverChanged;
|
||||
public Action? OnRefreshRequested { get; set; }
|
||||
public Action? OnDragEnd { get; set; }
|
||||
|
||||
public InventoryCategoryNode()
|
||||
{
|
||||
@@ -239,7 +240,7 @@ public class InventoryCategoryNode : SimpleComponentNode
|
||||
},
|
||||
IsClickable = true,
|
||||
OnDiscard = node => OnDiscard(node, data),
|
||||
OnEnd = _ => System.AddonInventoryWindow.ManualInventoryRefresh(),
|
||||
OnEnd = _ => OnDragEnd?.Invoke(),
|
||||
OnPayloadAccepted = (node, payload) => OnPayloadAccepted(node, payload, data),
|
||||
OnRollOver = node =>
|
||||
{
|
||||
@@ -292,7 +293,6 @@ public class InventoryCategoryNode : SimpleComponentNode
|
||||
Services.Logger.Debug($"[OnPayload] Source: {sourceLocation. Container} @ {sourceLocation. Slot}");
|
||||
Services.Logger.Debug($"[OnPayload] Target: {targetLocation.Container} @ {targetLocation.Slot}");
|
||||
|
||||
|
||||
if (sourceLocation.Container.IsSameContainerGroup(targetLocation.Container))
|
||||
{
|
||||
Services.Logger.Debug($"[OnPayload] Source and target are in the same container group; no move performed");
|
||||
|
||||
Reference in New Issue
Block a user