-
Recipe
+
Table de craft
@@ -34,6 +34,10 @@
{
}
+ @for (int i = 0; i < 64 - Items.Count; i++)
+ {
+
+ }
diff --git a/src/CraftSharp/Components/CraftingItem.razor b/src/CraftSharp/Components/CraftingItem.razor
index 0f3ab24..3dd47ea 100644
--- a/src/CraftSharp/Components/CraftingItem.razor
+++ b/src/CraftSharp/Components/CraftingItem.razor
@@ -7,7 +7,8 @@
@ondragstart="@OnDragStart"
@ondrop="@OnDrop"
@ondragenter="@OnDragEnter"
- @ondragleave="@OnDragLeave">
+ @ondragleave="@OnDragLeave"
+ @ondragend="@OnDragEnd">
@if (Item != null)
{
diff --git a/src/CraftSharp/Components/CraftingItem.razor.cs b/src/CraftSharp/Components/CraftingItem.razor.cs
index 9668a0a..e700471 100644
--- a/src/CraftSharp/Components/CraftingItem.razor.cs
+++ b/src/CraftSharp/Components/CraftingItem.razor.cs
@@ -28,6 +28,18 @@ namespace CraftSharp.Components
Parent.Actions.Add(new CraftingAction { Action = "Drag Enter", Item = this.Item, Index = this.Index });
}
+ internal void OnDragEnd()
+ {
+ if (NoDrop)
+ {
+ return;
+ }
+
+ Parent.RecipeItems[this.Index] = null;
+ Item = null;
+ Parent.CheckRecipe();
+ }
+
internal void OnDragLeave()
{
if (NoDrop)
diff --git a/src/CraftSharp/Models/CurrentUser.cs b/src/CraftSharp/Models/CurrentUser.cs
index 94c2718..13d2f82 100644
--- a/src/CraftSharp/Models/CurrentUser.cs
+++ b/src/CraftSharp/Models/CurrentUser.cs
@@ -9,5 +9,15 @@
public List
- Inventory { get; set; } = new List
- ();
public List Roles { get; set; } = new List() { UserRoles.User };
+ public void addItem(Item item)
+ {
+ Inventory.Add(item);
+ }
+
+ public int getSizeInventory()
+ {
+ return Inventory.Count;
+ }
+
}
}
diff --git a/src/CraftSharp/Models/ItemModel.cs b/src/CraftSharp/Models/ItemModel.cs
index 88f7b6a..5cbbe66 100644
--- a/src/CraftSharp/Models/ItemModel.cs
+++ b/src/CraftSharp/Models/ItemModel.cs
@@ -20,7 +20,7 @@ namespace CraftSharp.Models
public int StackSize { get; set; }
[Required]
- [Range(1, 125)]
+ [Range(0, 125)]
public int MaxDurability { get; set; }
public List EnchantCategories { get; set; }
diff --git a/src/CraftSharp/Pages/Opening.razor.cs b/src/CraftSharp/Pages/Opening.razor.cs
index a9c132b..a7ca7cd 100644
--- a/src/CraftSharp/Pages/Opening.razor.cs
+++ b/src/CraftSharp/Pages/Opening.razor.cs
@@ -20,13 +20,12 @@ namespace CraftSharp.Pages
bool isChestClosed = true;
int itemOpacity = 0;
-
[Inject]
public IDataService DataService { get; set; }
-
[Inject]
public CustomStateProvider AuthService { get; set; }
-
+ [Inject]
+ public CustomStateProvider AuthStateProvider { get; set; }
[CascadingParameter]
public Task Context { get; set; }
@@ -61,6 +60,14 @@ namespace CraftSharp.Pages
{
NumberOfKeys=NumberOfKeys-CostInKeys;
randomItem = ItemFactory.GetRandomItem(items);
+ if (AuthStateProvider.GetCurrentUser().getSizeInventory() <= 64)
+ {
+ //Vérifie quel n'existe pas déjà dans la liste
+ if (!AuthStateProvider.GetCurrentUser().Inventory.Any(n => n.Id == randomItem.Id))
+ {
+ AuthStateProvider.GetCurrentUser().addItem(randomItem);
+ }
+ }
Console.WriteLine(randomItem.Name);
openingAnimation();
}
diff --git a/src/CraftSharp/Pages/TableDeCraft.razor.cs b/src/CraftSharp/Pages/TableDeCraft.razor.cs
index c12dc0a..35b0747 100644
--- a/src/CraftSharp/Pages/TableDeCraft.razor.cs
+++ b/src/CraftSharp/Pages/TableDeCraft.razor.cs
@@ -9,9 +9,9 @@ namespace CraftSharp.Pages
{
[Inject]
public IDataService DataService { get; set; }
-
public List
- Items { get; set; } = new List
- ();
-
+ [Inject]
+ public CustomStateProvider AuthStateProvider { get; set; }
private List Recipes { get; set; } = new List();
protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -23,7 +23,8 @@ namespace CraftSharp.Pages
return;
}
- Items = await DataService.List(0, await DataService.Count());
+ //Items = await DataService.List(0, await DataService.Count());
+ Items = AuthStateProvider.GetCurrentUser().Inventory;
Recipes = await DataService.GetRecipes();
StateHasChanged();
diff --git a/src/CraftSharp/Shared/MainLayout.razor b/src/CraftSharp/Shared/MainLayout.razor
deleted file mode 100644
index c6f8f5a..0000000
--- a/src/CraftSharp/Shared/MainLayout.razor
+++ /dev/null
@@ -1,26 +0,0 @@
-@inherits LayoutComponentBase
-
-CraftSharp
-
-
-
diff --git a/src/CraftSharp/Shared/MainLayout.razor.css b/src/CraftSharp/Shared/MainLayout.razor.css
deleted file mode 100644
index 81763ac..0000000
--- a/src/CraftSharp/Shared/MainLayout.razor.css
+++ /dev/null
@@ -1,73 +0,0 @@
-.page {
- display: flex;
-}
-
-main {
- flex: 1;
-}
-
-.wrap {
- display: flex;
- flex-direction: column;
-}
-
-.sidebar {
- background-image: linear-gradient(180deg, rgb(120,51,174) 0%, #411186 90%);
-}
-
-.top-row {
- background-color: #f7f7f7;
- border-bottom: 1px solid #d6d5d5;
- justify-content: flex-end;
- height: 3.5rem;
- display: flex;
- align-items: center;
-}
-
- .top-row ::deep a, .top-row .btn-link {
- white-space: nowrap;
- margin-left: 1.5rem;
- }
-
- .top-row a:first-child {
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
-@media (max-width: 640.98px) {
- .top-row:not(.auth) {
- display: none;
- }
-
- .top-row.auth {
- justify-content: space-between;
- }
-
- .top-row a, .top-row .btn-link {
- margin-left: 0;
- }
-}
-
-@media (min-width: 641px) {
- .page {
- flex-direction: row;
- }
-
- .sidebar {
- width: 100%;
-
- position: sticky;
- top: 0;
- }
-
- .top-row {
- position: sticky;
- top: 0;
- z-index: 1;
- }
-
- .top-row, article {
- padding-left: 2rem !important;
- padding-right: 1.5rem !important;
- }
-}
diff --git a/src/CraftSharp/Shared/NavMenu.razor b/src/CraftSharp/Shared/NavMenu.razor
deleted file mode 100644
index 7089893..0000000
--- a/src/CraftSharp/Shared/NavMenu.razor
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-@code {
- private bool collapseNavMenu = true;
-
- private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
-
- private void ToggleNavMenu()
- {
- collapseNavMenu = !collapseNavMenu;
- }
-}
diff --git a/src/CraftSharp/Shared/NavMenu.razor.css b/src/CraftSharp/Shared/NavMenu.razor.css
deleted file mode 100644
index a388b8e..0000000
--- a/src/CraftSharp/Shared/NavMenu.razor.css
+++ /dev/null
@@ -1,85 +0,0 @@
-.navbar-toggler {
- background-color: rgba(255, 255, 255, 0.1);
-}
-
-.top-row {
- height: 3.5rem;
- background-color: rgba(0,0,0,0.4);
-}
-
-.navbar-brand {
- font-size: 1.1rem;
-}
-
-.oi {
- width: 3rem;
- font-size: 1.7rem;
- top: -2px;
-
-}
-
-.nav-image {
- width: 20rem;
- color: #ffffff;
-}
-
-.button {
- height: 6rem;
- width: 13rem;
- text-decoration: none;
- text-align: center;
- color: white;
- cursor: pointer;
- background: url('Images/btn1.png') no-repeat;
- font-family: SilkscreenNormal;
- line-height: 26px;
- padding-top: 6px;
-}
-
-.button:hover {
- background: url('Images/btn2.png') no-repeat;
-}
-
-.nav-item {
- font-size: 0.9rem;
- padding-bottom: 0.5rem;
- font-family: SuperDario;
-}
-
- .nav-item:first-of-type {
- padding-top: 1rem;
- }
-
- .nav-item:last-of-type {
- padding-bottom: 1rem;
- }
-
- .nav-item ::deep a {
- color: #d7d7d7;
- border-radius: 4px;
- height: 3rem;
- display: flex;
- align-items: center;
- line-height: 3rem;
- }
-
-.nav-item ::deep a.active {
- background-color: rgba(255,255,255,0.25);
- color: white;
-}
-
-.nav-item ::deep a:hover {
- background-color: rgba(255,255,255,0.1);
- color: white;
-}
-
-@media (min-width: 641px) {
- .navbar-toggler {
- display: none;
- }
-
- .collapse {
- /* Never collapse the sidebar for wide screens */
- display: block;
- }
-}
diff --git a/src/CraftSharp/wwwroot/css/site.css b/src/CraftSharp/wwwroot/css/site.css
index 1f4b8cf..cbffd44 100644
--- a/src/CraftSharp/wwwroot/css/site.css
+++ b/src/CraftSharp/wwwroot/css/site.css
@@ -18,6 +18,10 @@ a, .btn-link {
border-color: #1861ac;
}
+.table {
+ color: #ffffff;
+}
+
.content {
padding-top: 1.1rem;
}