Click Drag Functionality + Refactor Interaction Interfaces (#1125)

Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
Co-authored-by: ComicIronic <comicironic@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
chairbender
2020-07-06 14:27:03 -07:00
committed by GitHub
parent c019d428a7
commit b35333d366
184 changed files with 1792 additions and 895 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Storage;
using Content.Client.Interfaces.GameObjects;
using Content.Client.Interfaces.GameObjects.Components.Interaction;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.UserInterface;
@@ -21,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Storage
/// Client version of item storage containers, contains a UI which displays stored entities and their size
/// </summary>
[RegisterComponent]
public class ClientStorageComponent : SharedStorageComponent
public class ClientStorageComponent : SharedStorageComponent, IClientDraggable
{
private Dictionary<EntityUid, int> StoredEntities { get; set; } = new Dictionary<EntityUid, int>();
private int StorageSizeUsed;
@@ -316,5 +317,17 @@ namespace Content.Client.GameObjects.Components.Storage
AddChild(hBoxContainer);
}
}
public bool ClientCanDropOn(CanDropEventArgs eventArgs)
{
//can only drop on placeable surfaces to empty out contents
return eventArgs.Target.HasComponent<PlaceableSurfaceComponent>();
}
public bool ClientCanDrag(CanDragEventArgs eventArgs)
{
//always draggable, at least for now
return true;
}
}
}