mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 06:42:25 +02:00
Removes the old obsolete input system where the state system directly handles input. Everything is using the InputManager/InputSystem now.
This commit is contained in:
@@ -31,7 +31,6 @@ namespace Robust.Client
|
||||
public void MouseMove(MouseMoveEventArgs mouseMoveEventArgs)
|
||||
{
|
||||
_userInterfaceManager.MouseMove(mouseMoveEventArgs);
|
||||
_stateManager.MouseMove(mouseMoveEventArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,7 +43,6 @@ namespace Robust.Client
|
||||
{
|
||||
return;
|
||||
}
|
||||
_stateManager.MouseWheelMove(mouseWheelEventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,13 +88,6 @@ namespace Robust.Client.GameObjects
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void DispatchClick(IEntity user, ClickType clickType)
|
||||
{
|
||||
var message = new ClientEntityClickMsg(user.Uid, clickType);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnMouseEnter()
|
||||
{
|
||||
|
||||
@@ -22,13 +22,6 @@ namespace Robust.Client.Interfaces.GameObjects.Components
|
||||
/// <returns>True if the click worked, false otherwise.</returns>
|
||||
bool CheckClick(Vector2 worldPos, out int drawdepth);
|
||||
|
||||
/// <summary>
|
||||
/// Sends the click to the sister component on the server and things subscribed to
|
||||
/// </summary>
|
||||
/// <param name="userUID">The entity owned by the player that clicked.</param>
|
||||
/// <param name="clickType">See <see cref="MouseClickType" />.</param>
|
||||
void DispatchClick(IEntity user, ClickType clickType);
|
||||
|
||||
/// <summary>
|
||||
/// Invoked whenever the mouse hovers over this entity.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Robust.Client.Input;
|
||||
using System;
|
||||
using System;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Robust.Client.Interfaces.State
|
||||
@@ -12,10 +11,6 @@ namespace Robust.Client.Interfaces.State
|
||||
void RequestStateChange<T>() where T : Client.State.State, new();
|
||||
void Update(FrameEventArgs e);
|
||||
void FrameUpdate(FrameEventArgs e);
|
||||
void MouseUp(MouseButtonEventArgs e);
|
||||
void MouseDown(MouseButtonEventArgs e);
|
||||
void MouseMove(MouseMoveEventArgs e);
|
||||
void MouseWheelMove(MouseWheelEventArgs e);
|
||||
void FormResize();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Robust.Client.State
|
||||
{
|
||||
@@ -23,53 +21,9 @@ namespace Robust.Client.State
|
||||
|
||||
public virtual void FrameUpdate(FrameEventArgs e) { }
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Mouse button was pressed.
|
||||
/// </summary>
|
||||
public virtual void MousePressed(MouseButtonEventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// Mouse button was released.
|
||||
/// </summary>
|
||||
public virtual void MouseUp(MouseButtonEventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// Mouse button will be pressed.
|
||||
/// </summary>
|
||||
public virtual void MouseDown(MouseButtonEventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// Mouse cursor has moved.
|
||||
/// </summary>
|
||||
public virtual void MouseMoved(MouseMoveEventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// Mouse cursor will move.
|
||||
/// </summary>
|
||||
public virtual void MouseMove(MouseMoveEventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// Mouse wheel has been moved.
|
||||
/// </summary>
|
||||
public virtual void MouseWheelMove(MouseWheelEventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// Mouse has entered this screen.
|
||||
/// </summary>
|
||||
public virtual void MouseEntered(EventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// Left mouse button has been pressed.
|
||||
/// </summary>
|
||||
public virtual void MouseLeft(EventArgs e) { }
|
||||
|
||||
/// <summary>
|
||||
/// The screen has changed size, usually from resizing window. This is called automatically right after Startup.
|
||||
/// </summary>
|
||||
public virtual void FormResize() { }
|
||||
|
||||
#endregion Events
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Interfaces.State;
|
||||
using Robust.Client.Interfaces.State;
|
||||
using Robust.Shared.Log;
|
||||
using System;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -16,8 +15,6 @@ namespace Robust.Client.State
|
||||
public event Action<StateChangedEventArgs> OnStateChanged;
|
||||
public State CurrentState { get; private set; }
|
||||
|
||||
#region Updates & Statechanges
|
||||
|
||||
public void Update(FrameEventArgs e)
|
||||
{
|
||||
CurrentState?.Update(e);
|
||||
@@ -60,40 +57,5 @@ namespace Robust.Client.State
|
||||
|
||||
OnStateChanged?.Invoke(new StateChangedEventArgs(old, CurrentState));
|
||||
}
|
||||
|
||||
#endregion Updates & Statechanges
|
||||
#region Input
|
||||
|
||||
public void MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
CurrentState?.MouseUp(e);
|
||||
}
|
||||
|
||||
public void MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
CurrentState?.MouseDown(e);
|
||||
}
|
||||
|
||||
public void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
CurrentState?.MouseMove(e);
|
||||
}
|
||||
|
||||
public void MouseWheelMove(MouseWheelEventArgs e)
|
||||
{
|
||||
CurrentState?.MouseWheelMove(e);
|
||||
}
|
||||
|
||||
public void MouseEntered(EventArgs e)
|
||||
{
|
||||
CurrentState?.MouseEntered(e);
|
||||
}
|
||||
|
||||
public void MouseLeft(EventArgs e)
|
||||
{
|
||||
CurrentState?.MouseLeft(e);
|
||||
}
|
||||
|
||||
#endregion Input
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,38 +83,12 @@ namespace Robust.Client.State.States
|
||||
}
|
||||
}
|
||||
|
||||
public override void MouseDown(MouseButtonEventArgs eventargs)
|
||||
{
|
||||
if (playerManager.LocalPlayer == null)
|
||||
return;
|
||||
|
||||
var mousePosWorld = eyeManager.ScreenToWorld(new ScreenCoordinates(eventargs.Position));
|
||||
var entityToClick = GetEntityUnderPosition(mousePosWorld);
|
||||
|
||||
//Dispatches clicks to relevant clickable components, another single exit point for UI
|
||||
if (entityToClick == null)
|
||||
return;
|
||||
|
||||
var clickable = entityToClick.GetComponent<IClientClickableComponent>();
|
||||
clickable.DispatchClick(playerManager.LocalPlayer.ControlledEntity, eventargs.ClickType);
|
||||
}
|
||||
|
||||
public IEntity GetEntityUnderPosition(GridCoordinates coordinates)
|
||||
{
|
||||
var entitiesUnderPosition = GetEntitiesUnderPosition(coordinates);
|
||||
return entitiesUnderPosition.Count > 0 ? entitiesUnderPosition[0] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the entities currently under the mouse cursor.
|
||||
/// </summary>
|
||||
/// <returns>A list of the entities, sorted such that the first entry is the top entity.</returns>
|
||||
public IList<IEntity> GetEntitiesUnderMouse()
|
||||
{
|
||||
var mousePosWorld = eyeManager.ScreenToWorld(new ScreenCoordinates(inputManager.MouseScreenPosition));
|
||||
return GetEntitiesUnderPosition(mousePosWorld);
|
||||
}
|
||||
|
||||
public IList<IEntity> GetEntitiesUnderPosition(GridCoordinates coordinates)
|
||||
{
|
||||
// Find all the entities intersecting our click
|
||||
|
||||
@@ -17,20 +17,6 @@ namespace Robust.Shared.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class ClientEntityClickMsg : ComponentMessage
|
||||
{
|
||||
public EntityUid Uid { get; }
|
||||
public ClickType Click { get; }
|
||||
|
||||
public ClientEntityClickMsg(EntityUid uid, ClickType click)
|
||||
{
|
||||
Directed = true;
|
||||
Uid = uid;
|
||||
Click = click;
|
||||
}
|
||||
}
|
||||
|
||||
public class RelayMovementEntityMessage : ComponentMessage
|
||||
{
|
||||
public IEntity Entity { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user