Skip to content

Commit e72b67a

Browse files
authored
Merge branch 'AscensionGameDev:main' into main
2 parents fcb3abf + 4891f3c commit e72b67a

4 files changed

Lines changed: 34 additions & 9 deletions

File tree

Intersect.Client.Core/Interface/Game/Bag/BagItem.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,30 @@ public BagItem(BagWindow bagWindow, Base parent, int index, ContextMenu contextM
5656

5757
protected override void OnContextMenuOpening(ContextMenu contextMenu)
5858
{
59+
contextMenu.ClearChildren();
60+
5961
if (Globals.BagSlots is not { Length: > 0 } bagSlots)
6062
{
6163
return;
6264
}
6365

64-
if (!ItemDescriptor.TryGet(bagSlots[SlotIndex].ItemId, out var item))
66+
var slotIndex = SlotIndex;
67+
68+
if (slotIndex >= bagSlots.Length)
69+
{
70+
return;
71+
}
72+
73+
if (bagSlots[slotIndex] is not { } bagSlot)
74+
{
75+
return;
76+
}
77+
78+
if (!ItemDescriptor.TryGet(bagSlot.ItemId, out var item))
6579
{
6680
return;
6781
}
6882

69-
// Clear the context menu and add the withdraw item with updated item name
70-
contextMenu.ClearChildren();
7183
_withdrawContextItem.SetText(Strings.BagContextMenu.Withdraw.ToString(item.Name));
7284
contextMenu.AddChild(_withdrawContextItem);
7385
base.OnContextMenuOpening(contextMenu);

Intersect.Client.Core/Interface/Game/Bank/BankItem.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,33 @@ public BankItem(BankWindow bankWindow, Base parent, int index, ContextMenu conte
5959

6060
protected override void OnContextMenuOpening(ContextMenu contextMenu)
6161
{
62+
contextMenu.ClearChildren(); // Clear context menu
63+
6264
if (Globals.BankSlots is not { Length: > 0 } bankSlots)
6365
{
6466
return;
6567
}
6668

67-
if (!ItemDescriptor.TryGet(bankSlots[SlotIndex].ItemId, out var item))
69+
var slotIndex = SlotIndex;
70+
71+
if (slotIndex >= bankSlots.Length)
6872
{
6973
return;
7074
}
7175

72-
// Clear the context menu and add the withdraw item with updated item name
73-
contextMenu.ClearChildren();
74-
contextMenu.AddChild(_withdrawContextItem);
75-
_withdrawContextItem.SetText(Strings.BankContextMenu.Withdraw.ToString(item.Name));
76+
if (bankSlots[slotIndex] is not { } bankSlot)
77+
{
78+
return;
79+
}
7680

81+
if (!ItemDescriptor.TryGet(bankSlot.ItemId, out var item))
82+
{
83+
return;
84+
}
85+
86+
// Update context menu
87+
_withdrawContextItem.SetText(Strings.BankContextMenu.Withdraw.ToString(item.Name));
88+
contextMenu.AddChild(_withdrawContextItem);
7789
base.OnContextMenuOpening(contextMenu);
7890
}
7991

Intersect.Client.Core/Interface/Menu/CharacterCreationWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public void Update()
251251

252252
public void Show(bool force)
253253
{
254-
_backButton.IsVisibleInTree = !force;
254+
_backButton.IsVisibleInTree = true;
255255
_createButton.Alignment = force ? [Alignments.Center] : [Alignments.Left];
256256

257257
_renderLayers = new ImagePanel[Options.Instance.Equipment.Paperdoll.Down.Count];

Intersect.Client.Core/Interface/Menu/SelectCharacterWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ protected override void EnsureInitialized()
198198

199199
LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer?.GetResolutionString());
200200
EnsureArrowsVisibility();
201+
UpdateDisplay();
201202
}
202203

203204
//Methods

0 commit comments

Comments
 (0)