upd
This commit is contained in:
@@ -4,9 +4,12 @@
|
||||
|
||||
<root class="@( Inventar.IsInventoryOpen ? "" : "hidden" )">
|
||||
<div class="inventory-panel">
|
||||
@foreach ( var item in PlayerInventory.Items )
|
||||
@if ( PlayerInventory.Items.Count > 0 )
|
||||
{
|
||||
<Sasalka.Ui.InventoryItem Item="@item" OnItemClick="@( UseItem )"/>
|
||||
@foreach ( var item in PlayerInventory.Items )
|
||||
{
|
||||
<Sasalka.Ui.InventoryItem Item="@item" OnItemClick="@( UseItem )" OnItemRightClick="@( DropItem )"/>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</root>
|
||||
@@ -21,6 +24,11 @@
|
||||
Player?.Inventory?.EquipItem( item );
|
||||
}
|
||||
|
||||
void DropItem( Sasalka.InventoryItem item )
|
||||
{
|
||||
Player?.Inventory?.DropItem( item, Player.CameraPivot.WorldPosition + Player.Camera.LocalRotation.Right * 50 );
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if ( Input.Pressed( "Score" ) )
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
@inherits Sandbox.UI.Panel
|
||||
@namespace Sasalka.Ui
|
||||
|
||||
<root class="inventory-item @( Equipped ? "equipped" : "" )" @onclick="@(() => OnItemClick?.Invoke( Item ))">
|
||||
<input type="checkbox" class="equipped-checkbox" checked="@Equipped" disabled/>
|
||||
<root class="inventory-item @( Equipped ? "equipped" : "" )" @onclick="@(() => OnItemClick?.Invoke( Item ))" @onrightclick=@( () => OnItemRightClick?.Invoke( Item ) )>
|
||||
|
||||
@* <input type="checkbox" class="equipped-checkbox" checked="@Equipped" disabled/> *@
|
||||
|
||||
@if ( Item.Definition.ImageTexture.IsValid() )
|
||||
{
|
||||
<img src="@Item.Definition.ImageTexture.ResourcePath" alt="@Item.Definition.Name"/>
|
||||
@@ -16,12 +18,17 @@
|
||||
|
||||
<div class="inventory-item__name">@Item?.Definition.Name</div>
|
||||
|
||||
<div class="inventory-item__count">@Item?.Count / @Item?.MaxCount</div>
|
||||
@if ( Item?.Definition.MaxCount > 1 )
|
||||
{
|
||||
<div class="inventory-item__count">@Item?.Count / @Item?.Definition.MaxCount</div>
|
||||
}
|
||||
</root>
|
||||
|
||||
@code {
|
||||
public Sasalka.InventoryItem Item { get; set; }
|
||||
public Action<Sasalka.InventoryItem> OnItemClick { get; set; }
|
||||
public Action<Sasalka.InventoryItem> OnItemRightClick { get; set; }
|
||||
|
||||
public bool Equipped { get; set; }
|
||||
|
||||
protected override int BuildHash()
|
||||
|
||||
Reference in New Issue
Block a user