|
|
|
@ -35,7 +35,8 @@ namespace Blazor.Components
|
|
|
|
|
Parent.Actions.Add(new InventoryAction("On drag start",this.Index,Items.item));
|
|
|
|
|
this.Items = null;
|
|
|
|
|
Parent.inventory.inventoryItems[this.Index] = null ;
|
|
|
|
|
await LocalStorage.SetItemAsync<Models.InventoryItem>("data" + this.Index, this.Items);
|
|
|
|
|
await LocalStorage.RemoveItemAsync("data" + this.Index);
|
|
|
|
|
await LocalStorage.RemoveItemAsync("stack" + this.Index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -51,7 +52,8 @@ namespace Blazor.Components
|
|
|
|
|
{
|
|
|
|
|
this.Items = Parent.CurrentDragItem;
|
|
|
|
|
Parent.CurrentDragItem = null;
|
|
|
|
|
await LocalStorage.SetItemAsync<Models.InventoryItem>("data" + this.Index, this.Items);
|
|
|
|
|
await LocalStorage.SetItemAsync<Item>("data" + this.Index, this.Items.item);
|
|
|
|
|
await LocalStorage.SetItemAsync<int>("stack" + this.Index, this.Items.Stack);
|
|
|
|
|
Parent.Actions.Add(new InventoryAction("On drag drop",this.Index,Items.item));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -60,7 +62,8 @@ namespace Blazor.Components
|
|
|
|
|
{
|
|
|
|
|
this.Items = Parent.CurrentDragItem;
|
|
|
|
|
Parent.CurrentDragItem = null;
|
|
|
|
|
await LocalStorage.SetItemAsync<Models.InventoryItem>("data" + this.Index, this.Items);
|
|
|
|
|
await LocalStorage.SetItemAsync<Item>("data" + this.Index, this.Items.item);
|
|
|
|
|
await LocalStorage.SetItemAsync<int>("stack" + this.Index, this.Items.Stack);
|
|
|
|
|
Parent.Actions.Add(new InventoryAction("On drag drop",this.Index,Items.item));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -71,7 +74,9 @@ namespace Blazor.Components
|
|
|
|
|
{
|
|
|
|
|
this.Items.Stack = this.Items.item.StackSize;
|
|
|
|
|
Parent.CurrentDragItem = null;
|
|
|
|
|
await LocalStorage.SetItemAsync<Models.InventoryItem>("data" + this.Index, this.Items);
|
|
|
|
|
|
|
|
|
|
await LocalStorage.SetItemAsync<Item>("data" + this.Index, this.Items.item);
|
|
|
|
|
await LocalStorage.SetItemAsync<int>("stack" + this.Index, this.Items.Stack);
|
|
|
|
|
Parent.Actions.Add(new InventoryAction("On drag drop",this.Index,Items.item));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -79,7 +84,9 @@ namespace Blazor.Components
|
|
|
|
|
{
|
|
|
|
|
this.Items.Stack = total;
|
|
|
|
|
Parent.CurrentDragItem = null;
|
|
|
|
|
await LocalStorage.SetItemAsync<Models.InventoryItem>("data" + this.Index, this.Items);
|
|
|
|
|
await LocalStorage.SetItemAsync<Item>("data" + this.Index, this.Items.item);
|
|
|
|
|
await LocalStorage.SetItemAsync<int>("stack" + this.Index, this.Items.Stack);
|
|
|
|
|
Parent.Actions.Add(new InventoryAction("On drag drop",this.Index,Items.item));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -105,9 +112,19 @@ namespace Blazor.Components
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Items = await LocalStorage.GetItemAsync<InventoryItem>("item" + this.Index);
|
|
|
|
|
var item = await LocalStorage.GetItemAsync<Item>("data" + this.Index);
|
|
|
|
|
int stack = await LocalStorage.GetItemAsync<int>("stack" + this.Index);
|
|
|
|
|
|
|
|
|
|
if (item != null)
|
|
|
|
|
{
|
|
|
|
|
this.Items = new Models.InventoryItem(item, stack);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.Items = null;
|
|
|
|
|
}
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|