WIP : Ajoute l'empilage

master
Lou VALADE 3 years ago
parent 95342a887b
commit 1e2da0c204

@ -27,6 +27,7 @@ namespace BlazorApp1.Components
[Inject]
public IStringLocalizer<Inventory> Localizer { get; set; }
public int Stack { get; internal set; }
/// <summary>
/// Gets or sets the java script runtime.

@ -10,4 +10,10 @@
gap: 10px;
display: grid;
width: 286px;
}
.actions {
border: 1px solid black;
height: 250px;
overflow: scroll;
}

@ -10,9 +10,16 @@
@ondragleave="@OnDragLeave">
@if (Item != null)
{ <div class="Oui">
{ <div class="Oui">
<div class="compteur">
<a>@this.Item.Stack</a>
</div>
<div class="image">
<img src="data:image/png;base64, @(Item.ImageBase64)" class="img-thumbnail" alt="@(Item.DisplayName)" style="min-width: 64px; max-width: 64px"/>
<a>@this.Stack</a>
</div>
</div>
}
</div>

@ -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 });
}

@ -5,6 +5,12 @@
overflow: hidden;
}
.oui{
.image {
position: absolute;
z-index: 1;
}
.compteur {
position: absolute;
z-index: 2;
}

@ -2,10 +2,28 @@
{
public class Item
{
public Item(int id, string displayName, string name, int stackSize, int stack, int maxDurability, List<string> enchantCategories, List<string> 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<string> EnchantCategories { get; set; }
public List<string> RepairWith { get; set; }

Loading…
Cancel
Save