Skip to content

Commit 8e4bf96

Browse files
committed
Highlight magic items at max capacity with a gold border
1 parent 5617cac commit 8e4bf96

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Mythril.Blazor/Components/InventoryItem.razor

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
@using Mythril.Blazor.Services
2+
@using Mythril.Data
23
@inject DragDropService DragDropService
34
@inject InventoryService InventoryService
5+
@inject InventoryManager InventoryManager
46
@implements IDisposable
57

6-
<div class="inventory-item @(showOverflowGlow ? "overflowing" : "")" draggable="true" @ondragstart="HandleDragStart">
8+
<div class="inventory-item @(showOverflowGlow ? "overflowing" : "") @(isAtMaxCapacity ? "at-capacity" : "")" draggable="true" @ondragstart="HandleDragStart">
79
<span class="item-name">@Item.Item.Name</span>
810
<span class="item-quantity">@Item.Quantity</span>
911
@if (showAnimation)
@@ -30,6 +32,8 @@
3032
private bool showAnimation;
3133
private bool showOverflowGlow;
3234

35+
private bool isAtMaxCapacity => Item.Item.ItemType == ItemType.Spell && Item.Quantity >= InventoryManager.MagicCapacity;
36+
3337
protected override void OnInitialized()
3438
{
3539
InventoryService.OnItemOverflow += HandleOverflow;

Mythril.Blazor/Components/InventoryItem.razor.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
}
5757
}
5858

59+
.inventory-item.at-capacity {
60+
border-color: #ffd700;
61+
box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
62+
}
63+
5964
.inventory-item.overflowing {
6065
animation: red-glow 1s ease-in-out infinite alternate;
6166
border-color: #ff4444;

0 commit comments

Comments
 (0)