Skip to content

Commit bd88dc5

Browse files
WeylonSantanapandinocoder
authored andcommitted
initialize menu context on construtor
1 parent c83d0f7 commit bd88dc5

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Intersect.Client.Core/Interface/Game/Inventory/InventoryWindow.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public partial class InventoryWindow : Window
1313
{
1414
public List<SlotItem> Items { get; set; } = [];
1515
private readonly ScrollControl _slotContainer;
16-
private ContextMenu _contextMenu = default!;
16+
private readonly ContextMenu _contextMenu;
1717

1818
public InventoryWindow(Canvas gameCanvas) : base(gameCanvas, Strings.Inventory.Title, false, nameof(InventoryWindow))
1919
{
@@ -32,20 +32,19 @@ public InventoryWindow(Canvas gameCanvas) : base(gameCanvas, Strings.Inventory.T
3232
OverflowX = OverflowBehavior.Auto,
3333
OverflowY = OverflowBehavior.Scroll,
3434
};
35-
}
36-
37-
protected override void EnsureInitialized()
38-
{
39-
LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
4035

41-
_contextMenu = new ContextMenu(Interface.CurrentInterface.Root, "InventoryContextMenu")
36+
_contextMenu = new ContextMenu(gameCanvas, "InventoryContextMenu")
4237
{
4338
IsVisibleInParent = false,
4439
IconMarginDisabled = true,
4540
ItemFont = GameContentManager.Current.GetFont(name: "sourcesansproblack"),
4641
ItemFontSize = 10,
4742
};
43+
}
4844

45+
protected override void EnsureInitialized()
46+
{
47+
LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
4948
InitItemContainer();
5049
}
5150

Intersect.Client.Core/Interface/Game/Shop/ShopWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public ShopWindow(Canvas gameCanvas) : base(gameCanvas, Globals.GameShop?.Name ?
3434
OverflowY = OverflowBehavior.Scroll,
3535
};
3636

37-
_contextMenu = new ContextMenu(Interface.CurrentInterface.Root, "ShopContextMenu")
37+
_contextMenu = new ContextMenu(gameCanvas, "ShopContextMenu")
3838
{
3939
IsVisibleInParent = false,
4040
IconMarginDisabled = true,

0 commit comments

Comments
 (0)