Functional GUI!

This commit is contained in:
PJB3005
2017-09-30 16:56:19 +02:00
parent 4c4687eb8e
commit 26e9c37be1
10 changed files with 269 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
using Content.Server.Interfaces.GameObjects;
using Content.Server.Interfaces.GameObjects;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Server.Interfaces.GameObjects;
using System;
namespace Content.Server.GameObjects
@@ -20,6 +21,11 @@ namespace Content.Server.GameObjects
}
ContainingSlot = null;
foreach (var component in Owner.GetComponents<ISpriteRenderableComponent>())
{
component.Visible = true;
}
}
public void EquippedToSlot(IInventorySlot slot)
@@ -30,6 +36,11 @@ namespace Content.Server.GameObjects
}
ContainingSlot = slot;
foreach (var component in Owner.GetComponents<ISpriteRenderableComponent>())
{
component.Visible = false;
}
}
}
}

View File

@@ -4,12 +4,11 @@ using SS14.Server.GameObjects.Events;
using SS14.Server.Interfaces.GameObjects;
using SS14.Shared;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Utility;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Collections.Generic;
using YamlDotNet.RepresentationModel;
using Lidgren.Network;
namespace Content.Server.GameObjects
{
@@ -224,7 +223,7 @@ namespace Content.Server.GameObjects
dict[hand.Key] = hand.Value.Item.Owner.Uid;
}
}
return new HandsComponentState(dict);
return new HandsComponentState(dict, ActiveIndex);
}
// Game logic goes here.
@@ -276,5 +275,19 @@ namespace Content.Server.GameObjects
PutInHand(item, ActiveIndex, fallback: false);
}
public override void HandleNetworkMessage(IncomingEntityComponentMessage message, NetConnection sender)
{
if (message.MessageParameters.Count != 1)
{
return;
}
var index = message.MessageParameters[0];
if (index is string newIndex && HasHand(newIndex))
{
ActiveIndex = newIndex;
}
base.HandleNetworkMessage(message, sender);
}
}
}