Merge branch 'master' of https://codefirst.iut.uca.fr/git/theo.renaud/Projet_blazor
continuous-integration/drone/push Build is failing Details

master
Théo RENAUD 2 years ago
commit 95342a887b

@ -1,11 +1,9 @@
<h3>Inventory</h3> <CascadingValue Value="@this">
<CascadingValue Value="@this">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<div>Recipe</div> <div>@Localizer["InventoryTitle"]</div>
<div class="css-inventory"> <div class="css-inventory">
<InventoryItem Index="0"/> <InventoryItem Index="0"/>
@ -50,7 +48,7 @@
<div class="col-6"> <div class="col-6">
<div>Available items:</div> <div>@Localizer["AvailableItems"]</div>
<div> <div>
<div class="css-grid"> <div class="css-grid">
@ -65,11 +63,12 @@
</div> </div>
<div class="col-12"> <div class="col-12">
<div>Actions</div> <div>@Localizer["Logs"]</div>
<div class="actions" id="actions"> <div class="actions" id="actions">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</CascadingValue> </CascadingValue>

@ -1,5 +1,7 @@
using BlazorApp1.Models; using BlazorApp1.Models;
using BlazorApp1.Pages;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -23,6 +25,9 @@ namespace BlazorApp1.Components
public List<Item> InventoryItems { get; set; } public List<Item> InventoryItems { get; set; }
[Inject]
public IStringLocalizer<Inventory> Localizer { get; set; }
/// <summary> /// <summary>
/// Gets or sets the java script runtime. /// Gets or sets the java script runtime.
/// </summary> /// </summary>

@ -10,7 +10,9 @@
@ondragleave="@OnDragLeave"> @ondragleave="@OnDragLeave">
@if (Item != null) @if (Item != null)
{ { <div class="Oui">
<img src="data:image/png;base64, @(Item.ImageBase64)" class="img-thumbnail" alt="@(Item.DisplayName)" style="min-width: 64px; max-width: 64px"/> <img src="data:image/png;base64, @(Item.ImageBase64)" class="img-thumbnail" alt="@(Item.DisplayName)" style="min-width: 64px; max-width: 64px"/>
<a>@this.Stack</a>
</div>
} }
</div> </div>

@ -14,6 +14,9 @@ namespace BlazorApp1.Components
[Parameter] [Parameter]
public bool NoDrop { get; set; } public bool NoDrop { get; set; }
[Parameter]
public int Stack { get; set; }
[CascadingParameter] [CascadingParameter]
public InventoryComponent Parent { get; set; } public InventoryComponent Parent { get; set; }
@ -44,10 +47,22 @@ namespace BlazorApp1.Components
return; return;
} }
if (this.Item != null)
{
if (this.Item.Name == Parent.CurrentDragItem.Name)
{
this.Stack = this.Stack + 1;
}
else { return; }
}
else
{
this.Item = Parent.CurrentDragItem; this.Item = Parent.CurrentDragItem;
Parent.Actions.Add(new CraftingAction { Action = "Drop", Item = this.Item, Index = this.Index }); Parent.Actions.Add(new CraftingAction { Action = "Drop", Item = this.Item, Index = this.Index });
} }
}
private void OnDragStart() private void OnDragStart()
{ {

@ -4,3 +4,7 @@
border: 1px solid; border: 1px solid;
overflow: hidden; overflow: hidden;
} }
.oui{
position: absolute;
}

@ -3,7 +3,8 @@
@using BlazorApp1.Components @using BlazorApp1.Components
@using BlazorApp1.Models @using BlazorApp1.Models
<PageTitle>Inventory</PageTitle> <PageTitle>@Localizer["TitlePage"]</PageTitle>
<h3>@Localizer["Title"]</h3>
<div> <div>
<InventoryComponent Items="Items"/> <InventoryComponent Items="Items"/>

@ -2,6 +2,7 @@
using BlazorApp1.Models; using BlazorApp1.Models;
using Blazorise.DataGrid; using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
namespace BlazorApp1.Pages namespace BlazorApp1.Pages
{ {
@ -13,6 +14,9 @@ namespace BlazorApp1.Pages
private int totalItem; private int totalItem;
public List<Item> Items { get; set; } = new List<Item>(); public List<Item> Items { get; set; } = new List<Item>();
[Inject]
public IStringLocalizer<Inventory> Localizer { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender) protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
base.OnAfterRenderAsync(firstRender); base.OnAfterRenderAsync(firstRender);

@ -117,7 +117,19 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="AvailableItems" xml:space="preserve">
<value>Items disponibles</value>
</data>
<data name="InventoryTitle" xml:space="preserve">
<value>Votre inventaire</value>
</data>
<data name="Logs" xml:space="preserve">
<value>Historique des actions</value>
</data>
<data name="Title" xml:space="preserve"> <data name="Title" xml:space="preserve">
<value>Inventaire</value> <value>Inventaire</value>
</data> </data>
<data name="TitlePage" xml:space="preserve">
<value>Inventaire</value>
</data>
</root> </root>

@ -117,7 +117,19 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="AvailableItems" xml:space="preserve">
<value>Available Items</value>
</data>
<data name="InventoryTitle" xml:space="preserve">
<value>Your inventory</value>
</data>
<data name="Logs" xml:space="preserve">
<value>Action logs</value>
</data>
<data name="Title" xml:space="preserve"> <data name="Title" xml:space="preserve">
<value>Inventory</value> <value>Inventory</value>
</data> </data>
<data name="TitlePage" xml:space="preserve">
<value>Inventory</value>
</data>
</root> </root>
Loading…
Cancel
Save