|
|
@ -24,6 +24,9 @@ public partial class InventoryItem
|
|
|
|
[Parameter]
|
|
|
|
[Parameter]
|
|
|
|
public bool NoDrop { get; set; }
|
|
|
|
public bool NoDrop { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
|
|
|
public string Image { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
public IStringLocalizer<InventoryItem> Localizer { get; set; }
|
|
|
|
public IStringLocalizer<InventoryItem> Localizer { get; set; }
|
|
|
|
|
|
|
|
|
|
|
@ -50,19 +53,22 @@ public partial class InventoryItem
|
|
|
|
|
|
|
|
|
|
|
|
internal void OnDrop()
|
|
|
|
internal void OnDrop()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (NoDrop)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Parent.CurrentDragItem != "null")
|
|
|
|
if (Parent.CurrentDragItem != "null")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(this.Item == Parent.CurrentDragItem)
|
|
|
|
if(Parent.CurrentDragIndex == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.Number = this.Number + Parent.CurrentDragNumber;
|
|
|
|
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
|
|
|
|
|
|
this.StackSize = Parent.CurrentDragStackSize;
|
|
|
|
|
|
|
|
Parent.ItemsInventory[this.Index - 1] = new InventoryListItem(this.Item, this.Index, this.Number, this.StackSize);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (this.Item == Parent.CurrentDragItem)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.Number = this.Number + Parent.CurrentDragNumber;
|
|
|
|
this.Number = this.Number + Parent.CurrentDragNumber;
|
|
|
|
Parent.CurrentInventoryItem.Number = 0;
|
|
|
|
Parent.CurrentInventoryItem.Number = 0;
|
|
|
|
Parent.CurrentInventoryItem.Item = "null";
|
|
|
|
Parent.CurrentInventoryItem.Item = "null";
|
|
|
|
Parent.CurrentInventoryItem.StackSize = 0;
|
|
|
|
Parent.CurrentInventoryItem.StackSize = 0;
|
|
|
|
Parent.ItemsInventory[Parent.CurrentInventoryItem.Index-1] = new InventoryListItem(Parent.CurrentInventoryItem.Item, Parent.CurrentInventoryItem.Index, Parent.CurrentInventoryItem.Number, Parent.CurrentInventoryItem.StackSize);
|
|
|
|
Parent.ItemsInventory[Parent.CurrentInventoryItem.Index - 1] = new InventoryListItem(Parent.CurrentInventoryItem.Item, Parent.CurrentInventoryItem.Index, Parent.CurrentInventoryItem.Number, Parent.CurrentInventoryItem.StackSize);
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "End", ItemName = Parent.CurrentInventoryItem.Item, Index = Parent.CurrentInventoryItem.Index, Number = Parent.CurrentInventoryItem.Number, StackSize = Parent.CurrentInventoryItem.StackSize });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "End", ItemName = Parent.CurrentInventoryItem.Item, Index = Parent.CurrentInventoryItem.Index, Number = Parent.CurrentInventoryItem.Number, StackSize = Parent.CurrentInventoryItem.StackSize });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -70,7 +76,7 @@ public partial class InventoryItem
|
|
|
|
string tmpItem = this.Item;
|
|
|
|
string tmpItem = this.Item;
|
|
|
|
int tmpNumber = this.Number;
|
|
|
|
int tmpNumber = this.Number;
|
|
|
|
int tmpStackSize = this.StackSize;
|
|
|
|
int tmpStackSize = this.StackSize;
|
|
|
|
Parent.ItemsInventory[Parent.CurrentDragIndex-1] = new InventoryListItem(tmpItem, Parent.CurrentDragIndex, tmpNumber, tmpStackSize);
|
|
|
|
Parent.ItemsInventory[Parent.CurrentDragIndex - 1] = new InventoryListItem(tmpItem, Parent.CurrentDragIndex, tmpNumber, tmpStackSize);
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
|
|
this.Number = Parent.CurrentDragNumber;
|
|
|
|
this.Number = Parent.CurrentDragNumber;
|
|
|
|
this.StackSize = Parent.CurrentDragStackSize;
|
|
|
|
this.StackSize = Parent.CurrentDragStackSize;
|
|
|
@ -78,9 +84,10 @@ public partial class InventoryItem
|
|
|
|
Parent.CurrentInventoryItem.Number = tmpNumber;
|
|
|
|
Parent.CurrentInventoryItem.Number = tmpNumber;
|
|
|
|
Parent.CurrentInventoryItem.StackSize = tmpStackSize;
|
|
|
|
Parent.CurrentInventoryItem.StackSize = tmpStackSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drop", ItemName = this.Item, Index = this.Index, Number = this.Number, StackSize = this.StackSize });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drop", ItemName = this.Item, Index = this.Index, Number = this.Number, StackSize = this.StackSize });
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void OnDragEnd()
|
|
|
|
internal void OnDragEnd()
|
|
|
|