Re-organize all projects (#4166)

This commit is contained in:
DrSmugleaf
2021-06-09 22:19:39 +02:00
committed by GitHub
parent 9f50e4061b
commit ff1a2d97ea
1773 changed files with 5258 additions and 5508 deletions

View File

@@ -0,0 +1,37 @@
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Shared.DragDrop
{
/// <summary>
/// Requests a drag / drop interaction to be performed
/// </summary>
[Serializable, NetSerializable]
public class DragDropRequestEvent : EntityEventArgs
{
/// <summary>
/// Location that the entity was dropped.
/// </summary>
public EntityCoordinates DropLocation { get; }
/// <summary>
/// Entity that was dragged and dropped.
/// </summary>
public EntityUid Dropped { get; }
/// <summary>
/// Entity that was drag dropped on.
/// </summary>
public EntityUid Target { get; }
public DragDropRequestEvent(EntityCoordinates dropLocation, EntityUid dropped, EntityUid target)
{
DropLocation = dropLocation;
Dropped = dropped;
Target = target;
}
}
}

View File

@@ -0,0 +1,35 @@
#nullable enable
using Robust.Shared.Analyzers;
namespace Content.Shared.DragDrop
{
/// <summary>
/// This interface allows the component's entity to be dragged and dropped
/// onto by another entity and gives it behavior when that occurs.
/// </summary>
[RequiresExplicitImplementation]
public interface IDragDropOn
{
/// <summary>
/// Invoked when another entity is being dragged and dropped
/// onto this one before invoking <see cref="DragDropOn"/>.
/// Note that other drag and drop interactions may be attempted if
/// this one fails.
/// </summary>
/// <param name="eventArgs"></param>
/// <returns>true if <see cref="eventArgs"/> is valid, false otherwise.</returns>
bool CanDragDropOn(DragDropEvent eventArgs);
/// <summary>
/// Invoked server-side when another entity is being dragged and dropped
/// onto this one before invoking <see cref="DragDropOn"/>
/// Note that other drag and drop interactions may be attempted if
/// this one fails.
/// </summary>
/// <returns>
/// true if an interaction occurred and no further interaction should
/// be processed for this drop.
/// </returns>
bool DragDropOn(DragDropEvent eventArgs);
}
}

View File

@@ -0,0 +1,124 @@
#nullable enable
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
namespace Content.Shared.DragDrop
{
/// <summary>
/// This interface allows a local client to initiate dragging of the component's
/// entity by mouse, for drag and drop interactions.
/// </summary>
[RequiresExplicitImplementation]
public interface IDraggable
{
/// <summary>
/// Invoked when an user is attempting to initiate a drag with
/// this component's entity in range. It's fine to return true even if there
/// wouldn't be any valid targets - just return true if this entity is in a
/// "draggable" state.
/// </summary>
/// <param name="args">
/// The information about the drag, such as who is doing it.
/// </param>
/// <returns>True if the drag should be initiated, false otherwise.</returns>
bool CanStartDrag(StartDragDropEvent args)
{
return true;
}
/// <summary>
/// Invoked on entities visible to the user to check if this component's
/// entity can be dropped on the indicated target entity.
/// No need to check range / reachability in here.
/// Returning true will cause the target entity to be highlighted as
/// a potential target and allow dropping when in range.
/// </summary>
/// <returns>
/// True if target is a valid target to be dropped on by this component's
/// entity, false otherwise.
/// </returns>
bool CanDrop(CanDropEvent args);
/// <summary>
/// Invoked when this component's entity is being dropped on another.
/// Other drag and drop interactions may be attempted if this one fails.
/// </summary>
/// <param name="args">
/// The information about the drag, such as who is doing it.
/// </param>
/// <returns>
/// True if an interaction occurred and no further interaction should
/// be processed for this drop, false otherwise.
/// </returns>
bool Drop(DragDropEvent args)
{
return false;
}
}
public class StartDragDropEvent : EntityEventArgs
{
/// <summary>
/// Entity doing the drag and drop.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that is being dragged.
/// </summary>
public IEntity Dragged { get; }
/// <summary>
/// Creates a new instance of <see cref="StartDragDropEvent"/>.
/// </summary>
/// <param name="user">The entity doing the drag and drop.</param>
/// <param name="dragged">The entity that is being dragged and dropped.</param>
public StartDragDropEvent(IEntity user, IEntity dragged)
{
User = user;
Dragged = dragged;
}
}
public class CanDropEvent : StartDragDropEvent
{
/// <summary>
/// The entity that <see cref="StartDragDropEvent.Dragged"/>
/// is being dropped onto.
/// </summary>
public IEntity Target { get; }
/// <summary>
/// Creates a new instance of <see cref="CanDropEvent"/>.
/// </summary>
/// <param name="user">The entity doing the drag and drop.</param>
/// <param name="dragged">The entity that is being dragged and dropped.</param>
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
public CanDropEvent(IEntity user, IEntity dragged, IEntity target) : base(user, dragged)
{
Target = target;
}
}
public class DragDropEvent : CanDropEvent
{
/// <summary>
/// The location where <see cref="StartDragDropEvent.Dragged"/>
/// is being dropped.
/// </summary>
public EntityCoordinates DropLocation { get; }
/// <summary>
/// Creates a new instance of <see cref="DragDropEvent"/>.
/// </summary>
/// <param name="user">The entity doing the drag and drop.</param>
/// <param name="dropLocation">The location where <see cref="dropped"/> is being dropped.</param>
/// <param name="dragged">The entity that is being dragged and dropped.</param>
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
public DragDropEvent(IEntity user, EntityCoordinates dropLocation, IEntity dragged, IEntity target) : base(user, dragged, target)
{
DropLocation = dropLocation;
}
}
}

View File

@@ -0,0 +1,60 @@
#nullable enable
using System;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.DragDrop
{
/// <summary>
/// This interface gives components behavior when they're dropped by a mob.
/// </summary>
[RequiresExplicitImplementation]
public interface IDropped
{
[Obsolete("Use DroppedMessage instead")]
void Dropped(DroppedEventArgs eventArgs);
}
public class DroppedEventArgs : EventArgs
{
public DroppedEventArgs(IEntity user, bool intentional)
{
User = user;
Intentional = intentional;
}
public IEntity User { get; }
public bool Intentional { get; }
}
/// <summary>
/// Raised when an entity is dropped
/// </summary>
[PublicAPI]
public class DroppedEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that dropped the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was dropped.
/// </summary>
public IEntity Dropped { get; }
/// <summary>
/// If the item was dropped intentionally.
/// </summary>
public bool Intentional { get; }
public DroppedEvent(IEntity user, IEntity dropped, bool intentional)
{
User = user;
Dropped = dropped;
Intentional = intentional;
}
}
}