diff --git a/.vs/Blazor/v17/.suo b/.vs/Blazor/v17/.suo index f7b5653..11c58aa 100644 Binary files a/.vs/Blazor/v17/.suo and b/.vs/Blazor/v17/.suo differ diff --git a/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2 b/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2 index f87d52a..81d449a 100644 Binary files a/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2 and b/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/BlazorApp1/FileContentIndex/21d83365-6d08-4b53-bd71-4b4cc52292c6.vsidx b/.vs/BlazorApp1/FileContentIndex/21d83365-6d08-4b53-bd71-4b4cc52292c6.vsidx deleted file mode 100644 index 1f275c2..0000000 Binary files a/.vs/BlazorApp1/FileContentIndex/21d83365-6d08-4b53-bd71-4b4cc52292c6.vsidx and /dev/null differ diff --git a/.vs/BlazorApp1/FileContentIndex/38f223ae-c93a-4bad-af33-7774f70152c4.vsidx b/.vs/BlazorApp1/FileContentIndex/38f223ae-c93a-4bad-af33-7774f70152c4.vsidx deleted file mode 100644 index 53afac5..0000000 Binary files a/.vs/BlazorApp1/FileContentIndex/38f223ae-c93a-4bad-af33-7774f70152c4.vsidx and /dev/null differ diff --git a/.vs/BlazorApp1/FileContentIndex/53df30a0-58f9-4de4-ae74-8d6570fae41d.vsidx b/.vs/BlazorApp1/FileContentIndex/61d3f8c6-2fa9-4825-a90d-2bed82938e24.vsidx similarity index 91% rename from .vs/BlazorApp1/FileContentIndex/53df30a0-58f9-4de4-ae74-8d6570fae41d.vsidx rename to .vs/BlazorApp1/FileContentIndex/61d3f8c6-2fa9-4825-a90d-2bed82938e24.vsidx index ccef0af..5175f8a 100644 Binary files a/.vs/BlazorApp1/FileContentIndex/53df30a0-58f9-4de4-ae74-8d6570fae41d.vsidx and b/.vs/BlazorApp1/FileContentIndex/61d3f8c6-2fa9-4825-a90d-2bed82938e24.vsidx differ diff --git a/.vs/BlazorApp1/FileContentIndex/cfa8604e-f00a-45c7-8d31-3a67c6e4ecce.vsidx b/.vs/BlazorApp1/FileContentIndex/8c81259e-e2f1-46b9-b84c-cccb090fa3c1.vsidx similarity index 67% rename from .vs/BlazorApp1/FileContentIndex/cfa8604e-f00a-45c7-8d31-3a67c6e4ecce.vsidx rename to .vs/BlazorApp1/FileContentIndex/8c81259e-e2f1-46b9-b84c-cccb090fa3c1.vsidx index 55388c8..8af1d31 100644 Binary files a/.vs/BlazorApp1/FileContentIndex/cfa8604e-f00a-45c7-8d31-3a67c6e4ecce.vsidx and b/.vs/BlazorApp1/FileContentIndex/8c81259e-e2f1-46b9-b84c-cccb090fa3c1.vsidx differ diff --git a/.vs/BlazorApp1/FileContentIndex/9b6dd749-2b09-4714-b1d4-7bb5d74fc6e4.vsidx b/.vs/BlazorApp1/FileContentIndex/9b6dd749-2b09-4714-b1d4-7bb5d74fc6e4.vsidx new file mode 100644 index 0000000..bed85c6 Binary files /dev/null and b/.vs/BlazorApp1/FileContentIndex/9b6dd749-2b09-4714-b1d4-7bb5d74fc6e4.vsidx differ diff --git a/.vs/BlazorApp1/FileContentIndex/ebaf232f-3321-44a4-b7d8-7cd1f75a359e.vsidx b/.vs/BlazorApp1/FileContentIndex/ebaf232f-3321-44a4-b7d8-7cd1f75a359e.vsidx new file mode 100644 index 0000000..fbe147b Binary files /dev/null and b/.vs/BlazorApp1/FileContentIndex/ebaf232f-3321-44a4-b7d8-7cd1f75a359e.vsidx differ diff --git a/.vs/BlazorApp1/v17/.futdcache.v1 b/.vs/BlazorApp1/v17/.futdcache.v1 index 4a2a0c3..ffdd9e5 100644 Binary files a/.vs/BlazorApp1/v17/.futdcache.v1 and b/.vs/BlazorApp1/v17/.futdcache.v1 differ diff --git a/.vs/BlazorApp1/v17/.suo b/.vs/BlazorApp1/v17/.suo index 5ccca64..dc62618 100644 Binary files a/.vs/BlazorApp1/v17/.suo and b/.vs/BlazorApp1/v17/.suo differ diff --git a/.vs/BlazorApp1/v17/fileList.bin b/.vs/BlazorApp1/v17/fileList.bin index 74e633f..b165871 100644 Binary files a/.vs/BlazorApp1/v17/fileList.bin and b/.vs/BlazorApp1/v17/fileList.bin differ diff --git a/.vs/ProjectEvaluation/blazorapp1.metadata.v2 b/.vs/ProjectEvaluation/blazorapp1.metadata.v2 index f55bf34..1e75903 100644 Binary files a/.vs/ProjectEvaluation/blazorapp1.metadata.v2 and b/.vs/ProjectEvaluation/blazorapp1.metadata.v2 differ diff --git a/.vs/ProjectEvaluation/blazorapp1.projects.v2 b/.vs/ProjectEvaluation/blazorapp1.projects.v2 index 183eaac..b33580f 100644 Binary files a/.vs/ProjectEvaluation/blazorapp1.projects.v2 and b/.vs/ProjectEvaluation/blazorapp1.projects.v2 differ diff --git a/BlazorApp1/BlazorApp1.csproj b/BlazorApp1/BlazorApp1.csproj index c2c1ebb..51fe2da 100644 --- a/BlazorApp1/BlazorApp1.csproj +++ b/BlazorApp1/BlazorApp1.csproj @@ -8,6 +8,14 @@ Linux + + + + + + + + diff --git a/BlazorApp1/Components/CraftingItem.razor b/BlazorApp1/Components/CraftingItem.razor index 110bb21..dc49075 100644 --- a/BlazorApp1/Components/CraftingItem.razor +++ b/BlazorApp1/Components/CraftingItem.razor @@ -9,7 +9,7 @@ @if (Item != null) { - @Item.DisplayName - //@Item.DisplayName + //@Item.DisplayName + @Item.DisplayName } \ No newline at end of file diff --git a/BlazorApp1/Components/Inventory.razor b/BlazorApp1/Components/Inventory.razor index 37738de..a4a9eea 100644 --- a/BlazorApp1/Components/Inventory.razor +++ b/BlazorApp1/Components/Inventory.razor @@ -6,9 +6,9 @@
- @foreach (var item in Items) + @foreach (var item in items) { - + }
diff --git a/BlazorApp1/Components/Inventory.razor.cs b/BlazorApp1/Components/Inventory.razor.cs index 9f00c4a..b65cf77 100644 --- a/BlazorApp1/Components/Inventory.razor.cs +++ b/BlazorApp1/Components/Inventory.razor.cs @@ -1,10 +1,17 @@ -using Microsoft.AspNetCore.Components; +using Blazorise.DataGrid; +using Microsoft.AspNetCore.Components; +using BlazorApp1.Sevices; + namespace BlazorApp1.Components { public partial class Inventory { [Parameter] - public List Items { get; set; } + public List items { get; set; } + + [Parameter] + public int totalItem { get; set; } + } } diff --git a/BlazorApp1/Components/InventoryItem.razor b/BlazorApp1/Components/InventoryItem.razor new file mode 100644 index 0000000..dc49075 --- /dev/null +++ b/BlazorApp1/Components/InventoryItem.razor @@ -0,0 +1,15 @@ +
+ + @if (Item != null) + { + //@Item.DisplayName + @Item.DisplayName + } +
\ No newline at end of file diff --git a/BlazorApp1/Components/InventoryItem.razor.cs b/BlazorApp1/Components/InventoryItem.razor.cs new file mode 100644 index 0000000..9116c0d --- /dev/null +++ b/BlazorApp1/Components/InventoryItem.razor.cs @@ -0,0 +1,62 @@ +using Microsoft.AspNetCore.Components; + +namespace BlazorApp1.Components +{ + public partial class InventoryItem + { + [Parameter] + public int Index { get; set; } + + [Parameter] + public Item Item { get; set; } + + [Parameter] + public bool NoDrop { get; set; } + + [CascadingParameter] + public Crafting Parent { get; set; } + + internal void OnDragEnter() + { + if (NoDrop) + { + return; + } + + Parent.Actions.Add(new CraftingAction { Action = "Drag Enter", Item = this.Item, Index = this.Index }); + } + + internal void OnDragLeave() + { + if (NoDrop) + { + return; + } + + Parent.Actions.Add(new CraftingAction { Action = "Drag Leave", Item = this.Item, Index = this.Index }); + } + + internal void OnDrop() + { + if (NoDrop) + { + return; + } + + this.Item = Parent.CurrentDragItem; + Parent.RecipeItems[this.Index] = this.Item; + + Parent.Actions.Add(new CraftingAction { Action = "Drop", Item = this.Item, Index = this.Index }); + + // Check recipe + Parent.CheckRecipe(); + } + + private void OnDragStart() + { + Parent.CurrentDragItem = this.Item; + + Parent.Actions.Add(new CraftingAction { Action = "Drag Start", Item = this.Item, Index = this.Index }); + } + } +} diff --git a/BlazorApp1/Components/InventoryItem.razor.css b/BlazorApp1/Components/InventoryItem.razor.css new file mode 100644 index 0000000..d6f5ec3 --- /dev/null +++ b/BlazorApp1/Components/InventoryItem.razor.css @@ -0,0 +1,6 @@ +.item { + width: 64px; + height: 64px; + border: 1px solid; + overflow: hidden; +} diff --git a/BlazorApp1/Pages/List.razor.cs b/BlazorApp1/Pages/List.razor.cs index 3b27a7a..f7c9b32 100644 --- a/BlazorApp1/Pages/List.razor.cs +++ b/BlazorApp1/Pages/List.razor.cs @@ -14,7 +14,7 @@ namespace BlazorApp1.Pages [Inject] public IStringLocalizer Localizer { get; set; } - private List items; + private List items { get; set; } private int totalItem; diff --git a/BlazorApp1/Pages/PageInventaire.razor b/BlazorApp1/Pages/PageInventaire.razor index 900a6f4..ff81678 100644 --- a/BlazorApp1/Pages/PageInventaire.razor +++ b/BlazorApp1/Pages/PageInventaire.razor @@ -1,5 +1,8 @@ @page "/inventaire" -
- -
+

Inventaire

+ +@OnReadData; +
+ +
\ No newline at end of file diff --git a/BlazorApp1/Pages/PageInventaire.razor.cs b/BlazorApp1/Pages/PageInventaire.razor.cs index 05efe88..c4980a2 100644 --- a/BlazorApp1/Pages/PageInventaire.razor.cs +++ b/BlazorApp1/Pages/PageInventaire.razor.cs @@ -1,6 +1,7 @@ using BlazorApp1.Components; using BlazorApp1.Models; using BlazorApp1.Sevices; +using Blazorise.DataGrid; using Microsoft.AspNetCore.Components; namespace BlazorApp1.Pages @@ -10,5 +11,25 @@ namespace BlazorApp1.Pages [Parameter] public List Items { get; set; } + [Parameter] + public int totalItems { get; set; } + + [Inject] + public IDataService DataService { get; set; } + + private async Task OnReadData(DataGridReadDataEventArgs e) + { + if (e.CancellationToken.IsCancellationRequested) + { + return; + } + + if (!e.CancellationToken.IsCancellationRequested) + { + Items = await DataService.List(e.Page, e.PageSize); + totalItems = await DataService.Count(); + } + } } + } diff --git a/BlazorApp1/Sevices/DataApiService.cs b/BlazorApp1/Services/DataApiService.cs similarity index 100% rename from BlazorApp1/Sevices/DataApiService.cs rename to BlazorApp1/Services/DataApiService.cs diff --git a/BlazorApp1/Sevices/DataLocalService.cs b/BlazorApp1/Services/DataLocalService.cs similarity index 100% rename from BlazorApp1/Sevices/DataLocalService.cs rename to BlazorApp1/Services/DataLocalService.cs diff --git a/BlazorApp1/Sevices/IDataService.cs b/BlazorApp1/Services/IDataService.cs similarity index 100% rename from BlazorApp1/Sevices/IDataService.cs rename to BlazorApp1/Services/IDataService.cs diff --git a/BlazorApp1/Shared/NavMenu.razor b/BlazorApp1/Shared/NavMenu.razor index ff8c6b4..5c522db 100644 --- a/BlazorApp1/Shared/NavMenu.razor +++ b/BlazorApp1/Shared/NavMenu.razor @@ -19,6 +19,11 @@ edit +