diff --git a/BlazorApp/BlazorApp/BlazorApp.csproj b/BlazorApp/BlazorApp/BlazorApp.csproj index 1bb76d0..c675d0d 100644 --- a/BlazorApp/BlazorApp/BlazorApp.csproj +++ b/BlazorApp/BlazorApp/BlazorApp.csproj @@ -45,4 +45,7 @@ Pages.List.resx + + + diff --git a/BlazorApp/BlazorApp/Components/Crafting.razor.cs b/BlazorApp/BlazorApp/Components/Crafting.razor.cs index f7578fc..a154730 100644 --- a/BlazorApp/BlazorApp/Components/Crafting.razor.cs +++ b/BlazorApp/BlazorApp/Components/Crafting.razor.cs @@ -15,7 +15,7 @@ namespace BlazorApp.Components { Actions = new ObservableCollection(); Actions.CollectionChanged += OnActionsCollectionChanged; - this.RecipeItems = new List { null, null, null, null, null, null, null, null, null }; + this.RecipeItems = new List { null, null, null, null, null, null, null, null, null}; } public ObservableCollection Actions { get; set; } diff --git a/BlazorApp/BlazorApp/Components/InventoryComp.razor b/BlazorApp/BlazorApp/Components/InventoryComp.razor new file mode 100644 index 0000000..e02abfc --- /dev/null +++ b/BlazorApp/BlazorApp/Components/InventoryComp.razor @@ -0,0 +1 @@ + diff --git a/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs b/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/BlazorApp/BlazorApp/Components/InventoryComp.razor.css b/BlazorApp/BlazorApp/Components/InventoryComp.razor.css new file mode 100644 index 0000000..06bc1c9 --- /dev/null +++ b/BlazorApp/BlazorApp/Components/InventoryComp.razor.css @@ -0,0 +1,14 @@ +.css-grid { + grid-template-columns: repeat(6,minmax(0,1fr)); + gap: 10px; + display: grid; + width: 40%; +} + + +.css-recipe { + grid-template-columns: repeat(3,minmax(0,1fr)); + gap: 10px; + display: grid; + width: 212px; +} diff --git a/BlazorApp/BlazorApp/Components/InventoryItem.razor b/BlazorApp/BlazorApp/Components/InventoryItem.razor new file mode 100644 index 0000000..e64e6cd --- /dev/null +++ b/BlazorApp/BlazorApp/Components/InventoryItem.razor @@ -0,0 +1,13 @@ +
+ + @if (Item != null) + { + @Item.DisplayName + } +
\ No newline at end of file diff --git a/BlazorApp/BlazorApp/Components/InventoryItem.razor.cs b/BlazorApp/BlazorApp/Components/InventoryItem.razor.cs new file mode 100644 index 0000000..cef8968 --- /dev/null +++ b/BlazorApp/BlazorApp/Components/InventoryItem.razor.cs @@ -0,0 +1,58 @@ +using System; +using BlazorApp.Models; +using BlazorApp.Components; +using Microsoft.AspNetCore.Components; + +namespace BlazorApp.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 InventoryComp Parent { get; set; } + + internal void OnDragEnter() + { + if (NoDrop) + { + return; + } + + } + + internal void OnDragLeave() + { + if (NoDrop) + { + return; + } + + } + + internal void OnDrop() + { + if (NoDrop) + { + return; + } + + this.Item = Parent.CurrentDragItem; + Item tmp = Parent.RecipeItems[this.Index]; + Parent.RecipeItems[this.Index] = this.Item; + } + + private void OnDragStart() + { + Parent.CurrentDragItem = this.Item; + } + } +} + diff --git a/BlazorApp/BlazorApp/Components/InventoryItem.razor.css b/BlazorApp/BlazorApp/Components/InventoryItem.razor.css new file mode 100644 index 0000000..b2d4521 --- /dev/null +++ b/BlazorApp/BlazorApp/Components/InventoryItem.razor.css @@ -0,0 +1,6 @@ +.item { + width: 64px; + height: 64px; + border: 1px solid; + overflow: hidden; +} diff --git a/BlazorApp/BlazorApp/Components/MyFirstChildComponent.razor b/BlazorApp/BlazorApp/Components/MyFirstChildComponent.razor deleted file mode 100644 index 592c4e4..0000000 --- a/BlazorApp/BlazorApp/Components/MyFirstChildComponent.razor +++ /dev/null @@ -1,14 +0,0 @@ -@code { - [Parameter] - public RenderFragment ChildContent { get; set; } - - [CascadingParameter] - public MyRootComponent RootComponent { get; set; } -} - -
- MyFirstChildComponent - @RootComponent.Text -
- @ChildContent -
-
\ No newline at end of file diff --git a/BlazorApp/BlazorApp/Components/MyRootComponent.razor b/BlazorApp/BlazorApp/Components/MyRootComponent.razor deleted file mode 100644 index 18895ba..0000000 --- a/BlazorApp/BlazorApp/Components/MyRootComponent.razor +++ /dev/null @@ -1,16 +0,0 @@ -@code { - [Parameter] - public RenderFragment ChildContent { get; set; } - - [Parameter] - public string Text { get; set; } -} - -
- MyRootComponent - @Text -
- - @ChildContent - -
-
\ No newline at end of file diff --git a/BlazorApp/BlazorApp/Components/MySecondChildComponent.razor b/BlazorApp/BlazorApp/Components/MySecondChildComponent.razor deleted file mode 100644 index 7d207e6..0000000 --- a/BlazorApp/BlazorApp/Components/MySecondChildComponent.razor +++ /dev/null @@ -1,14 +0,0 @@ -@code { - [Parameter] - public RenderFragment ChildContent { get; set; } - - [CascadingParameter] - public MyRootComponent RootComponent { get; set; } -} - -
- MySecondChildComponent - @RootComponent.Text -
- @ChildContent -
-
\ No newline at end of file diff --git a/BlazorApp/BlazorApp/Components/TestRenderFragment.razor b/BlazorApp/BlazorApp/Components/TestRenderFragment.razor deleted file mode 100644 index e8ca13f..0000000 --- a/BlazorApp/BlazorApp/Components/TestRenderFragment.razor +++ /dev/null @@ -1,7 +0,0 @@ -

TestRenderFragment

- -@code { - [Parameter] - public RenderFragment ChildContent { get; set; } -} - diff --git a/BlazorApp/BlazorApp/Pages/Inventory.razor b/BlazorApp/BlazorApp/Pages/Inventory.razor index 4ead9fd..3f9c38d 100644 --- a/BlazorApp/BlazorApp/Pages/Inventory.razor +++ b/BlazorApp/BlazorApp/Pages/Inventory.razor @@ -3,73 +3,8 @@ @using BlazorApp.Pages; @using BlazorApp.Models; -
-

Inventory

-
- - - - - - - - - - - - - - - - - - - - -
+
+
-
- -
-
-

Available Items

- - -
-
- - - - - - @if (!string.IsNullOrWhiteSpace(context.ImageBase64)) - { - @context.DisplayName - } - else - { - @context.DisplayName - } - - - - -
\ No newline at end of file diff --git a/BlazorApp/BlazorApp/Pages/Inventory.razor.cs b/BlazorApp/BlazorApp/Pages/Inventory.razor.cs index ca82231..ee24093 100644 --- a/BlazorApp/BlazorApp/Pages/Inventory.razor.cs +++ b/BlazorApp/BlazorApp/Pages/Inventory.razor.cs @@ -27,7 +27,6 @@ namespace BlazorApp.Pages } Items = await DataService.List(0, await DataService.Count()); - StateHasChanged(); } @@ -46,7 +45,7 @@ namespace BlazorApp.Pages } } - private async Task SortByName(DataGridReadDataEventArgs e) + private async Task SortByName() { Items = await DataService.SortedList(); } diff --git a/BlazorApp/BlazorApp/Services/DataApiService.cs b/BlazorApp/BlazorApp/Services/DataApiService.cs index 19e473b..c2943a3 100644 --- a/BlazorApp/BlazorApp/Services/DataApiService.cs +++ b/BlazorApp/BlazorApp/Services/DataApiService.cs @@ -69,5 +69,9 @@ namespace BlazorApp.Services } */ + public Task> SortedList() + { + throw new NotImplementedException(); + } } } \ No newline at end of file diff --git a/BlazorApp/BlazorApp/Services/DataLocalService.cs b/BlazorApp/BlazorApp/Services/DataLocalService.cs index f2cbcb7..3b13a80 100644 --- a/BlazorApp/BlazorApp/Services/DataLocalService.cs +++ b/BlazorApp/BlazorApp/Services/DataLocalService.cs @@ -184,6 +184,11 @@ namespace BlazorApp.Services return Task.FromResult(items); } + + public Task> SortedList() + { + throw new NotImplementedException(); + } } }