diff --git a/BlazorApp1/Components/InventoryComponent.razor.cs b/BlazorApp1/Components/InventoryComponent.razor.cs index ed9f0b7..cf43fd9 100644 --- a/BlazorApp1/Components/InventoryComponent.razor.cs +++ b/BlazorApp1/Components/InventoryComponent.razor.cs @@ -27,6 +27,7 @@ namespace BlazorApp1.Components [Inject] public IStringLocalizer Localizer { get; set; } + public int Stack { get; internal set; } /// /// Gets or sets the java script runtime. diff --git a/BlazorApp1/Components/InventoryComponent.razor.css b/BlazorApp1/Components/InventoryComponent.razor.css index 951f1f7..31bf51e 100644 --- a/BlazorApp1/Components/InventoryComponent.razor.css +++ b/BlazorApp1/Components/InventoryComponent.razor.css @@ -10,4 +10,10 @@ gap: 10px; display: grid; width: 286px; +} + +.actions { + border: 1px solid black; + height: 250px; + overflow: scroll; } \ No newline at end of file diff --git a/BlazorApp1/Components/InventoryItem.razor b/BlazorApp1/Components/InventoryItem.razor index c51d5cb..ed9d123 100644 --- a/BlazorApp1/Components/InventoryItem.razor +++ b/BlazorApp1/Components/InventoryItem.razor @@ -10,9 +10,16 @@ @ondragleave="@OnDragLeave"> @if (Item != null) - {
+ {
+ + + + +
}
\ No newline at end of file diff --git a/BlazorApp1/Components/InventoryItem.razor.cs b/BlazorApp1/Components/InventoryItem.razor.cs index 72b2080..b561e1e 100644 --- a/BlazorApp1/Components/InventoryItem.razor.cs +++ b/BlazorApp1/Components/InventoryItem.razor.cs @@ -13,9 +13,6 @@ namespace BlazorApp1.Components [Parameter] public bool NoDrop { get; set; } - - [Parameter] - public int Stack { get; set; } [CascadingParameter] public InventoryComponent Parent { get; set; } @@ -42,6 +39,9 @@ namespace BlazorApp1.Components internal void OnDrop() { + Item CurrentHoldItem = new Item();//A remplir avec les valeurs de CurrentDragItem + //CurrentHoldItem = Parent.CurrentDragItem; + if (NoDrop) { return; @@ -49,16 +49,17 @@ namespace BlazorApp1.Components if (this.Item != null) { - if (this.Item.Name == Parent.CurrentDragItem.Name) + if (this.Item.Name == CurrentHoldItem.Name) { - this.Stack = this.Stack + 1; + CurrentHoldItem.Stack = CurrentHoldItem.Stack + this.Item.Stack; + this.Item = CurrentHoldItem; } else { return; } } else { - this.Item = Parent.CurrentDragItem; + this.Item = CurrentHoldItem; Parent.Actions.Add(new CraftingAction { Action = "Drop", Item = this.Item, Index = this.Index }); } diff --git a/BlazorApp1/Components/InventoryItem.razor.css b/BlazorApp1/Components/InventoryItem.razor.css index 288333f..8a7f9fe 100644 --- a/BlazorApp1/Components/InventoryItem.razor.css +++ b/BlazorApp1/Components/InventoryItem.razor.css @@ -5,6 +5,12 @@ overflow: hidden; } -.oui{ +.image { position: absolute; + z-index: 1; +} + +.compteur { + position: absolute; + z-index: 2; } \ No newline at end of file diff --git a/BlazorApp1/Models/Item.cs b/BlazorApp1/Models/Item.cs index 7a80931..91a165a 100644 --- a/BlazorApp1/Models/Item.cs +++ b/BlazorApp1/Models/Item.cs @@ -2,10 +2,28 @@ { public class Item { + public Item(int id, string displayName, string name, int stackSize, int stack, int maxDurability, List enchantCategories, List repairWith, DateTime createdDate, DateTime? updatedDate, string imageBase64) + { + Id = id; + DisplayName = displayName; + Name = name; + StackSize = stackSize; + Stack = stack; + MaxDurability = maxDurability; + EnchantCategories = enchantCategories; + RepairWith = repairWith; + CreatedDate = createdDate; + UpdatedDate = updatedDate; + ImageBase64 = imageBase64; + } + + public Item() {} + public int Id { get; set; } public string DisplayName { get; set; } public string Name { get; set; } public int StackSize { get; set; } + public int Stack { get; set; } = 1; public int MaxDurability { get; set; } public List EnchantCategories { get; set; } public List RepairWith { get; set; }