Updates the Content EntitySystems with the changes to the event API.
Visual Studio wants to update the version of the solution, and change some GUIDs around.
This commit is contained in:
@@ -46,13 +46,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
inputSys.BindMap.BindFunction(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine));
|
||||
}
|
||||
|
||||
public override void RegisterMessageTypes()
|
||||
{
|
||||
base.RegisterMessageTypes();
|
||||
|
||||
RegisterMessageType<ExamineSystemMessages.ExamineInfoResponseMessage>();
|
||||
}
|
||||
|
||||
private bool HandleExamine(ICommonSession session, GridCoordinates coords, EntityUid uid)
|
||||
{
|
||||
if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components.IconSmoothing;
|
||||
using JetBrains.Annotations;
|
||||
@@ -27,16 +27,10 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
|
||||
private int _generation;
|
||||
|
||||
public override void SubscribeEvents()
|
||||
{
|
||||
base.SubscribeEvents();
|
||||
|
||||
SubscribeEvent<IconSmoothDirtyEvent>(HandleDirtyEvent);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeEvent<IconSmoothDirtyEvent>(HandleDirtyEvent);
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -24,30 +23,10 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeEvent<PlayMeleeWeaponAnimationMessage>(PlayWeaponArc);
|
||||
EntityQuery = new TypeEntityQuery(typeof(MeleeWeaponArcAnimationComponent));
|
||||
}
|
||||
|
||||
public override void RegisterMessageTypes()
|
||||
{
|
||||
base.RegisterMessageTypes();
|
||||
|
||||
RegisterMessageType<PlayMeleeWeaponAnimationMessage>();
|
||||
}
|
||||
|
||||
public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message)
|
||||
{
|
||||
base.HandleNetMessage(channel, message);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case PlayMeleeWeaponAnimationMessage playMsg:
|
||||
PlayWeaponArc(playMsg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void FrameUpdate(float frameTime)
|
||||
{
|
||||
base.FrameUpdate(frameTime);
|
||||
@@ -58,7 +37,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayWeaponArc(PlayMeleeWeaponAnimationMessage msg)
|
||||
private void PlayWeaponArc(object sender, PlayMeleeWeaponAnimationMessage msg)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(msg.ArcPrototype, out MeleeWeaponAnimationPrototype weaponArc))
|
||||
{
|
||||
|
||||
@@ -9,15 +9,12 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects.EntitySystems;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.Interfaces.State;
|
||||
using Robust.Client.Interfaces.UserInterface;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.State.States;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
@@ -43,6 +40,8 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeEvent<VerbSystemMessages.VerbsResponseMessage>(FillEntityPopup);
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
var input = EntitySystemManager.GetEntitySystem<InputSystem>();
|
||||
@@ -50,24 +49,17 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
new PointerInputCmdHandler(OnOpenContextMenu));
|
||||
}
|
||||
|
||||
public override void RegisterMessageTypes()
|
||||
{
|
||||
base.RegisterMessageTypes();
|
||||
|
||||
RegisterMessageType<VerbSystemMessages.VerbsResponseMessage>();
|
||||
}
|
||||
|
||||
public void OpenContextMenu(IEntity entity, ScreenCoordinates screenCoordinates)
|
||||
{
|
||||
if (_currentPopup != null)
|
||||
{
|
||||
_closeContextMenu();
|
||||
CloseContextMenu();
|
||||
}
|
||||
|
||||
_currentEntity = entity.Uid;
|
||||
_currentPopup = new VerbPopup();
|
||||
_currentPopup.UserInterfaceManager.ModalRoot.AddChild(_currentPopup);
|
||||
_currentPopup.OnPopupHide += _closeContextMenu;
|
||||
_currentPopup.OnPopupHide += CloseContextMenu;
|
||||
|
||||
_currentPopup.List.AddChild(new Label {Text = "Waiting on Server..."});
|
||||
RaiseNetworkEvent(new VerbSystemMessages.RequestVerbsMessage(_currentEntity));
|
||||
@@ -81,7 +73,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
if (_currentPopup != null)
|
||||
{
|
||||
_closeContextMenu();
|
||||
CloseContextMenu();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -98,7 +90,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
}
|
||||
|
||||
_currentPopup = new VerbPopup();
|
||||
_currentPopup.OnPopupHide += _closeContextMenu;
|
||||
_currentPopup.OnPopupHide += CloseContextMenu;
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
var button = new Button {Text = entity.Name};
|
||||
@@ -120,19 +112,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
OpenContextMenu(entity, new ScreenCoordinates(_inputManager.MouseScreenPosition));
|
||||
}
|
||||
|
||||
public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message)
|
||||
{
|
||||
base.HandleNetMessage(channel, message);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case VerbSystemMessages.VerbsResponseMessage resp:
|
||||
_fillEntityPopup(resp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void _fillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg)
|
||||
private void FillEntityPopup(object sender, VerbSystemMessages.VerbsResponseMessage msg)
|
||||
{
|
||||
if (_currentEntity != msg.Entity || !_entityManager.TryGetEntity(_currentEntity, out var entity))
|
||||
{
|
||||
@@ -153,7 +133,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
button.OnPressed += _ =>
|
||||
{
|
||||
RaiseNetworkEvent(new VerbSystemMessages.UseVerbMessage(_currentEntity, data.Key));
|
||||
_closeContextMenu();
|
||||
CloseContextMenu();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -210,7 +190,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
button.OnPressed += _ =>
|
||||
{
|
||||
_closeContextMenu();
|
||||
CloseContextMenu();
|
||||
try
|
||||
{
|
||||
action.Invoke();
|
||||
@@ -224,7 +204,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
return button;
|
||||
}
|
||||
|
||||
private void _closeContextMenu()
|
||||
private void CloseContextMenu()
|
||||
{
|
||||
_currentPopup?.Dispose();
|
||||
_currentPopup = null;
|
||||
|
||||
Reference in New Issue
Block a user