|
|
@ -7,7 +7,9 @@ using myBlazorApp.Models;
|
|
|
|
public partial class InventoryItem
|
|
|
|
public partial class InventoryItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[Parameter]
|
|
|
|
[Parameter]
|
|
|
|
public Item Item { get; set; }
|
|
|
|
public Item? Item { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string state { get; set; } = null;
|
|
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
[Parameter]
|
|
|
|
public int Index { get; set; }
|
|
|
|
public int Index { get; set; }
|
|
|
@ -25,6 +27,21 @@ public partial class InventoryItem
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Enter", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Enter", Item = this.Item, Index = this.Index });
|
|
|
|
|
|
|
|
state = "enter";
|
|
|
|
|
|
|
|
if (this.Item != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
|
|
|
|
if (state == "enter")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Item item = Parent.CurrentDragItem;
|
|
|
|
|
|
|
|
Parent.CurrentDragItem = this.Item;
|
|
|
|
|
|
|
|
this.Item = item;
|
|
|
|
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drop", Item = item, Index = this.Index });
|
|
|
|
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Start", Item = Parent.CurrentDragItem, Index = this.Index });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void OnDragLeave()
|
|
|
|
internal void OnDragLeave()
|
|
|
@ -34,6 +51,7 @@ public partial class InventoryItem
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Leave", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Leave", Item = this.Item, Index = this.Index });
|
|
|
|
|
|
|
|
state = "left";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void OnDrop()
|
|
|
|
internal void OnDrop()
|
|
|
@ -42,15 +60,20 @@ public partial class InventoryItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.Item == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
|
|
|
|
|
|
}
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drop", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drop", Item = this.Item, Index = this.Index });
|
|
|
|
|
|
|
|
state = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnDragStart()
|
|
|
|
private void OnDragStart()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Parent.CurrentDragItem = this.Item;
|
|
|
|
Parent.CurrentDragItem = this.Item;
|
|
|
|
|
|
|
|
this.Item = null;
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Start", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Start", Item = this.Item, Index = this.Index });
|
|
|
|
|
|
|
|
state = "start";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|