Skip to content

Commit

Permalink
feature: display quantity of items within hotbar slots
Browse files Browse the repository at this point in the history
+ code refactoring
  • Loading branch information
Arufonsu committed Jul 24, 2024
1 parent e492c22 commit c56232c
Show file tree
Hide file tree
Showing 2 changed files with 261 additions and 269 deletions.
23 changes: 11 additions & 12 deletions Intersect.Client/Interface/Game/Hotbar/HotBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,28 @@ public partial class HotBarWindow
//Init
public HotBarWindow(Canvas gameCanvas)
{
HotbarWindow = new ImagePanel(gameCanvas, "HotbarWindow");
HotbarWindow.ShouldCacheToTexture = true;
InitHotbarItems();
HotbarWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
HotbarWindow = new ImagePanel(gameCanvas, "HotbarWindow")
{
ShouldCacheToTexture = true
};

for (var i = 0; i < Items.Count; i++)
if (Graphics.Renderer == null)
{
if (Items[i].EquipPanel.Texture == null)
{
Items[i].EquipPanel.Texture = Graphics.Renderer.GetWhiteTexture();
}
return;
}

InitHotbarItems();
HotbarWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
}

private void InitHotbarItems()
{
var x = 12;
for (var i = 0; i < Options.Instance.PlayerOpts.HotbarSlotCount; i++)
{
Items.Add(new HotbarItem((byte) i, HotbarWindow));
Items[i].Pnl = new ImagePanel(HotbarWindow, "HotbarContainer" + i);
Items[i].HotbarIcon = new ImagePanel(HotbarWindow, "HotbarContainer" + i);
Items[i].Setup();
Items[i].KeyLabel = new Label(Items[i].Pnl, "HotbarLabel" + i);
Items[i].KeyLabel = new Label(Items[i].HotbarIcon, "HotbarLabel" + i);
}
}

Expand Down
Loading

0 comments on commit c56232c

Please sign in to comment.