Add placeholder ghost UI, ghost component

This commit is contained in:
zumorica
2020-03-03 18:04:16 +01:00
parent 6c6ef3911d
commit 6905394e8a
4 changed files with 81 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
using Content.Client.UserInterface;
using Content.Shared.Observer;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
namespace Content.Client.Observer
{
[RegisterComponent]
public class GhostComponent : SharedGhostComponent
{
private GhostGui _gui;
#pragma warning disable 649
[Dependency] private readonly IGameHud _gameHud;
#pragma warning restore 649
public override void OnRemove()
{
base.OnRemove();
_gui?.Dispose();
}
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null,
IComponent component = null)
{
base.HandleMessage(message, netChannel, component);
switch (message)
{
case PlayerAttachedMsg _:
if (_gui == null)
{
_gui = new GhostGui();
}
else
{
_gui.Parent?.RemoveChild(_gui);
}
_gameHud.HandsContainer.AddChild(_gui);
break;
case PlayerDetachedMsg _:
_gui.Parent?.RemoveChild(_gui);
break;
}
}
}
}

View File

@@ -0,0 +1,18 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
namespace Content.Client.UserInterface
{
public class GhostGui : Control
{
public GhostGui()
{
IoCManager.InjectDependencies(this);
MouseFilter = MouseFilterMode.Ignore;
AddChild(new Label(){Text = "YES THIS IS GHOST WHOOOOOO"});
}
}
}

View File

@@ -0,0 +1,9 @@
using Robust.Shared.GameObjects;
namespace Content.Shared.Observer
{
public class SharedGhostComponent : Component
{
public override string Name => "Ghost";
}
}

View File

@@ -15,3 +15,4 @@
- type: Examiner - type: Examiner
DoRangeCheck: false DoRangeCheck: false
- type: IgnorePause - type: IgnorePause
- type: Ghost