diff --git a/Blazor/Blazor/Components/CraftingItem.razor.css b/Blazor/Blazor/Components/CraftingItem.razor.css index 3db9040..5f28270 100644 --- a/Blazor/Blazor/Components/CraftingItem.razor.css +++ b/Blazor/Blazor/Components/CraftingItem.razor.css @@ -1,17 +1 @@ -.item { - position: absolute; - text-align: center; - width: 50px; - height: 50px; - color: white; -} - -.number-item{ - position: absolute; - bottom: 5px; - right: 5px; - font-size: 3em; - font-weight: bold; - -webkit-text-stroke: 2px black; - font-family: 'Segoe UI', Tahoma, Verdana, Geneva, Tahoma, sans-serif -} \ No newline at end of file + \ No newline at end of file diff --git a/Blazor/Blazor/Components/Inventory.razor.cs b/Blazor/Blazor/Components/Inventory.razor.cs index 88e2f9e..efd1a4c 100644 --- a/Blazor/Blazor/Components/Inventory.razor.cs +++ b/Blazor/Blazor/Components/Inventory.razor.cs @@ -31,8 +31,8 @@ namespace Blazor.Components } public async void update() { - await LocalStorage.SetItemAsync("list", inventory); this.StateHasChanged(); + await LocalStorage.SetItemAsync("list", inventory.inventoryItems); return; } @@ -43,24 +43,7 @@ namespace Blazor.Components } - protected override async Task OnAfterRenderAsync(bool firstRender) - { - // Do not treat this action if is not the first render - if (!firstRender) - { - return; - } - - var currentData = await LocalStorage.GetItemAsync("data"); - - // Check if data exist in the local storage - if (currentData == null) - { - // this code add in the local storage the fake data (we load the data sync for initialize the data before load the OnReadData method) - await LocalStorage.SetItemAsync("list", inventory); - } - } - + /* private async Task OnReadData(DataGridReadDataEventArgs e) { if (e.CancellationToken.IsCancellationRequested) @@ -68,13 +51,13 @@ namespace Blazor.Components return; } - var response = (await LocalStorage.GetItemAsync("list")); + var response = (await LocalStorage.GetItemAsync>("list")); if (!e.CancellationToken.IsCancellationRequested) { - inventory = response; + inventory.inventoryItems = response; } - } + }*/ } } diff --git a/Blazor/Blazor/Components/Inventory.razor.css b/Blazor/Blazor/Components/Inventory.razor.css index c496f69..7bd0dcc 100644 --- a/Blazor/Blazor/Components/Inventory.razor.css +++ b/Blazor/Blazor/Components/Inventory.razor.css @@ -23,4 +23,4 @@ border: 1px solid black; height: 250px; overflow: scroll; -} \ No newline at end of file +} diff --git a/Blazor/Blazor/Components/ItemInventory.razor b/Blazor/Blazor/Components/ItemInventory.razor index dda1f9d..76de4c1 100644 --- a/Blazor/Blazor/Components/ItemInventory.razor +++ b/Blazor/Blazor/Components/ItemInventory.razor @@ -8,14 +8,14 @@ { @if(!string.IsNullOrWhiteSpace(Items.item.ImageBase64)) { -
+
@Items.item.DisplayName @Items.Stack
} else { -
+
@Items.item.DisplayName @Items.Stack
@@ -23,7 +23,7 @@ } else { -
+
empty slot
} diff --git a/Blazor/Blazor/Components/ItemInventory.razor.cs b/Blazor/Blazor/Components/ItemInventory.razor.cs index b408b8c..fce08e7 100644 --- a/Blazor/Blazor/Components/ItemInventory.razor.cs +++ b/Blazor/Blazor/Components/ItemInventory.razor.cs @@ -41,8 +41,8 @@ namespace Blazor.Components this.Items = Parent.CurrentDragItem; this.NoDrop = true; Parent.CurrentDragItem = null; - if (this.Items == null) return; Parent.inventory.inventoryItems[this.Index] = this.Items; + if (this.Items == null) return; Parent.Actions.Add(new InventoryAction("On Drop",this.Index,Items.item)); return; } diff --git a/Blazor/Blazor/Components/ItemInventory.razor.css b/Blazor/Blazor/Components/ItemInventory.razor.css new file mode 100644 index 0000000..aa9119e --- /dev/null +++ b/Blazor/Blazor/Components/ItemInventory.razor.css @@ -0,0 +1,17 @@ +.itemDisplay { + position: relative; + text-align: center; + width: 50px; + height: 50px; + color: black; +} + +.number-item { + position: absolute; + bottom: 5px; + right: 5px; + font-size: 1em; + font-weight: bold; + -webkit-text-stroke: 2px black; + font-family: 'Segoe UI', Tahoma, Verdana, Geneva, Tahoma, sans-serif +} \ No newline at end of file